From cb2011f70429231f1a1f636bd9b9ae9260a60bb3 Mon Sep 17 00:00:00 2001 From: Aiden Date: Thu, 15 Oct 2026 11:39:01 +0800 Subject: [PATCH] Add a Reset Total Energy button --- athom-mini-relay-v2.yaml | 12 +++++++++++- athom-smart-plug-v5.yaml | 14 +++++++++++--- athom-smart-plug.yaml | 12 +++++++++++- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/athom-mini-relay-v2.yaml b/athom-mini-relay-v2.yaml index 40838e4..eee4c9b 100644 --- a/athom-mini-relay-v2.yaml +++ b/athom-mini-relay-v2.yaml @@ -10,7 +10,7 @@ substitutions: # Project Name project_name: "China Athom Technology.Mini Relay V2" # Projection version denotes the release version of the yaml file, allowing checking of deployed vs latest version - project_version: "v3.1.3" + project_version: "v3.1.4" # Restore the relay (GPO switch) upon reboot to state: light_restore_mode: RESTORE_DEFAULT_OFF # Set the update interval for sensors @@ -328,6 +328,16 @@ button: internal: false entity_category: config + - platform: template + name: "Reset Total Energy" + icon: mdi:restart-alert + entity_category: config + on_press: + then: + - lambda: |- + id(total_energy) = 0.0; + id(total_energy_sensor).update(); + output: - platform: gpio id: relay_output diff --git a/athom-smart-plug-v5.yaml b/athom-smart-plug-v5.yaml index 5d5680a..31af11d 100644 --- a/athom-smart-plug-v5.yaml +++ b/athom-smart-plug-v5.yaml @@ -10,7 +10,7 @@ substitutions: # Project Name project_name: "China Athom Technology.Athom Plug V5" # Projection version denotes the release version of the yaml file, allowing checking of deployed vs latest version - project_version: "v5.0.5" + project_version: "v5.0.6" # Restore the relay (GPO switch) upon reboot to state: relay_restore_mode: RESTORE_DEFAULT_ON # Set the update interval for sensors @@ -285,8 +285,6 @@ sensor: unit_of_measurement: kWh filters: - throttle: ${sensor_update_interval} - # Multiplication factor from W to kW is 0.001 - - multiply: 0.001 on_value: then: - lambda: |- @@ -333,6 +331,16 @@ button: internal: false entity_category: config + - platform: template + name: "Reset Total Energy" + icon: mdi:restart-alert + entity_category: config + on_press: + then: + - lambda: |- + id(total_energy) = 0.0; + id(total_energy_sensor).update(); + switch: - platform: gpio name: "Switch" diff --git a/athom-smart-plug.yaml b/athom-smart-plug.yaml index 80853f4..e34b1a8 100644 --- a/athom-smart-plug.yaml +++ b/athom-smart-plug.yaml @@ -10,7 +10,7 @@ substitutions: # Project Name project_name: "China Athom Technology.Athom Plug V3" # Projection version denotes the release version of the yaml file, allowing checking of deployed vs latest version - project_version: "v2.0.8" + project_version: "v2.0.9" # Restore the relay (GPO switch) upon reboot to state: relay_restore_mode: RESTORE_DEFAULT_ON # Set the update interval for sensors @@ -377,6 +377,16 @@ button: internal: false entity_category: config + - platform: template + name: "Reset Total Energy" + icon: mdi:restart-alert + entity_category: config + on_press: + then: + - lambda: |- + id(total_energy) = 0.0; + id(total_energy_sensor).update(); + switch: - platform: gpio name: "Switch"