diff --git a/custom_components/smartir/__init__.py b/custom_components/smartir/__init__.py index e9bff4e8..be82a672 100644 --- a/custom_components/smartir/__init__.py +++ b/custom_components/smartir/__init__.py @@ -19,7 +19,7 @@ _LOGGER = logging.getLogger(__name__) DOMAIN = 'smartir' -VERSION = '1.17.7' +VERSION = '1.17.8' MANIFEST_URL = ( "https://raw.githubusercontent.com/" "smartHomeHub/SmartIR/{}/" diff --git a/custom_components/smartir/climate.py b/custom_components/smartir/climate.py index 14bcb69d..0c21ea2a 100644 --- a/custom_components/smartir/climate.py +++ b/custom_components/smartir/climate.py @@ -319,7 +319,7 @@ async def async_set_temperature(self, **kwargs): if not self._hvac_mode.lower() == HVAC_MODE_OFF: await self.send_command() - await self.async_update_ha_state() + self.async_write_ha_state() async def async_set_hvac_mode(self, hvac_mode): """Set operation mode.""" @@ -329,7 +329,7 @@ async def async_set_hvac_mode(self, hvac_mode): self._last_on_operation = hvac_mode await self.send_command() - await self.async_update_ha_state() + self.async_write_ha_state() async def async_set_fan_mode(self, fan_mode): """Set fan mode.""" @@ -337,7 +337,7 @@ async def async_set_fan_mode(self, fan_mode): if not self._hvac_mode.lower() == HVAC_MODE_OFF: await self.send_command() - await self.async_update_ha_state() + self.async_write_ha_state() async def async_set_swing_mode(self, swing_mode): """Set swing mode.""" @@ -345,7 +345,7 @@ async def async_set_swing_mode(self, swing_mode): if not self._hvac_mode.lower() == HVAC_MODE_OFF: await self.send_command() - await self.async_update_ha_state() + self.async_write_ha_state() async def async_turn_off(self): """Turn off.""" @@ -391,7 +391,7 @@ async def _async_temp_sensor_changed(self, entity_id, old_state, new_state): return self._async_update_temp(new_state) - await self.async_update_ha_state() + self.async_write_ha_state() async def _async_humidity_sensor_changed(self, entity_id, old_state, new_state): """Handle humidity sensor changes.""" @@ -399,7 +399,7 @@ async def _async_humidity_sensor_changed(self, entity_id, old_state, new_state): return self._async_update_humidity(new_state) - await self.async_update_ha_state() + self.async_write_ha_state() async def _async_power_sensor_changed(self, entity_id, old_state, new_state): """Handle power sensor changes.""" @@ -416,13 +416,13 @@ async def _async_power_sensor_changed(self, entity_id, old_state, new_state): else: self._hvac_mode = STATE_ON - await self.async_update_ha_state() + self.async_write_ha_state() if new_state.state == STATE_OFF: self._on_by_remote = False if self._hvac_mode != HVAC_MODE_OFF: self._hvac_mode = HVAC_MODE_OFF - await self.async_update_ha_state() + self.async_write_ha_state() @callback def _async_update_temp(self, state): diff --git a/custom_components/smartir/fan.py b/custom_components/smartir/fan.py index ce8393b9..8fb084fb 100644 --- a/custom_components/smartir/fan.py +++ b/custom_components/smartir/fan.py @@ -9,7 +9,7 @@ FanEntity, PLATFORM_SCHEMA, DIRECTION_REVERSE, DIRECTION_FORWARD, SUPPORT_SET_SPEED, SUPPORT_DIRECTION, SUPPORT_OSCILLATE, - ATTR_OSCILLATING ) + ATTR_OSCILLATING) from homeassistant.const import ( CONF_NAME, STATE_OFF, STATE_ON, STATE_UNKNOWN) from homeassistant.core import callback @@ -228,14 +228,14 @@ async def async_set_percentage(self, percentage: int): self._last_on_speed = self._speed await self.send_command() - await self.async_update_ha_state() + self.async_write_ha_state() async def async_oscillate(self, oscillating: bool) -> None: """Set oscillation of the fan.""" self._oscillating = oscillating await self.send_command() - await self.async_update_ha_state() + self.async_write_ha_state() async def async_set_direction(self, direction: str): """Set the direction of the fan""" @@ -244,7 +244,7 @@ async def async_set_direction(self, direction: str): if not self._speed.lower() == SPEED_OFF: await self.send_command() - await self.async_update_ha_state() + self.async_write_ha_state() async def async_turn_on(self, percentage: int = None, **kwargs): """Turn on the fan.""" @@ -288,10 +288,10 @@ async def _async_power_sensor_changed(self, entity_id, old_state, new_state): if new_state.state == STATE_ON and self._speed == SPEED_OFF: self._on_by_remote = True self._speed = None - await self.async_update_ha_state() + self.async_write_ha_state() if new_state.state == STATE_OFF: self._on_by_remote = False if self._speed != SPEED_OFF: self._speed = SPEED_OFF - await self.async_update_ha_state() \ No newline at end of file + self.async_write_ha_state() \ No newline at end of file diff --git a/custom_components/smartir/manifest.json b/custom_components/smartir/manifest.json index 0cf28721..060bf33a 100644 --- a/custom_components/smartir/manifest.json +++ b/custom_components/smartir/manifest.json @@ -5,11 +5,11 @@ "dependencies": [], "codeowners": ["@smartHomeHub"], "requirements": ["aiofiles>=0.6.0"], - "homeassistant": "2022.4.0", - "version": "1.17.7", + "homeassistant": "2023.6.0", + "version": "1.17.8", "updater": { - "version": "1.17.7", - "releaseNotes": "-- Fixes #1025", + "version": "1.17.8", + "releaseNotes": "-- Fix self.async_update_ha_state() #1071", "files": [ "__init__.py", "climate.py", diff --git a/custom_components/smartir/media_player.py b/custom_components/smartir/media_player.py index 4137972e..278a8402 100644 --- a/custom_components/smartir/media_player.py +++ b/custom_components/smartir/media_player.py @@ -225,7 +225,7 @@ async def async_turn_off(self): if self._power_sensor is None: self._state = STATE_OFF self._source = None - await self.async_update_ha_state() + self.async_write_ha_state() async def async_turn_on(self): """Turn the media player off.""" @@ -233,38 +233,38 @@ async def async_turn_on(self): if self._power_sensor is None: self._state = STATE_ON - await self.async_update_ha_state() + self.async_write_ha_state() async def async_media_previous_track(self): """Send previous track command.""" await self.send_command(self._commands['previousChannel']) - await self.async_update_ha_state() + self.async_write_ha_state() async def async_media_next_track(self): """Send next track command.""" await self.send_command(self._commands['nextChannel']) - await self.async_update_ha_state() + self.async_write_ha_state() async def async_volume_down(self): """Turn volume down for media player.""" await self.send_command(self._commands['volumeDown']) - await self.async_update_ha_state() + self.async_write_ha_state() async def async_volume_up(self): """Turn volume up for media player.""" await self.send_command(self._commands['volumeUp']) - await self.async_update_ha_state() + self.async_write_ha_state() async def async_mute_volume(self, mute): """Mute the volume.""" await self.send_command(self._commands['mute']) - await self.async_update_ha_state() + self.async_write_ha_state() async def async_select_source(self, source): """Select channel from source.""" self._source = source await self.send_command(self._commands['sources'][source]) - await self.async_update_ha_state() + self.async_write_ha_state() async def async_play_media(self, media_type, media_id, **kwargs): """Support channel change through play_media service.""" @@ -281,7 +281,7 @@ async def async_play_media(self, media_type, media_id, **kwargs): self._source = "Channel {}".format(media_id) for digit in media_id: await self.send_command(self._commands['sources']["Channel {}".format(digit)]) - await self.async_update_ha_state() + self.async_write_ha_state() async def send_command(self, command): async with self._temp_lock: diff --git a/hacs.json b/hacs.json index c910b722..e29892cb 100644 --- a/hacs.json +++ b/hacs.json @@ -1,5 +1,5 @@ { "name": "SmartIR", - "homeassistant": "0.115.0", + "homeassistant": "2023.6.0", "persistent_directory": "codes" }