replace some eval calls

This commit is contained in:
Stefan Allius
2024-10-25 21:38:36 +02:00
parent 8d67f1745d
commit 10a18237c7
2 changed files with 10 additions and 3 deletions

View File

@@ -259,6 +259,8 @@ def test_build_ha_conf4():
def test_exception_and_eval(inverter_data: bytes):
# add eval to convert temperature from °F to °C
ofs = RegisterMap.map[0x420100d8]['offset']
del RegisterMap.map[0x420100d8]['offset']
RegisterMap.map[0x420100d8]['eval'] = '(result-32)/1.8'
# map PV1_VOLTAGE to invalid register
RegisterMap.map[0x420100e0]['reg'] = Register.TEST_REG2
@@ -279,4 +281,5 @@ def test_exception_and_eval(inverter_data: bytes):
for key, update in i.parse (inverter_data, 0x42, 1):
pass # side effect is calling generator i.parse()
assert 54 == i.get_db_value(Register.INVERTER_TEMP, 0)
RegisterMap.map[0x420100d8]['offset'] = ofs