Hi,
I could say you are really not far away
I also wanted to know info for last month and etc. I| just added a little calculations for what day of month is today. So my code is:
sensor:
- platform: template
sensors:
# energy_usage:
# friendly_name: "Energijos sąnaudos"
# device_class: power
# value_template: "{{ state_attr('switch.sonoff_powermeter', 'power') }}"
today_consumption:
friendly_name: "Šiandien"
device_class: power
unit_of_measurement: kwh
value_template: "{{ state_attr('switch.sonoff_powermeter', 'consumption')[0] }}"
yesterday_consumption:
friendly_name: "Vakar"
device_class: power
unit_of_measurement: kwh
value_template: "{{ state_attr('switch.sonoff_powermeter', 'consumption')[1] }}"
this_week_consumption:
friendly_name: "Einamoji savaitė"
device_class: power
unit_of_measurement: kwh
value_template: "
{% set p=state_attr('switch.sonoff_powermeter', 'consumption') %}
{% set days=now().weekday()+1 %}
{{ p[1:(days)]|sum if p }}"
this_month_consumption:
friendly_name: "Einamasis mėnuo"
device_class: power
unit_of_measurement: kwh
value_template: "
{% set p=state_attr('switch.sonoff_powermeter', 'consumption') %}
{% set days=now().day %}
{{ (p[1:(days)]| sum if p )|round(2) }}"
it is easier now actually. Sonoff pow used to have a service called “consumption”…and you just had to do the math to get the daily, monthly usage, etc. Now, this service no longer exists, but now there´s a new entity “ENERGY” … you just have to add it to your energy panel… I do not like to use this energy panel, and I’m still trying to figure out how to generate an entity from this panel to get a regular entity to use in my dashboards…(energy panel could generate a month entity, instead of we have to create an entity using utility meter)
I have two separate phases coming to my house, one for the 2 ACs, and the other for all other devices. (The reason for this, that here we have a special price for AC heating for the winter, if you are using this kind of energy with AC higher SCOP rates)
So originally my idea was to use a Shelly EM with two 50A clamp, but it turned out, that Shelly EM cannot measure energy on a different phase - so its not working with one ShellyEM for two phases.
When the AC was set up 2 years ago, I’ve added two Sonoff POW2 for each AC, after the breaker, so I have measurement for the ACs already, but as it did not provided energy entity, I could not use it.
Now I would like to measure the ACs with Sonoff, and the other phase with Shelly, and I’m fine with the Energy dashboard as a beginning.
I was so happy that I found your topic, and I could enable the Energy entity on the Sonoff integration, but it says ‘Unknown’, and no any value in it.
What did I get wrong? Do I need to wait?
Same with me. I think it might be a firmware thing though. Had my POWR320D set up and working, and I am pretty sure there was a value there. But device had FW update, so I did that (on version 1.0.7 now) and now my Energy is also not showing up. So might be FW.