Black
This commit is contained in:
1 parent
da05dfe708
commit
4de97abc3a
2676 files changed
+163166
-140084
No files matched your search
@@ -14,10 +14,14 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
hub.update_overview()
|
||||
|
||||
if int(hub.config.get(CONF_DOOR_WINDOW, 1)):
|
||||
sensors.extend([
|
||||
VerisureDoorWindowSensor(device_label)
|
||||
for device_label in hub.get(
|
||||
"$.doorWindow.doorWindowDevice[*].deviceLabel")])
|
||||
sensors.extend(
|
||||
[
|
||||
VerisureDoorWindowSensor(device_label)
|
||||
for device_label in hub.get(
|
||||
"$.doorWindow.doorWindowDevice[*].deviceLabel"
|
||||
)
|
||||
]
|
||||
)
|
||||
add_entities(sensors)
|
||||
|
||||
|
||||
@@ -33,21 +37,30 @@ class VerisureDoorWindowSensor(BinarySensorDevice):
|
||||
"""Return the name of the binary sensor."""
|
||||
return hub.get_first(
|
||||
"$.doorWindow.doorWindowDevice[?(@.deviceLabel=='%s')].area",
|
||||
self._device_label)
|
||||
self._device_label,
|
||||
)
|
||||
|
||||
@property
|
||||
def is_on(self):
|
||||
"""Return the state of the sensor."""
|
||||
return hub.get_first(
|
||||
"$.doorWindow.doorWindowDevice[?(@.deviceLabel=='%s')].state",
|
||||
self._device_label) == "OPEN"
|
||||
return (
|
||||
hub.get_first(
|
||||
"$.doorWindow.doorWindowDevice[?(@.deviceLabel=='%s')].state",
|
||||
self._device_label,
|
||||
)
|
||||
== "OPEN"
|
||||
)
|
||||
|
||||
@property
|
||||
def available(self):
|
||||
"""Return True if entity is available."""
|
||||
return hub.get_first(
|
||||
"$.doorWindow.doorWindowDevice[?(@.deviceLabel=='%s')]",
|
||||
self._device_label) is not None
|
||||
return (
|
||||
hub.get_first(
|
||||
"$.doorWindow.doorWindowDevice[?(@.deviceLabel=='%s')]",
|
||||
self._device_label,
|
||||
)
|
||||
is not None
|
||||
)
|
||||
|
||||
# pylint: disable=no-self-use
|
||||
def update(self):
|
||||
|
||||
Reference in new issue
Block a user