Hassio Problem with concatenate rhasspy parameter to get climate temperature

I know, this is hassio Problem. Just a try.

I try to get my climate temperatures by event, called from rhasspy.
The names of the climates are
climate.ROOM_heizung (climate.wohnzimmer_heizung, climate_badezimmer_heizung, etc.)
The given parameter is room.

This works:
In other automations this works.In this case other parameter, are given (light.wohnzimmer_deckenlampe), if no room is given, it will take the sitId, which is always given.

#   rhasspy_ChangeLightState    
    - id: '1614092734440'
      alias: rhasspy_ChangeLightState
      - platform: event
        event_type: rhasspy_ChangeLightState
      - service: light.turn_{{ trigger.event.data.state }}
          entity_id: >
            {% if trigger.event.data.room %}
              light.{{ trigger.event.data.room}}_{{ trigger.event.data.device}}
            {% else %}
              light.{{ trigger.event.data._intent.siteId}}_{{trigger.event.data.device}}
            {% endif %}
      - service: mqtt.publish
          payload_template: >
            {% if trigger.event.data.state == "ON" %}
              {"siteId": "{{trigger.event.data._intent.siteId}}",
               "text": "Ich habe das Licht angemacht"}
            {% else %}
              {"siteId": "{{trigger.event.data._intent.siteId}}",
               "text": "Ich habe das Licht ausgemacht"}
             {% endif %}
          topic: hermes/tts/say

This does not work:

{{ state_attr("climate." + {{trigger.event.data.room}} + "_heizung", 'current_temperature') }} 


{{ state_attr("climate.{{trigger.event.data.room}}_heizung", 'current_temperature') }} 

should become:

{{ state_attr('climate.wohnzimmer_heizung', 'current_temperature') }}  

Thanks in advance

Not really the most appropriate place for this kind of request… You should ask on the Home Assistant forum.

Just a guess though…

{{ state_attr("climate." + trigger.event.data.room + "_heizung", 'current_temperature') }} 

I Love you. :heart_eyes: :heart_eyes: :heart_eyes: :stuck_out_tongue_winking_eye:
I tried for three days. You got it.
Thank you very much.


- id: 'rhasspy_Get_local_temperature'
  alias: rhasspy_Get_local_temperature
  - platform: event
    event_type: rhasspy_Get_local_temperature
    - service: mqtt.publish
        payload_template: >
                {"siteId": "{{trigger.event.data._intent.siteId}}",
                 "text": "Die aktuelle Temperatur im Raum {{trigger.event.data.room}} beträgt {{ state_attr("climate." + trigger.event.data.room + "_heizung", 'current_temperature') }}  Grad "}
        topic: hermes/tts/say      
  mode: single

I am trying to do a similar thing but failing. I have tried the great suggestion from @fastjack but it doesn’t seem to work in my case.

I think it’s because I don’t need the additional…

, 'current_temperature'

bit. It also seems to object to the use of…


… when I use this I don’t get any response at all from Rhasspy.

My full issue, start to finish, is this:

I’m trying to create a sentence with associated automation to pull the temperature from various rooms. Each room contains a temperature sensor.

My sentence is set up thus:

whats the temperature in the (kitchen:sensor.kitchen_temperature | office:sensor.office_temperature | garage:sensor.garage_temperature){entity}

… and the HA automation is:

- id: Rhasspy GetTemperature
  alias: Rhasspy GetTemperature
  mode: single
    - platform: event
      event_data: {}
      event_type: rhasspy_GetTemperature
    - service: mqtt.publish
        topic: hermes/dialogueManager/endSession
        payload_template: '{"sessionId": "{{ trigger.event.data._intent.sessionId }}", "text": "The temperature in the {{ trigger.event.data.entity_raw_value }} is {{ trigger.event.data.entity }} degrees."}'

… but an example of the spoken result is:
“The temperature in the kitchen is sensor.kitchen underscore temperature degrees”

… so it’s pulling the entity name but not its value (state? numerical state?)

I’ve tried using all sorts of variants of:

  • states.trigger.event.data.entity
  • states.trigger.event.data.entity.state
  • variations on the state_attr(“states.” + trigger.event.data.entity + “.state”) theme
    … but to no avail.

Any assistance gratefully received.


“state_attr” returns the content af a specific attribute. In my case, it was the attribute "‘current_temperature’ cause my climate uses this attribute

  • {{ state_attr(“climate.wohnzimmer_heizung”, ‘current_temperature’) }}

find out:

In your case, you should check the attribute name:

  • Homeassistant → Developer Tools → States
  • In Entity put the entity_id in (sensor.kitchen_temperature)

You will see all attributes of this entity and actual values
For example: if there is an attribute named “DING_DING”, you should create:

{{ state_attr("sensor.kitchen_temperature, ‘DING_DING’) }}

test it:

Now you should control, if your stuff works

  • Homeassistant → Developer Tools → TEMPLATE
  • Put the example in the Template editor and you should see the value

HA automation

payload_template: ‘{
   “sessionId”: “{{ trigger.event.data._intent.sessionId }}”,
   “text”:      “The temperature in the {{ trigger.event.data.entity_raw_value }} is
                 {{ state_attr( trigger.event.data.entity, ‘DING_DING’) }} degrees.”

Hope, that works