diff --git a/homeassistant/components/mysensors/climate.py b/homeassistant/components/mysensors/climate.py index a42861c5fa2..eb54a76b8a8 100644 --- a/homeassistant/components/mysensors/climate.py +++ b/homeassistant/components/mysensors/climate.py @@ -175,10 +175,6 @@ class MySensorsHVAC(MySensorsChildEntity, ClimateEntity): self.gateway.set_child_value( self.node_id, self.child_id, value_type, value, ack=1 ) - if self.assumed_state: - # Optimistically assume that device has changed state - self._values[value_type] = value - self.async_write_ha_state() async def async_set_fan_mode(self, fan_mode: str) -> None: """Set new target temperature.""" @@ -186,10 +182,6 @@ class MySensorsHVAC(MySensorsChildEntity, ClimateEntity): self.gateway.set_child_value( self.node_id, self.child_id, set_req.V_HVAC_SPEED, fan_mode, ack=1 ) - if self.assumed_state: - # Optimistically assume that device has changed state - self._values[set_req.V_HVAC_SPEED] = fan_mode - self.async_write_ha_state() async def async_set_hvac_mode(self, hvac_mode: HVACMode) -> None: """Set new target temperature.""" @@ -200,10 +192,6 @@ class MySensorsHVAC(MySensorsChildEntity, ClimateEntity): DICT_HA_TO_MYS[hvac_mode], ack=1, ) - if self.assumed_state: - # Optimistically assume that device has changed state - self._values[self.value_type] = hvac_mode - self.async_write_ha_state() @callback def _async_update(self) -> None: diff --git a/homeassistant/components/mysensors/cover.py b/homeassistant/components/mysensors/cover.py index 2ac0367d1fc..84346a5d10a 100644 --- a/homeassistant/components/mysensors/cover.py +++ b/homeassistant/components/mysensors/cover.py @@ -7,7 +7,7 @@ from typing import Any from homeassistant.components.cover import ATTR_POSITION, CoverEntity from homeassistant.config_entries import ConfigEntry -from homeassistant.const import STATE_OFF, STATE_ON, Platform +from homeassistant.const import STATE_ON, Platform from homeassistant.core import HomeAssistant from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback @@ -110,13 +110,6 @@ class MySensorsCover(MySensorsChildEntity, CoverEntity): self.gateway.set_child_value( self.node_id, self.child_id, set_req.V_UP, 1, ack=1 ) - if self.assumed_state: - # Optimistically assume that cover has changed state. - if set_req.V_DIMMER in self._values: - self._values[set_req.V_DIMMER] = 100 - else: - self._values[set_req.V_LIGHT] = STATE_ON - self.async_write_ha_state() async def async_close_cover(self, **kwargs: Any) -> None: """Move the cover down.""" @@ -124,13 +117,6 @@ class MySensorsCover(MySensorsChildEntity, CoverEntity): self.gateway.set_child_value( self.node_id, self.child_id, set_req.V_DOWN, 1, ack=1 ) - if self.assumed_state: - # Optimistically assume that cover has changed state. - if set_req.V_DIMMER in self._values: - self._values[set_req.V_DIMMER] = 0 - else: - self._values[set_req.V_LIGHT] = STATE_OFF - self.async_write_ha_state() async def async_set_cover_position(self, **kwargs: Any) -> None: """Move the cover to a specific position.""" @@ -139,10 +125,6 @@ class MySensorsCover(MySensorsChildEntity, CoverEntity): self.gateway.set_child_value( self.node_id, self.child_id, set_req.V_DIMMER, position, ack=1 ) - if self.assumed_state: - # Optimistically assume that cover has changed state. - self._values[set_req.V_DIMMER] = position - self.async_write_ha_state() async def async_stop_cover(self, **kwargs: Any) -> None: """Stop the device.""" diff --git a/homeassistant/components/mysensors/light.py b/homeassistant/components/mysensors/light.py index 4fa9eaa8ea6..fa5e625c72b 100644 --- a/homeassistant/components/mysensors/light.py +++ b/homeassistant/components/mysensors/light.py @@ -12,7 +12,7 @@ from homeassistant.components.light import ( LightEntity, ) from homeassistant.config_entries import ConfigEntry -from homeassistant.const import STATE_OFF, STATE_ON, Platform +from homeassistant.const import STATE_ON, Platform from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback @@ -77,11 +77,6 @@ class MySensorsLight(MySensorsChildEntity, LightEntity): self.node_id, self.child_id, set_req.V_LIGHT, 1, ack=1 ) - if self.assumed_state: - # optimistically assume that light has changed state - self._state = True - self._values[set_req.V_LIGHT] = STATE_ON - def _turn_on_dimmer(self, **kwargs: Any) -> None: """Turn on dimmer child device.""" set_req = self.gateway.const.SetReq @@ -98,20 +93,10 @@ class MySensorsLight(MySensorsChildEntity, LightEntity): self.node_id, self.child_id, set_req.V_DIMMER, percent, ack=1 ) - if self.assumed_state: - # optimistically assume that light has changed state - self._attr_brightness = brightness - self._values[set_req.V_DIMMER] = percent - async def async_turn_off(self, **kwargs: Any) -> None: """Turn the device off.""" value_type = self.gateway.const.SetReq.V_LIGHT self.gateway.set_child_value(self.node_id, self.child_id, value_type, 0, ack=1) - if self.assumed_state: - # optimistically assume that light has changed state - self._state = False - self._values[value_type] = STATE_OFF - self.async_write_ha_state() @callback def _async_update_light(self) -> None: @@ -139,8 +124,6 @@ class MySensorsLightDimmer(MySensorsLight): """Turn the device on.""" self._turn_on_light() self._turn_on_dimmer(**kwargs) - if self.assumed_state: - self.async_write_ha_state() @callback def _async_update(self) -> None: @@ -161,8 +144,6 @@ class MySensorsLightRGB(MySensorsLight): self._turn_on_light() self._turn_on_dimmer(**kwargs) self._turn_on_rgb(**kwargs) - if self.assumed_state: - self.async_write_ha_state() def _turn_on_rgb(self, **kwargs: Any) -> None: """Turn on RGB child device.""" @@ -176,11 +157,6 @@ class MySensorsLightRGB(MySensorsLight): self.node_id, self.child_id, self.value_type, hex_color, ack=1 ) - if self.assumed_state: - # optimistically assume that light has changed state - self._attr_rgb_color = new_rgb - self._values[self.value_type] = hex_color - @callback def _async_update(self) -> None: """Update the controller with the latest value from a sensor.""" @@ -209,8 +185,6 @@ class MySensorsLightRGBW(MySensorsLightRGB): self._turn_on_light() self._turn_on_dimmer(**kwargs) self._turn_on_rgbw(**kwargs) - if self.assumed_state: - self.async_write_ha_state() def _turn_on_rgbw(self, **kwargs: Any) -> None: """Turn on RGBW child device.""" @@ -224,11 +198,6 @@ class MySensorsLightRGBW(MySensorsLightRGB): self.node_id, self.child_id, self.value_type, hex_color, ack=1 ) - if self.assumed_state: - # optimistically assume that light has changed state - self._attr_rgbw_color = new_rgbw - self._values[self.value_type] = hex_color - @callback def _async_update_rgb_or_w(self) -> None: """Update the controller with values from RGBW child.""" diff --git a/homeassistant/components/mysensors/switch.py b/homeassistant/components/mysensors/switch.py index 499124919b5..9b57102a94c 100644 --- a/homeassistant/components/mysensors/switch.py +++ b/homeassistant/components/mysensors/switch.py @@ -6,7 +6,7 @@ from typing import Any from homeassistant.components.switch import SwitchEntity from homeassistant.config_entries import ConfigEntry -from homeassistant.const import STATE_OFF, STATE_ON, Platform +from homeassistant.const import STATE_ON, Platform from homeassistant.core import HomeAssistant from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback @@ -69,17 +69,9 @@ class MySensorsSwitch(MySensorsChildEntity, SwitchEntity): self.gateway.set_child_value( self.node_id, self.child_id, self.value_type, 1, ack=1 ) - if self.assumed_state: - # Optimistically assume that switch has changed state - self._values[self.value_type] = STATE_ON - self.async_write_ha_state() async def async_turn_off(self, **kwargs: Any) -> None: """Turn the switch off.""" self.gateway.set_child_value( self.node_id, self.child_id, self.value_type, 0, ack=1 ) - if self.assumed_state: - # Optimistically assume that switch has changed state - self._values[self.value_type] = STATE_OFF - self.async_write_ha_state()