diff --git a/.gitignore b/.gitignore index 7c49929..4adc92b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ # Python __pycache__/ +.pytest_cache/ # IDE .vscode diff --git a/ThermiaOnlineAPI/model/HeatPump.py b/ThermiaOnlineAPI/model/HeatPump.py index c8e4157..fdf7120 100644 --- a/ThermiaOnlineAPI/model/HeatPump.py +++ b/ThermiaOnlineAPI/model/HeatPump.py @@ -1023,9 +1023,6 @@ def debug(self): ["macAddress", "owner", "retailerAccess", "retailerId", "id", "status"], ) - print("self.__group_temperatures:") - pretty_print_except(self.__group_temperatures) - installation_profile_id = get_dict_value_or_none( self.__info, "installationProfileId" ) diff --git a/ThermiaOnlineAPI/tests/__init__.py b/ThermiaOnlineAPI/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/ThermiaOnlineAPI/tests/debug_files/diplomat_duo_921.txt b/ThermiaOnlineAPI/tests/debug_files/diplomat_duo_921.txt new file mode 100644 index 0000000..859c53a --- /dev/null +++ b/ThermiaOnlineAPI/tests/debug_files/diplomat_duo_921.txt @@ -0,0 +1,1188 @@ +########## DEBUG START ########## +self.__info: +{ + "createdWhen": "2020-01-02T13:00:44.257", + "deviceId": 1234567, + "hasLinkUnit": false, + "installationProfileId": 1001, + "isOnline": true, + "lastOnline": "2024-10-13T16:44:16.407", + "model": "", + "name": "Thermia", + "operationManualUrl": "https://thermia.com/products/thermia-online/", + "serialNumber": null +} + + +self.__status: +{ + "dcmVersion": "2.0.17", + "deviceConnectionType": "Dcm", + "hasIndoorTempSensor": false, + "heatingEffect": 13, + "heatingEffectRegisters": [ + null, + 106010 + ], + "hotWaterRegistryName": "UI_TAP_WATER", + "hotWaterTemperature": 53.0, + "indoorTemperature": 20.0, + "isGaugeDifferenciated": false, + "isHeatingEffectSetByUser": false, + "isHotWaterActive": true, + "isOutdoorTempSensorFunctioning": true, + "isReducedHeatingEffectSetByUser": false, + "linkIntegrationStatus": false, + "outdoorTemperature": 9.0, + "programVersion": "1.42", + "reducedHeatingEffect": 10, + "reducedHeatingEffectRegisters": [ + null, + 114167 + ], + "roomFactor": null, + "tcVersion": null +} + + +self.__device_data: +{ + "deviceId": 1234567, + "isOnline": true, + "lastOnline": "2024-10-13T13:44:16.407", + "location": null, + "name": "Thermia", + "profile": { + "icon": 1, + "id": 1001, + "name": "DHP H/L/C 921", + "thermiaName": "Diplomat / Diplomat Duo" + } +} + + +All available groups: +[ + { + "id": 14, + "name": "REG_GROUP_OPERATIONAL_OPERATION", + "parentId": null, + "visibility": 1 + }, + { + "id": 2, + "name": "REG_GROUP_OPERATIONAL_STATUS", + "parentId": null, + "visibility": 1 + }, + { + "id": 3, + "name": "REG_GROUP_TEMPERATURES", + "parentId": null, + "visibility": 1 + }, + { + "id": 10, + "name": "REG_GROUP_OPERATIONAL_TIME", + "parentId": null, + "visibility": 1 + }, + { + "id": 7, + "name": "REG_GROUP_POOL", + "parentId": null, + "visibility": 1 + }, + { + "id": 19, + "name": "REG_GROUP_HEATING_CURVE", + "parentId": null, + "visibility": 1 + }, + { + "id": 20, + "name": "REG_GROUP_HEAT_PUMP", + "parentId": null, + "visibility": 1 + }, + { + "id": 23, + "name": "REG_GROUP_HOT_WATER", + "parentId": null, + "visibility": 1 + }, + { + "id": 27, + "name": "REG_GROUP_IMMERSION_HEATER", + "parentId": null, + "visibility": 1 + }, + { + "id": 16, + "name": "REG_GROUP_SOFTWARE_VERSIONS", + "parentId": null, + "visibility": 1 + }, + { + "id": 52, + "name": "REG_GROUP_HEATING_CURVE_2", + "parentId": null, + "visibility": 1 + }, + { + "id": 42, + "name": "REG_GROUP_CALIBRATION", + "parentId": null, + "visibility": 1 + } +] + + +Group REG_GROUP_OPERATIONAL_OPERATION: +[ + { + "canBeShownInGraph": false, + "canBeShownInHistory": false, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 106013, + "groupId": 14, + "groupItemId": 24771, + "groupItemOrder": 60000, + "groupName": "REG_GROUP_OPERATIONAL_OPERATION", + "groupOrder": 10001, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": false, + "maxValue": null, + "minValue": null, + "modifier": 0, + "precision": null, + "presentation": "Enumeration", + "registerId": 106013, + "registerIndex": 51, + "registerName": "REG_OPERATIONMODE", + "registerValue": 2.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-03-14T16:42:52.217", + "trueText": null, + "unit": "NotSpecified", + "valueNames": [ + { + "confirmation": "UI_OPERATION_MODE_AUX_HEATER_ONLY_WARNING", + "isReadonly": false, + "name": "REG_VALUE_OPERATION_MODE_OFF", + "value": 0, + "visible": true + }, + { + "confirmation": "UI_OPERATION_MODE_AUX_HEATER_ONLY_WARNING", + "isReadonly": false, + "name": "REG_VALUE_OPERATION_MODE_AUTO", + "value": 1, + "visible": true + }, + { + "confirmation": "UI_OPERATION_MODE_AUX_HEATER_ONLY_WARNING", + "isReadonly": false, + "name": "REG_VALUE_OPERATION_MODE_COMPRESSOR", + "value": 2, + "visible": true + }, + { + "confirmation": "UI_OPERATION_MODE_AUX_HEATER_ONLY_WARNING", + "isReadonly": false, + "name": "REG_VALUE_OPERATION_MODE_AUXILIARY", + "value": 3, + "visible": true + }, + { + "confirmation": "UI_OPERATION_MODE_AUX_HEATER_ONLY_WARNING", + "isReadonly": false, + "name": "REG_VALUE_OPERATION_MODE_HOT_WATER", + "value": 4, + "visible": true + } + ] + }, + { + "canBeShownInGraph": false, + "canBeShownInHistory": false, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 6003, + "groupId": 14, + "groupItemId": 24774, + "groupItemOrder": 60005, + "groupName": "REG_GROUP_OPERATIONAL_OPERATION", + "groupOrder": 10001, + "groupParentId": null, + "isComputedRegister": true, + "isInvisible": false, + "isReadOnly": true, + "maxValue": null, + "minValue": null, + "modifier": 0, + "precision": null, + "presentation": "Hidden", + "registerId": 6003, + "registerIndex": 6003, + "registerName": "COMP_HAS_LINK", + "registerValue": 0.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-10-13T16:44:36.2556749", + "trueText": null, + "unit": "0", + "valueNames": null + }, + { + "canBeShownInGraph": false, + "canBeShownInHistory": false, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 106062, + "groupId": 14, + "groupItemId": 24788, + "groupItemOrder": 60010, + "groupName": "REG_GROUP_OPERATIONAL_OPERATION", + "groupOrder": 10001, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": false, + "maxValue": null, + "minValue": null, + "modifier": 2, + "precision": null, + "presentation": "Enumeration", + "registerId": 106062, + "registerIndex": 1369, + "registerName": "REG_LINK_INTEGRATION", + "registerValue": null, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": null, + "trueText": null, + "unit": "NotSpecified", + "valueNames": [ + { + "confirmation": null, + "isReadonly": false, + "name": "REG_LINK_STATUS_LIGHT", + "value": 0, + "visible": true + }, + { + "confirmation": null, + "isReadonly": false, + "name": "REG_LINK_STATUS_SYSTEM", + "value": 1, + "visible": true + } + ] + } +] + + +Group REG_GROUP_OPERATIONAL_STATUS: +[ + { + "canBeShownInGraph": false, + "canBeShownInHistory": false, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 6001, + "groupId": 2, + "groupItemId": 24782, + "groupItemOrder": 60010, + "groupName": "REG_GROUP_OPERATIONAL_STATUS", + "groupOrder": 10010, + "groupParentId": null, + "isComputedRegister": true, + "isInvisible": false, + "isReadOnly": true, + "maxValue": null, + "minValue": null, + "modifier": 0, + "precision": null, + "presentation": "StatusFlagsTextInd", + "registerId": 6001, + "registerIndex": 6001, + "registerName": "COMP_POWER_STATUS", + "registerValue": 0.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-10-13T16:44:36.3641213", + "trueText": null, + "unit": "0", + "valueNames": [ + { + "confirmation": null, + "isReadonly": false, + "name": "COMP_VALUE_STEP_3KW", + "value": 1, + "visible": true + }, + { + "confirmation": null, + "isReadonly": false, + "name": "COMP_VALUE_STEP_6KW", + "value": 2, + "visible": true + }, + { + "confirmation": null, + "isReadonly": false, + "name": "COMP_VALUE_STEP_9KW", + "value": 4, + "visible": false + }, + { + "confirmation": null, + "isReadonly": false, + "name": "COMP_VALUE_STEP_12KW", + "value": 8, + "visible": false + }, + { + "confirmation": null, + "isReadonly": false, + "name": "COMP_VALUE_STEP_15KW", + "value": 16, + "visible": false + } + ] + }, + { + "canBeShownInGraph": false, + "canBeShownInHistory": false, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 6002, + "groupId": 2, + "groupItemId": 24798, + "groupItemOrder": 60020, + "groupName": "REG_GROUP_OPERATIONAL_STATUS", + "groupOrder": 10010, + "groupParentId": null, + "isComputedRegister": true, + "isInvisible": false, + "isReadOnly": true, + "maxValue": null, + "minValue": null, + "modifier": 0, + "precision": null, + "presentation": "StatusFlagsTextInd", + "registerId": 6002, + "registerIndex": 6002, + "registerName": "COMP_STATUS", + "registerValue": 4.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-10-13T16:44:36.3641229", + "trueText": null, + "unit": "0", + "valueNames": [ + { + "confirmation": null, + "isReadonly": false, + "name": "COMP_VALUE_COMPR", + "value": 1, + "visible": true + }, + { + "confirmation": null, + "isReadonly": false, + "name": "COMP_VALUE_BRINEPUMP", + "value": 2, + "visible": true + }, + { + "confirmation": null, + "isReadonly": false, + "name": "COMP_VALUE_RADIATORPUMP", + "value": 4, + "visible": false + }, + { + "confirmation": null, + "isReadonly": false, + "name": "COMP_VALUE_COOLING", + "value": 8, + "visible": false + }, + { + "confirmation": null, + "isReadonly": false, + "name": "COMP_VALUE_HOT_WATER", + "value": 16, + "visible": true + }, + { + "confirmation": null, + "isReadonly": false, + "name": "COMP_VALUE_HEATING", + "value": 32, + "visible": true + } + ] + }, + { + "canBeShownInGraph": false, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 106017, + "groupId": 2, + "groupItemId": 24810, + "groupItemOrder": 60040, + "groupName": "REG_GROUP_OPERATIONAL_STATUS", + "groupOrder": 10010, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": true, + "maxValue": null, + "minValue": null, + "modifier": 4, + "precision": null, + "presentation": "Integer", + "registerId": 106017, + "registerIndex": 25, + "registerName": "REG_INTEGRAL_LSD", + "registerValue": -80.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-10-13T16:43:45.434", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + } +] + + +Group REG_GROUP_TEMPERATURES: +[ + { + "canBeShownInGraph": true, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 106000, + "groupId": 3, + "groupItemId": 24825, + "groupItemOrder": 60100, + "groupName": "REG_GROUP_TEMPERATURES", + "groupOrder": 11000, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": true, + "maxValue": null, + "minValue": null, + "modifier": 8, + "precision": null, + "presentation": "Integer", + "registerId": 106000, + "registerIndex": 0, + "registerName": "REG_OUTDOOR_TEMPERATURE", + "registerValue": 9.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-10-13T13:06:06.668", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + }, + { + "canBeShownInGraph": true, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 106001, + "groupId": 3, + "groupItemId": 24830, + "groupItemOrder": 60105, + "groupName": "REG_GROUP_TEMPERATURES", + "groupOrder": 11000, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": true, + "maxValue": null, + "minValue": null, + "modifier": 8, + "precision": null, + "presentation": "Integer", + "registerId": 106001, + "registerIndex": 1, + "registerName": "REG_INDOOR_TEMPERATURE", + "registerValue": 20.0, + "step": 0.1, + "stringRegisterValue": null, + "timeStamp": "2024-03-15T06:46:44.208", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + }, + { + "canBeShownInGraph": true, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 106002, + "groupId": 3, + "groupItemId": 24835, + "groupItemOrder": 60110, + "groupName": "REG_GROUP_TEMPERATURES", + "groupOrder": 11000, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": true, + "maxValue": null, + "minValue": null, + "modifier": 12, + "precision": null, + "presentation": "Integer", + "registerId": 106002, + "registerIndex": 5, + "registerName": "REG_SUPPLY_LINE", + "registerValue": 19.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-10-13T16:30:47.087", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + }, + { + "canBeShownInGraph": true, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 106009, + "groupId": 3, + "groupItemId": 24840, + "groupItemOrder": 60111, + "groupName": "REG_GROUP_TEMPERATURES", + "groupOrder": 11000, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": true, + "maxValue": null, + "minValue": null, + "modifier": 8, + "precision": null, + "presentation": "Integer", + "registerId": 106009, + "registerIndex": 14, + "registerName": "REG_DESIRED_SUPPLY_LINE", + "registerValue": 20.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-10-11T18:56:40.716", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + }, + { + "canBeShownInGraph": true, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 106003, + "groupId": 3, + "groupItemId": 24841, + "groupItemOrder": 60115, + "groupName": "REG_GROUP_TEMPERATURES", + "groupOrder": 11000, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": true, + "maxValue": null, + "minValue": null, + "modifier": 12, + "precision": null, + "presentation": "Integer", + "registerId": 106003, + "registerIndex": 6, + "registerName": "REG_RETURN_LINE", + "registerValue": 19.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-10-13T16:17:37.75", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + }, + { + "canBeShownInGraph": true, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 106004, + "groupId": 3, + "groupItemId": 24850, + "groupItemOrder": 60120, + "groupName": "REG_GROUP_TEMPERATURES", + "groupOrder": 11000, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": true, + "maxValue": null, + "minValue": null, + "modifier": 12, + "precision": null, + "presentation": "Integer", + "registerId": 106004, + "registerIndex": 7, + "registerName": "REG_HOT_WATER_TEMPERATURE", + "registerValue": 53.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-10-13T16:14:20.536", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + }, + { + "canBeShownInGraph": true, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 106005, + "groupId": 3, + "groupItemId": 24855, + "groupItemOrder": 60125, + "groupName": "REG_GROUP_TEMPERATURES", + "groupOrder": 11000, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": true, + "maxValue": null, + "minValue": null, + "modifier": 12, + "precision": null, + "presentation": "Integer", + "registerId": 106005, + "registerIndex": 8, + "registerName": "REG_BRINE_OUT", + "registerValue": 15.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-10-13T16:33:16.657", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + }, + { + "canBeShownInGraph": true, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 106006, + "groupId": 3, + "groupItemId": 24860, + "groupItemOrder": 60130, + "groupName": "REG_GROUP_TEMPERATURES", + "groupOrder": 11000, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": true, + "maxValue": null, + "minValue": null, + "modifier": 12, + "precision": null, + "presentation": "Integer", + "registerId": 106006, + "registerIndex": 9, + "registerName": "REG_BRINE_IN", + "registerValue": 17.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-10-13T16:36:28.155", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + }, + { + "canBeShownInGraph": true, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 106010, + "groupId": 3, + "groupItemId": 24881, + "groupItemOrder": 60155, + "groupName": "REG_GROUP_TEMPERATURES", + "groupOrder": 11000, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": true, + "maxValue": 30.0, + "minValue": 10.0, + "modifier": 8, + "precision": null, + "presentation": "Integer", + "registerId": 106010, + "registerIndex": 50, + "registerName": "REG_DESIRED_INDOOR_TEMPERATURE", + "registerValue": 13.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-08-09T14:55:01.185", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + } +] + + +Group REG_GROUP_OPERATIONAL_TIME: +[ + { + "canBeShownInGraph": true, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 106019, + "groupId": 10, + "groupItemId": 24894, + "groupItemOrder": 60190, + "groupName": "REG_GROUP_OPERATIONAL_TIME", + "groupOrder": 11500, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": true, + "maxValue": null, + "minValue": null, + "modifier": 16, + "precision": null, + "presentation": "Integer", + "registerId": 106019, + "registerIndex": 37, + "registerName": "REG_OPER_TIME_COMPRESSOR", + "registerValue": 6267.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-10-13T16:13:19.121", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + }, + { + "canBeShownInGraph": true, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 106020, + "groupId": 10, + "groupItemId": 24901, + "groupItemOrder": 60200, + "groupName": "REG_GROUP_OPERATIONAL_TIME", + "groupOrder": 11500, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": true, + "maxValue": null, + "minValue": null, + "modifier": 16, + "precision": null, + "presentation": "Integer", + "registerId": 106020, + "registerIndex": 41, + "registerName": "REG_OPER_TIME_HOT_WATER", + "registerValue": 1176.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-10-13T12:36:27.842", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + }, + { + "canBeShownInGraph": true, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 106023, + "groupId": 10, + "groupItemId": 24913, + "groupItemOrder": 60230, + "groupName": "REG_GROUP_OPERATIONAL_TIME", + "groupOrder": 11500, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": true, + "maxValue": null, + "minValue": null, + "modifier": 16, + "precision": null, + "presentation": "Integer", + "registerId": 106023, + "registerIndex": 39, + "registerName": "REG_OPER_TIME_IMM1", + "registerValue": 173.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-03-15T06:46:33.208", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + }, + { + "canBeShownInGraph": true, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 106024, + "groupId": 10, + "groupItemId": 24920, + "groupItemOrder": 60240, + "groupName": "REG_GROUP_OPERATIONAL_TIME", + "groupOrder": 11500, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": true, + "maxValue": null, + "minValue": null, + "modifier": 16, + "precision": null, + "presentation": "Integer", + "registerId": 106024, + "registerIndex": 47, + "registerName": "REG_OPER_TIME_IMM2", + "registerValue": 126.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-03-15T06:46:36.748", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + } +] + + +Group REG_GROUP_POOL: +[] + + +Group REG_GROUP_HEATING_CURVE: +[ + { + "canBeShownInGraph": false, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 106025, + "groupId": 19, + "groupItemId": 24921, + "groupItemOrder": 60250, + "groupName": "REG_GROUP_HEATING_CURVE", + "groupOrder": 12010, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": false, + "maxValue": 56.0, + "minValue": 22.0, + "modifier": 1, + "precision": null, + "presentation": "Slider", + "registerId": 106025, + "registerIndex": 52, + "registerName": "REG_HEATING_HEAT_CURVE", + "registerValue": 30.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-03-14T16:42:52.217", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + }, + { + "canBeShownInGraph": false, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 106026, + "groupId": 19, + "groupItemId": 24930, + "groupItemOrder": 60260, + "groupName": "REG_GROUP_HEATING_CURVE", + "groupOrder": 12010, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": false, + "maxValue": 50.0, + "minValue": 10.0, + "modifier": 1, + "precision": null, + "presentation": "Slider", + "registerId": 106026, + "registerIndex": 53, + "registerName": "REG_HEATING_HEAT_CURVE_MIN", + "registerValue": 20.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-03-14T16:42:52.217", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + }, + { + "canBeShownInGraph": false, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 106027, + "groupId": 19, + "groupItemId": 24931, + "groupItemOrder": 60270, + "groupName": "REG_GROUP_HEATING_CURVE", + "groupOrder": 12010, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": false, + "maxValue": 85.0, + "minValue": 40.0, + "modifier": 1, + "precision": null, + "presentation": "Slider", + "registerId": 106027, + "registerIndex": 54, + "registerName": "REG_HEATING_HEAT_CURVE_MAX", + "registerValue": 40.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-03-14T16:42:52.217", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + }, + { + "canBeShownInGraph": false, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 106028, + "groupId": 19, + "groupItemId": 24940, + "groupItemOrder": 60280, + "groupName": "REG_GROUP_HEATING_CURVE", + "groupOrder": 12010, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": false, + "maxValue": 5.0, + "minValue": -5.0, + "modifier": 1, + "precision": null, + "presentation": "Slider", + "registerId": 106028, + "registerIndex": 55, + "registerName": "REG_HEATING_CURVE_PLUS5", + "registerValue": 0.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-03-14T16:42:52.217", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + }, + { + "canBeShownInGraph": false, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 106029, + "groupId": 19, + "groupItemId": 24941, + "groupItemOrder": 60290, + "groupName": "REG_GROUP_HEATING_CURVE", + "groupOrder": 12010, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": false, + "maxValue": 5.0, + "minValue": -5.0, + "modifier": 1, + "precision": null, + "presentation": "Slider", + "registerId": 106029, + "registerIndex": 56, + "registerName": "REG_HEATING_CURVE_0", + "registerValue": 0.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-03-14T16:42:52.716", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + }, + { + "canBeShownInGraph": false, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 106030, + "groupId": 19, + "groupItemId": 24950, + "groupItemOrder": 60300, + "groupName": "REG_GROUP_HEATING_CURVE", + "groupOrder": 12010, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": false, + "maxValue": 5.0, + "minValue": -5.0, + "modifier": 1, + "precision": null, + "presentation": "Slider", + "registerId": 106030, + "registerIndex": 57, + "registerName": "REG_CURVE_MINUS_5", + "registerValue": 0.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-03-14T16:42:52.716", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + }, + { + "canBeShownInGraph": false, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 106031, + "groupId": 19, + "groupItemId": 24951, + "groupItemOrder": 60310, + "groupName": "REG_GROUP_HEATING_CURVE", + "groupOrder": 12010, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": false, + "maxValue": 40.0, + "minValue": 0.0, + "modifier": 0, + "precision": null, + "presentation": "Slider", + "registerId": 106031, + "registerIndex": 58, + "registerName": "REG_HEATING_STOP", + "registerValue": 15.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-03-14T16:42:52.716", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + }, + { + "canBeShownInGraph": false, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 106033, + "groupId": 19, + "groupItemId": 24961, + "groupItemOrder": 60330, + "groupName": "REG_GROUP_HEATING_CURVE", + "groupOrder": 12010, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": false, + "maxValue": 4.0, + "minValue": 0.0, + "modifier": 1, + "precision": null, + "presentation": "Slider", + "registerId": 106033, + "registerIndex": 60, + "registerName": "REG_ROOM_FACTOR", + "registerValue": 2.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-03-14T16:42:52.716", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + } +] + + +Group REG_GROUP_HEAT_PUMP: +[] + + +Group REG_GROUP_HOT_WATER: +[] + + +Group REG_GROUP_IMMERSION_HEATER: +[] + + +Group REG_GROUP_SOFTWARE_VERSIONS: +[] + + +Group REG_GROUP_HEATING_CURVE_2: +[] + + +Group REG_GROUP_CALIBRATION: +[] + + +########## DEBUG END ########## diff --git a/ThermiaOnlineAPI/tests/debug_files/iTec_IQ.txt b/ThermiaOnlineAPI/tests/debug_files/iTec_IQ.txt new file mode 100644 index 0000000..6b78ee7 --- /dev/null +++ b/ThermiaOnlineAPI/tests/debug_files/iTec_IQ.txt @@ -0,0 +1,1414 @@ +########## DEBUG START ########## +self.__info: +{ + "createdWhen": "2024-08-16T07:09:36.888", + "deviceId": 1234567, + "hasLinkUnit": false, + "installationProfileId": 1005, + "isOnline": true, + "lastOnline": "2024-10-12T19:54:34.249", + "model": "", + "name": "Thermia", + "operationManualUrl": "https://thermia.com/products/thermia-online/", + "serialNumber": null +} + + +self.__status: +{ + "dcmVersion": "2.0.17", + "deviceConnectionType": "Dcm", + "hasIndoorTempSensor": false, + "heatingEffect": 18, + "heatingEffectRegisters": [ + null, + 110000 + ], + "hotWaterRegistryName": "UI_TAP_WATER", + "hotWaterTemperature": 54.0, + "indoorTemperature": 20.0, + "isGaugeDifferenciated": false, + "isHeatingEffectSetByUser": false, + "isHotWaterActive": true, + "isOutdoorTempSensorFunctioning": true, + "isReducedHeatingEffectSetByUser": false, + "linkIntegrationStatus": false, + "outdoorTemperature": 7.0, + "programVersion": "2.4.1", + "reducedHeatingEffect": 18, + "reducedHeatingEffectRegisters": [ + null, + 110052 + ], + "roomFactor": 2, + "tcVersion": null +} + + +self.__device_data: +{ + "deviceId": 1234567, + "isOnline": true, + "lastOnline": "2024-10-12T17:54:34.249", + "location": null, + "name": "Thermia", + "profile": { + "icon": 2, + "id": 1005, + "name": "IQ", + "thermiaName": "iTec" + } +} + + +All available groups: +[ + { + "id": 50, + "name": "REG_GROUP_DEVICETIME", + "parentId": null, + "visibility": 1 + }, + { + "id": 14, + "name": "REG_GROUP_OPERATIONAL_OPERATION", + "parentId": null, + "visibility": 1 + }, + { + "id": 2, + "name": "REG_GROUP_OPERATIONAL_STATUS", + "parentId": null, + "visibility": 1 + }, + { + "id": 3, + "name": "REG_GROUP_TEMPERATURES", + "parentId": null, + "visibility": 1 + }, + { + "id": 10, + "name": "REG_GROUP_OPERATIONAL_TIME", + "parentId": null, + "visibility": 1 + }, + { + "id": 7, + "name": "REG_GROUP_POOL", + "parentId": null, + "visibility": 1 + }, + { + "id": 19, + "name": "REG_GROUP_HEATING_CURVE", + "parentId": null, + "visibility": 1 + }, + { + "id": 20, + "name": "REG_GROUP_HEAT_PUMP", + "parentId": null, + "visibility": 1 + }, + { + "id": 23, + "name": "REG_GROUP_HOT_WATER", + "parentId": null, + "visibility": 1 + }, + { + "id": 27, + "name": "REG_GROUP_IMMERSION_HEATER", + "parentId": null, + "visibility": 1 + }, + { + "id": 17, + "name": "REG_GROUP_OPERATIONAL_DIAGNOSTICS", + "parentId": null, + "visibility": 1 + }, + { + "id": 16, + "name": "REG_GROUP_SOFTWARE_VERSIONS", + "parentId": null, + "visibility": 1 + }, + { + "id": 6, + "name": "REG_GROUP_COOLING", + "parentId": null, + "visibility": 1 + }, + { + "id": 21, + "name": "REG_GROUP_IMMERSION_HEATER_AUX", + "parentId": null, + "visibility": 1 + }, + { + "id": 42, + "name": "REG_GROUP_CALIBRATION", + "parentId": null, + "visibility": 1 + }, + { + "id": 53, + "name": "REG_GROUP_BUFFER_TANK", + "parentId": null, + "visibility": 1 + }, + { + "id": 45, + "name": "REG_GROUP_DEFROSTING", + "parentId": null, + "visibility": 1 + }, + { + "id": 51, + "name": "REG_GROUP_HEATING_CURVE_CIRC1", + "parentId": null, + "visibility": 1 + }, + { + "id": 43, + "name": "REG_GROUP_HEATING_CURVE_CIRC2", + "parentId": null, + "visibility": 1 + }, + { + "id": 48, + "name": "REG_ERROR_CODES", + "parentId": null, + "visibility": 1 + }, + { + "id": 40, + "name": "REG_OPTIMUM", + "parentId": null, + "visibility": 1 + }, + { + "id": 46, + "name": "REG_GROUP_TEMPERATURES_SLAVE", + "parentId": null, + "visibility": 1 + }, + { + "id": 44, + "name": "REG_GROUP_CALENDAR", + "parentId": null, + "visibility": 1 + } +] + + +Group REG_GROUP_DEVICETIME: +[] + + +Group REG_GROUP_OPERATIONAL_OPERATION: +[ + { + "canBeShownInGraph": false, + "canBeShownInHistory": false, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 110030, + "groupId": 14, + "groupItemId": 25106, + "groupItemOrder": 70000, + "groupName": "REG_GROUP_OPERATIONAL_OPERATION", + "groupOrder": 10001, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": false, + "maxValue": null, + "minValue": null, + "modifier": 0, + "precision": null, + "presentation": "Enumeration", + "registerId": 110030, + "registerIndex": 1363, + "registerName": "REG_OPERATIONMODE", + "registerValue": 1.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-09-17T08:20:57.95", + "trueText": null, + "unit": "NotSpecified", + "valueNames": [ + { + "confirmation": "UI_OPERATION_MODE_AUX_HEATER_ONLY_WARNING", + "isReadonly": false, + "name": "REG_VALUE_OPERATION_MODE_OFF", + "value": 0, + "visible": true + }, + { + "confirmation": "UI_OPERATION_MODE_AUX_HEATER_ONLY_WARNING", + "isReadonly": false, + "name": "REG_VALUE_OPERATION_MODE_AUTO", + "value": 1, + "visible": true + }, + { + "confirmation": "UI_OPERATION_MODE_AUX_HEATER_ONLY_WARNING", + "isReadonly": false, + "name": "REG_VALUE_OPERATION_MODE_COMPRESSOR", + "value": 2, + "visible": true + }, + { + "confirmation": "UI_OPERATION_MODE_AUX_HEATER_ONLY_WARNING", + "isReadonly": false, + "name": "REG_VALUE_OPERATION_MODE_AUXILIARY", + "value": 3, + "visible": true + }, + { + "confirmation": "UI_OPERATION_MODE_AUX_HEATER_ONLY_WARNING", + "isReadonly": false, + "name": "REG_VALUE_OPERATION_MODE_HOT_WATER", + "value": 4, + "visible": false + } + ] + }, + { + "canBeShownInGraph": false, + "canBeShownInHistory": false, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 10003, + "groupId": 14, + "groupItemId": 25146, + "groupItemOrder": 70005, + "groupName": "REG_GROUP_OPERATIONAL_OPERATION", + "groupOrder": 10001, + "groupParentId": null, + "isComputedRegister": true, + "isInvisible": false, + "isReadOnly": true, + "maxValue": null, + "minValue": null, + "modifier": 0, + "precision": null, + "presentation": "Hidden", + "registerId": 10003, + "registerIndex": 10003, + "registerName": "COMP_HAS_LINK", + "registerValue": 0.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-10-12T19:54:54.6352969", + "trueText": null, + "unit": "0", + "valueNames": null + }, + { + "canBeShownInGraph": false, + "canBeShownInHistory": false, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 110105, + "groupId": 14, + "groupItemId": 25144, + "groupItemOrder": 70005, + "groupName": "REG_GROUP_OPERATIONAL_OPERATION", + "groupOrder": 10001, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": false, + "maxValue": null, + "minValue": null, + "modifier": 2, + "precision": null, + "presentation": "Enumeration", + "registerId": 110105, + "registerIndex": 1369, + "registerName": "REG_LINK_INTEGRATION", + "registerValue": 0.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-08-16T14:43:19.12", + "trueText": null, + "unit": "NotSpecified", + "valueNames": [ + { + "confirmation": null, + "isReadonly": false, + "name": "REG_LINK_STATUS_LIGHT", + "value": 0, + "visible": true + }, + { + "confirmation": null, + "isReadonly": false, + "name": "REG_LINK_STATUS_SYSTEM", + "value": 1, + "visible": true + } + ] + } +] + + +Group REG_GROUP_OPERATIONAL_STATUS: +[ + { + "canBeShownInGraph": false, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 110031, + "groupId": 2, + "groupItemId": 25138, + "groupItemOrder": 70001, + "groupName": "REG_GROUP_OPERATIONAL_STATUS", + "groupOrder": 10010, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": true, + "maxValue": null, + "minValue": null, + "modifier": 4, + "precision": null, + "presentation": "Integer", + "registerId": 110031, + "registerIndex": 2120, + "registerName": "REG_PID", + "registerValue": 50.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-10-12T18:56:54.334", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + }, + { + "canBeShownInGraph": false, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 110032, + "groupId": 2, + "groupItemId": 25149, + "groupItemOrder": 70010, + "groupName": "REG_GROUP_OPERATIONAL_STATUS", + "groupOrder": 10010, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": true, + "maxValue": null, + "minValue": null, + "modifier": 0, + "precision": null, + "presentation": "Integer", + "registerId": 110032, + "registerIndex": 2068, + "registerName": "REG_CURRENT_LIMITER_EXP_PORT203_1", + "registerValue": 18.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-10-11T20:22:18.732", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + }, + { + "canBeShownInGraph": false, + "canBeShownInHistory": false, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 10002, + "groupId": 2, + "groupItemId": 25152, + "groupItemOrder": 70020, + "groupName": "REG_GROUP_OPERATIONAL_STATUS", + "groupOrder": 10010, + "groupParentId": null, + "isComputedRegister": true, + "isInvisible": false, + "isReadOnly": true, + "maxValue": null, + "minValue": null, + "modifier": 0, + "precision": null, + "presentation": "StatusFlagsTextInd", + "registerId": 10002, + "registerIndex": 10002, + "registerName": "COMP_STATUS_ITEC", + "registerValue": 2.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-10-12T19:54:54.740536", + "trueText": null, + "unit": "0", + "valueNames": [ + { + "confirmation": null, + "isReadonly": false, + "name": "COMP_VALUE_COMPR", + "value": 1, + "visible": true + }, + { + "confirmation": null, + "isReadonly": false, + "name": "COMP_VALUE_RADIATORPUMP", + "value": 2, + "visible": false + }, + { + "confirmation": null, + "isReadonly": false, + "name": "COMP_VALUE_HOT_WATER", + "value": 8, + "visible": false + }, + { + "confirmation": null, + "isReadonly": false, + "name": "COMP_VALUE_HEATING", + "value": 16, + "visible": true + }, + { + "confirmation": null, + "isReadonly": false, + "name": "COMP_VALUE_DEFROST", + "value": 32, + "visible": true + }, + { + "confirmation": null, + "isReadonly": false, + "name": "COMP_VALUE_POOL", + "value": 64, + "visible": false + }, + { + "confirmation": null, + "isReadonly": false, + "name": "COMP_VALUE_COOLING", + "value": 128, + "visible": true + } + ] + } +] + + +Group REG_GROUP_TEMPERATURES: +[ + { + "canBeShownInGraph": true, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 114183, + "groupId": 3, + "groupItemId": 24767, + "groupItemOrder": 10002, + "groupName": "REG_GROUP_TEMPERATURES", + "groupOrder": 11000, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": true, + "maxValue": null, + "minValue": null, + "modifier": 8, + "precision": null, + "presentation": "Integer", + "registerId": 114183, + "registerIndex": 2002, + "registerName": "REG_OPER_DATA_RETURN_MA_SA", + "registerValue": 24.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-10-12T16:46:53.16", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + }, + { + "canBeShownInGraph": true, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 114184, + "groupId": 3, + "groupItemId": 24768, + "groupItemOrder": 10003, + "groupName": "REG_GROUP_TEMPERATURES", + "groupOrder": 11000, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": true, + "maxValue": null, + "minValue": null, + "modifier": 8, + "precision": null, + "presentation": "Integer", + "registerId": 114184, + "registerIndex": 2009, + "registerName": "OPER_DATA_TANK", + "registerValue": 24.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-10-12T17:53:13.265", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + }, + { + "canBeShownInGraph": true, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 110001, + "groupId": 3, + "groupItemId": 25155, + "groupItemOrder": 70105, + "groupName": "REG_GROUP_TEMPERATURES", + "groupOrder": 11000, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": true, + "maxValue": null, + "minValue": null, + "modifier": 8, + "precision": null, + "presentation": "Integer", + "registerId": 110001, + "registerIndex": 2010, + "registerName": "REG_OPER_DATA_OUTDOOR_TEMP_MA_SA", + "registerValue": 7.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-10-12T18:57:02.836", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + }, + { + "canBeShownInGraph": true, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 110007, + "groupId": 3, + "groupItemId": 25161, + "groupItemOrder": 70135, + "groupName": "REG_GROUP_TEMPERATURES", + "groupOrder": 11000, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": true, + "maxValue": null, + "minValue": null, + "modifier": 8, + "precision": null, + "presentation": "Integer", + "registerId": 110007, + "registerIndex": 2060, + "registerName": "REG_INDOOR_TEMPERATURE", + "registerValue": 20.0, + "step": 0.1, + "stringRegisterValue": null, + "timeStamp": "2024-08-16T14:43:13.885", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + }, + { + "canBeShownInGraph": true, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 110009, + "groupId": 3, + "groupItemId": 25162, + "groupItemOrder": 70140, + "groupName": "REG_GROUP_TEMPERATURES", + "groupOrder": 11000, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": true, + "maxValue": null, + "minValue": null, + "modifier": 8, + "precision": null, + "presentation": "Integer", + "registerId": 110009, + "registerIndex": 2121, + "registerName": "REG_DESIRED_SUPPLY_LINE_TEMP", + "registerValue": 24.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-10-12T18:56:54.334", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + }, + { + "canBeShownInGraph": true, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 110008, + "groupId": 3, + "groupItemId": 25165, + "groupItemOrder": 70145, + "groupName": "REG_GROUP_TEMPERATURES", + "groupOrder": 11000, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": true, + "maxValue": null, + "minValue": null, + "modifier": 12, + "precision": null, + "presentation": "Integer", + "registerId": 110008, + "registerIndex": 2000, + "registerName": "REG_OPER_DATA_SUPPLY_MA_SA", + "registerValue": 24.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-10-12T17:33:01.792", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + }, + { + "canBeShownInGraph": true, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 110011, + "groupId": 3, + "groupItemId": 25171, + "groupItemOrder": 70155, + "groupName": "REG_GROUP_TEMPERATURES", + "groupOrder": 11000, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": true, + "maxValue": null, + "minValue": null, + "modifier": 8, + "precision": null, + "presentation": "Integer", + "registerId": 110011, + "registerIndex": 2003, + "registerName": "REG_HOT_WATER_TEMPERATURE", + "registerValue": 54.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-10-12T19:01:00.936", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + } +] + + +Group REG_GROUP_OPERATIONAL_TIME: +[ + { + "canBeShownInGraph": true, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 110033, + "groupId": 10, + "groupItemId": 25211, + "groupItemOrder": 70330, + "groupName": "REG_GROUP_OPERATIONAL_TIME", + "groupOrder": 11500, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": true, + "maxValue": null, + "minValue": null, + "modifier": 16, + "precision": null, + "presentation": "Integer", + "registerId": 110033, + "registerIndex": 2160, + "registerName": "REG_OPER_TIME_COMPRESSOR", + "registerValue": 226.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-10-12T15:05:14.782", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + }, + { + "canBeShownInGraph": true, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 110034, + "groupId": 10, + "groupItemId": 25212, + "groupItemOrder": 70340, + "groupName": "REG_GROUP_OPERATIONAL_TIME", + "groupOrder": 11500, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": true, + "maxValue": null, + "minValue": null, + "modifier": 16, + "precision": null, + "presentation": "Integer", + "registerId": 110034, + "registerIndex": 2162, + "registerName": "REG_OPER_TIME_HEATING", + "registerValue": 61.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-10-12T08:10:51.692", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + }, + { + "canBeShownInGraph": true, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 110035, + "groupId": 10, + "groupItemId": 25215, + "groupItemOrder": 70350, + "groupName": "REG_GROUP_OPERATIONAL_TIME", + "groupOrder": 11500, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": true, + "maxValue": null, + "minValue": null, + "modifier": 16, + "precision": null, + "presentation": "Integer", + "registerId": 110035, + "registerIndex": 2163, + "registerName": "REG_OPER_TIME_COOLING", + "registerValue": 59.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-09-03T17:39:25.284", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + }, + { + "canBeShownInGraph": true, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 110036, + "groupId": 10, + "groupItemId": 25216, + "groupItemOrder": 70360, + "groupName": "REG_GROUP_OPERATIONAL_TIME", + "groupOrder": 11500, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": true, + "maxValue": null, + "minValue": null, + "modifier": 16, + "precision": null, + "presentation": "Integer", + "registerId": 110036, + "registerIndex": 2166, + "registerName": "REG_OPER_TIME_HOT_WATER", + "registerValue": 102.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-10-12T15:00:55.512", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + }, + { + "canBeShownInGraph": true, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 110037, + "groupId": 10, + "groupItemId": 25219, + "groupItemOrder": 70370, + "groupName": "REG_GROUP_OPERATIONAL_TIME", + "groupOrder": 11500, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": true, + "maxValue": null, + "minValue": null, + "modifier": 16, + "precision": null, + "presentation": "Integer", + "registerId": 110037, + "registerIndex": 2167, + "registerName": "REG_OPER_TIME_IMM1", + "registerValue": 0.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-08-16T14:43:15.172", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + }, + { + "canBeShownInGraph": true, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 110038, + "groupId": 10, + "groupItemId": 25220, + "groupItemOrder": 70380, + "groupName": "REG_GROUP_OPERATIONAL_TIME", + "groupOrder": 11500, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": true, + "maxValue": null, + "minValue": null, + "modifier": 16, + "precision": null, + "presentation": "Integer", + "registerId": 110038, + "registerIndex": 2168, + "registerName": "REG_OPER_TIME_IMM2", + "registerValue": 3.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-09-28T08:10:15.681", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + } +] + + +Group REG_GROUP_POOL: +[] + + +Group REG_GROUP_HEATING_CURVE: +[ + { + "canBeShownInGraph": false, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 110045, + "groupId": 19, + "groupItemId": 25236, + "groupItemOrder": 70450, + "groupName": "REG_GROUP_HEATING_CURVE", + "groupOrder": 12010, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": false, + "maxValue": 56.0, + "minValue": 22.0, + "modifier": 1, + "precision": null, + "presentation": "Slider", + "registerId": 110045, + "registerIndex": 1000, + "registerName": "REG_HEATING_HEAT_CURVE", + "registerValue": 33.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-08-16T13:44:10.671", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + }, + { + "canBeShownInGraph": false, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 110046, + "groupId": 19, + "groupItemId": 25239, + "groupItemOrder": 70460, + "groupName": "REG_GROUP_HEATING_CURVE", + "groupOrder": 12010, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": false, + "maxValue": 50.0, + "minValue": 10.0, + "modifier": 1, + "precision": null, + "presentation": "Slider", + "registerId": 110046, + "registerIndex": 1001, + "registerName": "REG_HEATING_HEAT_CURVE_MIN", + "registerValue": 20.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-08-16T13:44:10.671", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + }, + { + "canBeShownInGraph": false, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 110047, + "groupId": 19, + "groupItemId": 25240, + "groupItemOrder": 70470, + "groupName": "REG_GROUP_HEATING_CURVE", + "groupOrder": 12010, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": false, + "maxValue": 85.0, + "minValue": 40.0, + "modifier": 1, + "precision": null, + "presentation": "Slider", + "registerId": 110047, + "registerIndex": 1002, + "registerName": "REG_HEATING_HEAT_CURVE_MAX", + "registerValue": 45.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-08-16T13:44:10.671", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + }, + { + "canBeShownInGraph": false, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 110048, + "groupId": 19, + "groupItemId": 25243, + "groupItemOrder": 70480, + "groupName": "REG_GROUP_HEATING_CURVE", + "groupOrder": 12010, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": false, + "maxValue": 5.0, + "minValue": -5.0, + "modifier": 1, + "precision": null, + "presentation": "Slider", + "registerId": 110048, + "registerIndex": 1003, + "registerName": "REG_HEATING_CURVE_PLUS5", + "registerValue": 0.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-10-12T09:04:47.347", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + }, + { + "canBeShownInGraph": false, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 110049, + "groupId": 19, + "groupItemId": 25244, + "groupItemOrder": 70490, + "groupName": "REG_GROUP_HEATING_CURVE", + "groupOrder": 12010, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": false, + "maxValue": 5.0, + "minValue": -5.0, + "modifier": 1, + "precision": null, + "presentation": "Slider", + "registerId": 110049, + "registerIndex": 1004, + "registerName": "REG_HEATING_CURVE_0", + "registerValue": 0.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-08-16T13:44:10.671", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + }, + { + "canBeShownInGraph": false, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 110050, + "groupId": 19, + "groupItemId": 25247, + "groupItemOrder": 70500, + "groupName": "REG_GROUP_HEATING_CURVE", + "groupOrder": 12010, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": false, + "maxValue": 5.0, + "minValue": -5.0, + "modifier": 1, + "precision": null, + "presentation": "Slider", + "registerId": 110050, + "registerIndex": 1005, + "registerName": "REG_HEATING_CURVE_MINUS5", + "registerValue": 0.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-08-16T13:44:10.671", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + }, + { + "canBeShownInGraph": false, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 110051, + "groupId": 19, + "groupItemId": 25250, + "groupItemOrder": 70510, + "groupName": "REG_GROUP_HEATING_CURVE", + "groupOrder": 12010, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": false, + "maxValue": 40.0, + "minValue": 0.0, + "modifier": 0, + "precision": null, + "presentation": "Slider", + "registerId": 110051, + "registerIndex": 1006, + "registerName": "REG_HEATING_HEAT_STOP", + "registerValue": 17.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-08-16T13:44:10.671", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + }, + { + "canBeShownInGraph": false, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 110053, + "groupId": 19, + "groupItemId": 25263, + "groupItemOrder": 70530, + "groupName": "REG_GROUP_HEATING_CURVE", + "groupOrder": 12010, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": false, + "maxValue": 4.0, + "minValue": 0.0, + "modifier": 1, + "precision": null, + "presentation": "Slider", + "registerId": 110053, + "registerIndex": 1008, + "registerName": "REG_HEATING_ROOM_FACTOR", + "registerValue": 2.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-08-16T13:44:10.671", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + } +] + + +Group REG_GROUP_HEAT_PUMP: +[] + + +Group REG_GROUP_HOT_WATER: +[ + { + "canBeShownInGraph": false, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 110054, + "groupId": 23, + "groupItemId": 25275, + "groupItemOrder": 70540, + "groupName": "REG_GROUP_HOT_WATER", + "groupOrder": 13500, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": false, + "maxValue": 1.0, + "minValue": 0.0, + "modifier": 0, + "precision": null, + "presentation": "Enumeration", + "registerId": 110054, + "registerIndex": 1070, + "registerName": "REG_HOT_WATER_STATUS", + "registerValue": 0.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-10-12T15:47:14.141", + "trueText": null, + "unit": "NotSpecified", + "valueNames": [ + { + "confirmation": null, + "isReadonly": false, + "name": "REG_VALUE_STATUS_OFF", + "value": 0, + "visible": true + }, + { + "confirmation": null, + "isReadonly": false, + "name": "REG_VALUE_STATUS_ON", + "value": 1, + "visible": true + } + ] + } +] + + +Group REG_GROUP_IMMERSION_HEATER: +[] + + +Group REG_GROUP_OPERATIONAL_DIAGNOSTICS: +[] + + +Group REG_GROUP_SOFTWARE_VERSIONS: +[] + + +Group REG_GROUP_COOLING: +[] + + +Group REG_GROUP_IMMERSION_HEATER_AUX: +[] + + +Group REG_GROUP_CALIBRATION: +[] + + +Group REG_GROUP_BUFFER_TANK: +[] + + +Group REG_GROUP_DEFROSTING: +[ + { + "canBeShownInGraph": false, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 110041, + "groupId": 45, + "groupItemId": 25227, + "groupItemOrder": 70410, + "groupName": "REG_GROUP_DEFROSTING", + "groupOrder": 70410, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": true, + "maxValue": null, + "minValue": null, + "modifier": 0, + "precision": null, + "presentation": "Integer", + "registerId": 110041, + "registerIndex": 2171, + "registerName": "REG_DEFROSTS_MA_SA", + "registerValue": 9.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-10-12T07:58:36.885", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + }, + { + "canBeShownInGraph": false, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 110042, + "groupId": 45, + "groupItemId": 25228, + "groupItemOrder": 70420, + "groupName": "REG_GROUP_DEFROSTING", + "groupOrder": 70410, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": true, + "maxValue": null, + "minValue": null, + "modifier": 0, + "precision": null, + "presentation": "Integer", + "registerId": 110042, + "registerIndex": 2172, + "registerName": "REG_DEFROSTS_BETW2DEFR_MA_SA", + "registerValue": 0.601, + "step": 0.0167, + "stringRegisterValue": null, + "timeStamp": "2024-10-12T06:38:53.923", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + }, + { + "canBeShownInGraph": false, + "canBeShownInHistory": true, + "collapsible": false, + "disabledByLink": false, + "falseText": null, + "graphRegisterIndex": 110043, + "groupId": 45, + "groupItemId": 25231, + "groupItemOrder": 70430, + "groupName": "REG_GROUP_DEFROSTING", + "groupOrder": 70410, + "groupParentId": null, + "isComputedRegister": false, + "isInvisible": false, + "isReadOnly": true, + "maxValue": null, + "minValue": null, + "modifier": 4, + "precision": null, + "presentation": "Integer", + "registerId": 110043, + "registerIndex": 2173, + "registerName": "REG_DEFROST_TIME_LAST_DEFROST_MA_SA", + "registerValue": 120.0, + "step": 1.0, + "stringRegisterValue": null, + "timeStamp": "2024-10-12T15:48:02.841", + "trueText": null, + "unit": "NotSpecified", + "valueNames": null + } +] + + +Group REG_GROUP_HEATING_CURVE_CIRC1: +[] + + +Group REG_GROUP_HEATING_CURVE_CIRC2: +[] + + +Group REG_ERROR_CODES: +[] + + +Group REG_OPTIMUM: +[] + + +Group REG_GROUP_TEMPERATURES_SLAVE: +[] + + +Group REG_GROUP_CALENDAR: +[] + + +########## DEBUG END ########## diff --git a/ThermiaOnlineAPI/tests/setup.py b/ThermiaOnlineAPI/tests/setup.py new file mode 100644 index 0000000..5aa83bf --- /dev/null +++ b/ThermiaOnlineAPI/tests/setup.py @@ -0,0 +1,115 @@ +from datetime import datetime, timedelta +import os +from typing import List + +from .utils import match_lists_in_any_order, parse_debug_file + +from .. import Thermia +from ..api.ThermiaAPI import ( + AZURE_AUTH_AUTHORIZE_URL, + AZURE_AUTH_CONFIRM_URL, + AZURE_AUTH_GET_TOKEN_URL, + AZURE_SELF_ASSERTED_URL, +) +from ..const import THERMIA_CONFIG_URL +from ..model.HeatPump import ThermiaHeatPump + +THERMIA_TEST_URL = "https://thermia-api-url" + + +def __mock_auth_requests(requests_mock): + requests_mock.get(THERMIA_CONFIG_URL, json={"apiBaseUrl": THERMIA_TEST_URL}) + requests_mock.get( + AZURE_AUTH_AUTHORIZE_URL, + text='var SETTINGS = {"transId": "key=some-transaction-id-value", "csrf": "some-csrf-value"};', + ) + requests_mock.post(AZURE_SELF_ASSERTED_URL, text="") + requests_mock.get( + AZURE_AUTH_CONFIRM_URL, + json={}, + ) + requests_mock.post( + AZURE_AUTH_GET_TOKEN_URL, + json={ + "access_token": "some-access-token", + "expires_on": (datetime.now() + timedelta(hours=6)).timestamp(), + "refresh_token": "some-refresh-token", + }, + ) + + +def __mock_data_requests(requests_mock, test_data_file: str): + absolute_path = os.path.dirname(os.path.abspath(__file__)) + test_data = parse_debug_file(f"{absolute_path}/debug_files/{test_data_file}") + + requests_mock.get( + f"{THERMIA_TEST_URL}/api/v1/InstallationsInfo/own", + json=[{**test_data["device_data"], "id": "test-id"}], + ) + requests_mock.get( + f"{THERMIA_TEST_URL}/api/v1/installations/test-id", + json=test_data["info"], + ) + requests_mock.get( + f"{THERMIA_TEST_URL}/api/v1/installationstatus/test-id/status", + json=test_data["status"], + ) + requests_mock.get( + f"{THERMIA_TEST_URL}/api/v1/Registers/Installations/test-id/Groups/REG_GROUP_TEMPERATURES", + json=test_data["groups"]["REG_GROUP_TEMPERATURES"], + ) + requests_mock.get( + f"{THERMIA_TEST_URL}/api/v1/Registers/Installations/test-id/Groups/REG_GROUP_OPERATIONAL_STATUS", + json=test_data["groups"]["REG_GROUP_OPERATIONAL_STATUS"], + ) + requests_mock.get( + f"{THERMIA_TEST_URL}/api/v1/Registers/Installations/test-id/Groups/REG_GROUP_OPERATIONAL_TIME", + json=test_data["groups"]["REG_GROUP_OPERATIONAL_TIME"], + ) + requests_mock.get( + f"{THERMIA_TEST_URL}/api/v1/Registers/Installations/test-id/Groups/REG_GROUP_OPERATIONAL_OPERATION", + json=test_data["groups"]["REG_GROUP_OPERATIONAL_OPERATION"], + ) + requests_mock.get( + f"{THERMIA_TEST_URL}/api/v1/Registers/Installations/test-id/Groups/REG_GROUP_HOT_WATER", + json=test_data["groups"]["REG_GROUP_HOT_WATER"], + ) + requests_mock.get( + f"{THERMIA_TEST_URL}/api/v1/installation/test-id/events?onlyActiveAlarms=false", + json=[], + ) + + +def setup_thermia_and_perform_basic_tests( + requests_mock, + test_data_file: str, + expected_model: str, + expected_model_id: str, + expected_available_operational_modes: List[str], + expected_available_operational_statuses: List[str], + expected_available_power_statuses: List[str], +) -> ThermiaHeatPump: + __mock_auth_requests(requests_mock) + __mock_data_requests(requests_mock, test_data_file) + + thermia = Thermia("username", "password") + + assert thermia.connected == True + + heat_pump = thermia.heat_pumps[0] + + assert heat_pump.model == expected_model + assert heat_pump.model_id == expected_model_id + print(heat_pump.available_operation_modes) + assert match_lists_in_any_order( + heat_pump.available_operation_modes, expected_available_operational_modes + ) + assert match_lists_in_any_order( + heat_pump.available_operational_statuses, + expected_available_operational_statuses, + ) + assert match_lists_in_any_order( + heat_pump.available_power_statuses, expected_available_power_statuses + ) + + return heat_pump diff --git a/ThermiaOnlineAPI/tests/test_heat_pumps.py b/ThermiaOnlineAPI/tests/test_heat_pumps.py new file mode 100644 index 0000000..7c79d25 --- /dev/null +++ b/ThermiaOnlineAPI/tests/test_heat_pumps.py @@ -0,0 +1,25 @@ +from .setup import setup_thermia_and_perform_basic_tests + + +def test_diplomat_duo_921(requests_mock): + setup_thermia_and_perform_basic_tests( + requests_mock, + "diplomat_duo_921.txt", + "Diplomat / Diplomat Duo", + "DHP H/L/C 921", + ["OFF", "AUTO", "COMPRESSOR", "AUXILIARY", "HOT_WATER"], + ["COMPR", "BRINEPUMP", "HOT_WATER", "HEATING"], + ["3KW", "6KW"], + ) + + +def test_itec_iq(requests_mock): + setup_thermia_and_perform_basic_tests( + requests_mock, + "iTec_IQ.txt", + "iTec", + "IQ", + ["OFF", "AUTO", "COMPRESSOR", "AUXILIARY"], + ["COMPR", "HEATING", "DEFROST", "COOLING"], + [], + ) diff --git a/ThermiaOnlineAPI/tests/utils.py b/ThermiaOnlineAPI/tests/utils.py new file mode 100644 index 0000000..635d989 --- /dev/null +++ b/ThermiaOnlineAPI/tests/utils.py @@ -0,0 +1,76 @@ +from typing import Any, Dict +import json + + +def parse_debug_file(file_path: str) -> Dict[str, Any]: + with open(file_path, "r") as file: + data = file.read() + + # Remove debug comments + data = data.split("\n") + data = [line for line in data if not line.startswith("#")] + + out_data = { + "info": [], + "status": [], + "device_data": [], + "groups": {}, + } + + parsing_key = None + parsing_key_group = None + empty_line_count = 0 + + for line in data: + # end of useful data + if not line: + empty_line_count += 1 + if empty_line_count > 1: + # Data collection is done, it can be parsed + if parsing_key is not None: + useful_data = ( + out_data["groups"][parsing_key_group] + if parsing_key == "groups" + else out_data[parsing_key] + ) + + useful_data = "".join(useful_data) + + if parsing_key == "groups": + out_data["groups"][parsing_key_group] = json.loads(useful_data) + else: + out_data[parsing_key] = json.loads(useful_data) + + parsing_key = None + parsing_key_group = None + empty_line_count = 0 + + continue + + # start of new data + if not parsing_key: + if line.startswith("self.__info"): + parsing_key = "info" + elif line.startswith("self.__status:"): + parsing_key = "status" + elif line.startswith("self.__device_data:"): + parsing_key = "device_data" + elif line.startswith("Group "): + group_id = line.split(" ")[1][:-1] # remove colon + out_data["groups"][group_id] = [] + parsing_key = "groups" + parsing_key_group = group_id + + continue + + # append data to correct key + if parsing_key == "groups": + out_data["groups"][parsing_key_group].append(line) + else: + out_data[parsing_key].append(line) + + return out_data + + +def match_lists_in_any_order(list1, list2): + return sorted(list1) == sorted(list2) diff --git a/example.py b/example.py index 3164590..f271742 100644 --- a/example.py +++ b/example.py @@ -14,7 +14,7 @@ print("Connected: " + str(thermia.connected)) -heat_pump = thermia.fetch_heat_pumps()[0] +heat_pump = thermia.heat_pumps[0] heat_pump.debug() diff --git a/requirements_testing.txt b/requirements_testing.txt new file mode 100644 index 0000000..cd9ae1e --- /dev/null +++ b/requirements_testing.txt @@ -0,0 +1,2 @@ +pytest == 8.3.3 +requests-mock == 1.12.1