Nuki add binary sensor for battery charging (#111320)
* Nuki binary sensors * disable by defaultpull/111386/head
parent
7d37aeac59
commit
13621532fd
|
@ -29,6 +29,7 @@ async def async_setup_entry(
|
||||||
if lock.is_door_sensor_activated:
|
if lock.is_door_sensor_activated:
|
||||||
entities.append(NukiDoorsensorEntity(entry_data.coordinator, lock))
|
entities.append(NukiDoorsensorEntity(entry_data.coordinator, lock))
|
||||||
entities.append(NukiBatteryCriticalEntity(entry_data.coordinator, lock))
|
entities.append(NukiBatteryCriticalEntity(entry_data.coordinator, lock))
|
||||||
|
entities.append(NukiBatteryChargingEntity(entry_data.coordinator, lock))
|
||||||
|
|
||||||
for opener in entry_data.openers:
|
for opener in entry_data.openers:
|
||||||
entities.append(NukiRingactionEntity(entry_data.coordinator, opener))
|
entities.append(NukiRingactionEntity(entry_data.coordinator, opener))
|
||||||
|
@ -107,7 +108,6 @@ class NukiBatteryCriticalEntity(NukiEntity[NukiDevice], BinarySensorEntity):
|
||||||
"""Representation of Nuki Battery Critical."""
|
"""Representation of Nuki Battery Critical."""
|
||||||
|
|
||||||
_attr_has_entity_name = True
|
_attr_has_entity_name = True
|
||||||
_attr_translation_key = "battery_critical"
|
|
||||||
_attr_device_class = BinarySensorDeviceClass.BATTERY
|
_attr_device_class = BinarySensorDeviceClass.BATTERY
|
||||||
_attr_entity_category = EntityCategory.DIAGNOSTIC
|
_attr_entity_category = EntityCategory.DIAGNOSTIC
|
||||||
|
|
||||||
|
@ -118,5 +118,24 @@ class NukiBatteryCriticalEntity(NukiEntity[NukiDevice], BinarySensorEntity):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_on(self) -> bool:
|
def is_on(self) -> bool:
|
||||||
"""Return the value of the ring action state."""
|
"""Return the value of the battery critical."""
|
||||||
return self._nuki_device.battery_critical
|
return self._nuki_device.battery_critical
|
||||||
|
|
||||||
|
|
||||||
|
class NukiBatteryChargingEntity(NukiEntity[NukiDevice], BinarySensorEntity):
|
||||||
|
"""Representation of a Nuki Battery charging."""
|
||||||
|
|
||||||
|
_attr_has_entity_name = True
|
||||||
|
_attr_device_class = BinarySensorDeviceClass.BATTERY_CHARGING
|
||||||
|
_attr_entity_category = EntityCategory.DIAGNOSTIC
|
||||||
|
_attr_entity_registry_enabled_default = False
|
||||||
|
|
||||||
|
@property
|
||||||
|
def unique_id(self) -> str:
|
||||||
|
"""Return a unique ID."""
|
||||||
|
return f"{self._nuki_device.nuki_id}_battery_charging"
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_on(self) -> bool:
|
||||||
|
"""Return the value of the battery charging."""
|
||||||
|
return self._nuki_device.battery_charging
|
||||||
|
|
|
@ -12,5 +12,5 @@
|
||||||
"documentation": "https://www.home-assistant.io/integrations/nuki",
|
"documentation": "https://www.home-assistant.io/integrations/nuki",
|
||||||
"iot_class": "local_polling",
|
"iot_class": "local_polling",
|
||||||
"loggers": ["pynuki"],
|
"loggers": ["pynuki"],
|
||||||
"requirements": ["pynuki==1.6.2"]
|
"requirements": ["pynuki==1.6.3"]
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,9 +41,6 @@
|
||||||
"binary_sensor": {
|
"binary_sensor": {
|
||||||
"ring_action": {
|
"ring_action": {
|
||||||
"name": "Ring Action"
|
"name": "Ring Action"
|
||||||
},
|
|
||||||
"battery_critical": {
|
|
||||||
"name": "Battery critical"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lock": {
|
"lock": {
|
||||||
|
|
|
@ -1992,7 +1992,7 @@ pynetio==0.1.9.1
|
||||||
pynobo==1.6.0
|
pynobo==1.6.0
|
||||||
|
|
||||||
# homeassistant.components.nuki
|
# homeassistant.components.nuki
|
||||||
pynuki==1.6.2
|
pynuki==1.6.3
|
||||||
|
|
||||||
# homeassistant.components.nut
|
# homeassistant.components.nut
|
||||||
pynut2==2.1.2
|
pynut2==2.1.2
|
||||||
|
|
|
@ -1537,7 +1537,7 @@ pynetgear==0.10.10
|
||||||
pynobo==1.6.0
|
pynobo==1.6.0
|
||||||
|
|
||||||
# homeassistant.components.nuki
|
# homeassistant.components.nuki
|
||||||
pynuki==1.6.2
|
pynuki==1.6.3
|
||||||
|
|
||||||
# homeassistant.components.nut
|
# homeassistant.components.nut
|
||||||
pynut2==2.1.2
|
pynut2==2.1.2
|
||||||
|
|
Loading…
Reference in New Issue