From afddb7f93903a6b1910833898b2b6a105c153906 Mon Sep 17 00:00:00 2001 From: jwansek Date: Mon, 19 May 2025 16:32:07 +0100 Subject: Added toggling firestick after a delay --- mqtt-client/mqtt-client.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'mqtt-client/mqtt-client.py') diff --git a/mqtt-client/mqtt-client.py b/mqtt-client/mqtt-client.py index c846578..dcb8614 100644 --- a/mqtt-client/mqtt-client.py +++ b/mqtt-client/mqtt-client.py @@ -1,6 +1,7 @@ import paho.mqtt.client as paho from influxdb_client import InfluxDBClient, Point, WritePrecision from influxdb_client.client.write_api import SYNCHRONOUS +import time import json import os @@ -58,6 +59,10 @@ class MQTTClient: if fields["Power"] == 2: print("TV Zigbee button pressed, toggling TasmotaTV Tasmota Plug") self.toggle_plug("TasmotaTV") + time.sleep(8) + self.toggle_plug("TasmotaGeoffery") + time.sleep(0.5) + self.toggle_plug("TasmotaGeoffery") if zigbee_id == "0x74B3" and friendlyname == "HarveyButton" and "Power" in fields.keys(): if fields["Power"] == 2: @@ -85,8 +90,8 @@ if __name__ == "__main__": if os.path.exists(env_path): import dotenv dotenv.load_dotenv(dotenv_path = env_path) - INFLUXDB_HOST = "localhost" - MQTT_HOST = "localhost" + INFLUXDB_HOST = "dns.athome" + MQTT_HOST = "dns.athome" else: INFLUXDB_HOST = "influxdb" MQTT_HOST = "mqtt" -- cgit v1.2.3