Solaredge PV convertor readings in KWh for Home Assistant

Add following code in the configuration.yaml, configured for your SolarEdge entities, in the sensor section.

sensor:
  - platform: template
  # SolarEdge zonnepanelen in KWh
    sensors:
      solaredge_energy_this_year_kwh:
        friendly_name: "SolarEdge Jaaropbrengst"
        unit_of_measurement: 'KWh'
        value_template: "{{ (states('sensor.solaredge_energy_this_year')|float / 1000)|round(2) }}"
        icon_template: "mdi:solar-power"
      solaredge_energy_this_month_kwh:
        friendly_name: "SolarEdge Maandopbrengst"
        unit_of_measurement: 'KWh'
        value_template: "{{ (states('sensor.solaredge_energy_this_month')|float / 1000)|round(2) }}"
        icon_template: "mdi:solar-power"
      solaredge_energy_today_kwh:
        friendly_name: "SolarEdge Dagopbrengst"
        unit_of_measurement: 'KWh'
        value_template: "{{ (states('sensor.solaredge_energy_today')|float / 1000)|round(2) }}"
        icon_template: "mdi:solar-power"
      solaredge_current_power_kwh:
        friendly_name: "SolarEdge Huidig vermogen"
        unit_of_measurement: 'KWh'
        value_template: "{{ (states('sensor.solaredge_current_power')|float / 1000)|round(3) }}"
        icon_template: "mdi:solar-power"
      solaredge_lifetime_energy_kwh:
        friendly_name: "SolarEdge Totaal"
        unit_of_measurement: 'KWh'
        value_template: "{{ (states('sensor.solaredge_lifetime_energy')|float / 1000)|round(0) }}"
        icon_template: "mdi:solar-power"

Now add the created sensors in your lovelace dashboard and you will see all readings in KWh instead of W