From 39a7d8ed80a3d440ad3632898ff4f90f6b9833d4 Mon Sep 17 00:00:00 2001 From: Edwin Eefting Date: Sun, 2 Aug 2020 16:08:17 +0200 Subject: [PATCH] make cam stuff optional offcourse :) --- micropython/config.py.example | 4 ++++ micropython/meowton.py | 29 +++++++++++++++-------------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/micropython/config.py.example b/micropython/config.py.example index a713837..7ba0ebf 100644 --- a/micropython/config.py.example +++ b/micropython/config.py.example @@ -21,3 +21,7 @@ id="test" import display_web display_class=display_web.Display run_webserver=True + +status_ip='' + + diff --git a/micropython/meowton.py b/micropython/meowton.py index 6e81238..69694d7 100644 --- a/micropython/meowton.py +++ b/micropython/meowton.py @@ -137,20 +137,21 @@ def p(): global last_state last_state="bla" def cam_send(state): - global last_state - if state!=last_state: - try: - # print("Setting cam to "+state) - s=usocket.socket() - sockaddr = usocket.getaddrinfo('192.168.13.233', 1234)[0][-1] - s.connect(sockaddr) - s.send(state+"\n") - s.close() - # print("Cam send done") - except Exception as e: - # print("failed: "+str(e)) - pass - last_state=state + """this will control an external device to control a camera or light""" + if config.status_ip: + global last_state + if state!=last_state: + try: + # print("Setting cam to "+state) + s=usocket.socket()config.status_ip, 1234)[0][-1] + s.connect(sockaddr) + s.send(state+"\n") + s.close() + # print("Cam send done") + except Exception as e: + # print("failed: "+str(e)) + pass + last_state=state ################ read sensors, fast stuff