Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query Json with python #25

Closed
infinitymakerspace opened this issue Jul 15, 2020 · 3 comments
Closed

Query Json with python #25

infinitymakerspace opened this issue Jul 15, 2020 · 3 comments

Comments

@infinitymakerspace
Copy link

Is there a way to use input from voice2json to trigger action with pyhton script on raspberry pi?

Node Red is a mess and not working smooth and no simple examples.

Regards
Gert

@infinitymakerspace
Copy link
Author

I managed to get it all working many thanks
[
{
"id": "80cde23.fdcfb2",
"type": "tab",
"label": "wakeword",
"disabled": false,
"info": ""
},
{
"id": "38e0c57c.a4530a",
"type": "inject",
"z": "80cde23.fdcfb2",
"name": "",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "5",
"topic": "",
"payload": "start",
"payloadType": "str",
"x": 110,
"y": 400,
"wires": [
[
"78fa719a.b761a"
]
]
},
{
"id": "78fa719a.b761a",
"type": "sox-record",
"z": "80cde23.fdcfb2",
"name": "",
"buttonStart": "msg",
"inputs": 1,
"inputSource": "0,0",
"byteOrder": "-L",
"encoding": "signed-integer",
"channels": 1,
"rate": 16000,
"bits": 16,
"gain": "0",
"lowpass": 8000,
"showDuration": false,
"durationType": "forever",
"durationLength": 0,
"silenceDetection": "nothing",
"silenceDuration": "2.0",
"silenceThreshold": "2.0",
"outputFormat": "stream",
"manualPath": "",
"debugOutput": false,
"x": 270,
"y": 140,
"wires": [
[
"e8b85f5e.ed926"
],
[]
]
},
{
"id": "82e25186.6ea89",
"type": "voice2json-record-command",
"z": "80cde23.fdcfb2",
"name": "",
"voice2JsonConfig": "aa3ded1f.a0f4d",
"inputField": "payload",
"outputField": "payload",
"x": 730,
"y": 240,
"wires": [
[
"af12f0aa.66484",
"210b3e1a.d60882"
]
]
},
{
"id": "af12f0aa.66484",
"type": "change",
"z": "80cde23.fdcfb2",
"name": "listen",
"rules": [
{
"t": "set",
"p": "control",
"pt": "msg",
"to": "listen",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 570,
"y": 480,
"wires": [
[
"e8b85f5e.ed926"
]
]
},
{
"id": "210b3e1a.d60882",
"type": "voice2json-stt",
"z": "80cde23.fdcfb2",
"name": "",
"voice2JsonConfig": "aa3ded1f.a0f4d",
"inputField": "payload",
"controlField": "control",
"outputField": "payload",
"autoStart": true,
"x": 940,
"y": 180,
"wires": [
[
"66d867d2.1d0458",
"37a7238c.e9f1ac"
]
]
},
{
"id": "66d867d2.1d0458",
"type": "debug",
"z": "80cde23.fdcfb2",
"name": "main",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1150,
"y": 180,
"wires": []
},
{
"id": "e8b85f5e.ed926",
"type": "voice2json-wait-wake",
"z": "80cde23.fdcfb2",
"name": "",
"voice2JsonConfig": "aa3ded1f.a0f4d",
"inputField": "payload",
"controlField": "control",
"outputField": "payload",
"nonContinousListen": true,
"x": 460,
"y": 240,
"wires": [
[],
[
"82e25186.6ea89"
]
]
},
{
"id": "9f2c59d6.f72718",
"type": "trigger",
"z": "80cde23.fdcfb2",
"name": "",
"op1": "0",
"op2": "1",
"op1type": "num",
"op2type": "num",
"duration": "20",
"extend": false,
"units": "s",
"reset": "",
"bytopic": "topic",
"topic": "topic",
"outputs": 1,
"x": 1290,
"y": 300,
"wires": [
[
"1bf8ffa2.e7934"
]
]
},
{
"id": "1bf8ffa2.e7934",
"type": "rpi-gpio out",
"z": "80cde23.fdcfb2",
"name": "",
"pin": "11",
"set": true,
"level": "1",
"freq": "",
"out": "out",
"x": 1320,
"y": 420,
"wires": []
},
{
"id": "37a7238c.e9f1ac",
"type": "function",
"z": "80cde23.fdcfb2",
"name": "outputTrue",
"func": "if (msg.payload.text == 'turn on the dispenser') {\nmsg.payload = 0\nreturn msg\n}",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 1060,
"y": 380,
"wires": [
[
"9f2c59d6.f72718",
"f0f20a96.1a0d68"
]
]
},
{
"id": "f0f20a96.1a0d68",
"type": "debug",
"z": "80cde23.fdcfb2",
"name": "FunctionDebugOut",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1300,
"y": 600,
"wires": []
},
{
"id": "aa3ded1f.a0f4d",
"type": "voice2json-config",
"z": "",
"profilePath": "/home/pi/.config/voice2json/",
"name": "enUsKaldi",
"sentences": "[GetTime]\nwhat time is it\ntell me the time\n\n[GetTemperature]\nwhats the temperature\nhow (hot | cold) is it\n\n[GetGarageState]\nis the garage door (open | closed)\n\n[ChangeLightState]\nlight_name = ((living room lamp | garage light) {name}) | <ChangeLightColor.light_name>\nlight_state = (on | off) {state}\n\nturn <light_state> [the] <light_name>\nturn [the] <light_name> <light_state>\n\n[ChangeLightColor]\nlight_name = (bedroom light) {name}\ncolor = (red | green | blue) {color}\n\nset [the] <light_name> [to] \nmake [the] <light_name> \n\n[ChangeDispenserState]\ndispenser_name = ((dispenser) {name})\ndispenser_state = (on | off) {state}\n\nturn <dispenser_state> [the] <dispenser_name>\nturn [the] <dispenser_name> <dispenser_state>\n",
"slots": [
{
"fileName": "rhasspy/number",
"managedBy": "external",
"fileContent": null,
"executable": true
}
],
"removeSlots": false
}
]

@synesthesiam
Copy link
Owner

Glad to hear it! What kind of assistant are you building?

@infinitymakerspace
Copy link
Author

infinitymakerspace commented Jul 16, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants