@Oleksii_Zelivianskyi wrote:
I’m out of ideas and I need some help.
I want to have a sum of all values of sensor, how can I do it correctly?I have PZEM sensor reporting electricity use every minute.
Then I have utility_meeter taking values from this sensor and counting daily and monthly usage.
I want to have a sum off all values of utility_meeter sensor to have my current electricity meter readings on screen. I tried to create statistics sensor.My config:
utility_meter: daily_energy: source: sensor.pzem_004t_energy cycle: daily tariffs: - peak - offpeak monthly_energy: source: sensor.pzem_004t_energy cycle: monthly tariffs: - peak - offpeak sensor: - platform: statistics name: "Energy use offpeak stats" entity_id: sensor.monthly_energy_offpeak - platform: statistics name: "Energy use peak stats" entity_id: sensor.monthly_energy_peak - platform: template sensors: energy_counter_day: friendly_name: "Electro meeter day" unit_of_measurement: 'кВт' value_template: "{{ (states('input_number.pokhibka_lichilnika_ee_den')|float + (state_attr('sensor.energy_use_peak_stats', 'total')/ 1000))|float|round(2) }}" energy_counter_night: friendly_name: "Electro meeter night" unit_of_measurement: 'кВт' value_template: "{{ (states('input_number.pokhibka_lichilnika_ee_nich')|float + (state_attr('sensor.energy_use_offpeak_stats', 'total')/ 1000))|float|round(2) }}"
It works but today I noticed value drop and I don’t understand what is wrong?
Posts: 1
Participants: 1