I’m trying to make a template sensor that displays the difference between two other sensors but I’m terrible with making templates so I need your help
So I want to determine what the power usage is of my house using a sensor giving me the solar power and a sensor giving me the usage from the grid.
The reason I’m asking for a difference between the two and not just calculate one minus the other is that it can give a negative number if solar power is higher than the usage from the grid.
What I got so far from searching on the internet/forum is the below code:
Thanks for helping out! I’m just not getting the correct result. So I’ve 3 sensors, two of them from my smart meter between my home and the grid, so 1 sensor for usage of the grid and 1 sensor supplying to the grid. Then one more sensor for total power delivered from the solar panels to the house.
So, a moment shot:
Sensor 1: 0,0 kW (no usage from grid)
Sensor 2: 1,3 kW (supplying to the grid)
Sensor 3: 1,74 kW (production from solar panels)
I have a similar problem, I first had the energy used from the net from the 3 fases added with a start value so that is equaled my analog meter (commented out). I then changed the template so that I can subtract the energy sent to the net by my solar panels because the analog meter can count backwards. But now i get an Unknown value on lovelace.