When I get to HA an intent from Rhasspy, the name slot will contain the substituted value (e.g. cupboard_lights instead of cupboard light). I know that it is possible to use raw_value to access the original text (before the substitution occurs), but I don’t know how to read it from the slots array…
I have the following sentences in sentences.ini file:
[ChangeLightState]
light_name = ($lights){name}
light_state = (on | off) {state}
(switch | turn) <light_state> [the] <light_name>
(switch | turn) [the] <light_name> <light_state>
I have defined the following lights slot:
(cupboard light):cupboard_lights
(living room lamp):living_room_lamp
(hall lamp):hall_lamp
(sink light | sink lamp):sink_lamp
And I substitute the name of the light with the HA name of the device.
And at the HA end, I have the following automation:
alias: Rhasspy - Turn the lights on and off
trigger:
- platform: event
event_type: rhasspy_ChangeLightState
condition: []
action:
- service_template: light.turn_{{trigger.event.data.state}}
data:
entity_id: light.{{trigger.event.data.name}}
- service: mqtt.publish
data:
topic: hermes/dialogueManager/endSession
payload_template: >-
{"sessionId": "{{trigger.event.data._intent.sessionId}}", "text": "Okay.
I turned the light {{ trigger.event.data.state }}"}
mode: single
I would like HA to return the actual (spoken) name of the light when publishing in the hermes/dialogueManager/endSession topic. How should I alter the payload_template?