Node Red / google home

Alexa, Google Home and Siri
Post Reply
piedro
Posts: 3
Joined: Wednesday 07 November 2018 12:09
Target OS: Linux
Domoticz version:
Contact:

Node Red / google home

Post by piedro » Wednesday 07 November 2018 14:12

With node red an google-action response (https://flows.nodered.org/node/node-red ... gle-action) a domoticz voice interface can be build.

You need a domain name, (self-signed) SSL certificates and have to open a port to your server and an ac.json file for the gaction deploy command

ac.json:

Code: Select all

{
  "actions": [
    {
      "description": "Default Welcome Intent",
      "name": "MAIN",
      "fulfillment": {
        "conversationName": "Piedro"
      },
      "intent": {
        "name": "actions.intent.MAIN",
        "trigger": {
          "queryPatterns": [
            "talk to Piedro"
          ]
        }
      }
    }
  ],
  "conversations": {
    "Piedro": {
      "name": "Piedro",
      "url": "http://youraddress.nl:1885"
    }
  },
  "locale": "nl"
}

Code: Select all

gactions test -preview_mins 9999999 -action_package ac.json -project projectnl-fffff
Proof of concept NR flow:

Code: Select all

[{"id":"722d2b6d.22ade4","type":"google-action in","z":"b0f263a2.64a2c","name":"Action Request","topic":"action","port":"1885","url":"/","key":"/node-red/server.key","cert":"/node-red/server.crt","x":103,"y":108,"wires":[["541ee53.1b1d21c","d65e779f.0ee598"]]},{"id":"541ee53.1b1d21c","type":"debug","z":"b0f263a2.64a2c","name":"","active":true,"console":"false","complete":"true","x":1235,"y":124,"wires":[]},{"id":"6141a85c.4c3a78","type":"google-action response","z":"b0f263a2.64a2c","name":"","x":1242,"y":196,"wires":[]},{"id":"9829ba84.fdbb98","type":"change","z":"b0f263a2.64a2c","name":"Goodbye","rules":[{"t":"set","p":"payload","pt":"msg","to":"See ya later","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":617,"y":552,"wires":[["541ee53.1b1d21c","6141a85c.4c3a78"]]},{"id":"298f0c9e.a24074","type":"switch","z":"b0f263a2.64a2c","name":"Question","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"lamp aan","vt":"str"},{"t":"cont","v":"lamp uit","vt":"str"},{"t":"cont","v":"stop","vt":"str"},{"t":"cont","v":"geniaal","vt":"str"},{"t":"else"}],"checkall":"true","outputs":5,"x":421,"y":262,"wires":[["cb5d6f6e.a90a7"],["5096e285.82644c"],["d4cc7a0b.19c5e8"],["13050e02.e84ab2"],["cd420bdb.9d7248"]],"outputLabels":["number","","","","don't understand"]},{"id":"cb5d6f6e.a90a7","type":"change","z":"b0f263a2.64a2c","name":"Lamp aan","rules":[{"t":"set","p":"closeConversation","pt":"msg","to":"false","tot":"bool"},{"t":"set","p":"payload","pt":"msg","to":"Lamp aan","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":621,"y":206,"wires":[["541ee53.1b1d21c","6141a85c.4c3a78","aa65f781.d39f08"]]},{"id":"cd420bdb.9d7248","type":"change","z":"b0f263a2.64a2c","name":"Don't understand","rules":[{"t":"set","p":"closeConversation","pt":"msg","to":"false","tot":"bool"},{"t":"set","p":"payload","pt":"msg","to":"Sorry Ik begrijp je even niet","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":597,"y":440,"wires":[["541ee53.1b1d21c","6141a85c.4c3a78"]]},{"id":"b3ca28e1.090888","type":"change","z":"b0f263a2.64a2c","name":"Begin","rules":[{"t":"set","p":"closeConversation","pt":"msg","to":"false","tot":"bool"},{"t":"set","p":"payload","pt":"msg","to":"Wat wil je? Lamp aan of Lamp uit?","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":421,"y":149,"wires":[["541ee53.1b1d21c","6141a85c.4c3a78"]]},{"id":"d65e779f.0ee598","type":"switch","z":"b0f263a2.64a2c","name":"Intent","property":"intent","propertyType":"msg","rules":[{"t":"eq","v":"actions.intent.MAIN","vt":"str"},{"t":"eq","v":"actions.intent.TEXT","vt":"str"},{"t":"eq","v":"actions.intent.CANCEL","vt":"str"}],"checkall":"true","outputs":3,"x":216,"y":218,"wires":[["b3ca28e1.090888"],["298f0c9e.a24074"],["9829ba84.fdbb98"]],"outputLabels":["MAIN","TEXT","CANCEL"]},{"id":"5096e285.82644c","type":"change","z":"b0f263a2.64a2c","name":"Lamp uit","rules":[{"t":"set","p":"closeConversation","pt":"msg","to":"false","tot":"bool"},{"t":"set","p":"payload","pt":"msg","to":"Lamp uit","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":620,"y":256,"wires":[["541ee53.1b1d21c","6141a85c.4c3a78","61aa12b8.9daddc"]]},{"id":"aa65f781.d39f08","type":"function","z":"b0f263a2.64a2c","name":"DoeLampAan","func":"\nmsg.payload = {};\nmsg.payload.command = \"switchlight\"\nmsg.payload.idx = 6;\nmsg.payload.switchcmd = \"On\"\n\n\nreturn msg;","outputs":1,"noerr":0,"x":936,"y":440,"wires":[["f92a58f8.f79778"]]},{"id":"f92a58f8.f79778","type":"mqtt out","z":"b0f263a2.64a2c","name":"","topic":"domoticz/in","qos":"","retain":"","broker":"362f1eb8.2dcf02","x":1242,"y":282,"wires":[]},{"id":"61aa12b8.9daddc","type":"function","z":"b0f263a2.64a2c","name":"DoeLampUit","func":"\nmsg.payload = {};\nmsg.payload.command = \"switchlight\"\nmsg.payload.idx = 6;\nmsg.payload.switchcmd = \"Off\"\n\n\nreturn msg;","outputs":1,"noerr":0,"x":925,"y":485,"wires":[["f92a58f8.f79778"]]},{"id":"d4cc7a0b.19c5e8","type":"change","z":"b0f263a2.64a2c","name":"Stop","rules":[{"t":"set","p":"closeConversation","pt":"msg","to":"true","tot":"bool"},{"t":"set","p":"payload","pt":"msg","to":"Tot je dienst Piedro","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":630,"y":300,"wires":[["541ee53.1b1d21c","6141a85c.4c3a78"]]},{"id":"13050e02.e84ab2","type":"change","z":"b0f263a2.64a2c","name":"Geniaal","rules":[{"t":"set","p":"closeConversation","pt":"msg","to":"false","tot":"bool"},{"t":"set","p":"payload","pt":"msg","to":"Piedro is Geniaal!","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":565,"y":377,"wires":[["541ee53.1b1d21c","6141a85c.4c3a78"]]},{"id":"362f1eb8.2dcf02","type":"mqtt-broker","z":"","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""}]

User avatar
jvdz
Posts: 1447
Joined: Tuesday 30 December 2014 20:25
Target OS: Raspberry Pi
Domoticz version: Stable
Location: Westland/Netherlands
Contact:

Re: Node Red / google home

Post by jvdz » Wednesday 07 November 2018 17:27

Nice ... I was looking for a direct integration with Google Home and this works nicely. ... thanks for sharing.
Do you also know of a way that you can give commands directly without first "praat met ...." ?

Jos

piedro
Posts: 3
Joined: Wednesday 07 November 2018 12:09
Target OS: Linux
Domoticz version:
Contact:

Re: Node Red / google home

Post by piedro » Wednesday 07 November 2018 18:35

Not that I know of.

Anyhow, you can leave out the 'praat met' en just say 'mijn test-app'

This works in some kind of sandbox of Google Actions.

User avatar
EdwinK
Posts: 1382
Joined: Sunday 22 January 2017 22:46
Target OS: Raspberry Pi
Domoticz version: BETA
Location: Rhoon
Contact:

Re: Node Red / google home

Post by EdwinK » Wednesday 07 November 2018 19:02

So, this is made with a real Google home, instead of Controlicz and other stuff

Need todi sine study on this
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | RFxcom | Dashticz V2

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests