Improve devolo Home Control (#36557)
This commit is contained in:
parent
de7bbd3e24
commit
31dd06bd12
1 changed files with 2 additions and 11 deletions
|
@ -8,8 +8,6 @@ from .subscriber import Subscriber
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
ATTR_BATTERY_LEVEL = "battery_level"
|
|
||||||
|
|
||||||
|
|
||||||
class DevoloDeviceEntity(Entity):
|
class DevoloDeviceEntity(Entity):
|
||||||
"""Representation of a sensor within devolo Home Control."""
|
"""Representation of a sensor within devolo Home Control."""
|
||||||
|
@ -20,16 +18,14 @@ class DevoloDeviceEntity(Entity):
|
||||||
self._name = name
|
self._name = name
|
||||||
self._unique_id = element_uid
|
self._unique_id = element_uid
|
||||||
self._homecontrol = homecontrol
|
self._homecontrol = homecontrol
|
||||||
|
|
||||||
|
# This is not doing I/O. It fetches an internal state of the API
|
||||||
self._available = device_instance.is_online()
|
self._available = device_instance.is_online()
|
||||||
|
|
||||||
# Get the brand and model information
|
# Get the brand and model information
|
||||||
self._brand = device_instance.brand
|
self._brand = device_instance.brand
|
||||||
self._model = device_instance.name
|
self._model = device_instance.name
|
||||||
|
|
||||||
self._state_attrs = {}
|
|
||||||
if hasattr(self._device_instance, "batteryLevel"):
|
|
||||||
self._state_attrs = {ATTR_BATTERY_LEVEL: self._device_instance.batteryLevel}
|
|
||||||
|
|
||||||
self.subscriber = None
|
self.subscriber = None
|
||||||
self.sync_callback = sync
|
self.sync_callback = sync
|
||||||
|
|
||||||
|
@ -63,11 +59,6 @@ class DevoloDeviceEntity(Entity):
|
||||||
"model": self._model,
|
"model": self._model,
|
||||||
}
|
}
|
||||||
|
|
||||||
@property
|
|
||||||
def device_state_attributes(self):
|
|
||||||
"""Return the state attributes of the device."""
|
|
||||||
return self._state_attrs
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def should_poll(self):
|
def should_poll(self):
|
||||||
"""Return the polling state."""
|
"""Return the polling state."""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue