Change value from Wh to KWh

I’ve created an automation that reads out values ​​from our SMA PV system to me. Below is an example.

I’ve created an automation that reads out values ​​from our SMA PV system to me. Below is an example.

It’s working fine so far, except that the values ​​are recorded in Wh. However, I would like to have them read out in kWh. Does anyone have any ideas how I can proceed?

action: tts.speak
metadata: {}
data:
  cache: true
  media_player_entity_id: media_player.display_sofa_fully_kiosk
  message: >-
    Du hast heute schon ganze {{states('sensor.gedo_pv_erzeugung_heute')}} KWh
    Strom erzeugt. Gesamt hast du {{states('sensor.sma_pv_gedo_pv_gen_meter')}}
    KWh erzeugt
target:
  entity_id: tts.google_translate_de_de

action: tts.speak
metadata: {}
data:
  cache: true
  media_player_entity_id: media_player.display_sofa_fully_kiosk
  message: >-
    Du hast heute schon ganze {{ states('sensor.gedo_pv_erzeugung_heute')|float(0) /1000 }} KWh
    Strom erzeugt. Gesamt hast du {{ states('sensor.sma_pv_gedo_pv_gen_meter') }}
    KWh erzeugt
target:
  entity_id: tts.google_translate_de_de

Thank you. That’s exactly what I was looking for.
That works for me:



1 Like

Next Automation I have a new Problem.

action: tts.speak
metadata: {}
data:
  cache: true
  media_player_entity_id: media_player.display_sofa_fully_kiosk
  message: Der Batterie Status ist {{states('sensor.sma_pv_gedo_battery_status_operating_mode')}}
target:
  entity_id: tts.google_translate_de_de

In the operating mode google speak “charging battery”
How can i translate to “Batterie wird geladen”?

You’d need to add a check/translation into your message along these lines:

{% if states('sensor.sma_pv_gedo_battery_status_operating_mode') == 'charging battery' %}
  Batterie wird geladen
{% endif %}

The safest way to get the correct string after the == is to find the sensor state in the Developer tools - states.

If you want use different states, e.g. ‘Batterie wird entladen’ or ‘Batterie Status unbekannt’, you’ll have to find out how these states are reported and add a few {% elif %} and/or {% else %} lines to the message.

Thanks a lot. Now I’m finish.

If the dashboard normally shows the right translation, you can also try:

{{ state_translated('sensor.sma_pv_gedo_battery_status_operating_mode') }}
1 Like