Energy Dashboard custom solar sensor

I have 2 solar panel systems I run at home (just got a new Enphase system that works along side my old system that came with the house)

I have managed to get the Enphase system to work in the Energy Dashboard but I can get the older System to do the same.

The older system isnt reporting to HA at all apart from a custom sensor I crated that takes the new system and divides the result by 6, its a very rough estimate but testing over the last month its the closet I can get.

This is the sensor:

- platform: template
  sensors:
    old_solar_system:
      friendly_name: "Old Solar"
      unit_of_measurement: "kW"
      device_class: power
      value_template: "{{ (states('sensor.envoy_SERIALNUMBER_today_s_energy_production') | float / 6) | round(3) }}"

I also tried setting the device class to energy

- platform: template
  sensors:
    old_solar_system:
      friendly_name: "Old Solar"
      unit_of_measurement: "kW"
      device_class: energy
      value_template: "{{ (states('sensor.envoy_SERIALNUMBER_today_s_energy_production') | float / 6) | round(3) }}"

The problem is I can not get this to be selectable in the energy dashboard config drop down list.

I also added this under utility_meter in my config file and that didnt help either.

  old_solar_estimated_energy:
    name: Old Solar Estimated Energy
    source: sensor.old_solar_system
    cycle: daily

What am I missing to add this to my dashboad.

That’s because it has the wrong unit. Energy is measured in kWh or Wh, not kW or W.

Also as well as the correct device class of energy you need a valid state class, (total or total_increasing). You can not do this with the old template sensor format.

This is why you should be using the new template sensor format. The old style is not getting updated with new features.

It’s not that different and is well documented: Template - Home Assistant

Here’s an example (configuration.yaml):

template:
  - sensor:
      - name: "Old Solar"
        unit_of_measurement: "kWh"
        device_class: energy
        state_class: total_increasing # or just "total" if it does not periodically reset
        state: "{{ (states('sensor.envoy_SERIALNUMBER_today_s_energy_production') | float(0) / 6) | round(3) }}"
        availability: "{{ (states('sensor.envoy_SERIALNUMBER_today_s_energy_production') | is_number }}"
1 Like

Thanks, that is now working!

It has a strange issues (might not be strange) it started updating the energy page, but it was added alot more than it should. The sensor was showing 1.5kWh for the day so far and after 2 hours that had added 20ish kWh to the Solar total.

Show the history graph for sensor.envoy_SERIALNUMBER_today_s_energy_production

Like this?

Yes like that. I don’t see anything that could have caused the template sensor to misbehave. Can you share the history of the template sensor sensor.old_solar too?

Yep sure here you go.

I have added the old solar back into the dashboard today and it appears to be correct now, maybe it didnt like being added in half way in the day and some calculations got out of wack, ill keep an eye on it.

I have also just bought a Tuya Life WiFi Energy Meter 80A with Current Transformer Clamp that I can attach to my old solar out going lead that will give me live updates so hoping that will replace this all together anyway :slight_smile:

Thanks for the help!