It seems that the sensor with unit kWh is needed. Not the ordinary Watts! It works now.
Of course, a sensor that shows Watts measures power, but you need an energy sensor (power over time).
My energy integration stopped updating the graph? No errors anywhere I can see. Any suggestions on how to fix or what to check?
Thanks all for your info in this post, it’s been helping me to progress this. Unfortunately I’ve not be able to get it working and I’ve tried both old and new template sensors.
I’m using a Shelly EM which works great and sends its data using MQTT. Here’s a simple card with the data items:
Here is the sensor defintion (shame the new method cant use friendly_name):
template:
- sensor:
- name: "house_energy_kwh"
# friendly_name_template: "House Energy (Total)"
unit_of_measurement: "kWh"
state_class: measurement
device_class: energy
state: >
{% set phase1 = states('sensor.shellyem3_8caab561f4aa_channel_a_energy') | float %}
{% set phase2 = states('sensor.shellyem3_8caab561f4aa_channel_b_energy') | float %}
{% set phase3 = states('sensor.shellyem3_8caab561f4aa_channel_c_energy') | float %}
{{ float(phase1) + float(phase2) + float(phase3) }}
Here is the active sensor definition:
For some reason the new “Energy” configuration UI will not allow me select the “sensor.house_energy_kwh” entity as the “Grid Consumption” sensor:
Ive got the point where after 4 hours of trial and error i’m giving up for a while in the hope that HA will recognise the entity in the “Energy” UI once its populated with some more data…
Any and all ideas are welcome. Thx
The ‘some’ reason is : there is no last_reset attribute.
template:
- sensor:
- name: "house_energy_kwh"
# friendly_name_template: "House Energy (Total)"
unit_of_measurement: "kWh"
state_class: measurement
device_class: energy
state: >
{% set phase1 = states('sensor.shellyem3_8caab561f4aa_channel_a_energy') | float %}
{% set phase2 = states('sensor.shellyem3_8caab561f4aa_channel_b_energy') | float %}
{% set phase3 = states('sensor.shellyem3_8caab561f4aa_channel_c_energy') | float %}
{{ float(phase1) + float(phase2) + float(phase3) }}
attributes:
last_reset: '1970-01-01T00:00:00+00:00'
Thanks @fancisp, that worked a treat and now I just need to wait for the values to populate. Thanks again and I hope this helps others
I have a problem too.
The “cost” is not recalculated to me.
But in the interface, the data is displayed.
My localization is “RU”
What am I doing wrong. Thanks
sensor:
- platform: integration
source: sensor.charger_volt_power
name: energy_spent
round: 2
I’m fighting with this, but no success, maybe someone can help?
Got you! I have changed W to Wh, however, nothing show up again, do I need to restert HA?
UPDATE:
Ok so what you need to do in order for the thing to work: make sure you have Energy kWh measurement in your system, I have it in configuration file.
If you have Power, which is instant measurements, you can change it to kWh, which mend that if you use instant data 1 hr and devide it to 1000 you will have kWh:
- name: Pgrid
address: 25214
scan_interval: 10
slave: 4
input_type: holding
scale: 0.001
offset: 0
unit_of_measurement: "kWh"
precision: 1
device_class: energy
Then you should go to Configuration tab → Customization and find your device there and add state class: measurement:
Hit SAVE, check again your configuration files and restart HA!
And you still get nothing )))
Below two devices, one is MQTT and it works, other MODBUS and it doesn’t!
unit_of_measurement: kWh
friendly_name: Pgrid
device_class: energy
state_class: measurement
state_class: measurement
unit_of_measurement: kWh
friendly_name: Washing_Machine ENERGY Total
device_class: energy
You still need a last_reset
Where to add this?
You can’t do that.Use the integration integration
And use the left method.
Thanks, will try!
No success, I have added the following into sensor.yaml as you proposed:
- platform: integration
source: sensor.power
name: solar_energy
unit_prefix: k
round: 2
method: left
, restarted HA and still nothing:
UPDATE:
I have checked STATES and here what I get, I think problem is with unit of measurements, will fix and report back!
Just wait a little. The integration produces results once an hour. And that kwhh I just saw
All worked, thanks to you! However I do not see data on the right, it shows 0kWh,
where if I go to DeveloperTools/STATES:
it shows 0.15
any idea?
While I like the idea of the Energy consumption card, I am missing a possibility to use the Greeneye Monitor as source. This is what I use to track detailed energy use, including the main consumption. I ended up just building a lovelace dashboard.
Wait at least one hour, as said already the energy dashboard only updates once every hour.
So even though your sensor shows a value now, the energy dashboard needs some time to update.
You probably only need to add some attributes to your sensor in order for them to be available for the energy dashboard. As this whole energy thing is pretty new, it will take some time until all the integrations adapt it.