From 4d5b24e00d56a3b926e07b94843cdb3255d66272 Mon Sep 17 00:00:00 2001 From: Ronald van der Meer Date: Sun, 15 Mar 2026 17:49:53 +0100 Subject: [PATCH 1/2] Convert enabled/disabled sensors to binary_sensor type Change circulation_pump_status, power_on_delay_status, and flow_delay_status from sensor type with string conversion (disabled/enabled) to binary_sensor type with boolean conversion (false/true). This aligns with Home Assistant's entity model where on/off states should be represented as binary sensors rather than enum sensors. --- .../mappings/model_PDPR1H1HAW100_FW539187.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/pooldose/mappings/model_PDPR1H1HAW100_FW539187.json b/src/pooldose/mappings/model_PDPR1H1HAW100_FW539187.json index 0c0ca78..ba6917e 100644 --- a/src/pooldose/mappings/model_PDPR1H1HAW100_FW539187.json +++ b/src/pooldose/mappings/model_PDPR1H1HAW100_FW539187.json @@ -212,10 +212,10 @@ }, "circulation_pump_status": { "key": "w_1eo2fpohe", - "type": "sensor", + "type": "binary_sensor", "conversion": { - "|PDPR1H1HAW100_FW539187_LABEL_w_1eo2fpohe_DISABLED_|": "disabled", - "|PDPR1H1HAW100_FW539187_LABEL_w_1eo2fpohe_ENABLED|": "enabled" + "|PDPR1H1HAW100_FW539187_LABEL_w_1eo2fpohe_DISABLED_|": false, + "|PDPR1H1HAW100_FW539187_LABEL_w_1eo2fpohe_ENABLED|": true } }, "peristaltic_cl_dosing": { @@ -247,18 +247,18 @@ }, "power_on_delay_status": { "key": "w_1fhb0hqu2", - "type": "sensor", + "type": "binary_sensor", "conversion": { - "|PDPR1H1HAW100_FW539187_LABEL_w_1fhb0hqu2_DISABLE|": "disabled", - "|PDPR1H1HAW100_FW539187_LABEL_w_1fhb0hqu2_ENABLE|": "enabled" + "|PDPR1H1HAW100_FW539187_LABEL_w_1fhb0hqu2_DISABLE|": false, + "|PDPR1H1HAW100_FW539187_LABEL_w_1fhb0hqu2_ENABLE|": true } }, "flow_delay_status": { "key": "w_1fhb0ht7t", - "type": "sensor", + "type": "binary_sensor", "conversion": { - "|PDPR1H1HAW100_FW539187_LABEL_w_1fhb0ht7t_DISABLE|": "disabled", - "|PDPR1H1HAW100_FW539187_LABEL_w_1fhb0ht7t_ENABLE|": "enabled" + "|PDPR1H1HAW100_FW539187_LABEL_w_1fhb0ht7t_DISABLE|": false, + "|PDPR1H1HAW100_FW539187_LABEL_w_1fhb0ht7t_ENABLE|": true } }, "time_off_ph_dosing": { From ab0c17c224ed13ac0f6f4489d07a7f2aba2eca84 Mon Sep 17 00:00:00 2001 From: Ronald van der Meer Date: Sun, 15 Mar 2026 17:53:15 +0100 Subject: [PATCH 2/2] Update tests for binary_sensor type conversion --- tests/test_mapping_info.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/test_mapping_info.py b/tests/test_mapping_info.py index 1f98424..1acfdd7 100644 --- a/tests/test_mapping_info.py +++ b/tests/test_mapping_info.py @@ -86,8 +86,8 @@ async def test_total_entity_count(self, mapping): async def test_entity_type_counts(self, mapping): """Test entity count per type.""" types = mapping.available_types() - assert len(types.get("sensor", [])) == 22 - assert len(types.get("binary_sensor", [])) == 20 + assert len(types.get("sensor", [])) == 19 + assert len(types.get("binary_sensor", [])) == 23 assert len(types.get("number", [])) == 8 assert len(types.get("switch", [])) == 3 assert len(types.get("select", [])) == 1 @@ -107,6 +107,9 @@ async def test_new_alarm_binary_sensors(self, mapping): "alarm_cl_too_high_orp", "alarm_cl_too_high", "alarm_system_standby", + "circulation_pump_status", + "power_on_delay_status", + "flow_delay_status", ] for alarm in expected_alarms: assert alarm in types["binary_sensor"], f"Missing binary_sensor: {alarm}" @@ -115,12 +118,9 @@ async def test_new_sensors_with_conversions(self, mapping): """Test new sensors with conversion dictionaries.""" sensors = mapping.available_sensors() sensors_with_conversion = [ - "circulation_pump_status", "peristaltic_cl_dosing", "device_config", "temperature_unit", - "power_on_delay_status", - "flow_delay_status", ] for name in sensors_with_conversion: assert name in sensors, f"Missing sensor: {name}"