mirror of
https://github.com/home-assistant/core.git
synced 2025-07-13 08:17:08 +00:00
Implement battery state binary sensor in Plugwise (#126020)
This commit is contained in:
parent
156a88a3a3
commit
29fb83e98b
@ -9,6 +9,7 @@ from typing import Any
|
|||||||
from plugwise.constants import BinarySensorType
|
from plugwise.constants import BinarySensorType
|
||||||
|
|
||||||
from homeassistant.components.binary_sensor import (
|
from homeassistant.components.binary_sensor import (
|
||||||
|
BinarySensorDeviceClass,
|
||||||
BinarySensorEntity,
|
BinarySensorEntity,
|
||||||
BinarySensorEntityDescription,
|
BinarySensorEntityDescription,
|
||||||
)
|
)
|
||||||
@ -31,6 +32,12 @@ class PlugwiseBinarySensorEntityDescription(BinarySensorEntityDescription):
|
|||||||
|
|
||||||
|
|
||||||
BINARY_SENSORS: tuple[PlugwiseBinarySensorEntityDescription, ...] = (
|
BINARY_SENSORS: tuple[PlugwiseBinarySensorEntityDescription, ...] = (
|
||||||
|
PlugwiseBinarySensorEntityDescription(
|
||||||
|
key="low_battery",
|
||||||
|
translation_key="low_battery",
|
||||||
|
device_class=BinarySensorDeviceClass.BATTERY,
|
||||||
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
|
),
|
||||||
PlugwiseBinarySensorEntityDescription(
|
PlugwiseBinarySensorEntityDescription(
|
||||||
key="compressor_state",
|
key="compressor_state",
|
||||||
translation_key="compressor_state",
|
translation_key="compressor_state",
|
||||||
|
@ -30,6 +30,9 @@
|
|||||||
},
|
},
|
||||||
"entity": {
|
"entity": {
|
||||||
"binary_sensor": {
|
"binary_sensor": {
|
||||||
|
"low_battery": {
|
||||||
|
"name": "Battery state"
|
||||||
|
},
|
||||||
"compressor_state": {
|
"compressor_state": {
|
||||||
"name": "Compressor state"
|
"name": "Compressor state"
|
||||||
},
|
},
|
||||||
|
@ -40,6 +40,9 @@ TOM = {
|
|||||||
"location": "f871b8c4d63549319221e294e4f88074",
|
"location": "f871b8c4d63549319221e294e4f88074",
|
||||||
"model": "Tom/Floor",
|
"model": "Tom/Floor",
|
||||||
"name": "Tom Zolder",
|
"name": "Tom Zolder",
|
||||||
|
"binary_sensors": {
|
||||||
|
"low_battery": False,
|
||||||
|
},
|
||||||
"sensors": {
|
"sensors": {
|
||||||
"battery": 99,
|
"battery": 99,
|
||||||
"temperature": 18.6,
|
"temperature": 18.6,
|
||||||
@ -221,7 +224,7 @@ async def test_update_device(
|
|||||||
entity_registry, mock_config_entry.entry_id
|
entity_registry, mock_config_entry.entry_id
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
== 29
|
== 31
|
||||||
)
|
)
|
||||||
assert (
|
assert (
|
||||||
len(
|
len(
|
||||||
@ -244,7 +247,7 @@ async def test_update_device(
|
|||||||
entity_registry, mock_config_entry.entry_id
|
entity_registry, mock_config_entry.entry_id
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
== 34
|
== 37
|
||||||
)
|
)
|
||||||
assert (
|
assert (
|
||||||
len(
|
len(
|
||||||
@ -271,7 +274,7 @@ async def test_update_device(
|
|||||||
entity_registry, mock_config_entry.entry_id
|
entity_registry, mock_config_entry.entry_id
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
== 29
|
== 31
|
||||||
)
|
)
|
||||||
assert (
|
assert (
|
||||||
len(
|
len(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user