No Sensors - Error

NHey guys, need your help. I would create a overview from our tumble dryer (trockner). It is connected with a “Fritz Dect 210” socket. The identify of the devices and entities are without problems…

I see:

That i can display the sensor datas i have to add the sensors in the configuration.yaml - i do it like this:

sensor:  
  - platform: template
    sensors:
      trockner_watts:
        friendly_name_template: "{{ states.switch.trockner.name}} Aktueller Verbrauch"
        value_template: '{{ states.switch.trockner.attributes["current_power_w"] | float }}'
        unit_of_measurement: 'W'
      trockner_total_kWh:
        friendly_name_template: "{{ states.switch.trockner.name}} Gesamt Verbrauch"
        value_template: '{{ states.switch.trockner.attributes["total_consumption"] | float }}'
        unit_of_measurement: 'kWh'
      trockner_temperature:
        friendly_name_template: "{{ states.switch.trockner.name}} Aktuelle Temperatur"
        value_template: '{{ states.switch.trockner.attributes["temperature"] | float }}'
        unit_of_measurement: '°C'

But it doesn’t work and i have no ideas what is wrong…on verify from the configuration i get this:

Konfiguration fehlerhaftKONFIGURATION PRÜFEN

Invalid config for [sensor.template]: invalid slug trockner_total_kWh (try trockner_total_kwh) for dictionary value @ data[‘sensors’]. Got OrderedDict([(‘trockner_watts’, OrderedDict([(‘friendly_name_template’, ‘{{ states.switch.trockner.name}} Aktueller Verbrauch’), (‘value_template’, ‘{{ states.switch.trockner.attributes[“current_power_w”] | float }}’), (‘unit_of_measurement’, ‘W’)])), (‘trockner_total_kWh’, OrderedDict([(‘friendly_name_template’, ‘{{ states.switch.trockner.name}} Gesamt Verbrauch’), (‘value_template’, ‘{{ states.switch.trockner.attributes[“total_consumption”] | float }}’), (‘unit_of_measurement’, ‘kWh’)])), (… (See ?, line ?).

Would be nice if some can help…thank you! :slight_smile:

Remove the capital W and replace with lowercase w. Can only be lower case letters, underscore or numbers.

Why use a template for the friendly name?

Are you expecting the friendly name to change?

2 Likes

Woah, Thank you @tom_l - so simpl…

I got this from this manual…

Just because it can be done does not always mean it should. Seems like a waste of CPU cycles to me to generate a name that will never change by using a template. You can just use friendly_name: YOUR NAME HERE

Okidoki, thanks again, i will do it. Nice evening and greetings

1 Like