diff --git a/custom_components/tesla_custom/climate.py b/custom_components/tesla_custom/climate.py index 0f689a61..b30a902b 100644 --- a/custom_components/tesla_custom/climate.py +++ b/custom_components/tesla_custom/climate.py @@ -128,7 +128,7 @@ async def async_set_temperature(self, **kwargs): temp = round(temperature, 1) await self._car.set_temperature(temp) - await self.async_update_ha_state() + self.async_write_ha_state() async def async_set_hvac_mode(self, hvac_mode): """Set new target hvac mode.""" diff --git a/custom_components/tesla_custom/cover.py b/custom_components/tesla_custom/cover.py index 1e5c58d3..81bcd8fe 100644 --- a/custom_components/tesla_custom/cover.py +++ b/custom_components/tesla_custom/cover.py @@ -55,13 +55,13 @@ async def async_close_cover(self, **kwargs): """Send close cover command.""" _LOGGER.debug("Closing cover: %s", self.name) await self._car.charge_port_door_close() - await self.async_update_ha_state() + self.async_write_ha_state() async def async_open_cover(self, **kwargs): """Send open cover command.""" _LOGGER.debug("Opening cover: %s", self.name) await self._car.charge_port_door_open() - await self.async_update_ha_state() + self.async_write_ha_state() @property def is_closed(self): @@ -86,14 +86,14 @@ async def async_close_cover(self, **kwargs): _LOGGER.debug("Closing cover: %s", self.name) if self.is_closed is False: await self._car.toggle_frunk() - await self.async_update_ha_state() + self.async_write_ha_state() async def async_open_cover(self, **kwargs): """Send open cover command.""" _LOGGER.debug("Opening cover: %s", self.name) if self.is_closed is True: await self._car.toggle_frunk() - await self.async_update_ha_state() + self.async_write_ha_state() @property def is_closed(self): @@ -130,14 +130,14 @@ async def async_close_cover(self, **kwargs): _LOGGER.debug("Closing cover: %s", self.name) if self.is_closed is False: await self._car.toggle_trunk() - await self.async_update_ha_state() + self.async_write_ha_state() async def async_open_cover(self, **kwargs): """Send open cover command.""" _LOGGER.debug("Opening cover: %s", self.name) if self.is_closed is True: await self._car.toggle_trunk() - await self.async_update_ha_state() + self.async_write_ha_state() @property def is_closed(self): @@ -176,14 +176,14 @@ async def async_close_cover(self, **kwargs): _LOGGER.debug("Closing cover: %s", self.name) if self.is_closed is False: await self._car.close_windows() - await self.async_update_ha_state() + self.async_write_ha_state() async def async_open_cover(self, **kwargs): """Send open cover command.""" _LOGGER.debug("Opening cover: %s", self.name) if self.is_closed is True: await self._car.vent_windows() - await self.async_update_ha_state() + self.async_write_ha_state() @property def is_closed(self): diff --git a/custom_components/tesla_custom/lock.py b/custom_components/tesla_custom/lock.py index 99f251b5..6e3b5012 100644 --- a/custom_components/tesla_custom/lock.py +++ b/custom_components/tesla_custom/lock.py @@ -44,13 +44,13 @@ async def async_lock(self, **kwargs): """Send lock command.""" _LOGGER.debug("Locking: %s", self.name) await self._car.lock() - await self.async_update_ha_state() + self.async_write_ha_state() async def async_unlock(self, **kwargs): """Send unlock command.""" _LOGGER.debug("Unlocking: %s", self.name) await self._car.unlock() - await self.async_update_ha_state() + self.async_write_ha_state() @property def is_locked(self): @@ -77,13 +77,13 @@ async def async_open(self, **kwargs): """Send open command.""" _LOGGER.debug("Opening: %s", self.name) await self._car.charge_port_door_open() - await self.async_update_ha_state() + self.async_write_ha_state() async def async_unlock(self, **kwargs): """Send unlock command.""" _LOGGER.debug("Unlocking: %s", self.name) await self._car.charge_port_door_open() - await self.async_update_ha_state() + self.async_write_ha_state() async def async_lock(self, **kwargs): """Log lock command not possible.""" diff --git a/custom_components/tesla_custom/number.py b/custom_components/tesla_custom/number.py index 2f22443d..22224b21 100644 --- a/custom_components/tesla_custom/number.py +++ b/custom_components/tesla_custom/number.py @@ -57,7 +57,7 @@ def __init__( async def async_set_native_value(self, value: int) -> None: """Update charge limit.""" await self._car.change_charge_limit(value) - await self.async_update_ha_state() + self.async_write_ha_state() @property def native_value(self) -> int: @@ -99,7 +99,7 @@ def __init__( async def async_set_native_value(self, value: int) -> None: """Update charging amps.""" await self._car.set_charging_amps(value) - await self.async_update_ha_state() + self.async_write_ha_state() @property def native_value(self) -> int: @@ -141,7 +141,7 @@ def __init__( async def async_set_native_value(self, value: int) -> None: """Update backup reserve percentage.""" await self._energysite.set_reserve_percent(value) - await self.async_update_ha_state() + self.async_write_ha_state() @property def native_value(self) -> int: diff --git a/custom_components/tesla_custom/select.py b/custom_components/tesla_custom/select.py index edd8abde..c3906a5e 100644 --- a/custom_components/tesla_custom/select.py +++ b/custom_components/tesla_custom/select.py @@ -191,7 +191,7 @@ def __init__( async def async_select_option(self, option: str, **kwargs): """Change the selected option.""" await self._car.set_cabin_overheat_protection(option) - await self.async_update_ha_state() + self.async_write_ha_state() @property def current_option(self): @@ -220,7 +220,7 @@ async def async_select_option(self, option: str, **kwargs): else: await self._energysite.set_grid_charging(False) - await self.async_update_ha_state() + self.async_write_ha_state() @property def current_option(self): @@ -259,7 +259,7 @@ async def async_select_option(self, option: str, **kwargs): if option == EXPORT_RULE[1]: await self._energysite.set_export_rule("battery_ok") - await self.async_update_ha_state() + self.async_write_ha_state() @property def current_option(self) -> str: @@ -295,7 +295,7 @@ async def async_select_option(self, option: str, **kwargs): if option == OPERATION_MODE[2]: await self._energysite.set_operation_mode("backup") - await self.async_update_ha_state() + self.async_write_ha_state() @property def current_option(self) -> str: diff --git a/custom_components/tesla_custom/switch.py b/custom_components/tesla_custom/switch.py index f934bec8..f16ef6ca 100644 --- a/custom_components/tesla_custom/switch.py +++ b/custom_components/tesla_custom/switch.py @@ -60,12 +60,12 @@ def is_on(self): async def async_turn_on(self, **kwargs): """Send the on command.""" await self._car.set_heated_steering_wheel(True) - await self.async_update_ha_state() + self.async_write_ha_state() async def async_turn_off(self, **kwargs): """Send the off command.""" await self._car.set_heated_steering_wheel(False) - await self.async_update_ha_state() + self.async_write_ha_state() class TeslaCarPolling(TeslaCarEntity, SwitchEntity): @@ -95,13 +95,13 @@ async def async_turn_on(self, **kwargs): """Send the on command.""" _LOGGER.debug("Enable polling: %s %s", self.name, self._car.vin) self._coordinator.controller.set_updates(vin=self._car.vin, value=True) - await self.async_update_ha_state() + self.async_write_ha_state() async def async_turn_off(self, **kwargs): """Send the off command.""" _LOGGER.debug("Disable polling: %s %s", self.name, self._car.vin) self._coordinator.controller.set_updates(vin=self._car.vin, value=False) - await self.async_update_ha_state() + self.async_write_ha_state() class TeslaCarCharger(TeslaCarEntity, SwitchEntity): @@ -126,12 +126,12 @@ def is_on(self): async def async_turn_on(self, **kwargs): """Send the on command.""" await self._car.start_charge() - await self.async_update_ha_state() + self.async_write_ha_state() async def async_turn_off(self, **kwargs): """Send the off command.""" await self._car.stop_charge() - await self.async_update_ha_state() + self.async_write_ha_state() class TeslaCarSentryMode(TeslaCarEntity, SwitchEntity): @@ -169,12 +169,12 @@ def is_on(self): async def async_turn_on(self, **kwargs): """Send the on command.""" await self._car.set_sentry_mode(True) - await self.async_update_ha_state() + self.async_write_ha_state() async def async_turn_off(self, **kwargs): """Send the off command.""" await self._car.set_sentry_mode(False) - await self.async_update_ha_state() + self.async_write_ha_state() class TeslaCarValetMode(TeslaCarEntity, SwitchEntity): @@ -203,7 +203,7 @@ async def async_turn_on(self, **kwargs): _LOGGER.debug("Pin required for valet mode, set pin in vehicle or app.") else: await self._car.valet_mode(True) - await self.async_update_ha_state() + self.async_write_ha_state() async def async_turn_off(self, **kwargs): """Send the off command.""" @@ -212,4 +212,4 @@ async def async_turn_off(self, **kwargs): _LOGGER.debug("Pin required for valet mode, set pin in vehicle or app.") else: await self._car.valet_mode(False) - await self.async_update_ha_state() + self.async_write_ha_state() diff --git a/custom_components/tesla_custom/text.py b/custom_components/tesla_custom/text.py index 3a0f257e..0b66d569 100644 --- a/custom_components/tesla_custom/text.py +++ b/custom_components/tesla_custom/text.py @@ -53,7 +53,7 @@ async def async_set_value(self, value: str) -> None: await self.teslsmate.set_car_id(self._car.vin, value) await self.teslsmate.watch_cars() - await self.async_update_ha_state() + self.async_write_ha_state() async def async_update(self) -> None: """Update the entity."""