Template sensor does not appear

Hi,
I am quite new to HA.
I configured a sensor via Developertools/Templates. My target was to extract the attribut “current_temperature” from my heatingthermostat. (Comet DECT 700018) to use it later in automatisations.

Here’s the code:

  - platform: template
    sensors:
    TemperaturWohn:
      entity_id: sensor.TemperaturWohn
      value_template: "{{ states.climate.comet_dect_1.attributes.current_temperature | int }}"
      feindly_name: "Temperatut Heizung"

Here what as a result is shown:

- platform: template
    sensors:
    TemperaturWohn:
      entity_id: sensor.TemperaturWohn
      value_template: "23"
      feindly_name: "Temperatut Heizung"

I restarted everything, but the sensor does not appear, if I try to add it to a lovelace.

found this, but does not realy helps me:

Can anybody help or give me advice?
thx

There was quite a bit wrong with your sensor. Try this:

- platform: template
    sensors:
      temperatur_wohn: # this must be lower case, and notice the indentation
        value_template: "{{ state_attr('climate.comet_dect_1', 'current_temperature') }}" # Fixed quite a few things here
        friendly_name: "Temperatur Heizung" # I don't speak German but I think this is the correct spelling
        unit_of_measurement: "°C" # this is required if you ever want to make a graph

Typo:
states() state_attr()

1 Like

Fixed. Thanks.

Hi. Via /Developertools/templates it didn’t work. No error but the sensor didn’t show up.
So I copied your code to my configuration.yaml,

I received an error “Invalid config for [sensor.template]: [unit_of_measuremant] is an invalid option for [sensor.template].”

So i deleted that line and it works, even with a graph (i think so) I have to observe if it realy shows the right values.

Anyway, thanks a lot so far for your help.

Because I cant spell.

unit_of_measuremant: should be unit_of_measurement:

Sorry.

Hi,
thanks for checking again. If would have payed a little bit more attention …