rob
January 7, 2020, 11:02am
1
Hi there!
I am trying to edit my profile in the advanced tab in order to use a custom program for intent handling.
"handle": {
"system":"command",
"command": {
"program": "/home/pi/.config/rhasspy/intenthandler.py"
"arguments": []
},
"forward_to_hass": false
}
But when I hit “save profile” and restart Rhasspy, the added part is gone. Since that is a change diffferent from the default, I am wondering why it is not shown? Thanks for any help!
The code only saves non-standard/custom portions of your profile. Perhaps your config YAML matches the default a little too closely?
1 Like
rob
January 7, 2020, 2:04pm
3
Thank you! The thing is that’s the template
“handle”: {
“system”: “command”,
“command”: {
“program”: “/path/to/program”,
“arguments”: []
},
“forward_to_hass”: true
}
so it can’t really differ that much
do you need a comma after the program line?
"handle": {
"system":"command",
"command": {
"program": "/home/pi/.config/rhasspy/intenthandler.py",
"arguments": []
},
"forward_to_hass": false
}
1 Like
rob
January 7, 2020, 3:10pm
5
You’re right, thank you very much! Unfortunately, Rhasspy’s behaviour doesn’t change Still not saved
hmmm… need a space after the colon in
"system": "command",
but that’s the only other syntax issue that I can see. Might want to check that all the parts above and below what you shared are valid json, too, including starting with a {
Obvious, I know, but it’s always the punctuation that gets me.
1 Like
rob
January 7, 2020, 3:52pm
7
Embarrrassing how many typos I missed Thanks again! I hope there is no left
{
“microphone”: {
“arecord”: {
“device”: “default:CARD=seeed4micvoicec”
},
“system”: “arecord”
}
“handle”: {
“system”: “command”,
“command”: {
“program”: “/home/pi/.config/rhasspy/intenthandler.py”,
“arguments”: []
},
“forward_to_hass”: false
}
}
That’s how I’m trying to save it now, but it still doesn’t work I’m sorry to bother you! Obviously there’s something I’m missing, I’m sure it’s something stupid…
Your JSON is missing a comma before “handle”.
Here you go (the corrected version):
{
"microphone": {
"arecord": {
"device": "default:CARD=seeed4micvoicec"
},
"system": "arecord"
},
"handle": {
"system": "command",
"command": {
"program": "/home/pi/.config/rhasspy/intenthandler.py",
"arguments": []
},
"forward_to_hass": false
}
}
You can use something like this to validate your JSON before submitting it:
4 Likes
rob
January 8, 2020, 10:30am
9
What a powerful tool, thank you very much! I don’t know why, but Rhasspy still only saves the microphone part …
My input:
{
“microphone”: {
“arecord”: {
“device”: “default:CARD=seeed4micvoicec”
},
“system”: “arecord”
},
“handle”: {
“system”: “command”,
“command”: {
“program”: “/home/pi/.config/rhasspy/intenthandler.py”,
“arguments”: []
},
“forward_to_hass”: false
}
}
What Rhasspy shows after save and automatic restart
{
“microphone”: {
“arecord”: {
“device”: “default:CARD=seeed4micvoicec”
},
“system”: “arecord”
}
}
EDIT: After updating to 2.4.16, rhasspy shows me this after the save and automatic restart:
{
“microphone”: {
“arecord”: {
“device”: “default:CARD=seeed4micvoicec”
},
“system”: “arecord”
},
“handle”: {
“system”: “command”,
“command”: {
“program”: “/home/pi/.config/rhasspy/intenthandler.py”
}
}
}
Also, it doesn’t call my program
“error”: “[Errno 2] No such file or directory: ‘/home/pi/intenthandler.py’: ‘/home/pi/intenthandler.py’”
But I guess that’s another story
jamesb
January 13, 2020, 6:07am
10
Nice suggestion on the tool, I wonder who created these tools for a developer whose life got easier. I use similar tools for JSON.
Thank you Fastjack for suggesting this JSON tool.
1 Like