mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 20:27:08 +00:00
Fix long update 'load_power' and 'in_use' for Xiaomi Zegbee Plug (#16915)
This commit is contained in:
parent
4c36ffd0ef
commit
b0c1c37cd5
@ -99,6 +99,11 @@ class XiaomiGenericSwitch(XiaomiDevice, SwitchDevice):
|
||||
attrs.update(super().device_state_attributes)
|
||||
return attrs
|
||||
|
||||
@property
|
||||
def should_poll(self):
|
||||
"""Return the polling state. Polling needed for zigbee plug only."""
|
||||
return self._supports_power_consumption
|
||||
|
||||
def turn_on(self, **kwargs):
|
||||
"""Turn the switch on."""
|
||||
if self._write_to_hub(self._sid, **{self._data_key: 'on'}):
|
||||
@ -131,3 +136,8 @@ class XiaomiGenericSwitch(XiaomiDevice, SwitchDevice):
|
||||
return False
|
||||
self._state = state
|
||||
return True
|
||||
|
||||
def update(self):
|
||||
"""Get data from hub."""
|
||||
_LOGGER.debug("Update data from hub: %s", self._name)
|
||||
self._get_from_hub(self._sid)
|
||||
|
Loading…
x
Reference in New Issue
Block a user