Create "Current Temp" entity from air con

Hi all,

I’m new to HA and find it all a bit confusing, so this question may be simple and hope you can help.

I have an air conditioner integrated through Sensibo (boy was that an effort for me!). The device exists, but there doesn’t seem to be a current temp entity that I can use in other cards etc.

How do I take the data from one entity and split it so I can use it?

Many thanks

Your current temperature is probably an attribute of your climate entity, not a state.
So you need to create a sensor based on this entity.

This is what works for me:

- platform: template
  sensors:
    zone_1_temp:
      value_template: "{{ states.climate.lyric_12821706.attributes['current_temperature'] | float }}"
      unit_of_measurement: '°F'
      friendly_name: 'Zone 1 Temperature'
    zone_2_temp:
      value_template: "{{ states.climate.lyric_12821546.attributes['current_temperature'] | float }}"
      unit_of_measurement: '°F'
      friendly_name: 'Zone 2 Temperature'
2 Likes

The only thing I would add is a state_class (for long term statistics) and a device_class (mainly for the icon, you could also just add mdi:thermometer).

Also please heed this warning when constructing templates:

https://www.home-assistant.io/docs/configuration/templating/#states

- platform: template
  sensors:
    zone_1_temp:
      value_template: "{{ state_attr('climate.lyric_12821706', 'current_temperature') }}"
      unit_of_measurement: '°F'
      friendly_name: 'Zone 1 Temperature'
      state_class: measurement
      device_class: temperature
    zone_2_temp:
      value_template: "{{ state_attr('climate.lyric_12821546', 'current_temperature') }}"
      unit_of_measurement: '°F'
      friendly_name: 'Zone 2 Temperature'
      state_class: measurement
      device_class: temperature
1 Like

Hi @tom_l - device_class seems to work fine but state_class causes an error:

Invalid config for [sensor.template]: [state_class] is an invalid option for [sensor.template]. Check: sensor.template->sensors->zone_1_temp->state_class.

And:
Do I need the | float in there asa well?

Oh. I thought that had been added. Must still have to use customize for that. Sorry.

Nope. Not unless doing any mathematical operations in the template. Even then you might be able to get away without it. Unlike states (that are always strings), attributes can have other types. In this case it is very likely a number already. Mine are.

Screenshot 2022-02-10 at 12-49-42 Developer Tools – Home Assistant

1 Like

Thanks again, @tom_l !

That whole thing about ‘when is it a number and when is it a string?’ and the conversion from a string to a number, still trips me up, just like the spaces in yaml :frowning:

1 Like

Ah, just realised that this option has only been added to the new template integration, not the older template sensor platform.

Hello, probably reviving a dead post, but how did you guys do this?