Custom temperature sensor

Morning All,

im still quite new to home assistant! I have a three smart TRV’s I am wanting to convert the temperature status into a sensor so I can include it in some bedroom cards that I am making.

I have done the following code which is passing the developer check and restarting fine but I cannot see the sensors anywhere. Am I doing something wrong or looking in the wrong place?

Here is the code:

CONVERT TEMPERATURE OF ROOMS

Riley_temperature:

      friendly_name: 'Rileys Room'

      value_template: "{{ state_attr('climate.rileys_room', 'current_temperature') }}"

Bedroom_temperature:

    friendly_name: 'Bedroom'

    value_template: "{{ state_attr('climate.bedroom', 'current_temperature') }}"

Dressing_temperature:

    friendly_name: 'Dressing Room'

    value_template: "{{ state_attr('climate.dressing_room', 'current_temperature') }}"

Don’t use capital letters.

Thanks, I have removed the capitals and not made any difference.

You have reloaded the YAML, right?

If so, please post the complete sensor file.

here is the full sensor yaml file:

sensor:

  • platform: systemmonitor

    resources:

    • type: disk_use_percent

      arg: /config

    • type: memory_free

    • type: memory_use

    • type: memory_use_percent

    • type: processor_temperature

    • type: disk_free

    • type: disk_use

    • type: processor_use

  • platform: template

    sensors:

    nextsunrise:

    entity_id: sun.sun
    
    friendly_name: 'Next Sunrise'
    
    value_template: >
    
      {{ as_timestamp(states.sun.sun.attributes.next_rising) | timestamp_custom(' %I:%M %p') | replace(" 0", "") }}
    
    icon_template: mdi:weather-sunset-up
    

    nextsunset:

    entity_id: sun.sun
    
    friendly_name: 'Next Sunset'
    
    value_template: >
    
      {{ as_timestamp(states.sun.sun.attributes.next_setting) | timestamp_custom(' %I:%M %p') | replace(" 0", "") }}
    
    icon_template: mdi:weather-sunset-down
    

Minimal configuration of the standard time and date sensor

  • platform: time_date

    display_options:

    • ‘date_time_iso’

Build on the standard sensor to produce one that can be customized

template:

  • sensor:

    • name: “Date and time”

      state: “{{ as_timestamp(states(‘sensor.date_time_iso’)) | timestamp_custom(’%A %B %-d’) }}”

      icon: “mdi:calendar-clock”

  • sensor:

    • name: “Date and time”

      state: “{{ as_timestamp(states(‘sensor.date_time_iso’)) | timestamp_custom(’%A %B %-d, %I:%M %p’) }}”

      icon: “mdi:calendar-clock”

CONVERT TEMPERATURE OF ROOMS

riley_temperature:

      friendly_name: 'Rileys Room'

      value_template: "{{ state_attr('climate.rileys_room', 'current_temperature') }}"

bedroom_temperature:

    friendly_name: 'Bedroom'

    value_template: "{{ state_attr('climate.bedroom', 'current_temperature') }}"

dressing_temperature:

    friendly_name: 'Dressing Room'

    value_template: "{{ state_attr('climate.dressing_room', 'current_temperature') }}"

Ok, this is a little hard to read because the code is not set in backticks (see no. 11 of the community guidelines). If I can read it correctly, you have placed the legacy sensor code under the template domain. However, legacy template sensors belong to the domain sensor.

1 Like