decode-config.py: adapt settings

- rename SetOption65 (tuya_disable_dimmer)
- expand settings
- add energy_usage struct
- add Tariff3 (energy_weekend)
- change baudrate/sbaudrate
- fix KeyError on -T cmnd
This commit is contained in:
Norbert Richter 2019-08-28 16:13:23 +02:00
parent 9af67a5278
commit d83d2210b0
1 changed files with 36 additions and 1 deletions

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
VER = '2.2.0031' VER = '2.3.0032'
""" """
decode-config.py - Backup/Restore Sonoff-Tasmota configuration data decode-config.py - Backup/Restore Sonoff-Tasmota configuration data
@ -955,7 +955,40 @@ Setting_6_6_0_5['flag3'][0].update ({
'tuya_dimmer_min_limit': ('<L', (0x3A0,1,19), (None, None, ('SetOption', '"SetOption69 {}".format($)')) ), 'tuya_dimmer_min_limit': ('<L', (0x3A0,1,19), (None, None, ('SetOption', '"SetOption69 {}".format($)')) ),
}) })
# ====================================================================== # ======================================================================
Setting_6_6_0_6 = copy.deepcopy(Setting_6_6_0_5)
Setting_6_6_0_6['flag3'][0].pop('tuya_show_dimmer',None)
Setting_6_6_0_6['flag3'][0].update ({
'tuya_disable_dimmer': ('<L', (0x3A0,1,15), (None, None, ('SetOption', '"SetOption65 {}".format($)')) ),
})
# ======================================================================
Setting_6_6_0_7 = copy.deepcopy(Setting_6_6_0_6)
Setting_6_6_0_7.update ({
'energy_usage': ({
'usage1_kWhtotal': ('<L', 0x77C, (None, None, ('Power', None)) ),
'usage1_kWhtoday': ('<L', 0x780, (None, None, ('Power', None)) ),
'return1_kWhtotal': ('<L', 0x784, (None, None, ('Power', None)) ),
'return2_kWhtotal': ('<L', 0x788, (None, None, ('Power', None)) ),
'last_usage_kWhtotal': ('<L', 0x78C, (None, None, ('Power', None)) ),
'last_return_kWhtotal': ('<L', 0x790, (None, None, ('Power', None)) ),
}, 0x77C, (None, None, ('Power', None)) ),
})
# ======================================================================
Setting_6_6_0_8 = copy.deepcopy(Setting_6_6_0_7)
Setting_6_6_0_8['flag3'][0].update ({
'energy_weekend': ('<L', (0x3A0,1,20), (None, None, ('Power', '"Tariff3 {}".format($)')) ),
})
# ======================================================================
Setting_6_6_0_9 = copy.deepcopy(Setting_6_6_0_8)
Setting_6_6_0_9.update ({
'baudrate': ('<H', 0x778, (None, None, ('Serial', '"Baudrate {}".format($)')), ('$ * 1200','$ / 1200') ),
'sbaudrate': ('<H', 0x77A, (None, None, ('Serial', '"SBaudrate {}".format($)')), ('$ * 1200','$ / 1200') ),
})
# ======================================================================
Settings = [ Settings = [
(0x6060009,0x1000, Setting_6_6_0_9),
(0x6060008,0x1000, Setting_6_6_0_8),
(0x6060007,0x1000, Setting_6_6_0_7),
(0x6060006, 0xe00, Setting_6_6_0_6),
(0x6060005, 0xe00, Setting_6_6_0_5), (0x6060005, 0xe00, Setting_6_6_0_5),
(0x6060003, 0xe00, Setting_6_6_0_3), (0x6060003, 0xe00, Setting_6_6_0_3),
(0x6060002, 0xe00, Setting_6_6_0_2), (0x6060002, 0xe00, Setting_6_6_0_2),
@ -2468,6 +2501,8 @@ def SetCmnd(cmnds, fieldname, fielddef, valuemapping, mappedvalue, addroffset=0,
# a simple value # a simple value
elif isinstance(format_, (str, bool, int, float, long)): elif isinstance(format_, (str, bool, int, float, long)):
if group is not None:
group = group.title();
if isinstance(tasmotacmnd, tuple): if isinstance(tasmotacmnd, tuple):
tasmotacmnds = tasmotacmnd tasmotacmnds = tasmotacmnd
for tasmotacmnd in tasmotacmnds: for tasmotacmnd in tasmotacmnds: