From ec3dc2a82b0a67662f5394181bf824e0fcf7f36d Mon Sep 17 00:00:00 2001 From: Roving Ronin <108674933+Roving-Ronin@users.noreply.github.com> Date: Mon, 1 Jul 2024 11:13:04 +1000 Subject: [PATCH 01/16] Update athom-smart-plug-v2.yaml - Update project version number. - Update SNTP update interval to use substitution to set, that was overlooked previously. - Update SNTP to define pool.ntp.org servers to use, can be changed to country/region pool servers in substitutions. - Make log level changeable using value declared in substitutions. - Add Energy Yesterday, Weekly, Monthly sensors (provided by https://github.com/dentra/esphome-components/tree/master/components/energy_statistics - if preferred the component could be copied to Athom Repo instead) - Amend 'Total Daily Energy' sensor to 'Total Energy Today' to keep in line with 'Total Energy Yesterday/Week/Month' ('Total Yesterday Energy' is incorrect grammar and stops the use of that format). - Amend 'Energy' sensor to be 'internal', as serves no purpose, has no timeframe associated with it and resets at boot & reflashing. Made changeable via hide_energy_sensor subsitution (true/false). --- athom-smart-plug-v2.yaml | 70 ++++++++++++++++++++++++++++++++++------ 1 file changed, 61 insertions(+), 9 deletions(-) diff --git a/athom-smart-plug-v2.yaml b/athom-smart-plug-v2.yaml index 8616441f..e14e3c60 100644 --- a/athom-smart-plug-v2.yaml +++ b/athom-smart-plug-v2.yaml @@ -5,7 +5,7 @@ substitutions: room: "" device_description: "athom smart plug v2" project_name: "Athom Technology.Smart Plug V2" - project_version: "2.0.3" + project_version: "2.0.4" relay_restore_mode: RESTORE_DEFAULT_OFF sensor_update_interval: 10s # Current Limit in Amps. AU Plug = 10. IL, BR, EU, UK, US Plug = 16. @@ -14,12 +14,25 @@ substitutions: dns_domain: "" # Set timezone of the smart plug. Useful if the plug is in a location different to the HA server. Can be entered in unix Country/Area format (i.e. "Australia/Sydney") timezone: "" + # Set the duration between the sntp service polling ntp.org servers for an update + sntp_update_interval: 6h + # Network time servers for your region, enter from lowest to highest priority. To use local servers update as per zones or countries at: https://www.ntppool.org/zone/@ + sntp_server_1: "0.pool.ntp.org" + sntp_server_2: "1.pool.ntp.org" + sntp_server_3: "2.pool.ntp.org" # Enables faster network connections, with last connected SSID being connected to and no full scan for SSID being undertaken - wifi_fast_connect: "false" - + wifi_fast_connect: "false" + # Define logging level: NONE, ERROR, WARN, INFO, DEBUG (Default), VERBOSE, VERY_VERBOSE + log_level: "INFO" + # Hide the ENERGY sensor that shows kWh consumed, but with no time period associated with it. Resets when device restarted and reflashed. + hide_energy_sensor: true + + + esphome: name: "${name}" friendly_name: "${friendly_name}" + comment: "${device_description}" area: "${room}" name_add_mac_suffix: true min_version: 2024.6.0 @@ -40,6 +53,7 @@ ota: - platform: esphome logger: + level: ${log_level} baud_rate: 0 mdns: @@ -49,8 +63,11 @@ web_server: port: 80 wifi: - ap: {} # This spawns an AP with the device name and mac address with no password. + # This spawns an AP with the device name and mac address with no password. + ap: {} + # Allow rapid re-connection to previously connect WiFi SSID, skipping scan of all SSID fast_connect: "${wifi_fast_connect}" + # Define dns domain / suffix to add to hostname domain: "${dns_domain}" captive_portal: @@ -58,6 +75,11 @@ captive_portal: dashboard_import: package_import_url: github://athom-tech/athom-configs/athom-smart-plug-v2.yaml +# Dentra Components - Adds 'Platform - Energy Statistics' +# https://github.com/dentra/esphome-components/tree/master/components/energy_statistics +external_components: + - source: github://dentra/esphome-components + uart: rx_pin: RX baud_rate: 4800 @@ -153,11 +175,13 @@ sensor: id(total_energy) += current_energy_value - previous_energy_value; previous_energy_value = current_energy_value; id(total_energy_sensor).update(); + internal: ${hide_energy_sensor} apparent_power: name: "Apparent Power" filters: - throttle_average: ${sensor_update_interval} + power_factor: name: "Power Factor" filters: @@ -173,17 +197,40 @@ sensor: accuracy_decimals: 3 lambda: |- return id(total_energy); - update_interval: never + update_interval: ${sensor_update_interval} - - platform: total_daily_energy - name: "Total Daily Energy" + - platform: total_energy_today + name: "Total Energy Today" restore: true power_id: power_sensor unit_of_measurement: kWh + icon: mdi:hours-24 accuracy_decimals: 3 filters: - multiply: 0.001 + # Dentra Components - Define the id of the sensor providing 'Total Energy' used + - platform: "energy_statistics" + total: energy_total_sensor + + # Dentra Components - Adds Energy Yesterday + energy_yesterday: + name: "Total Energy Yesterday" + id: total_energy_yesterday + accuracy_decimals: 3 + + # Dentra Components - Adds Energy Week + energy_week: + name: "Total Energy Week" + id: total_energy_week + accuracy_decimals: 3 + + # Dentra Components - Adds Energy Month + energy_month: + name: "Total Energy Month" + id: total_energy_month + accuracy_decimals: 3 + button: - platform: restart name: "Restart" @@ -265,8 +312,13 @@ time: id: sntp_time # Define the timezone of the device timezone: "${timezone}" - # Change sync interval from default 5min to 6 hours - update_interval: 360min + # Change sync interval from default 5min to 6 hours (or as set in substitutions) + update_interval: ${sntp_update_interval} + # Set specific sntp servers to use + servers: + - "${sntp_server_1}" + - "${sntp_server_2}" + - "${sntp_server_3}" # Publish the time the device was last restarted on_time_sync: then: From 4262528079ebf70d0b79d9e2661d2674361e0509 Mon Sep 17 00:00:00 2001 From: Roving Ronin <108674933+Roving-Ronin@users.noreply.github.com> Date: Tue, 2 Jul 2024 09:46:26 +1000 Subject: [PATCH 02/16] Update athom-smart-plug-v2.yaml --- athom-smart-plug-v2.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/athom-smart-plug-v2.yaml b/athom-smart-plug-v2.yaml index e14e3c60..5f0a7113 100644 --- a/athom-smart-plug-v2.yaml +++ b/athom-smart-plug-v2.yaml @@ -6,8 +6,8 @@ substitutions: device_description: "athom smart plug v2" project_name: "Athom Technology.Smart Plug V2" project_version: "2.0.4" - relay_restore_mode: RESTORE_DEFAULT_OFF - sensor_update_interval: 10s + relay_restore_mode: "RESTORE_DEFAULT_OFF" + sensor_update_interval: "10s" # Current Limit in Amps. AU Plug = 10. IL, BR, EU, UK, US Plug = 16. current_limit : "16" # Define a domain for this device to use. i.e. iot.home.lan (so device will appear as athom-smart-plug-v2.iot.home.lan in DNS/DHCP logs) @@ -15,7 +15,7 @@ substitutions: # Set timezone of the smart plug. Useful if the plug is in a location different to the HA server. Can be entered in unix Country/Area format (i.e. "Australia/Sydney") timezone: "" # Set the duration between the sntp service polling ntp.org servers for an update - sntp_update_interval: 6h + sntp_update_interval: "6h" # Network time servers for your region, enter from lowest to highest priority. To use local servers update as per zones or countries at: https://www.ntppool.org/zone/@ sntp_server_1: "0.pool.ntp.org" sntp_server_2: "1.pool.ntp.org" @@ -25,7 +25,7 @@ substitutions: # Define logging level: NONE, ERROR, WARN, INFO, DEBUG (Default), VERBOSE, VERY_VERBOSE log_level: "INFO" # Hide the ENERGY sensor that shows kWh consumed, but with no time period associated with it. Resets when device restarted and reflashed. - hide_energy_sensor: true + hide_energy_sensor: "true" From d20856577010ca222bb5dd5e79063821c2c01dbb Mon Sep 17 00:00:00 2001 From: Roving Ronin <108674933+Roving-Ronin@users.noreply.github.com> Date: Tue, 2 Jul 2024 09:48:28 +1000 Subject: [PATCH 03/16] Update athom-smart-plug-v2.yaml --- athom-smart-plug-v2.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/athom-smart-plug-v2.yaml b/athom-smart-plug-v2.yaml index 5f0a7113..09c45bbe 100644 --- a/athom-smart-plug-v2.yaml +++ b/athom-smart-plug-v2.yaml @@ -199,7 +199,7 @@ sensor: return id(total_energy); update_interval: ${sensor_update_interval} - - platform: total_energy_today + - platform: total_daily_energy name: "Total Energy Today" restore: true power_id: power_sensor From 4ca450a68c84f1aa51f666e094674bd1e562fd0d Mon Sep 17 00:00:00 2001 From: Roving Ronin <108674933+Roving-Ronin@users.noreply.github.com> Date: Tue, 2 Jul 2024 09:53:17 +1000 Subject: [PATCH 04/16] Update athom-smart-plug-v2.yaml --- athom-smart-plug-v2.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/athom-smart-plug-v2.yaml b/athom-smart-plug-v2.yaml index 09c45bbe..0656c8e8 100644 --- a/athom-smart-plug-v2.yaml +++ b/athom-smart-plug-v2.yaml @@ -211,7 +211,7 @@ sensor: # Dentra Components - Define the id of the sensor providing 'Total Energy' used - platform: "energy_statistics" - total: energy_total_sensor + total: total_energy_sensor # Dentra Components - Adds Energy Yesterday energy_yesterday: From 75a43d2b376e90a1ed0295897528a10b12f201ca Mon Sep 17 00:00:00 2001 From: Roving Ronin <108674933+Roving-Ronin@users.noreply.github.com> Date: Tue, 2 Jul 2024 10:29:29 +1000 Subject: [PATCH 05/16] Update athom-smart-plug.yaml - To same code level as v2 & v3 plugs Update the v1 smart plug to the same code level of the newer v2 and v3 plugs, as at https://github.com/athom-tech/athom-configs/pull/66 --- athom-smart-plug.yaml | 144 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 136 insertions(+), 8 deletions(-) diff --git a/athom-smart-plug.yaml b/athom-smart-plug.yaml index d5ef4dad..5a816ff5 100644 --- a/athom-smart-plug.yaml +++ b/athom-smart-plug.yaml @@ -1,16 +1,38 @@ substitutions: + name: "athom-smart-plug" friendly_name: "Smart Plug" + # Allows ESP device to be automatically lined to an 'Area' in Home Assistant. Typically used for areas such as 'Lounge Room', 'Kitchen' etc room: "" device_description: "athom smart plug" project_name: "Athom Technology.Smart Plug" - project_version: "1.0.1" + project_version: "1.0.2" relay_restore_mode: RESTORE_DEFAULT_OFF sensor_update_interval: 10s + # Current Limit in Amps. AU Plug = 10. IL, BR, EU, UK, US Plug = 16. + current_limit : "10" + # Define a domain for this device to use. i.e. iot.home.lan (so device will appear as athom-smart-plug-v2.iot.home.lan in DNS/DHCP logs) + dns_domain: "" + # Set timezone of the smart plug. Useful if the plug is in a location different to the HA server. Can be entered in unix Country/Area format (i.e. "Australia/Sydney") + timezone: "" + # Set the duration between the sntp service polling ntp.org servers for an update + sntp_update_interval: "6h" + # Network time servers for your region, enter from lowest to highest priority. To use local servers update as per zones or countries at: https://www.ntppool.org/zone/@ + sntp_server_1: "0.pool.ntp.org" + sntp_server_2: "1.pool.ntp.org" + sntp_server_3: "2.pool.ntp.org" + # Enables faster network connections, with last connected SSID being connected to and no full scan for SSID being undertaken + wifi_fast_connect: "false" + # Define logging level: NONE, ERROR, WARN, INFO, DEBUG (Default), VERBOSE, VERY_VERBOSE + log_level: "INFO" + # Hide the ENERGY sensor that shows kWh consumed, but with no time period associated with it. Resets when device restarted and reflashed. + hide_energy_sensor: "true" esphome: name: "${name}" friendly_name: "${friendly_name}" + comment: "${device_description}" + area: "${room}" name_add_mac_suffix: true min_version: 2024.6.0 project: @@ -22,7 +44,7 @@ esp8266: restore_from_flash: true preferences: - flash_write_interval: 1min + flash_write_interval: 5min api: @@ -30,18 +52,44 @@ ota: - platform: esphome logger: + level: ${log_level} + baud_rate: 0 + +mdns: + disabled: false web_server: port: 80 wifi: - ap: {} # This spawns an AP with the device name and mac address with no password. + # This spawns an AP with the device name and mac address with no password. + ap: {} + # Allow rapid re-connection to previously connect WiFi SSID, skipping scan of all SSID + fast_connect: "${wifi_fast_connect}" + # Define dns domain / suffix to add to hostname + domain: "${dns_domain}" captive_portal: dashboard_import: package_import_url: github://athom-tech/athom-configs/athom-smart-plug.yaml +# Dentra Components - Adds 'Platform - Energy Statistics' +# https://github.com/dentra/esphome-components/tree/master/components/energy_statistics +external_components: + - source: github://dentra/esphome-components + +globals: + - id: total_energy + type: float + restore_value: yes + initial_value: '0.0' + + - id: restore_mode + type: int + restore_value: yes + initial_value: "3" + binary_sensor: - platform: status name: "Status" @@ -95,8 +143,12 @@ sensor: cf_pin: GPIO4 cf1_pin: GPIO5 voltage_divider: 780 + current: name: "Current" + id: current + unit_of_measurement: A + accuracy_decimals: 2 filters: - calibrate_linear: - 0.0000 -> 0.0110 # Relay off no load @@ -109,13 +161,24 @@ sensor: - 9.9171 -> 7.9830 # Normalize for plug load - lambda: if (x < 0.0260) return 0; else return (x - 0.0260); + on_value_range: + - above: ${current_limit} + then: + - switch.turn_off: relay + voltage: name: "Voltage" + id: voltage + unit_of_measurement: V + accuracy_decimals: 1 + filters: + - skip_initial: 2 power: name: "Power" id: socket_my_power unit_of_measurement: W + accuracy_decimals: 1 filters: - calibrate_linear: - 0.0000 -> 0.5900 # Relay off no load @@ -131,8 +194,40 @@ sensor: change_mode_every: 1 update_interval: 5s - - platform: total_daily_energy + # Shows the Energy kWh since the device was last started + energy: + name: "Energy" + id: energy + unit_of_measurement: kWh + accuracy_decimals: 3 + filters: + # Multiplication factor from W to kW is 0.001 + - multiply: 0.001 + on_value: + then: + - lambda: |- + static float previous_energy_value = 0.0; + float current_energy_value = id(energy).state; + id(total_energy) += current_energy_value - previous_energy_value; + previous_energy_value = current_energy_value; + id(energy_total_sensor).update(); + internal: true + + # Shows the TOTAL/Lifetime Energy kWh used by the device, may reset to zero upon firmware updates + - platform: template name: "Total Energy" + id: total_energy_sensor + unit_of_measurement: kWh + device_class: "energy" + state_class: "total_increasing" + icon: "mdi:lightning-bolt" + accuracy_decimals: 3 + lambda: |- + return id(total_energy); + update_interval: ${sensor_update_interval} + + - platform: total_daily_energy + name: "Total Energy Today" power_id: socket_my_power unit_of_measurement: kWh accuracy_decimals: 3 @@ -140,7 +235,33 @@ sensor: filters: - multiply: 0.001 + # Dentra Components - Define the id of the sensor providing 'Total Energy' used + - platform: "energy_statistics" + total: total_energy_sensor + + # Dentra Components - Adds Energy Yesterday + energy_yesterday: + name: "Total Energy Yesterday" + id: total_energy_yesterday + accuracy_decimals: 3 + + # Dentra Components - Adds Energy Week + energy_week: + name: "Total Energy Week" + id: total_energy_week + accuracy_decimals: 3 + + # Dentra Components - Adds Energy Month + energy_month: + name: "Total Energy Month" + id: total_energy_month + accuracy_decimals: 3 + button: + - platform: restart + name: "Restart" + entity_category: config + - platform: factory_reset name: "Reset" id: Reset @@ -186,7 +307,7 @@ text_sensor: # Creates a sensor showing when the device was last restarted - platform: template - name: 'Device Last Restart' + name: 'Last Restart' id: device_last_restart icon: mdi:clock entity_category: diagnostic @@ -194,7 +315,7 @@ text_sensor: # Creates a sensor of the uptime of the device, in formatted days, hours, minutes and seconds - platform: template - name: "Device Uptime" + name: "Uptime" entity_category: diagnostic lambda: |- int seconds = (id(uptime_sensor).state); @@ -220,8 +341,15 @@ text_sensor: time: - platform: sntp id: sntp_time - # Change sync interval from default 5min to 6 hours - update_interval: 360min + # Define the timezone of the device + timezone: "${timezone}" + # Change sync interval from default 5min to 6 hours (or as set in substitutions) + update_interval: ${sntp_update_interval} + # Set specific sntp servers to use + servers: + - "${sntp_server_1}" + - "${sntp_server_2}" + - "${sntp_server_3}" # Publish the time the device was last restarted on_time_sync: then: From 81405c0187dccec4da15af31806b7f9d277fbbde Mon Sep 17 00:00:00 2001 From: Roving Ronin <108674933+Roving-Ronin@users.noreply.github.com> Date: Fri, 5 Jul 2024 10:04:41 +1000 Subject: [PATCH 06/16] Update athom-smart-plug-v2.yaml --- athom-smart-plug-v2.yaml | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/athom-smart-plug-v2.yaml b/athom-smart-plug-v2.yaml index 0656c8e8..cd02fa45 100644 --- a/athom-smart-plug-v2.yaml +++ b/athom-smart-plug-v2.yaml @@ -199,20 +199,27 @@ sensor: return id(total_energy); update_interval: ${sensor_update_interval} - - platform: total_daily_energy - name: "Total Energy Today" - restore: true - power_id: power_sensor - unit_of_measurement: kWh - icon: mdi:hours-24 - accuracy_decimals: 3 - filters: - - multiply: 0.001 +# - platform: total_daily_energy +# name: "Total Energy Today" +# restore: true +# power_id: power_sensor +# unit_of_measurement: kWh +# icon: mdi:hours-24 +# accuracy_decimals: 3 +# filters: +# - multiply: 0.001 # Dentra Components - Define the id of the sensor providing 'Total Energy' used - platform: "energy_statistics" total: total_energy_sensor + # Dentra Components - Adds Energy Today. Persistents if restarted, unlike 'total_daily_energy' + energy_today: + name: "Energy Today" + id: total_energy_today + accuracy_decimals: 3 + icon: mdi:hours-24 + # Dentra Components - Adds Energy Yesterday energy_yesterday: name: "Total Energy Yesterday" From 01bb2bfbf34d3dfeb101df310de80e29d9ffae83 Mon Sep 17 00:00:00 2001 From: Roving Ronin <108674933+Roving-Ronin@users.noreply.github.com> Date: Fri, 5 Jul 2024 10:10:53 +1000 Subject: [PATCH 07/16] Update athom-smart-plug.yaml Replace 'Total Energy Today' with Dentra Component that provides this information, but is persistent between reboots / reflashing versus the previous version that reset to zero every time. --- athom-smart-plug.yaml | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/athom-smart-plug.yaml b/athom-smart-plug.yaml index 5a816ff5..4c0f3560 100644 --- a/athom-smart-plug.yaml +++ b/athom-smart-plug.yaml @@ -226,19 +226,27 @@ sensor: return id(total_energy); update_interval: ${sensor_update_interval} - - platform: total_daily_energy - name: "Total Energy Today" - power_id: socket_my_power - unit_of_measurement: kWh - accuracy_decimals: 3 - restore: true - filters: - - multiply: 0.001 +# - platform: total_daily_energy +# name: "Total Energy Since Boot" +# power_id: socket_my_power +# unit_of_measurement: kWh +# accuracy_decimals: 3 +# restore: true +# filters: +# - multiply: 0.001 +# internal: true # Dentra Components - Define the id of the sensor providing 'Total Energy' used - platform: "energy_statistics" total: total_energy_sensor + # Dentra Components - Adds Energy Today. Persistents if restarted, unlike 'total_daily_energy' + energy_today: + name: "Total Energy Today" + id: total_energy_today + accuracy_decimals: 3 + icon: mdi:hours-24 + # Dentra Components - Adds Energy Yesterday energy_yesterday: name: "Total Energy Yesterday" From 2c0cff49808eb7cd74f4b994074e124406549741 Mon Sep 17 00:00:00 2001 From: Roving Ronin <108674933+Roving-Ronin@users.noreply.github.com> Date: Fri, 5 Jul 2024 10:11:55 +1000 Subject: [PATCH 08/16] Update athom-smart-plug-v2.yaml Replace 'Total Energy Today' with Dentra Component that provides this information, but is persistent between reboots / reflashing versus the previous version that reset to zero every time. --- athom-smart-plug-v2.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/athom-smart-plug-v2.yaml b/athom-smart-plug-v2.yaml index cd02fa45..cc2c219d 100644 --- a/athom-smart-plug-v2.yaml +++ b/athom-smart-plug-v2.yaml @@ -200,7 +200,7 @@ sensor: update_interval: ${sensor_update_interval} # - platform: total_daily_energy -# name: "Total Energy Today" +# name: "Total Energy Since Boot # restore: true # power_id: power_sensor # unit_of_measurement: kWh From 8bc4a36e78e52e02c29e5d0c10015cd1ef4fa7ae Mon Sep 17 00:00:00 2001 From: Roving Ronin <108674933+Roving-Ronin@users.noreply.github.com> Date: Fri, 5 Jul 2024 10:13:57 +1000 Subject: [PATCH 09/16] Update athom-smart-plug-v2.yaml Replace 'Total Energy Today' with Dentra Component that provides this information, but is persistent between reboots / reflashing versus the previous version that reset to zero every time. --- athom-smart-plug-v2.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/athom-smart-plug-v2.yaml b/athom-smart-plug-v2.yaml index cc2c219d..a6111bb2 100644 --- a/athom-smart-plug-v2.yaml +++ b/athom-smart-plug-v2.yaml @@ -200,7 +200,7 @@ sensor: update_interval: ${sensor_update_interval} # - platform: total_daily_energy -# name: "Total Energy Since Boot +# name: "Total Energy Since Boot" # restore: true # power_id: power_sensor # unit_of_measurement: kWh From ef413b3c5f1a950d9c18c5c8b736aeb6497cb964 Mon Sep 17 00:00:00 2001 From: Roving Ronin <108674933+Roving-Ronin@users.noreply.github.com> Date: Fri, 5 Jul 2024 10:35:30 +1000 Subject: [PATCH 10/16] Update athom-smart-plug.yaml --- athom-smart-plug.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/athom-smart-plug.yaml b/athom-smart-plug.yaml index 4c0f3560..e553fcd0 100644 --- a/athom-smart-plug.yaml +++ b/athom-smart-plug.yaml @@ -210,7 +210,7 @@ sensor: float current_energy_value = id(energy).state; id(total_energy) += current_energy_value - previous_energy_value; previous_energy_value = current_energy_value; - id(energy_total_sensor).update(); + id(total_energy_sensor).update(); internal: true # Shows the TOTAL/Lifetime Energy kWh used by the device, may reset to zero upon firmware updates From 5313f47cf24f1b7f5cf356093dac7055fedbf5e1 Mon Sep 17 00:00:00 2001 From: Aiden <37043404+tarontop@users.noreply.github.com> Date: Fri, 16 Aug 2024 17:16:19 +0800 Subject: [PATCH 11/16] Remove External Components --- athom-smart-plug-v2.yaml | 82 ++++++++++++++++++++-------------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/athom-smart-plug-v2.yaml b/athom-smart-plug-v2.yaml index a6111bb2..5092870f 100644 --- a/athom-smart-plug-v2.yaml +++ b/athom-smart-plug-v2.yaml @@ -77,8 +77,8 @@ dashboard_import: # Dentra Components - Adds 'Platform - Energy Statistics' # https://github.com/dentra/esphome-components/tree/master/components/energy_statistics -external_components: - - source: github://dentra/esphome-components +# external_components: +# - source: github://dentra/esphome-components uart: rx_pin: RX @@ -175,7 +175,7 @@ sensor: id(total_energy) += current_energy_value - previous_energy_value; previous_energy_value = current_energy_value; id(total_energy_sensor).update(); - internal: ${hide_energy_sensor} + # internal: ${hide_energy_sensor} apparent_power: name: "Apparent Power" @@ -199,44 +199,44 @@ sensor: return id(total_energy); update_interval: ${sensor_update_interval} -# - platform: total_daily_energy -# name: "Total Energy Since Boot" -# restore: true -# power_id: power_sensor -# unit_of_measurement: kWh -# icon: mdi:hours-24 -# accuracy_decimals: 3 -# filters: -# - multiply: 0.001 - - # Dentra Components - Define the id of the sensor providing 'Total Energy' used - - platform: "energy_statistics" - total: total_energy_sensor - - # Dentra Components - Adds Energy Today. Persistents if restarted, unlike 'total_daily_energy' - energy_today: - name: "Energy Today" - id: total_energy_today - accuracy_decimals: 3 - icon: mdi:hours-24 - - # Dentra Components - Adds Energy Yesterday - energy_yesterday: - name: "Total Energy Yesterday" - id: total_energy_yesterday - accuracy_decimals: 3 - - # Dentra Components - Adds Energy Week - energy_week: - name: "Total Energy Week" - id: total_energy_week - accuracy_decimals: 3 - - # Dentra Components - Adds Energy Month - energy_month: - name: "Total Energy Month" - id: total_energy_month - accuracy_decimals: 3 + - platform: total_daily_energy + name: "Total Energy Since Boot" + restore: true + power_id: power_sensor + unit_of_measurement: kWh + icon: mdi:hours-24 + accuracy_decimals: 3 + filters: + - multiply: 0.001 + + # # Dentra Components - Define the id of the sensor providing 'Total Energy' used + # - platform: "energy_statistics" + # total: total_energy_sensor + + # # Dentra Components - Adds Energy Today. Persistents if restarted, unlike 'total_daily_energy' + # energy_today: + # name: "Energy Today" + # id: total_energy_today + # accuracy_decimals: 3 + # icon: mdi:hours-24 + + # # Dentra Components - Adds Energy Yesterday + # energy_yesterday: + # name: "Total Energy Yesterday" + # id: total_energy_yesterday + # accuracy_decimals: 3 + + # # Dentra Components - Adds Energy Week + # energy_week: + # name: "Total Energy Week" + # id: total_energy_week + # accuracy_decimals: 3 + + # # Dentra Components - Adds Energy Month + # energy_month: + # name: "Total Energy Month" + # id: total_energy_month + # accuracy_decimals: 3 button: - platform: restart From 6ea727b5cee5048880898b5c8dd9d1031cf676ba Mon Sep 17 00:00:00 2001 From: Aiden <37043404+tarontop@users.noreply.github.com> Date: Fri, 16 Aug 2024 17:19:18 +0800 Subject: [PATCH 12/16] Remove External Components --- athom-smart-plug.yaml | 78 +++++++++++++++++++++---------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/athom-smart-plug.yaml b/athom-smart-plug.yaml index e553fcd0..5f35cbaf 100644 --- a/athom-smart-plug.yaml +++ b/athom-smart-plug.yaml @@ -76,8 +76,8 @@ dashboard_import: # Dentra Components - Adds 'Platform - Energy Statistics' # https://github.com/dentra/esphome-components/tree/master/components/energy_statistics -external_components: - - source: github://dentra/esphome-components +# external_components: +# - source: github://dentra/esphome-components globals: - id: total_energy @@ -211,7 +211,7 @@ sensor: id(total_energy) += current_energy_value - previous_energy_value; previous_energy_value = current_energy_value; id(total_energy_sensor).update(); - internal: true + # internal: ${hide_energy_sensor} # Shows the TOTAL/Lifetime Energy kWh used by the device, may reset to zero upon firmware updates - platform: template @@ -226,44 +226,44 @@ sensor: return id(total_energy); update_interval: ${sensor_update_interval} -# - platform: total_daily_energy -# name: "Total Energy Since Boot" -# power_id: socket_my_power -# unit_of_measurement: kWh -# accuracy_decimals: 3 -# restore: true -# filters: -# - multiply: 0.001 -# internal: true + - platform: total_daily_energy + name: "Total Energy Since Boot" + power_id: socket_my_power + unit_of_measurement: kWh + accuracy_decimals: 3 + restore: true + filters: + - multiply: 0.001 + internal: true # Dentra Components - Define the id of the sensor providing 'Total Energy' used - - platform: "energy_statistics" - total: total_energy_sensor - - # Dentra Components - Adds Energy Today. Persistents if restarted, unlike 'total_daily_energy' - energy_today: - name: "Total Energy Today" - id: total_energy_today - accuracy_decimals: 3 - icon: mdi:hours-24 - - # Dentra Components - Adds Energy Yesterday - energy_yesterday: - name: "Total Energy Yesterday" - id: total_energy_yesterday - accuracy_decimals: 3 - - # Dentra Components - Adds Energy Week - energy_week: - name: "Total Energy Week" - id: total_energy_week - accuracy_decimals: 3 - - # Dentra Components - Adds Energy Month - energy_month: - name: "Total Energy Month" - id: total_energy_month - accuracy_decimals: 3 + # - platform: "energy_statistics" + # total: total_energy_sensor + + # # Dentra Components - Adds Energy Today. Persistents if restarted, unlike 'total_daily_energy' + # energy_today: + # name: "Total Energy Today" + # id: total_energy_today + # accuracy_decimals: 3 + # icon: mdi:hours-24 + + # # Dentra Components - Adds Energy Yesterday + # energy_yesterday: + # name: "Total Energy Yesterday" + # id: total_energy_yesterday + # accuracy_decimals: 3 + + # # Dentra Components - Adds Energy Week + # energy_week: + # name: "Total Energy Week" + # id: total_energy_week + # accuracy_decimals: 3 + + # # Dentra Components - Adds Energy Month + # energy_month: + # name: "Total Energy Month" + # id: total_energy_month + # accuracy_decimals: 3 button: - platform: restart From 27a6dc9c6fbc239c5489fc8309b7aaa072942623 Mon Sep 17 00:00:00 2001 From: Aiden <37043404+tarontop@users.noreply.github.com> Date: Fri, 16 Aug 2024 17:40:27 +0800 Subject: [PATCH 13/16] Fix indentation errors --- athom-smart-plug-v2.yaml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/athom-smart-plug-v2.yaml b/athom-smart-plug-v2.yaml index 785fe7c9..3eef7dda 100644 --- a/athom-smart-plug-v2.yaml +++ b/athom-smart-plug-v2.yaml @@ -200,15 +200,15 @@ sensor: return id(total_energy); update_interval: ${sensor_update_interval} - - platform: total_daily_energy - name: "Total Energy Since Boot" - restore: true - power_id: power_sensor - unit_of_measurement: kWh - icon: mdi:hours-24 - accuracy_decimals: 3 - filters: - - multiply: 0.001 + - platform: total_daily_energy + name: "Total Energy Since Boot" + restore: true + power_id: power_sensor + unit_of_measurement: kWh + icon: mdi:hours-24 + accuracy_decimals: 3 + filters: + - multiply: 0.001 # # Dentra Components - Define the id of the sensor providing 'Total Energy' used # - platform: "energy_statistics" From 733b418463522d2d18688fc8907d774d5bf53a7c Mon Sep 17 00:00:00 2001 From: Aiden <37043404+tarontop@users.noreply.github.com> Date: Fri, 16 Aug 2024 17:41:32 +0800 Subject: [PATCH 14/16] Fix indentation errors --- athom-smart-plug.yaml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/athom-smart-plug.yaml b/athom-smart-plug.yaml index af8b138b..236b88be 100644 --- a/athom-smart-plug.yaml +++ b/athom-smart-plug.yaml @@ -227,15 +227,14 @@ sensor: return id(total_energy); update_interval: ${sensor_update_interval} - - platform: total_daily_energy - name: "Total Energy Since Boot" - power_id: socket_my_power - unit_of_measurement: kWh - accuracy_decimals: 3 - restore: true - filters: - - multiply: 0.001 - internal: true + - platform: total_daily_energy + name: "Total Energy Since Boot" + power_id: socket_my_power + unit_of_measurement: kWh + accuracy_decimals: 3 + restore: true + filters: + - multiply: 0.001 # Dentra Components - Define the id of the sensor providing 'Total Energy' used # - platform: "energy_statistics" From 389f0db8da374a4a95c1a2677a5589cfedec5032 Mon Sep 17 00:00:00 2001 From: Aiden <37043404+tarontop@users.noreply.github.com> Date: Fri, 16 Aug 2024 17:45:58 +0800 Subject: [PATCH 15/16] Update athom-smart-plug-v2.yaml --- athom-smart-plug-v2.yaml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/athom-smart-plug-v2.yaml b/athom-smart-plug-v2.yaml index 3eef7dda..ace4d215 100644 --- a/athom-smart-plug-v2.yaml +++ b/athom-smart-plug-v2.yaml @@ -200,15 +200,15 @@ sensor: return id(total_energy); update_interval: ${sensor_update_interval} - - platform: total_daily_energy - name: "Total Energy Since Boot" - restore: true - power_id: power_sensor - unit_of_measurement: kWh - icon: mdi:hours-24 - accuracy_decimals: 3 - filters: - - multiply: 0.001 + - platform: total_daily_energy + name: "Total Energy Since Boot" + restore: true + power_id: power_sensor + unit_of_measurement: kWh + icon: mdi:hours-24 + accuracy_decimals: 3 + filters: + - multiply: 0.001 # # Dentra Components - Define the id of the sensor providing 'Total Energy' used # - platform: "energy_statistics" From 53230ad9cd5bcc3812496b1d7b49e64d32702c53 Mon Sep 17 00:00:00 2001 From: Aiden <37043404+tarontop@users.noreply.github.com> Date: Fri, 16 Aug 2024 17:50:49 +0800 Subject: [PATCH 16/16] Update athom-smart-plug.yaml --- athom-smart-plug.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/athom-smart-plug.yaml b/athom-smart-plug.yaml index 236b88be..57aa26e1 100644 --- a/athom-smart-plug.yaml +++ b/athom-smart-plug.yaml @@ -227,14 +227,14 @@ sensor: return id(total_energy); update_interval: ${sensor_update_interval} - - platform: total_daily_energy - name: "Total Energy Since Boot" - power_id: socket_my_power - unit_of_measurement: kWh - accuracy_decimals: 3 - restore: true - filters: - - multiply: 0.001 + - platform: total_daily_energy + name: "Total Energy Since Boot" + power_id: socket_my_power + unit_of_measurement: kWh + accuracy_decimals: 3 + restore: true + filters: + - multiply: 0.001 # Dentra Components - Define the id of the sensor providing 'Total Energy' used # - platform: "energy_statistics"