How would I reference {{trigger.event.data.entity}} in an mqtt payload_template to evaluate something like {{states.sensor.outside_temperature.state}}
where {{trigger.event.data.entity}} would replace ‘outside_temperature’.
I have Rhasspy integrated with Home Assistant and is working very well.
I would like to have ‘one’ automation to be able to respond with all the different entities defined in a rhasspy slot.
I have a rhasspy slot setup for $Temperatures containing a list of available temperature sensors available to HA.
The Rhasspy sentence send HA the intent [GetTemperature] as an event, with the tag {entity} which would contain the called for temperature sensor.
So the {entity} tag or {{trigger.event.data.entity}} as HA sees it would contain the temperature entity such as ‘outdoor_temperature’
The issue is that I cannot find a way to evaluate the value of the rhasspy {entity} or HA’s {{trigger.event.data.entity}} to have HA return an actual temperature.
Hopefully someone can guide me in the right direction.
Here is my configuration:
HA version 2021.11.5
Rhasspy version 2.5.11
mqtt is external
audio recording and wake word using UDP
send Events to HA (/api/events)
HA and Rhasspy running on same Intel NUC
no satellites (yet)
Rhasspy sentences:
[GetTemperature]
whats the ($Temperatures) {entity} temperature
whats the temperature ($Temperatures) {entity}
how (hot | cold) is it [in the] ($Temperatures) {entity}
Rhasspy slot: Temperatures
(kitchen | den | downstairs | inside):kitchen_temperature
outside:outside_temperature
((master bath) | bathroom):masterbath_temperature
((bonus room) | (allens office)):bonusroom_temperature
bedroom:mbr_temperature
# not valid
automation:
alias: RhasspyGetTemperature
description: ''
trigger:
- platform: event
event_type: rhasspy_GetTemperature
condition: []
action:
- service: mqtt.publish
data:
topic: hermes/dialogueManager/endSession
payload_template: >-
{"sessionId": "{{trigger.event.data._intent.sessionId}}", "text": "the
{{trigger.event.data.entity_raw_value}} temperature is currently
{{states.sensor.{{trigger.event.data.entity}}.state}} degrees"}
mode: single