mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 20:27:08 +00:00
Update led brightness select state only if valid data is available, Xiaomi Miio integration (#57197)
* Update state if there is valid data * Add comment
This commit is contained in:
parent
0e48985fc5
commit
a238cce37c
@ -146,9 +146,13 @@ class XiaomiAirHumidifierSelector(XiaomiSelector):
|
|||||||
@callback
|
@callback
|
||||||
def _handle_coordinator_update(self):
|
def _handle_coordinator_update(self):
|
||||||
"""Fetch state from the device."""
|
"""Fetch state from the device."""
|
||||||
self._current_led_brightness = self._extract_value_from_attribute(
|
led_brightness = self._extract_value_from_attribute(
|
||||||
self.coordinator.data, self.entity_description.key
|
self.coordinator.data, self.entity_description.key
|
||||||
)
|
)
|
||||||
|
# Sometimes (quite rarely) the device returns None as the LED brightness so we
|
||||||
|
# check that the value is not None before updating the state.
|
||||||
|
if led_brightness:
|
||||||
|
self._current_led_brightness = led_brightness
|
||||||
self.async_write_ha_state()
|
self.async_write_ha_state()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
Loading…
x
Reference in New Issue
Block a user