diff --git a/CHANGELOG.md b/CHANGELOG.md index 2335c807..729288cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ ## Versions from 0.4x +### v0.55.0 - 2025-06-22 + +- Implement an energy-reset button for energy devices that resets/restarts the energy-collection on the device overwriting the existing data +- Improve the energy collection reset process to reduce ZigBee traffic, network and server load via plugwise_usb [v0.44.4](https://github.com/plugwise/python-plugwise-usb/releases/tag/v0.44.4) + ### v0.54.2 - Bump plugwise to [v0.44.3](https://github.com/plugwise/python-plugwise-usb/releases/tag/v0.44.3) diff --git a/custom_components/plugwise_usb/__init__.py b/custom_components/plugwise_usb/__init__.py index 5634b952..8c40c95c 100644 --- a/custom_components/plugwise_usb/__init__.py +++ b/custom_components/plugwise_usb/__init__.py @@ -20,7 +20,6 @@ PLUGWISE_USB_PLATFORMS, SERVICE_DISABLE_PRODUCTION, SERVICE_ENABLE_PRODUCTION, - SERVICE_ENERGY_RESET, SERVICE_USB_DEVICE_SCHEMA, STICK, ) @@ -111,17 +110,6 @@ async def async_node_discovered(node_event: NodeEvent, mac: str) -> None: config_entry, PLUGWISE_USB_PLATFORMS ) - async def reset_energy_logs(call: ServiceCall) -> bool: - """Reset energylog collection for a Node.""" - mac = call.data[ATTR_MAC] - try: - result = await api_stick.energy_reset_request(mac) - except (NodeError, StickError) as exc: - raise HomeAssistantError( - f"Energy logs reset failed for {mac}: {exc}" - ) from exc - return result - async def enable_production(call: ServiceCall) -> bool: """Enable production-logging for a Node.""" mac = call.data[ATTR_MAC] @@ -150,9 +138,6 @@ async def disable_production(call: ServiceCall) -> bool: hass.services.async_register( DOMAIN, SERVICE_DISABLE_PRODUCTION, disable_production, SERVICE_USB_DEVICE_SCHEMA ) - hass.services.async_register( - DOMAIN, SERVICE_ENERGY_RESET, reset_energy_logs, SERVICE_USB_DEVICE_SCHEMA - ) # Initiate background nodes discovery task config_entry.async_create_task( diff --git a/custom_components/plugwise_usb/button.py b/custom_components/plugwise_usb/button.py index 0d534493..32108ef4 100644 --- a/custom_components/plugwise_usb/button.py +++ b/custom_components/plugwise_usb/button.py @@ -41,6 +41,13 @@ class PlugwiseButtonEntityDescription( async_button_fn="enable_auto_join", node_feature=NodeFeature.CIRCLEPLUS, ), + PlugwiseButtonEntityDescription( + key="energy_reset", + translation_key="energy_reset", + entity_category=EntityCategory.CONFIG, + async_button_fn="energy_reset_request", + node_feature=NodeFeature.CIRCLE, + ), ) diff --git a/custom_components/plugwise_usb/manifest.json b/custom_components/plugwise_usb/manifest.json index 80cee8db..9fbe94c9 100644 --- a/custom_components/plugwise_usb/manifest.json +++ b/custom_components/plugwise_usb/manifest.json @@ -8,6 +8,6 @@ "integration_type": "hub", "iot_class": "local_polling", "loggers": ["plugwise_usb"], - "requirements": ["plugwise-usb==0.44.3"], - "version": "0.54.2" + "requirements": ["plugwise-usb==0.44.4"], + "version": "0.55.0" } diff --git a/custom_components/plugwise_usb/services.yaml b/custom_components/plugwise_usb/services.yaml index 543cdbb4..bdf4e0f4 100644 --- a/custom_components/plugwise_usb/services.yaml +++ b/custom_components/plugwise_usb/services.yaml @@ -8,11 +8,6 @@ disable_production: fields: mac: example: "data: {mac: 0123456789ABCDEF}" -reset_energy_logs: - description: "Reset energylogs for a Plugwise USB node by MAC address" - fields: - mac: - example: "data: {mac: 0123456789ABCDEF}" configure_scan: fields: entity_id: diff --git a/custom_components/plugwise_usb/strings.json b/custom_components/plugwise_usb/strings.json index 2448e87f..da8797f6 100644 --- a/custom_components/plugwise_usb/strings.json +++ b/custom_components/plugwise_usb/strings.json @@ -43,16 +43,6 @@ } } }, - "reset_energy_logs":{ - "name": "Reset energy logs for a Node", - "description": "Enter the mac of the Node: (data = mac: 0123456789ABCDEF)", - "fields": { - "mac": { - "name": "MAC address", - "description": "The full 16 character MAC address of the plugwise device." - } - } - }, "configure_scan": { "name": "Configure motion settings", "description": "Configure the motion settings for a Plugwise Scan device. The new configuration will be send soon as the Scan devices is awake to receive configuration changes. For quick activation press the local button to awake the device.", @@ -190,6 +180,9 @@ "button": { "enable_auto_join": { "name": "Enable Auto-joining (temporarily)" + }, + "energy_reset":{ + "name": "Reset energy collection" } } } diff --git a/custom_components/plugwise_usb/translations/en.json b/custom_components/plugwise_usb/translations/en.json index 0033aa24..1bb36ab7 100644 --- a/custom_components/plugwise_usb/translations/en.json +++ b/custom_components/plugwise_usb/translations/en.json @@ -43,16 +43,6 @@ } } }, - "reset_energy_logs":{ - "name": "Reset energy logs for a Node", - "description": "Enter the mac of the Node: (data = mac: 0123456789ABCDEF)", - "fields": { - "mac": { - "name": "MAC address", - "description": "The full 16 character MAC address of the plugwise device." - } - } - }, "configure_scan": { "name": "Configure motion settings", "description": "Configure the motion settings for a Plugwise Scan device. The new configuration will be send soon as the Scan devices is awake to receive configuration changes. For quick activation press the local button to awake the device.", @@ -190,6 +180,9 @@ "button": { "enable_auto_join": { "name": "Enable Auto-joining (temporarily)" + }, + "energy_reset":{ + "name": "Reset energy collection" } } } diff --git a/custom_components/plugwise_usb/translations/nl.json b/custom_components/plugwise_usb/translations/nl.json index 8cead0e2..5bacb2ee 100644 --- a/custom_components/plugwise_usb/translations/nl.json +++ b/custom_components/plugwise_usb/translations/nl.json @@ -43,16 +43,6 @@ } } }, - "reset_energy_logs":{ - "name": "Voer een energielog reset uit voor een Node", - "description": "Voer het mac-adres van de Node in: (data = mac: 0123456789ABSDEF)", - "fields": { - "mac": { - "name": "MAC adres", - "description": "Het volledige MAC address (16 karakters) van het plugwise apparaat." - } - } - }, "configure_scan": { "name": "Configureer bewegingsinstellingen voor een Plugwise Scan apparaat", "description": "Configureert bewegingsinstellingen voor een Plugwise Scan apparaat.", @@ -190,6 +180,9 @@ "button": { "enable_auto_join": { "name": "Zet Plugwise auto-toevoegen aan (tijdelijk)" + }, + "energy_reset":{ + "name": "Energieverzameling resetten" } } } diff --git a/requirements_test.txt b/requirements_test.txt index 43534b54..98c257bf 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -4,4 +4,4 @@ pytest-asyncio pytest-homeassistant-custom-component aiousbwatcher # From our manifest.json for our custom component -plugwise-usb @ https://files.pythonhosted.org/packages/73/7f/d87b3090a7c52e82615a1bd1c7a539c57d9c96b1c8352e3eb79905f938ac/plugwise_usb-0.44.1.tar.gz \ No newline at end of file +plugwise-usb @ https://files.pythonhosted.org/packages/5d/51/5e1a7f12954bdf0cbed1a460ec1700802e9d92015735c93a6e755f639c95/plugwise_usb-0.44.4.tar.gz \ No newline at end of file