synesthesiam / voice2json

Command-line tools for speech and intent recognition on Linux
MIT License
1.09k stars 63 forks source link

Query Json with python #25

Closed infinitymakerspace closed 4 years ago

infinitymakerspace commented 4 years ago

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 commented 4 years ago

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}) | \nlight_state = (on | off) {state}\n\nturn [the] \nturn [the] \n\n[ChangeLightColor]\nlight_name = (bedroom light) {name}\ncolor = (red | green | blue) {color}\n\nset [the] [to] \nmake [the] \n\n[ChangeDispenserState]\ndispenser_name = ((dispenser) {name})\ndispenser_state = (on | off) {state}\n\nturn [the] \nturn [the] \n", "slots": [ { "fileName": "rhasspy/number", "managedBy": "external", "fileContent": null, "executable": true } ], "removeSlots": false } ]

synesthesiam commented 4 years ago

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

infinitymakerspace commented 4 years ago

Its for a multi basin sanitizing station where the anti bacterial soap pump and water pumps arr triggered water and soap fuses before it comes out then 10 seconds in the soap cuts off and water runs for rinse and aftrer 10 seconds shuts down. Its still early prototype and testing. Its for a potential customer

On Thu, 16 Jul 2020, 19:03 Michael Hansen, notifications@github.com wrote:

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

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/synesthesiam/voice2json/issues/25#issuecomment-659544526, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOR3576MFVSDE47PSS3AQU3R34XEXANCNFSM4O2VJRXQ .