Page 1 of 1

Assistant Relay

Posted: Fri Oct 16, 2020 8:46 am
by martijnj
I got Housebot connected to Google assistant. I had to build it because IFTTT ransomewared my applets with there pro-version subscription.

Scott already made Google assistant -> Housebot working. But now I can trigger a "works with Google assistant" device in Housebot.

You Need:
Google assistant device (hub or speaker)
Assistant Relay (https://assistantrelay.com/). -> Follow the instructions in Getting Started

After you get Assistant relay working:

Build a python script :

Code: Select all

import sys
import requests

def AssistantRelay(command):
    newHeaders = {'Content-type': 'application/json'}

    response = requests.post('http://127.0.0.1:3000/assistant',
                         data='{"user": "Martijn", "command": "'+ command +'", "broadcast": false, "converse": false }', headers=newHeaders)

    #print("Status code: ", response.status_code)
    sys.exit(response.status_code)
    #response_Json = response.json()

if __name__== "__main__":
     AssistantRelay((sys.argv[1])) 
If you have assistant relay working on an other machine as housebot replace 127.0.0.1 with the IP of your assistant relay machine
Replace "Martijn" with your username in Assistant Relay.

Use the Execute Program Device in Housebot
Arguments: C:\Progra~1\HouseBot\Config\Scripts\AssistantRelay.py "Zonwering Achter openen"
The first part of te Argument is the path and name of your python script. The second is the command that you normaly 'say' to your Google assistant.
Path and name of program: C:\Python39\python.exe (Full path to python.exe)

@Scott: Native Python support in HB would be very handy. Or if someone gets this working with vbs it would work to.