I have a API Rest “sensor” that reads the Watt produced by my solar panels each 1 sec. as configured in the code below.
At the moment it is configured with state_class: total and I have also tried with “meassurement” and “total_increase”. None of the configurations sums the data correct so it’s displayed correctly in the Energy Dashboard.
The data look like this in the “history” when it’s configured as “total”.
I have a feeling that I need the sensor to be configured as “measurement” and in some way create a new sensor that used this data that sums it up correctly.
So the question is: does someone have an idea how to create a sensor, based on a API rest call for every 1 second that can be used to sum the total amount of Watt in the Energy Dashboard?
As you can see in the graph below the data on the sensor goes up and down each second according to the amount produced watt.
When compared to the summarized data in the Energy Dashboard the data looks totally off. Produced power goes up and down which is not possible and the total sum for this example is only 3,87 kWh and should be around 34 kWh .
Then feed this rest power sensor to the Riemann Sum helper to integrate power with respect to time to get energy. Be sure to use method: left. Use this energy sensor in your energy dashboard.
I ended up though doing a configuration with template still, I tried you simple solution but couldn’t get HA to accept, I had json entity error it said.
So the code that did the trick ended up like (and I converted to W instead of kW) :