I am losing my mind on getting the Energy screen to work properly. This seems so easy, yet…
In the US, we can measure how much energy the house uses and how much solar produces but we just don’t have a way to measure data from the actual meter(s), that I can find. I don’t want to create a Raspberry Pi camera that “watches” the numbers on the meters and waterproofing, etc. Besides, I have, what should be, enough data to figure this out, right?!
Home Usage Tracking:
In my case, I use the Emporia Vue to read kWh from my home usage. I was going to use the Shelly EM, but I found out about the Emporia Vue and how it can track individual circuits AND whole home energy usage. (Thanks for the advice Rob from the Hook Up!) This has worked for months now, verified by matching my bills usage, all from the energy section in HA. THIS is part of the reason I’m going crazy, this has worked perfectly since I got the Emporia Vue this summer. But!, we just added Solar to our home.
Solar Production Tracking:
I have just had solar installed and the inverter can read and report to HA the instant power (kW) and can track energy (kWh). I have SolarEdge (SE) and the SE modbus integration from HACS gives me the kWh from sensor: sensor.solaredge_ac_energy_kwh, works great.
The Problem, CREATING Good Data:
The 1st problem is this SE sensor is lifetime production and not reset daily for energy. This works fine for the Solar section of the Energy screen and will reset the shown data properly every day but I haven’t been able to figure out how to use this data to reliably figure out how to create template sensors (or meters or whatever) to provide the “Return to Grid” and “Grid Consumption” to the energy. I’ve created so many template sensors and helper utility meters trying to get these to work but I can’t seem to get it to work.
I need a clean slate, has anyone solved this? Thank you, and sorry for the detail.
Does anyone know how to get the “Return to Grid” and “Grid Consumption” to calculate in a way the displays properly on the Energy tab of HA with just Home usage and Solar production? If you only add Emporia Vue to Grid Consumption, it will show the house used 100% of that as used from the home. This is great until I added solar. It then showed that my home used ALL of the Grid Consumption AND ALL of the Solar Production. That’s when this journey turned into a frustration-fest!!
I have created template sensors in the configuration.yaml, but I can’t for the life of me figure out how to get the energy section to work properly:
-
platform: template
sensors:
exported_energy:
friendly_name: Exported Energy
unit_of_measurement: “kWh”
device_class: energy
value_template: >
{% if ((states(‘sensor.daily_solar_production’)|float - states(‘sensor.red_oak_123_1d’)|float)) | int >= 0 %}
{{ (states(‘sensor.daily_solar_production’)|float - states(‘sensor.red_oak_123_1d’)|float)|round(3) }}
{% else %}
0.0
{% endif %} -
platform: template
sensors:
imported_energy:
friendly_name: Imported Energy
unit_of_measurement: “kWh”
device_class: energy
value_template: >
{% if ((states(‘sensor.red_oak_123_1d’)|float - states(‘sensor.daily_solar_production’)|float)) | int >= 0 %}
{{ (states(‘sensor.red_oak_123_1d’)|float - states(‘sensor.daily_solar_production’)|float)|round(3) }}
{% else %}
0.0
{% endif %}