Skip to content

Commit 0de5013

Browse files
authored
Merge pull request #702 from plugwise/battery_state
Add battery_state binary_sensor for battery powered devices
2 parents 013bdba + 617fd46 commit 0de5013

File tree

13 files changed

+244
-145
lines changed

13 files changed

+244
-145
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
## Versions from 0.40 and up
44

5-
## Ongoing
5+
## v0.52.0
66

7+
- Add battery-state binary_sensors for battery-powered devices.
78
- Fix climate-test error: implement homeassistant.exceptions.ServiceValidationError
89

910
## v0.51.6

custom_components/plugwise/binary_sensor.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from plugwise.constants import BinarySensorType
99

1010
from homeassistant.components.binary_sensor import (
11+
BinarySensorDeviceClass,
1112
BinarySensorEntity,
1213
BinarySensorEntityDescription,
1314
)
@@ -17,6 +18,7 @@
1718

1819
from . import PlugwiseConfigEntry
1920
from .const import (
21+
BATTERY_STATE,
2022
BINARY_SENSORS,
2123
COMPRESSOR_STATE,
2224
COOLING_ENABLED,
@@ -45,6 +47,12 @@ class PlugwiseBinarySensorEntityDescription(BinarySensorEntityDescription):
4547

4648

4749
PLUGWISE_BINARY_SENSORS: tuple[PlugwiseBinarySensorEntityDescription, ...] = (
50+
PlugwiseBinarySensorEntityDescription(
51+
key=BATTERY_STATE,
52+
translation_key=BATTERY_STATE,
53+
device_class=BinarySensorDeviceClass.BATTERY,
54+
entity_category=EntityCategory.DIAGNOSTIC,
55+
),
4856
PlugwiseBinarySensorEntityDescription(
4957
key=COMPRESSOR_STATE,
5058
translation_key=COMPRESSOR_STATE,

custom_components/plugwise/const.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
# Binary Sensor constants
2929
BINARY_SENSORS: Final = "binary_sensors"
30+
BATTERY_STATE: Final = "low_battery"
3031
COMPRESSOR_STATE: Final = "compressor_state"
3132
COOLING_ENABLED: Final = "cooling_enabled"
3233
COOLING_STATE: Final = "cooling_state"

custom_components/plugwise/manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
"integration_type": "hub",
99
"iot_class": "local_polling",
1010
"loggers": ["plugwise"],
11-
"requirements": ["plugwise==0.38.3"],
12-
"version": "0.51.6"
11+
"requirements": ["plugwise==1.1.0"],
12+
"version": "0.52.0"
1313
}

custom_components/plugwise/strings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@
4747
},
4848
"entity": {
4949
"binary_sensor": {
50+
"low_battery": {
51+
"name": "Battery state"
52+
},
5053
"compressor_state": {
5154
"name": "Compressor state"
5255
},

0 commit comments

Comments
 (0)