Adding value template to SolarEdge Integration

I added my SolarEdge Inverter using the Configuration - Integrations - Add Integration. This part is working.

But I want to add a value template to change from Watt hours to kilo Watt hours as in the documentation, but where do I put the code? Tried adding to Configuration.yaml but I get an Invalid configuration. I did not find any other place to put it. Can it be added to the entities card for each sensor?, Thanks

Can anyone please help with this?

I had it working in the older system, but not since I upgrade to a RPi 4 and Lovelace.
Thanks,
Chuck

You mean

# Example configuration.yaml entry for template platform
sensor:
  platform: template
  sensors:
    solaredge_energy_this_year_template:
      value_template: "{{ (states('sensor.solaredge_energy_this_year') | float / 1000) | round(2) }}"

It should be in configuration.yaml.
What’s the exact error message you get?

Sorry for the delay, I have been trying different options.
If I change the configuration.yaml to:

sensor:
 - platform: systemmonitor
    resources:
      - type: memory_use_percent
      - type: processor_use
      - type: last_boot
  - platform: template
    sensors:
       solaredge_inverter_current_power
       friendly_name 'Current Power Production'
       value_template: "{{ (states('sensor.solar_edge_inverter_current_power') | float / 1000) | round(1) }}"
       unit_of_measurement: "kWh"

The file editor shows a check mark and no errors.
If I use visual code it has me remove the semi-colons and say invalid type for the value_template.
If I run the configuration checker under the server control it goes into a continuous circle and does not return.
Can I add two sensor groups? Also the other platforms have a dash before them, should this be removed?
Suggestions?
Thanks for the help.

  - platform: template
    sensors:
      solaredge_inverter_current_power_2:
        friendly_name 'Current Power Production'
        value_template: "{{ (states('sensor.solar_edge_inverter_current_power') | float / 1000) | round(1) }}"
        unit_of_measurement: "kWh"

You cannot define a template sensor whose value is itself, though.

Thanks for the help Chris,
That was just one of the problems:

  • The template had the same name.
  • The quotes somehow got changed to the curved quotes instead of straight quotes.
  • I didn’t use the new name on the card, I was using sensor.solar_edge_inverter_current_power instead of sensor.solaredge_inverter_current_power_template.
  • At one point I had changed solaredge_inverter_current_power_kwh to solaredge_inverter_current_power_kWh, It didn’t like the capital letter.

I ended up using the customization off of the configuration page to set the units, device type and friendly name. Then I picked the new state for the entity on the card.
Chuck