Skip to content

Commit

Permalink
Merge pull request #109 from Robbe-B/fix_stove_power_state
Browse files Browse the repository at this point in the history
Fix power state of the stove for some older models
  • Loading branch information
Robbe-B authored Feb 17, 2024
2 parents d66434f + a7be8fc commit 5f05e3c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
11 changes: 6 additions & 5 deletions custom_components/maestro_mcz/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,16 +170,17 @@ def _handle_coordinator_update(self) -> None:
def handle_coordinator_update_internal(self) -> None:
#HVAC mode
if(self._supported_power_sensor is not None):
fase_op = getattr(self.coordinator._maestroapi.Status, self._supported_power_sensor.sensor_get_name)
if(fase_op is not None):
if(str(fase_op).lower() == "on" or str(fase_op).lower() == "turning-on"):
self._attr_hvac_mode = HVACMode.HEAT
else: # turning-off | off | cooling-down
stato_stufa = getattr(self.coordinator._maestroapi.Status, self._supported_power_sensor.sensor_get_name)
if(stato_stufa is not None):
if(stato_stufa == 1):
self._attr_hvac_mode = HVACMode.OFF
else:
self._attr_hvac_mode = HVACMode.HEAT
else:
self._attr_hvac_mode = HVACMode.OFF
else:
self._attr_hvac_mode = None


#current temp
self._attr_current_temperature = self.coordinator._maestroapi.State.temp_amb_install
Expand Down
2 changes: 1 addition & 1 deletion custom_components/maestro_mcz/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/Robbe-B/maestro_mcz/issues",
"requirements": [],
"version": "0.4.2-beta"
"version": "0.5.3-beta"
}
4 changes: 2 additions & 2 deletions custom_components/maestro_mcz/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ def __init__(self, user_friendly_name:str, sensor_get_name:str, icon:str, unit:s
self.api_value_renames = api_value_renames

supported_power_settings = [
PowerSettingMczConfigItem("Power", "fase_op", "com_on_off", "Spegnimento", True),
PowerSettingMczConfigItem("Power", "fase_op", "m1_stato_stufa", "Spegnimento", True), #for first generation M1+
PowerSettingMczConfigItem("Power", "stato_stufa", "com_on_off", "Spegnimento", True),
PowerSettingMczConfigItem("Power", "stato_stufa", "m1_stato_stufa", "Spegnimento", True), #for first generation M1+
]

supported_climate_function_modes = [
Expand Down

0 comments on commit 5f05e3c

Please sign in to comment.