Skip to content

Commit ba6ff0a

Browse files
authored
Merge pull request #326 from plugwise/mdi_sense
Activate new Sense hysteresis based switch action
2 parents d824384 + ae2d7f4 commit ba6ff0a

File tree

9 files changed

+235
-15
lines changed

9 files changed

+235
-15
lines changed

CHANGELOG.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
# Changelog
22

3-
## Versions from 0.4x
3+
## v0.56.0 - 2025-09-03
44

5-
### Ongoing
5+
- Activate new Sense hysteresis based switch action via PR [326](https://github.com/plugwise/plugwise_usb-beta/pull/326)
6+
- Link to plugwise_usb [v0.45.0](https://github.com/plugwise/python-plugwise-usb/releases/tag/v0.45.0)
7+
8+
### v0.55.12 - 2025-09-01
69

710
- Fix #312 via PR [324](https://github.com/plugwise/plugwise_usb-beta/pull/324)
811
- Link to plugwise_usb [v0.44.14](https://github.com/plugwise/python-plugwise-usb/releases/tag/v0.44.14)
912

13+
### v0.55.11 - 2025-08-29
14+
15+
- Integrate HACS via PR [322](https://github.com/plugwise/plugwise_usb-beta/pull/322)
16+
1017
### v0.55.10 - 2025-08-29
1118

1219
- Final fix for unavailable buttons via plugwise_usb [v0.44.13](https://github.com/plugwise/python-plugwise-usb/releases/tag/v0.44.13)

custom_components/plugwise_usb/binary_sensor.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,27 @@ class PlugwiseBinarySensorEntityDescription(
6161
entity_registry_enabled_default=False,
6262
api_attribute="dirty",
6363
),
64+
PlugwiseBinarySensorEntityDescription(
65+
key="sense_config_dirty",
66+
translation_key="sense_config_dirty",
67+
node_feature=NodeFeature.SENSE_HYSTERESIS,
68+
device_class=BinarySensorDeviceClass.SAFETY,
69+
entity_category=EntityCategory.DIAGNOSTIC,
70+
entity_registry_enabled_default=False,
71+
api_attribute="dirty",
72+
),
73+
PlugwiseBinarySensorEntityDescription(
74+
key="humidity_hysteresis_state",
75+
translation_key="humidity_hysteresis_state",
76+
node_feature=NodeFeature.SENSE,
77+
api_attribute="humidity_hysteresis_state",
78+
),
79+
PlugwiseBinarySensorEntityDescription(
80+
key="temperature_hysteresis_state",
81+
translation_key="temperature_hysteresis_state",
82+
node_feature=NodeFeature.SENSE,
83+
api_attribute="temperature_hysteresis_state",
84+
),
6485
)
6586

6687

custom_components/plugwise_usb/manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
"iot_class": "local_polling",
1010
"issue_tracker": "https://github.com/plugwise/python-plugwise-usb/issues",
1111
"loggers": ["plugwise_usb"],
12-
"requirements": ["plugwise-usb==0.44.14"],
13-
"version": "0.55.12"
12+
"requirements": ["plugwise-usb==0.45.0"],
13+
"version": "0.56.0"
1414
}

custom_components/plugwise_usb/number.py

Lines changed: 71 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,13 @@
1313
NumberEntity,
1414
NumberEntityDescription,
1515
)
16-
from homeassistant.const import EntityCategory, Platform, UnitOfTime
16+
from homeassistant.const import (
17+
PERCENTAGE,
18+
EntityCategory,
19+
Platform,
20+
UnitOfTemperature,
21+
UnitOfTime,
22+
)
1723
from homeassistant.core import HomeAssistant, callback
1824
from homeassistant.helpers.entity_platform import AddEntitiesCallback
1925

@@ -32,8 +38,8 @@ class PlugwiseNumberEntityDescription(
3238
):
3339
"""Describes Plugwise Number entity."""
3440

35-
api_attribute: str = ""
3641
async_number_fn: str = ""
42+
async_number_type: str = "int"
3743

3844

3945
NUMBER_TYPES: tuple[PlugwiseNumberEntityDescription, ...] = (
@@ -47,7 +53,7 @@ class PlugwiseNumberEntityDescription(
4753
native_unit_of_measurement=UnitOfTime.MINUTES,
4854
native_max_value=255,
4955
native_min_value=1,
50-
api_attribute="reset_timer",
56+
mode="box",
5157
),
5258
PlugwiseNumberEntityDescription(
5359
key="maintenance_interval",
@@ -59,7 +65,6 @@ class PlugwiseNumberEntityDescription(
5965
native_unit_of_measurement=UnitOfTime.MINUTES,
6066
native_max_value=1440,
6167
native_min_value=5,
62-
api_attribute="maintenance_interval",
6368
),
6469
PlugwiseNumberEntityDescription(
6570
key="sleep_duration",
@@ -71,7 +76,6 @@ class PlugwiseNumberEntityDescription(
7176
entity_category=EntityCategory.CONFIG,
7277
native_max_value=1440,
7378
native_min_value=60,
74-
api_attribute="sleep_duration",
7579
),
7680
PlugwiseNumberEntityDescription(
7781
key="awake_duration",
@@ -83,7 +87,7 @@ class PlugwiseNumberEntityDescription(
8387
entity_category=EntityCategory.CONFIG,
8488
native_max_value=60,
8589
native_min_value=1,
86-
api_attribute="awake_duration",
90+
mode="box",
8791
),
8892
PlugwiseNumberEntityDescription(
8993
key="clock_interval",
@@ -95,7 +99,62 @@ class PlugwiseNumberEntityDescription(
9599
native_unit_of_measurement=UnitOfTime.MINUTES,
96100
native_max_value=65535,
97101
native_min_value=1,
98-
api_attribute="clock_interval",
102+
),
103+
PlugwiseNumberEntityDescription(
104+
key="humidity_upper_bound",
105+
translation_key="sense_humidity_upper_bound",
106+
async_number_fn="set_hysteresis_humidity_upper_bound",
107+
node_feature=NodeFeature.SENSE_HYSTERESIS,
108+
entity_category=EntityCategory.CONFIG,
109+
device_class=NumberDeviceClass.HUMIDITY,
110+
native_unit_of_measurement=PERCENTAGE,
111+
native_max_value=99,
112+
native_min_value=1,
113+
native_step=0.1,
114+
async_number_type="float",
115+
mode="box",
116+
),
117+
PlugwiseNumberEntityDescription(
118+
key="humidity_lower_bound",
119+
translation_key="sense_humidity_lower_bound",
120+
async_number_fn="set_hysteresis_humidity_lower_bound",
121+
node_feature=NodeFeature.SENSE_HYSTERESIS,
122+
entity_category=EntityCategory.CONFIG,
123+
device_class=NumberDeviceClass.HUMIDITY,
124+
native_unit_of_measurement=PERCENTAGE,
125+
native_max_value=99,
126+
native_min_value=1,
127+
native_step=0.1,
128+
async_number_type="float",
129+
mode="box",
130+
),
131+
PlugwiseNumberEntityDescription(
132+
key="temperature_upper_bound",
133+
translation_key="sense_temperature_upper_bound",
134+
async_number_fn="set_hysteresis_temperature_upper_bound",
135+
node_feature=NodeFeature.SENSE_HYSTERESIS,
136+
entity_category=EntityCategory.CONFIG,
137+
device_class=NumberDeviceClass.TEMPERATURE,
138+
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
139+
native_max_value=60,
140+
native_min_value=1,
141+
native_step=0.1,
142+
async_number_type="float",
143+
mode="box",
144+
),
145+
PlugwiseNumberEntityDescription(
146+
key="temperature_lower_bound",
147+
translation_key="sense_temperature_lower_bound",
148+
async_number_fn="set_hysteresis_temperature_lower_bound",
149+
node_feature=NodeFeature.SENSE_HYSTERESIS,
150+
entity_category=EntityCategory.CONFIG,
151+
device_class=NumberDeviceClass.TEMPERATURE,
152+
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
153+
native_max_value=60,
154+
native_min_value=1,
155+
native_step=0.1,
156+
async_number_type="float",
157+
mode="box",
99158
),
100159
)
101160

@@ -178,12 +237,14 @@ def _handle_coordinator_update(self) -> None:
178237
return
179238
self._attr_native_value = getattr(
180239
self.coordinator.data[self.entity_description.node_feature],
181-
self.entity_description.api_attribute,
240+
self.entity_description.key,
182241
)
183242
self.async_write_ha_state()
184243

185244
async def async_set_native_value(self, value: float) -> None:
186245
"""Update the current value."""
187-
188-
await self.async_number_fn(int(value))
246+
if self.entity_description.async_number_type == "float":
247+
await self.async_number_fn(float(value))
248+
else:
249+
await self.async_number_fn(int(value))
189250
self.async_write_ha_state()

custom_components/plugwise_usb/strings.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,15 @@
5454
},
5555
"battery_config_dirty": {
5656
"name": "Battery config changed"
57+
},
58+
"sense_config_dirty": {
59+
"name": "Sense hysteresis config changed"
60+
},
61+
"humidity_hysteresis_state": {
62+
"name": "Humidity Status"
63+
},
64+
"temperature_hysteresis_state": {
65+
"name": "Temperature Status"
5766
}
5867
},
5968
"select": {
@@ -122,6 +131,18 @@
122131
},
123132
"motion_daylight_mode": {
124133
"name": "Daylight mode"
134+
},
135+
"sense_humidity_enabled": {
136+
"name": "Enable humidity switching on hysteresis"
137+
},
138+
"sense_humidity_direction": {
139+
"name": "Switch on increasing or decreasing humidity"
140+
},
141+
"sense_temperature_enabled": {
142+
"name": "Enable temperature switching on hysteresis"
143+
},
144+
"sense_temperature_direction": {
145+
"name": "Switch on increasing or decreasing temperature"
125146
}
126147
},
127148
"number": {
@@ -139,6 +160,18 @@
139160
},
140161
"sed_clock_interval": {
141162
"name": "Clock interval"
163+
},
164+
"sense_humidity_upper_bound": {
165+
"name": "Humidity upper boundary value"
166+
},
167+
"sense_humidity_lower_bound": {
168+
"name": "Humidity lower boundary value"
169+
},
170+
"sense_temperature_upper_bound": {
171+
"name": "Temperature upper boundary value"
172+
},
173+
"sense_temperature_lower_bound": {
174+
"name": "Temperature lower boundary value"
142175
}
143176
},
144177
"button": {

custom_components/plugwise_usb/switch.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,38 @@ class PlugwiseSwitchEntityDescription(
7070
node_feature=NodeFeature.MOTION_CONFIG,
7171
api_attribute="daylight_mode",
7272
),
73+
PlugwiseSwitchEntityDescription(
74+
key="humidity_enabled",
75+
translation_key="sense_humidity_enabled",
76+
async_switch_fn="set_hysteresis_humidity_enabled",
77+
entity_category=EntityCategory.CONFIG,
78+
node_feature=NodeFeature.SENSE_HYSTERESIS,
79+
api_attribute="humidity_enabled",
80+
),
81+
PlugwiseSwitchEntityDescription(
82+
key="humidity_direction",
83+
translation_key="sense_humidity_direction",
84+
async_switch_fn="set_hysteresis_humidity_direction",
85+
entity_category=EntityCategory.CONFIG,
86+
node_feature=NodeFeature.SENSE_HYSTERESIS,
87+
api_attribute="humidity_direction",
88+
),
89+
PlugwiseSwitchEntityDescription(
90+
key="temperature_enabled",
91+
translation_key="sense_temperature_enabled",
92+
async_switch_fn="set_hysteresis_temperature_enabled",
93+
entity_category=EntityCategory.CONFIG,
94+
node_feature=NodeFeature.SENSE_HYSTERESIS,
95+
api_attribute="temperature_enabled",
96+
),
97+
PlugwiseSwitchEntityDescription(
98+
key="temperature_direction",
99+
translation_key="sense_temperature_direction",
100+
async_switch_fn="set_hysteresis_temperature_direction",
101+
entity_category=EntityCategory.CONFIG,
102+
node_feature=NodeFeature.SENSE_HYSTERESIS,
103+
api_attribute="temperature_direction",
104+
),
73105
)
74106

75107

custom_components/plugwise_usb/translations/en.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,15 @@
5454
},
5555
"battery_config_dirty": {
5656
"name": "Battery config changed"
57+
},
58+
"sense_config_dirty": {
59+
"name": "Sense hysteresis config changed"
60+
},
61+
"humidity_hysteresis_state": {
62+
"name": "Humidity Status"
63+
},
64+
"temperature_hysteresis_state": {
65+
"name": "Temperature Status"
5766
}
5867
},
5968
"select": {
@@ -122,6 +131,18 @@
122131
},
123132
"motion_daylight_mode": {
124133
"name": "Daylight mode"
134+
},
135+
"sense_humidity_enabled": {
136+
"name": "Enable humidity switching on hysteresis"
137+
},
138+
"sense_humidity_direction": {
139+
"name": "Switch on increasing or decreasing humidity"
140+
},
141+
"sense_temperature_enabled": {
142+
"name": "Enable temperature switching on hysteresis"
143+
},
144+
"sense_temperature_direction": {
145+
"name": "Switch on increasing or decreasing temperature"
125146
}
126147
},
127148
"number": {
@@ -139,6 +160,18 @@
139160
},
140161
"sed_clock_interval": {
141162
"name": "Clock interval"
163+
},
164+
"sense_humidity_upper_bound": {
165+
"name": "Humidity upper boundary value"
166+
},
167+
"sense_humidity_lower_bound": {
168+
"name": "Humidity lower boundary value"
169+
},
170+
"sense_temperature_upper_bound": {
171+
"name": "Temperature upper boundary value"
172+
},
173+
"sense_temperature_lower_bound": {
174+
"name": "Temperature lower boundary value"
142175
}
143176
},
144177
"button": {

0 commit comments

Comments
 (0)