aboutsummaryrefslogtreecommitdiffstats
path: root/mqtt-client
diff options
context:
space:
mode:
Diffstat (limited to 'mqtt-client')
-rw-r--r--mqtt-client/Dockerfile8
-rw-r--r--mqtt-client/mqtt-client.py18
2 files changed, 13 insertions, 13 deletions
diff --git a/mqtt-client/Dockerfile b/mqtt-client/Dockerfile
index 12c8a53..be304a1 100644
--- a/mqtt-client/Dockerfile
+++ b/mqtt-client/Dockerfile
@@ -1,12 +1,12 @@
-FROM debian:11-slim
+FROM debian:12-slim
ENV TZ=Europe/London
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update -y
RUN apt-get install -y python3-pip iputils-ping
COPY . /app
WORKDIR /app
-RUN pip3 install -r requirements.txt
-RUN pip3 install docker
-RUN pip3 install -r TasmotaCLI/requirements.txt
+RUN pip3 install --break-system-packages -r requirements.txt
+RUN pip3 install --break-system-packages docker
+RUN pip3 install --break-system-packages -r TasmotaCLI/requirements.txt
ENTRYPOINT ["python3"]
CMD ["mqtt-client.py"]
diff --git a/mqtt-client/mqtt-client.py b/mqtt-client/mqtt-client.py
index 00a808f..6940df2 100644
--- a/mqtt-client/mqtt-client.py
+++ b/mqtt-client/mqtt-client.py
@@ -88,13 +88,13 @@ class MQTTClient:
self.tasmota_power_prom.labels(plug = location, field = k).set(v)
def handle_zigbee(self, msg_j):
- def toggle_geoffery():
+ def toggle_firestick():
print("Starting thread...")
- tasmotaMQTTClient.MQTTClient(MQTT_HOST, "TasmotaGeoffery", os.environ["MQTT_USER"], os.environ["MQTT_PASSWD"], "OFF")
+ tasmotaMQTTClient.MQTTClient(MQTT_HOST, "TasmotaFirestick", os.environ["MQTT_USER"], os.environ["MQTT_PASSWD"], "OFF")
print("Waiting...")
time.sleep(8)
- tasmotaMQTTClient.MQTTClient(MQTT_HOST, "TasmotaGeoffery", os.environ["MQTT_USER"], os.environ["MQTT_PASSWD"], "ON")
- print("Toggled again.")
+ tasmotaMQTTClient.MQTTClient(MQTT_HOST, "TasmotaFirestick", os.environ["MQTT_USER"], os.environ["MQTT_PASSWD"], "ON")
+ print("Toggled firestick.")
zigbee_id = list(msg_j["ZbReceived"].keys())[0]
fields = msg_j["ZbReceived"][zigbee_id]
@@ -106,11 +106,11 @@ class MQTTClient:
if fields["Power"] == 2:
print("TV Zigbee button pressed, toggling TasmotaTV Tasmota Plug")
self.toggle_plug("TasmotaTV")
- # threading.Thread(target = toggle_geoffery, args = ()).start()
- loop = asyncio.get_event_loop()
- loop.run_until_complete(tasmotaHTTPClient.main(host = "geoffery.plug", username = "admin", password = os.environ["MQTT_PASSWD"], toggle = True))
- time.sleep(8)
- loop.run_until_complete(tasmotaHTTPClient.main(host = "geoffery.plug", username = "admin", password = os.environ["MQTT_PASSWD"], toggle = True))
+ threading.Thread(target = toggle_firestick, args = ()).start()
+ #loop = asyncio.get_event_loop()
+ #loop.run_until_complete(tasmotaHTTPClient.main(host = "geoffery.plug", username = "admin", password = os.environ["MQTT_PASSWD"], toggle = True))
+ #time.sleep(8)
+ #loop.run_until_complete(tasmotaHTTPClient.main(host = "geoffery.plug", username = "admin", password = os.environ["MQTT_PASSWD"], toggle = True))
if zigbee_id == "0x74B3" and friendlyname == "HarveyButton" and "Power" in fields.keys():