Using Rest to obtain solar power to add to the energy panel

Hi
After reading a lot off about the Restful sensors, I can’t add my own sensors to the Energy panel:

I Added this to the configuration.yaml

rest :

  • resource: http://192.168.1.206:3001/hass
    method: GET
    scan_interval: 15
    sensor :
    name: “Consumo watios”
    value_template: ‘{{ value_json.actualpower | float(0) | round(2) }}’
    device_class: energy
    state_class: total_increasing
    unit_of_measurement: kWh

  • resource: http://192.168.1.206:3001/hass
    method: GET
    scan_interval: 15
    sensor :
    name: “Solar”
    value_template: ‘{{ value_json.wattsolar | float(0) | round(0) }}’
    device_class: energy
    state_class: total_increasing
    unit_of_measurement: kWh

With this configuration the panel shows the values, but, the data is increasing, adding the value to the total, has a result the statitics are wrong, because the total_increasing is doing his job, and adds the value to the total.

if I set the state_class to measurement , the value doesn’t appear in the energy panel, same with total, total + last reset…

what I’m doing wrong?

Thanks and happy Christmas!!

Google translate suggests that Consumo watios is watts consumption. I believe that you are trying to use watts (power) as kWh (energy) - “actualpower” and “wattsolar” suggest power!

The energy dashboard reports only energy (kWh), and not power(W).

Solar power produced is measured in watts, and is instantaneous electrical power. Power is a measurement and changes - its value goes up and down. device_class: power, state_class: measurement.

Energy, which is what the energy dashboard wants, is measured in kWh. Energy is the integrated sum of instantaneous power over time. Energy generated, as a value, always increases over time.

For the energy dashboard to see an input sensor it has to be device_class energy (and total_increasing). If not, the dashboard will not see it. The energy dashboard does the job of slicing the energy figure up by day, and reporting only the difference generated / consumed in kWh between midnight and now, each day.

If you want to report solar power, (Watts) then you need to use a power card. There are several community add-on cards available.

If you want to report solar energy generated (kWh), then you need to use a Riemann Sum integration to convert power (W) to energy (kWh).

Feliz Navidad

it’s impossible to answer better!!, thanks for your indications, now it’s working perfect.

Happy New Year my friend.