diff options
| author | jwansek <eddie.atten.ea29@gmail.com> | 2026-06-20 21:57:38 +0100 |
|---|---|---|
| committer | jwansek <eddie.atten.ea29@gmail.com> | 2026-06-20 21:57:38 +0100 |
| commit | 07ce4cca57d4d9d1a6438fb998e53dc38de1d9a9 (patch) | |
| tree | 55ebee2e22b3bc457c0e26e1cac135da39ae4c72 /powerButtons.py | |
| parent | cc70a0c1a054d82562ace99b530654ef2208537a (diff) | |
| download | HomelabPowerButtons-07ce4cca57d4d9d1a6438fb998e53dc38de1d9a9.tar.gz HomelabPowerButtons-07ce4cca57d4d9d1a6438fb998e53dc38de1d9a9.zip | |
Reduced the timeout
Diffstat (limited to 'powerButtons.py')
| -rw-r--r-- | powerButtons.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/powerButtons.py b/powerButtons.py index 62eb85e..ef40343 100644 --- a/powerButtons.py +++ b/powerButtons.py @@ -130,8 +130,16 @@ class App(tk.Tk): def _after(self): for ip in self.config["tasmota"]["plugs"].split(","): - data = query_tasmota_power(ip, self.config["tasmota"]["password"]) - fields = tasmota_query_to_fields(data) + try: + data = query_tasmota_power(ip, self.config["tasmota"]["password"]) + except requests.exceptions.ConnectionError: + print("Couldnt find %s" % ip) + fields = { + field: None + for field in TASMOTA_TRANSFORMATIONS.values() + } + else: + fields = tasmota_query_to_fields(data) friendlyname = list(self.tasmota_ips.keys())[list(self.tasmota_ips.values()).index(ip)] self.devices[friendlyname] = fields self.device_widgets[friendlyname].update() @@ -372,7 +380,7 @@ def send_raw_tasmota_http(host, password, command): "cmnd": str(command), "user": "admin", "password": password - }) + }, timeout = 5) return req.json() if __name__ == "__main__": |
