SolarEdge from Wh to kWh

Hi,
I hope someone can help me,
I have a SolarEdge transformer. But the the information I get from the API server from SolarEdge is in Wh.
Hou can I convert it to kWh.
Is it possible to change the values within Home Assistant.

If you need more information, please let me know
Currently running the latest version of HA: 0.101.2

Greetings
Palermo

I also have a SE transformer. The easiest what you can do is make a template sensor and divide the original sensor value by 1000.

See part of my config:

Can i use this configuration in HA>Developer tool>states,
In my case select: sensor.solaredge_energy_today and change it in the: State attributes (YAML, optional) ?
Or do i need to change it in the configuration.yaml

Greetings
Palermo

Skye is talking about creating a template sensor. That page along with this one should have everything you need to know.

The value_template would look something like this in your case:

"{{ states('sensor.solaredge_energy_today') | float / 1000 }}"

@ Skye And @Tediore,
Thank for helping. I`m gonna look into it. Never used templates before.

Greatly appreciate it :smiley:
Gr Palermo

Well. Been reading, playing, configuring. Still no sigar.
If been testing with one sensor to see if it works. I currently have the following in the configuration:

sensor:

  • platform: template
    sensors:
    solaredge_energy_today_kwh:
    friendly_name: ‘Vandaag’
    unit_of_measurement: ‘kWh’
    value_template: “{{ states(‘sensor.solaredge_energy_today’) | float / 1000 }}”
    icon_template: mdi:white-balance-sunny

If checkt the configuration, and it should be vallid according HA. But nothing happens with the values.

Screen Shot 2019-11-06 at 6.08.33 AM.png

What am i missing.
appreciate the help
Gr
Palermo

Can you format your code properly? Use three backticks ( ` ) above and below the code.

Also, what is the value of sensor.solaredge_energy_today?

Hi, Sorry for the code, I mess it up
Here is the correct format.

sensor:
  - platform: template
    sensors:
      solaredge_energy_today_kwh:
        friendly_name: 'Vandaag'
        unit_of_measurement: 'kWh'
        value_template: "{{ states('sensor.solaredge_energy_today') | float / 1000 }}"
        icon_template: mdi:white-balance-sunny

Well today the values for today is still 0 because its quite early in the morning here :smiley:
But the unit of measurement is still Wh like in the screenshot.

Thanks. The template sensor will create a new entity with the sensor’s value (it won’t change anything with the sensor that your referenced in the template). Based on what you named it, it should be sensor.solaredge_energy_today_kwh. Use that sensor in your frontend.

Unless you’re actually saying the template sensor itself doesn’t have the correct unit of measurement…which would be strange because your formatting is right. icon_template isn’t a template like it’s supposed to be, but if you’re not getting errors related to that then I guess it’s ok.

Ok,
Took me some time sorry, kids, work, Television series I needed to watch, and so on.
But i got it working. Still it took me some time. I had to read you post several times to understand it. (I`m no coder)
I had to change and try lots of the configuration and i ended up with the following which worked for me:

sensor:
  - platform: template
    sensors:
      solaredge_energy_today_kwh:
        friendly_name: 'Vandaag'
        unit_of_measurement: 'kWh'
        value_template: "{{ states('sensor.solaredge_energy_today') | float / 1000 }}"
        icon_template: mdi:solar-power
  - platform: template
    sensors:
      solaredge_energy_month_kwh:
        friendly_name: 'Maand'
        unit_of_measurement: 'kWh'
        value_template: "{{ states('sensor.solaredge_energy_this_month') | float / 1000 }}"
        icon_template: mdi:solar-power

The YAML markup I find rather difficult. But it comes slowly to me :slight_smile:

@Tediore Thanks for you patience and you help

4 Likes