Skip to content

Commit

Permalink
Merge pull request #152 from barbudor/update_timers
Browse files Browse the repository at this point in the history
Fix TIMERs for Tasmota >= 9.4.0.5
  • Loading branch information
jziolkowski committed Jun 20, 2021
2 parents de1690e + ece97e1 commit ca4c32a
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 11 deletions.
24 changes: 19 additions & 5 deletions GUI/Timers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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())
4 changes: 2 additions & 2 deletions tdmgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

# TODO: rework device export

__version__ = "0.2.10"
__version__ = "0.2.11"
__tasmota_minimum__ = "6.6.0.17"


Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion tdmgr.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion tdmgr32.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions tdmgr_mac.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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')

0 comments on commit ca4c32a

Please sign in to comment.