Skip to content

Commit

Permalink
fix: support OFF for SystemStatus #168
Browse files Browse the repository at this point in the history
  • Loading branch information
kodebach committed Jan 6, 2025
1 parent caac038 commit bca4159
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions custom_components/idm_heatpump/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def _missing_(cls, value) -> Any:
class SystemStatus(_SensorEnum):
"""IDM heat pump system status."""

OFF = 0xFFFF
STANDBY = 0
AUTOMATIC = 1
AWAY = 2
Expand Down
3 changes: 2 additions & 1 deletion custom_components/idm_heatpump/sensor_addresses.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,8 @@ def datatype(self) -> ModbusClientMixin.DATATYPE:
def decode(self, registers: list[int]) -> tuple[bool, _EnumT]:
value = self._decode_raw(registers)
LOGGER.debug("raw value (uint16) for %s: %d", self.name, value)
if value == 0xFFFF:

if value == 0xFFFF and 0xFFFF not in list(map(int, self.enum)):
# special case: unavailable
return (False, self.enum(None))

Expand Down
1 change: 1 addition & 0 deletions custom_components/idm_heatpump/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ set_system_status:
selector:
select:
options:
- off
- standby
- automatic
- away
Expand Down
1 change: 1 addition & 0 deletions custom_components/idm_heatpump/translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@
},
"system_status_options": {
"options": {
"off": "Komplett Aus (kein Frostschutz)",
"standby": "Standby",
"automatic": "Automatik",
"away": "Abwesend",
Expand Down
1 change: 1 addition & 0 deletions custom_components/idm_heatpump/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@
},
"system_status_options": {
"options": {
"off": "Off (no freeze protection)",
"standby": "Standby",
"automatic": "Automatic",
"away": "Away",
Expand Down

0 comments on commit bca4159

Please sign in to comment.