diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b752b06..9939d04b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,19 @@ # Changelog -## Versions from 0.4x +## v0.56.0 - 2025-09-03 -### Ongoing +- Activate new Sense hysteresis based switch action via PR [326](https://github.com/plugwise/plugwise_usb-beta/pull/326) +- Link to plugwise_usb [v0.45.0](https://github.com/plugwise/python-plugwise-usb/releases/tag/v0.45.0) + +### v0.55.12 - 2025-09-01 - Fix #312 via PR [324](https://github.com/plugwise/plugwise_usb-beta/pull/324) - Link to plugwise_usb [v0.44.14](https://github.com/plugwise/python-plugwise-usb/releases/tag/v0.44.14) +### v0.55.11 - 2025-08-29 + +- Integrate HACS via PR [322](https://github.com/plugwise/plugwise_usb-beta/pull/322) + ### v0.55.10 - 2025-08-29 - Final fix for unavailable buttons via plugwise_usb [v0.44.13](https://github.com/plugwise/python-plugwise-usb/releases/tag/v0.44.13) diff --git a/custom_components/plugwise_usb/binary_sensor.py b/custom_components/plugwise_usb/binary_sensor.py index 13533e3d..c99d2c4d 100644 --- a/custom_components/plugwise_usb/binary_sensor.py +++ b/custom_components/plugwise_usb/binary_sensor.py @@ -61,6 +61,27 @@ class PlugwiseBinarySensorEntityDescription( entity_registry_enabled_default=False, api_attribute="dirty", ), + PlugwiseBinarySensorEntityDescription( + key="sense_config_dirty", + translation_key="sense_config_dirty", + node_feature=NodeFeature.SENSE_HYSTERESIS, + device_class=BinarySensorDeviceClass.SAFETY, + entity_category=EntityCategory.DIAGNOSTIC, + entity_registry_enabled_default=False, + api_attribute="dirty", + ), + PlugwiseBinarySensorEntityDescription( + key="humidity_hysteresis_state", + translation_key="humidity_hysteresis_state", + node_feature=NodeFeature.SENSE, + api_attribute="humidity_hysteresis_state", + ), + PlugwiseBinarySensorEntityDescription( + key="temperature_hysteresis_state", + translation_key="temperature_hysteresis_state", + node_feature=NodeFeature.SENSE, + api_attribute="temperature_hysteresis_state", + ), ) diff --git a/custom_components/plugwise_usb/manifest.json b/custom_components/plugwise_usb/manifest.json index 7e055277..a6c095bd 100644 --- a/custom_components/plugwise_usb/manifest.json +++ b/custom_components/plugwise_usb/manifest.json @@ -9,6 +9,6 @@ "iot_class": "local_polling", "issue_tracker": "https://github.com/plugwise/python-plugwise-usb/issues", "loggers": ["plugwise_usb"], - "requirements": ["plugwise-usb==0.44.14"], - "version": "0.55.12" + "requirements": ["plugwise-usb==0.45.0"], + "version": "0.56.0" } diff --git a/custom_components/plugwise_usb/number.py b/custom_components/plugwise_usb/number.py index a060d5c9..f5d249f8 100644 --- a/custom_components/plugwise_usb/number.py +++ b/custom_components/plugwise_usb/number.py @@ -13,7 +13,13 @@ NumberEntity, NumberEntityDescription, ) -from homeassistant.const import EntityCategory, Platform, UnitOfTime +from homeassistant.const import ( + PERCENTAGE, + EntityCategory, + Platform, + UnitOfTemperature, + UnitOfTime, +) from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.entity_platform import AddEntitiesCallback @@ -32,8 +38,8 @@ class PlugwiseNumberEntityDescription( ): """Describes Plugwise Number entity.""" - api_attribute: str = "" async_number_fn: str = "" + async_number_type: str = "int" NUMBER_TYPES: tuple[PlugwiseNumberEntityDescription, ...] = ( @@ -47,7 +53,7 @@ class PlugwiseNumberEntityDescription( native_unit_of_measurement=UnitOfTime.MINUTES, native_max_value=255, native_min_value=1, - api_attribute="reset_timer", + mode="box", ), PlugwiseNumberEntityDescription( key="maintenance_interval", @@ -59,7 +65,6 @@ class PlugwiseNumberEntityDescription( native_unit_of_measurement=UnitOfTime.MINUTES, native_max_value=1440, native_min_value=5, - api_attribute="maintenance_interval", ), PlugwiseNumberEntityDescription( key="sleep_duration", @@ -71,7 +76,6 @@ class PlugwiseNumberEntityDescription( entity_category=EntityCategory.CONFIG, native_max_value=1440, native_min_value=60, - api_attribute="sleep_duration", ), PlugwiseNumberEntityDescription( key="awake_duration", @@ -83,7 +87,7 @@ class PlugwiseNumberEntityDescription( entity_category=EntityCategory.CONFIG, native_max_value=60, native_min_value=1, - api_attribute="awake_duration", + mode="box", ), PlugwiseNumberEntityDescription( key="clock_interval", @@ -95,7 +99,62 @@ class PlugwiseNumberEntityDescription( native_unit_of_measurement=UnitOfTime.MINUTES, native_max_value=65535, native_min_value=1, - api_attribute="clock_interval", + ), + PlugwiseNumberEntityDescription( + key="humidity_upper_bound", + translation_key="sense_humidity_upper_bound", + async_number_fn="set_hysteresis_humidity_upper_bound", + node_feature=NodeFeature.SENSE_HYSTERESIS, + entity_category=EntityCategory.CONFIG, + device_class=NumberDeviceClass.HUMIDITY, + native_unit_of_measurement=PERCENTAGE, + native_max_value=99, + native_min_value=1, + native_step=0.1, + async_number_type="float", + mode="box", + ), + PlugwiseNumberEntityDescription( + key="humidity_lower_bound", + translation_key="sense_humidity_lower_bound", + async_number_fn="set_hysteresis_humidity_lower_bound", + node_feature=NodeFeature.SENSE_HYSTERESIS, + entity_category=EntityCategory.CONFIG, + device_class=NumberDeviceClass.HUMIDITY, + native_unit_of_measurement=PERCENTAGE, + native_max_value=99, + native_min_value=1, + native_step=0.1, + async_number_type="float", + mode="box", + ), + PlugwiseNumberEntityDescription( + key="temperature_upper_bound", + translation_key="sense_temperature_upper_bound", + async_number_fn="set_hysteresis_temperature_upper_bound", + node_feature=NodeFeature.SENSE_HYSTERESIS, + entity_category=EntityCategory.CONFIG, + device_class=NumberDeviceClass.TEMPERATURE, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, + native_max_value=60, + native_min_value=1, + native_step=0.1, + async_number_type="float", + mode="box", + ), + PlugwiseNumberEntityDescription( + key="temperature_lower_bound", + translation_key="sense_temperature_lower_bound", + async_number_fn="set_hysteresis_temperature_lower_bound", + node_feature=NodeFeature.SENSE_HYSTERESIS, + entity_category=EntityCategory.CONFIG, + device_class=NumberDeviceClass.TEMPERATURE, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, + native_max_value=60, + native_min_value=1, + native_step=0.1, + async_number_type="float", + mode="box", ), ) @@ -178,12 +237,14 @@ def _handle_coordinator_update(self) -> None: return self._attr_native_value = getattr( self.coordinator.data[self.entity_description.node_feature], - self.entity_description.api_attribute, + self.entity_description.key, ) self.async_write_ha_state() async def async_set_native_value(self, value: float) -> None: """Update the current value.""" - - await self.async_number_fn(int(value)) + if self.entity_description.async_number_type == "float": + await self.async_number_fn(float(value)) + else: + await self.async_number_fn(int(value)) self.async_write_ha_state() diff --git a/custom_components/plugwise_usb/strings.json b/custom_components/plugwise_usb/strings.json index cdbf2d78..4dc8f062 100644 --- a/custom_components/plugwise_usb/strings.json +++ b/custom_components/plugwise_usb/strings.json @@ -54,6 +54,15 @@ }, "battery_config_dirty": { "name": "Battery config changed" + }, + "sense_config_dirty": { + "name": "Sense hysteresis config changed" + }, + "humidity_hysteresis_state": { + "name": "Humidity Status" + }, + "temperature_hysteresis_state": { + "name": "Temperature Status" } }, "select": { @@ -122,6 +131,18 @@ }, "motion_daylight_mode": { "name": "Daylight mode" + }, + "sense_humidity_enabled": { + "name": "Enable humidity switching on hysteresis" + }, + "sense_humidity_direction": { + "name": "Switch on increasing or decreasing humidity" + }, + "sense_temperature_enabled": { + "name": "Enable temperature switching on hysteresis" + }, + "sense_temperature_direction": { + "name": "Switch on increasing or decreasing temperature" } }, "number": { @@ -139,6 +160,18 @@ }, "sed_clock_interval": { "name": "Clock interval" + }, + "sense_humidity_upper_bound": { + "name": "Humidity upper boundary value" + }, + "sense_humidity_lower_bound": { + "name": "Humidity lower boundary value" + }, + "sense_temperature_upper_bound": { + "name": "Temperature upper boundary value" + }, + "sense_temperature_lower_bound": { + "name": "Temperature lower boundary value" } }, "button": { diff --git a/custom_components/plugwise_usb/switch.py b/custom_components/plugwise_usb/switch.py index f7a22b55..cd217f0b 100644 --- a/custom_components/plugwise_usb/switch.py +++ b/custom_components/plugwise_usb/switch.py @@ -70,6 +70,38 @@ class PlugwiseSwitchEntityDescription( node_feature=NodeFeature.MOTION_CONFIG, api_attribute="daylight_mode", ), + PlugwiseSwitchEntityDescription( + key="humidity_enabled", + translation_key="sense_humidity_enabled", + async_switch_fn="set_hysteresis_humidity_enabled", + entity_category=EntityCategory.CONFIG, + node_feature=NodeFeature.SENSE_HYSTERESIS, + api_attribute="humidity_enabled", + ), + PlugwiseSwitchEntityDescription( + key="humidity_direction", + translation_key="sense_humidity_direction", + async_switch_fn="set_hysteresis_humidity_direction", + entity_category=EntityCategory.CONFIG, + node_feature=NodeFeature.SENSE_HYSTERESIS, + api_attribute="humidity_direction", + ), + PlugwiseSwitchEntityDescription( + key="temperature_enabled", + translation_key="sense_temperature_enabled", + async_switch_fn="set_hysteresis_temperature_enabled", + entity_category=EntityCategory.CONFIG, + node_feature=NodeFeature.SENSE_HYSTERESIS, + api_attribute="temperature_enabled", + ), + PlugwiseSwitchEntityDescription( + key="temperature_direction", + translation_key="sense_temperature_direction", + async_switch_fn="set_hysteresis_temperature_direction", + entity_category=EntityCategory.CONFIG, + node_feature=NodeFeature.SENSE_HYSTERESIS, + api_attribute="temperature_direction", + ), ) diff --git a/custom_components/plugwise_usb/translations/en.json b/custom_components/plugwise_usb/translations/en.json index e115fa2b..d7dcc8f8 100644 --- a/custom_components/plugwise_usb/translations/en.json +++ b/custom_components/plugwise_usb/translations/en.json @@ -54,6 +54,15 @@ }, "battery_config_dirty": { "name": "Battery config changed" + }, + "sense_config_dirty": { + "name": "Sense hysteresis config changed" + }, + "humidity_hysteresis_state": { + "name": "Humidity Status" + }, + "temperature_hysteresis_state": { + "name": "Temperature Status" } }, "select": { @@ -122,6 +131,18 @@ }, "motion_daylight_mode": { "name": "Daylight mode" + }, + "sense_humidity_enabled": { + "name": "Enable humidity switching on hysteresis" + }, + "sense_humidity_direction": { + "name": "Switch on increasing or decreasing humidity" + }, + "sense_temperature_enabled": { + "name": "Enable temperature switching on hysteresis" + }, + "sense_temperature_direction": { + "name": "Switch on increasing or decreasing temperature" } }, "number": { @@ -139,6 +160,18 @@ }, "sed_clock_interval": { "name": "Clock interval" + }, + "sense_humidity_upper_bound": { + "name": "Humidity upper boundary value" + }, + "sense_humidity_lower_bound": { + "name": "Humidity lower boundary value" + }, + "sense_temperature_upper_bound": { + "name": "Temperature upper boundary value" + }, + "sense_temperature_lower_bound": { + "name": "Temperature lower boundary value" } }, "button": { diff --git a/custom_components/plugwise_usb/translations/nl.json b/custom_components/plugwise_usb/translations/nl.json index 24d1289d..b6638dcb 100644 --- a/custom_components/plugwise_usb/translations/nl.json +++ b/custom_components/plugwise_usb/translations/nl.json @@ -54,6 +54,15 @@ }, "battery_config_dirty": { "name": "Batterijinstellingen aangepast" + }, + "sense_config_dirty": { + "name": "Sense hystereseinstellingen aangepast" + }, + "humidity_hysteresis_state": { + "name": "Status Luchtvochtigheid" + }, + "temperature_hysteresis_state": { + "name": "Status Temperatuur" } }, "select": { @@ -122,6 +131,18 @@ }, "motion_daylight_mode": { "name": "Daglichtmodus" + }, + "sense_humidity_enabled": { + "name": "Zet schakelen op luchtvochtigheid hysterese aan" + }, + "sense_humidity_direction": { + "name": "Schakel bij stijgende of dalende luchtvochtigheid" + }, + "sense_temperature_enabled": { + "name": "Zet schakelen op temperatuur hysterese aan" + }, + "sense_temperature_direction": { + "name": "Schakel bij stijgende of dalende temperatuur" } }, "number": { @@ -139,6 +160,18 @@ }, "sed_clock_interval": { "name": "Klokinterval" + }, + "sense_humidity_upper_bound": { + "name": "Hoge schakelpunt luchtvochtigheid" + }, + "sense_humidity_lower_bound": { + "name": "Lage schakelpunt luchtvochtigheid" + }, + "sense_temperature_upper_bound": { + "name": "Hoge schakelpunt temperatuur" + }, + "sense_temperature_lower_bound": { + "name": "Lage schakelpunt temperatuur" } }, "button": { diff --git a/pyproject.toml b/pyproject.toml index 7ea878a8..c8b8a02d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "plugwise_usb-beta" -version = "0.55.12" +version = "0.55.13" description = "Plugwise USB custom_component (BETA)" readme = "README.md" requires-python = ">=3.13"