diff --git a/homeassistant/components/sense/binary_sensor.py b/homeassistant/components/sense/binary_sensor.py index 62fe0d01d4e..bc06721ae5e 100644 --- a/homeassistant/components/sense/binary_sensor.py +++ b/homeassistant/components/sense/binary_sensor.py @@ -133,6 +133,9 @@ class SenseDevice(BinarySensorEntity): @callback def _async_update_from_data(self): """Get the latest data, update state. Must not do I/O.""" + new_state = bool(self._sense_devices_data.get_device_by_id(self._id)) + if self._available and self._state == new_state: + return self._available = True - self._state = bool(self._sense_devices_data.get_device_by_id(self._id)) + self._state = new_state self.async_write_ha_state() diff --git a/homeassistant/components/sense/sensor.py b/homeassistant/components/sense/sensor.py index 197168f9199..25fa5943bd5 100644 --- a/homeassistant/components/sense/sensor.py +++ b/homeassistant/components/sense/sensor.py @@ -195,11 +195,14 @@ class SenseActiveSensor(Entity): @callback def _async_update_from_data(self): """Update the sensor from the data. Must not do I/O.""" - self._state = round( + new_state = round( self._data.active_solar_power if self._is_production else self._data.active_power ) + if self._available and self._state == new_state: + return + self._state = new_state self._available = True self.async_write_ha_state() @@ -276,8 +279,11 @@ class SenseVoltageSensor(Entity): @callback def _async_update_from_data(self): """Update the sensor from the data. Must not do I/O.""" - self._state = round(self._data.active_voltage[self._voltage_index], 1) + new_state = round(self._data.active_voltage[self._voltage_index], 1) + if self._available and self._state == new_state: + return self._available = True + self._state = new_state self.async_write_ha_state() @@ -438,8 +444,11 @@ class SenseEnergyDevice(Entity): """Get the latest data, update state. Must not do I/O.""" device_data = self._sense_devices_data.get_device_by_id(self._id) if not device_data or "w" not in device_data: - self._state = 0 + new_state = 0 else: - self._state = int(device_data["w"]) + new_state = int(device_data["w"]) + if self._available and self._state == new_state: + return + self._state = new_state self._available = True self.async_write_ha_state()