I’m attempting the template example given in rhasspy docs to control lights in homeassistant, using a data template. The tutorial uses JSON data in slots, but rhasspy no longer seems to use JSON for slots, instead using a text file. I found that an entry such as:
(door lights){switch.door_lights}
(kitchen lights){switch.kitchen_lights}
(basement lights){switch.basement_lights}
(dining lights){switch.dining_lights}
(garage lights){switch.garage_lights}
is accepted by rhasspy. The sentences entry reads:
[ChangeLightState]
state = (on | off) {light_state}
turn [the] ($lights) {light_name} <state>
turn <state> [the] ($lights) {light_name}
When triggered by voice recognition the following JSON is produced:
{
"intent": {
"name": "ChangeLightState",
"confidence": 1
},
"entities": [
{
"entity": "light_state",
"value": "on",
"value_details": {
"kind": "Unknown",
"value": "on"
},
"raw_value": "on",
"start": 5,
"end": 7,
"raw_start": 5,
"raw_end": 7
},
{
"entity": "switch.kitchen_lights",
"value": "kitchen lights",
"value_details": {
"kind": "Unknown",
"value": "kitchen lights"
},
"raw_value": "kitchen lights",
"start": 12,
"end": 26,
"raw_start": 12,
"raw_end": 26
},
{
"entity": "light_name",
"value": "",
"value_details": {
"kind": "Unknown",
"value": ""
},
"raw_value": "",
"start": 12,
"end": 26,
"raw_start": 12,
"raw_end": 26
}
],
"slots": {
"light_state": "on",
"switch.kitchen_lights": "kitchen lights",
"light_name": ""
},
"text": "turn on the kitchen lights",
"raw_text": "turn on the kitchen lights",
"tokens": [
"turn",
"on",
"the",
"kitchen",
"lights"
],
"raw_tokens": [
"turn",
"on",
"the",
"kitchen",
"lights"
],
"wakeword_id": "jarvis_raspberry-pi",
"siteId": "default",
"sessionId": "default-jarvis_raspberry-pi-275ba5d4-85ac-4c7d-be65-fb717bf804c6",
"customData": "jarvis_raspberry-pi",
"wakewordId": "jarvis_raspberry-pi",
"lang": null
}
As you see, no value for light_name is sent to HA, but there it is needed in the automation data template. Should the slots entry be another format, or somehow use JSON? Any help is appreciated.