mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 22:37:11 +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 homeassistant.components.binary_sensor import (
|
||||
BinarySensorDeviceClass,
|
||||
BinarySensorEntity,
|
||||
BinarySensorEntityDescription,
|
||||
)
|
||||
@ -31,6 +32,12 @@ class PlugwiseBinarySensorEntityDescription(BinarySensorEntityDescription):
|
||||
|
||||
|
||||
BINARY_SENSORS: tuple[PlugwiseBinarySensorEntityDescription, ...] = (
|
||||
PlugwiseBinarySensorEntityDescription(
|
||||
key="low_battery",
|
||||
translation_key="low_battery",
|
||||
device_class=BinarySensorDeviceClass.BATTERY,
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
),
|
||||
PlugwiseBinarySensorEntityDescription(
|
||||
key="compressor_state",
|
||||
translation_key="compressor_state",
|
||||
|
@ -30,6 +30,9 @@
|
||||
},
|
||||
"entity": {
|
||||
"binary_sensor": {
|
||||
"low_battery": {
|
||||
"name": "Battery state"
|
||||
},
|
||||
"compressor_state": {
|
||||
"name": "Compressor state"
|
||||
},
|
||||
|
@ -40,6 +40,9 @@ TOM = {
|
||||
"location": "f871b8c4d63549319221e294e4f88074",
|
||||
"model": "Tom/Floor",
|
||||
"name": "Tom Zolder",
|
||||
"binary_sensors": {
|
||||
"low_battery": False,
|
||||
},
|
||||
"sensors": {
|
||||
"battery": 99,
|
||||
"temperature": 18.6,
|
||||
@ -221,7 +224,7 @@ async def test_update_device(
|
||||
entity_registry, mock_config_entry.entry_id
|
||||
)
|
||||
)
|
||||
== 29
|
||||
== 31
|
||||
)
|
||||
assert (
|
||||
len(
|
||||
@ -244,7 +247,7 @@ async def test_update_device(
|
||||
entity_registry, mock_config_entry.entry_id
|
||||
)
|
||||
)
|
||||
== 34
|
||||
== 37
|
||||
)
|
||||
assert (
|
||||
len(
|
||||
@ -271,7 +274,7 @@ async def test_update_device(
|
||||
entity_registry, mock_config_entry.entry_id
|
||||
)
|
||||
)
|
||||
== 29
|
||||
== 31
|
||||
)
|
||||
assert (
|
||||
len(
|
||||
|
Loading…
x
Reference in New Issue
Block a user