Skip to content

Commit

Permalink
Merge pull request #119 from MTrab:Fix-deprecation-warning
Browse files Browse the repository at this point in the history
Fix deprecation warning for Home Assistant 2024.5
  • Loading branch information
MTrab committed May 6, 2024
2 parents 0d4e2e6 + 67b5d46 commit 9859a44
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion custom_components/danfoss_ally/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def device_class(self):
def _async_update_callback(self):
"""Update and write state."""
self._async_update_data()
self.async_write_ha_state()
self.schedule_update_ha_state()

@callback
def _async_update_data(self):
Expand Down
10 changes: 5 additions & 5 deletions custom_components/danfoss_ally/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def set_preset_mode(self, preset_mode):
self._ally.set_mode(self._device_id, mode)

# Update UI
self.async_write_ha_state()
self.schedule_update_ha_state()

@property
def hvac_action(self):
Expand Down Expand Up @@ -292,7 +292,7 @@ def set_temperature(self, **kwargs):

# Update UI
if changed:
self.async_write_ha_state()
self.schedule_update_ha_state()

async def set_preset_temperature(self, **kwargs):
"""Service call to set new target temperature."""
Expand Down Expand Up @@ -373,7 +373,7 @@ def set_external_temperature(self, **kwargs):
# Update local copy and UI
self._device["external_sensor_temperature"] = temp_10 / 10
self._device["ext_measured_rs"] = temp_100 / 100
self.async_write_ha_state()
self.schedule_update_ha_state()
else:
_LOGGER.debug("Skip setting external temperature")

Expand Down Expand Up @@ -402,7 +402,7 @@ def _async_update_data(self):
def _async_update_callback(self):
"""Load data and update state."""
self._async_update_data()
self.async_write_ha_state()
self.schedule_update_ha_state()

def set_hvac_mode(self, hvac_mode):
"""Set new target hvac mode."""
Expand All @@ -421,7 +421,7 @@ def set_hvac_mode(self, hvac_mode):
self._ally.set_mode(self._device_id, mode)

# Update UI
self.async_write_ha_state()
self.schedule_update_ha_state()

def get_setpoint_code_for_mode(self, mode, for_writing=True):
setpoint_code = None
Expand Down
4 changes: 2 additions & 2 deletions custom_components/danfoss_ally/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,13 @@ def _async_update_callback(self):
self._async_update_data()
else:
_LOGGER.debug("Skip update: %s, %s", self._device_id, self._type)
self.async_write_ha_state()
self.schedule_update_ha_state()

def update_ui(self, option: str):
"""Update UI."""
self._latest_write_time = datetime.utcnow()
self._attr_current_option = option
self.async_write_ha_state()
self.schedule_update_ha_state()

@callback
def _async_update_data(self):
Expand Down
2 changes: 1 addition & 1 deletion custom_components/danfoss_ally/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ async def async_added_to_hass(self):
def _async_update_callback(self):
"""Update and write state."""
self._async_update_data()
self.async_write_ha_state()
self.schedule_update_ha_state()

@callback
def _async_update_data(self):
Expand Down
4 changes: 2 additions & 2 deletions custom_components/danfoss_ally/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,13 @@ def _async_update_callback(self):
self._async_update_data()
else:
_LOGGER.debug("Skip update: %s, %s", self._device_id, self._type)
self.async_write_ha_state()
self.schedule_update_ha_state()

def update_ui(self, new_state: bool):
"""Update UI."""
self._latest_write_time = datetime.utcnow()
self._attr_is_on = new_state
self.async_write_ha_state()
self.schedule_update_ha_state()

@callback
def _async_update_data(self):
Expand Down
2 changes: 1 addition & 1 deletion hacs.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Danfoss Ally",
"render_readme": true,
"homeassistant": "2022.1.0",
"homeassistant": "2024.5.0",
"zip_release": true,
"filename": "danfoss_ally.zip"
}

0 comments on commit 9859a44

Please sign in to comment.