OrangeAssist - Google Assistant Integration

When i tigger how’s my day it does not respond in my Google Home.

/Mike

Well of course. It won’t trigger your GH. The code itself is the assistant. You get the response through the API. You need to trigger routines if you have routines set in your GH app. I had mine to broadcast “my day” to the kitchen GH device.

Spent all night trying to figure out why this won’t run… Was using this -

root@ubuntu1:/orange-assist# python3.7 -m orangeassist

when i should be using this incase someone needs it

root@ubuntu1:/orange-assist# python3.7 -m or

And in general, you shouldn’t be using root :wink:

Can I install this straight onto my openhab server?

Hi Lucky !
This is a very interresting project, thanks you for sharing it with us.
You’ve said in the first post :

Could you please explain this feature a little bit more ?
In side of the google assistant integration, I also use somes IFTTT applets to manage some commands that are not handle by GA. (Like say “Ok Google, I’m leaving home” and this trigger an openhab rules.)
I wish to know if with your tool we can avoid IFTTT and register our own Voice commands ?
Or maybe if you know a way to do that. I’ve found IFTTT not very handy and slow somes times…

Best regards

I think this is what Google Assistant Routines are for.

Create a Switch Item that triggers the Rule you want. Tag this Item as switchable and sync devices in Google Assistant. Test that you can switch the Item by asking Google assistant to turn the Item ON.

If that all works open Google Home, tap your account (bottom right icon) and tap Settings. Tap “Assistant” and you will find Routines in the list. Add a new Routine.

  • Add commands = “I’m leaving home”
  • Add Action = “Turn on MyLeavingHomeItem”

You can add more than one command like “Heading out” and “See you later”. You can also have more than one Action. Actions can be pretty much anything you can ask Google Assistant to do.

Yup. @rlkoshak is correct. You create routines that will turn on/off several items. What I usually do is create a switchable item for a group item. The group item then turns on/off several items.

My most used one is the GA speaker I have in the garage. I just say “I’m going to work.” It will lock the garage, turn off all lights (or leave one on if at night time), arm the alarm, and send a a notification to my phone.

Hi, and thanks you for your answer.
Yeah I agree with that, but with IFTTT, you can send some parameters to a String Item, for exemple, say “Switch to channel number $” and the action set a String Item to “Channel $” that will be handle by a rule.
I don’t know if I can / how to do that with GA routines.

As far as I know the only tags the GA integration supports right now that lets GA pass a value to OH are Lighting and TargetTemperature. Perhaps you can figure out something that makes sense with these.

Hummm … ok I see what you mean … thanks you for pointing this out !

Yes. You can do that to. I use it on my Diy IR blaster. You need to use a thermostat tag or a dimmer

Anyone?

Yes you can

nup this is too technical and the instructions are assuming I have some technical knowledge - i no idea if I am supposed to submit my google stuff for verification and im lost in venvs and not sure if the order is stuffed up now or how to start again
think i might wait for a market binding - hope this is on the cards

Here are some of my notes on installation and configuration of OrangeAssist that may be related to my having a non-standard config I’m working on. I started with the image from Google AIY Voice which might not completely match a standard Raspbian environment.

  • All the Google config stuff was already set up for me as I was starting from a Google AIY Voice project.

  • I tried to install Python 3.7 but in the end I couldn’t get pip to work as it kept complaining about missing SSL. Since Lucky provided a 3.4 branch I backed that out and will just use what Raspian comes with.

  • Installing the prerequisites didn’t work right.

    • gevent failed to install with
      ValueError: ("Expected ',' or end-of-list in", "cffi >= 1.11.5 ; sys_platform == 'win32' and platform_python_implementation == 'CPython'", 'at', " ; sys_platform == 'win32' and platform_python_implementation == 'CPython'")
      The solution is to upgrade setuptools into the virtualenv.
      pip install --upgrade setuptools

    • The next error complained of Python.h missing. To fix that install the python3-dev package using apt.
      sudo apt-get install python3-dev

  • When I tried to generate credentials I got a 403 error from Google. The error page indicates that the OAuth consent screen must be explicitly set up. I just added a support email and logo and it worked. Not sure if both are needed.

  • And now I’m dead in the water. I’m getting “Could not create the device instance. Project_id from side channel and project_id from url do not match.” I’ve recreated the credentials twice and still get the same error. Guess I need to recreate the project on Google’s side instead of reusing the the old Google AIY project. Something to try on another day. But hopefully the gotchas I ran into above will help others who ran into the same problem.

I find it easier to use the registration tool
https://developers.google.com/assistant/sdk/reference/device-registration/device-tool

1 Like

Hi everyone.

I’ve created a docker image to play with this useful tool, I share it here if it can be usefull to someone and how to do it.

This image contain Python 3.7.3 from a slim debian and get the lastest version of orange assist on github.

You must have credentials.json and config.json files in the same directory where you launch the container.

Follow Lucky’s guide until step 5 to download the client_secret_xxx file and store it in the same directory you will launch the container.

In place of steps 4 and 5, use the following :

Create the Dockerfile for the image :

FROM python:3.7.3-slim-stretch

RUN apt-get update && \
        apt-get install -y --no-install-recommends git wget \
        portaudio19-dev libffi-dev libssl-dev libmpg123-dev && \
        apt-get clean && \
        rm -rf /var/lib/apt/lists/*

WORKDIR /opt
RUN git init && git pull https://github.com/LuckyMallari/orange-assist.git
RUN pip3 install -r requirements.txt && \
    pip3 install --upgrade google-auth-oauthlib[tool]
EXPOSE 2828
ENTRYPOINT ["/usr/local/bin/python3"]
CMD ["/opt/or.py"]

Build the image with :

docker build -t orange-assist .

Generate Credentials
To generate credentials.json file for the first time, we can start a temporary container :

docker run --name temp --entrypoint=/bin/bash -dt orange-assist

Copy client secret downloaded previously in step 2.5 into it :

docker cp client_secret_xxxxxxxxxxxxx.apps.googleusercontent.com.json temp:/opt

Login into the container :

docker exec -it temp /bin/bash

Follow the guide from point 6, you don’t need to install oauthlib-tool, just go to the step two and create credentials.json file
Exit the container with CTRL+D
Get back the credentials file :

docker cp temp:/root/.config/google-oauthlib-tool/credentials.json ./

Stop and Delete the temp container :

docker stop temp && docker rm temp

Put in the same directory a config.json that suit your needs.
Start the final container with this command :

docker run \
        --name orange \
        --restart unless-stopped \
        -p 2828:2828 \
        -v $(pwd)/credentials.json:/root/.config/google-oauthlib-tool/credentials.json \
        -v $(pwd)/config.json:/opt/config.json \
        -dt \
        orange-assist

You can see if everything start well with :

docker logs orange

Have fun !

4 Likes

Hi @luckymallari!

How do I stop it from showing up in Home app under devices?
On every restart of the service it registers a new instance…
Got 14 of them so far in those several months of use :laughing:

GH - Account - General Settings - Settings - Assistant Devices