Skip to content

Commit 5a5c60b

Browse files
author
Xavier Berger
committed
refactor(energy_counter): Use plarform 'integration' instead of 'total_daily_energy'
1 parent 1014b08 commit 5a5c60b

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

solar_router/energy_counter_theorical.yaml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,15 @@ script:
3636
# Sensor showing the actual energy diverted consumption
3737
sensor:
3838
- id: energy_diverted
39-
platform: total_daily_energy
39+
platform: integration
4040
name: 'Total energy diverted'
41-
power_id: power_divertion
41+
sensor: power_divertion
4242
unit_of_measurement: 'kWh'
4343
state_class: total_increasing
4444
device_class: energy
4545
accuracy_decimals: 3
46+
time_unit: h
47+
restore: true
4648
filters:
4749
# Multiplication factor from W to kW is 0.001
4850
- multiply: 0.001
@@ -51,17 +53,20 @@ sensor:
5153
name: Power divertion
5254
id: power_divertion
5355
unit_of_measurement: 'W'
56+
device_class: power
5457

5558
# Enable time component to
5659
# - Update energy diverted counter
57-
# - Reset energy at midnight
60+
# - Reset energy counter at midnight
5861
time:
59-
- platform: homeassistant
60-
id: homeassistant_time_for_solar_router
61-
6262
- platform: sntp
6363
on_time:
6464
# Trigger action every second
6565
- seconds: /1
6666
then:
67-
- script.execute: energy_diverted_counter
67+
- script.execute: energy_diverted_counter
68+
- seconds: 0
69+
minutes: 0
70+
hours: 0
71+
then:
72+
- sensor.integration.reset: energy_diverted

0 commit comments

Comments
 (0)