diff --git a/GUI/Timers.py b/GUI/Timers.py index d854619..634917b 100644 --- a/GUI/Timers.py +++ b/GUI/Timers.py @@ -222,11 +222,22 @@ def saveTimer(self): @pyqtSlot(str, str) def parseMessage(self, topic, msg): + """ + Tasmota < 9.4.0.5 : There are a total of 4 messages in reply to `Timers` command: + {"Timers": "ON" } + {"Timers1" : {"Timer1":{"Enable":0,"Mode":0,"Time":"00:00","Window":0,"Days":"0000000","Repeat":0,"Action":0}, .... + ... + {"Timers4" : {"Timer13":{"Enable":0,"Mode":0,"Time":"00:00","Window":0,"Days":"0000000","Repeat":0,"Action":0}, .... + + Tasmota >= 9.4.0.5 : There is only 1 message that covers all + { "Timers": "ON", "Timer1":{"Enable":0,"Mode":0,"Time":"00:00","Window":0,"Days":"0000000","Repeat":0,"Action":0}, .... + """ if self.device.matches(topic): if self.device.reply == "RESULT" or self.device.reply == "TIMERS": try: payload = loads(msg) - first = list(payload)[0] + all = list(payload) + first = all[0] except JSONDecodeError as e: error = "Timer loading error", "Can't load the timer from device.\n{}".format(e) @@ -237,9 +248,12 @@ def parseMessage(self, topic, msg): if first == 'Timers': self.gbTimers.setChecked(payload[first] == "ON") + if len(all) > 1: + payload.pop("Timers") + self.timers.update(payload) + self.loadTimer(self.cbTimer.currentText()) + elif first.startswith('Timers'): self.timers.update(payload[first]) - - if first == 'Timers4': - self.loadTimer(self.cbTimer.currentText()) - + if first == 'Timers4': + self.loadTimer(self.cbTimer.currentText()) diff --git a/tdmgr.py b/tdmgr.py index 93073b8..15c1eb0 100644 --- a/tdmgr.py +++ b/tdmgr.py @@ -38,7 +38,7 @@ # TODO: rework device export -__version__ = "0.2.10" +__version__ = "0.2.11" __tasmota_minimum__ = "6.6.0.17" @@ -88,7 +88,7 @@ def __init__(self, *args, **kwargs): for k in self.devices.childKeys(): device.history.append(self.devices.value(k)) self.devices.endGroup() - + self.devices.endGroup() self.device_model = TasmotaDevicesModel(self.env) diff --git a/tdmgr.spec b/tdmgr.spec index 119b192..a956f12 100644 --- a/tdmgr.spec +++ b/tdmgr.spec @@ -22,7 +22,7 @@ exe = EXE(pyz, a.zipfiles, a.datas, [], - name='tdmgr_0.2.10', + name='tdmgr_0.2.11', debug=False, bootloader_ignore_signals=False, strip=False, diff --git a/tdmgr32.spec b/tdmgr32.spec index 872fdfd..ac6a3bf 100644 --- a/tdmgr32.spec +++ b/tdmgr32.spec @@ -22,7 +22,7 @@ exe = EXE(pyz, a.zipfiles, a.datas, [], - name='tdmgr_0.2.10_x86', + name='tdmgr_0.2.11_x86', debug=False, bootloader_ignore_signals=False, strip=False, diff --git a/tdmgr_mac.spec b/tdmgr_mac.spec index d515ecc..1b87b33 100644 --- a/tdmgr_mac.spec +++ b/tdmgr_mac.spec @@ -19,12 +19,12 @@ exe = EXE(pyz, a.binaries, a.zipfiles, a.datas, - name='tdmgr_0.2.10', + name='tdmgr_0.2.11', debug=False, strip=False, upx=True, console=False , icon='tdmgr.icns') app = BUNDLE(exe, - name='tdmgr_0.2.10.app', + name='tdmgr_0.2.11.app', icon='tdmgr.icns', bundle_identifier='com.tasmota.tdmgr')