diff --git a/app/tests/test_config.py b/app/tests/test_config.py index aa0cd52..b97a4e8 100644 --- a/app/tests/test_config.py +++ b/app/tests/test_config.py @@ -152,6 +152,16 @@ def ConfigComplete(): 'pv4': {'manufacturer': 'man4', 'type': 'type4'}, 'suggested_area': 'Garage2', + 'sensor_list': 688}, + 'Y170000000000002': {'modbus_polling': False, + 'modbus_scanning': { + 'bytes': 16, + 'start': 2048, + 'step': 1024 + }, + 'monitor_sn': 2000000001, + 'node_id': 'PV-Garage3/', + 'suggested_area': 'Garage3', 'sensor_list': 688} }, 'batteries': { @@ -224,8 +234,9 @@ def test_full_config(ConfigComplete): }, 'inverters': {'allow_all': False, 'R170000000000001': {'modbus_polling': False, 'node_id': 'PV-Garage/', 'sensor_list': 0x02B0, 'suggested_area': 'Garage', 'pv1': {'type': 'type1', 'manufacturer': 'man1'}, 'pv2': {'type': 'type2', 'manufacturer': 'man2'}}, - 'Y170000000000001': {'modbus_polling': True, 'monitor_sn': 2000000000, 'node_id': 'PV-Garage2/', 'sensor_list': 0x02B0, 'suggested_area': 'Garage2', 'pv1': {'type': 'type1', 'manufacturer': 'man1'}, 'pv2': {'type': 'type2', 'manufacturer': 'man2'}, 'pv3': {'type': 'type3', 'manufacturer': 'man3'}, 'pv4': {'type': 'type4', 'manufacturer': 'man4'}} - } + 'Y170000000000001': {'modbus_polling': True, 'monitor_sn': 2000000000, 'node_id': 'PV-Garage2/', 'sensor_list': 0x02B0, 'suggested_area': 'Garage2', 'pv1': {'type': 'type1', 'manufacturer': 'man1'}, 'pv2': {'type': 'type2', 'manufacturer': 'man2'}, 'pv3': {'type': 'type3', 'manufacturer': 'man3'}, 'pv4': {'type': 'type4', 'manufacturer': 'man4'}}, + 'Y170000000000002': {'modbus_polling': False, 'monitor_sn': 2000000001, 'node_id': 'PV-Garage3/', 'sensor_list': 0x02B0, 'suggested_area': 'Garage3', 'modbus_scanning': {'start': 2048, 'step': 1024, 'bytes': 16}} + } } try: validated = Config.conf_schema.validate(cnf) diff --git a/app/tests/test_config_read_json.py b/app/tests/test_config_read_json.py index 647885a..68c5b60 100644 --- a/app/tests/test_config_read_json.py +++ b/app/tests/test_config_read_json.py @@ -380,6 +380,15 @@ def test_full_config(ConfigComplete): "pv4.manufacturer": "man4", "pv4.type": "type4", "sensor_list": 688 + }, + { + "serial": "Y170000000000002", + "monitor_sn": 2000000001, + "modbus_polling": false, + "modbus_scanning.start": 2048, + "node_id": "PV-Garage3", + "suggested_area": "Garage3", + "sensor_list": 688 } ], "batteries": [ diff --git a/ha_addons/templates/config.jinja b/ha_addons/templates/config.jinja index f17a758..796d0c2 100755 --- a/ha_addons/templates/config.jinja +++ b/ha_addons/templates/config.jinja @@ -40,6 +40,9 @@ schema: client_mode.host: match(\b((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\b)? client_mode.port: port? client_mode.forward: bool? + modbus_scanning.start: int(0,65535)? + modbus_scanning.step: int(0,65535)? + modbus_scanning.bytes: int(1,80)? pv1.manufacturer: str? pv1.type: str? pv2.manufacturer: str?