OrangeAssist - Google Assistant Integration

Awesome! I updated the OP

I don’t see 2 being confusing from a user’s perspective. People already all why they can’t tell GA to do stuff with the existing bindings. I’m not positive, but I think that the Alexa binding already does have Orange Assist type capabilities.

Users will expect that if they install a GA binding, they will get two way integration. Having two bindings to connect to GA would be more confusing.

Similarly, having one binding that supports both services would be unexpected. In OH 2, the trend had been to move away from such bindings (see weather 1 versus all the separate v2 weather service bindings). I don’t know if this is official policy or just how things developed. But it does establish expectations for the users.

Hi,

does anyone know why it didnt fire everything? So i have a few “Abläufe” i think its called rules in Ghome us. Some of them are triggered when i send the configured command and some are not.
I would like to send the command “Starte Tims abend” and it should fire 2 things in the assistant 1:“spiele die Playlist playlistname im büro von google play music ab” 2:“Stelle die Lautstärke im büro auf 20%”

So here are the screenshots:

When i fire it with a voice command in front of an google home mini or when i type it in the assistant on my mobile its working.

So did i miss something?

br
Doxlike

i can only add one picture :smiley:

Answer in the activitys on google.com

It is not a full GHome, it is limited with what the API can provide

My wife broke my nest API access by accepting the prompt to update on the app. Since then I have thought about going back to zwave for my thermostat. Could I use this to get responses from assistant on the state of the thermostat? I have several circulation fans that used to trigger every time the HVAC turned on so that they would run while the main fan was running.
Could I use the setup to query state every so often and use the response? I don’t assistant would broadcast every time the best changed state and would instead have to be queried. At this point it doesn’t seem that Google will have an API that works as well as the nest one did. I’m very close to changing back to zwave, but this interface seems very promising in several ways. Ran across it while looking up assistant secure pin entry issues I have with voice input of numbers. It auto corrects and never enters the correct numbers and instead covers to fractions when not stating as a number as if it were 1 value instead of individual values in series.
Whatever the case on nest, I’m going to set this up. It seems like a great in between. Assistant just got a test setup for designing screen pages for Google home hubs. It would be great to be able to create remote interfaces for control of certain things when prompted. The current setup is cumbersome when attempting simple things like adjusting volume of a device controlled by Harmony. Something like 6 clocks and some scrolling before you get to it. If I could present a set of buttons when a command is spoken, it would end that frustration.

Id be happy with anything - ive attempted this a couple of times but cant get it to work - I am however much more confident with bindings and jars and tinkering with them. A stand alone new binding would be quicker and self contained for testing then perhaps look at merging into existing later?

Hi all.

Before I try to find some time to try OrangeAssist, is it still working and in active development?

If not, is there another way to use the “broadcast” rather than “say” option with openHAB and Google assistant devices?

Thanks.

Cant get it to work!

I get this doing sudo python3 -m or:

Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/pi/orange-assist/or.py", line 9, in <module>
    from orangeassist import OrangeAssistant
  File "/home/pi/orange-assist/orangeassist.py", line 3, in <module>
    import google.auth.transport.grpc
ModuleNotFoundError: No module named 'google'

Anyone that can point me in the right direction?

You need to install the google library (see step 5 in the OP).

I think i have done that but it still doesn’t work. This is what I’ve installed in the virtual environment:

(env) pi@VPN:~/orange-assist $ pip list
Package                  Version  
------------------------ ---------
cachetools               4.1.1    
certifi                  2020.6.20
cffi                     1.14.0   
chardet                  3.0.4    
click                    6.7      
cryptography             2.9.2    
enum34                   1.1.10   
Flask                    1.1.2    
futures                  3.1.1    
gevent                   20.6.2   
google-assistant-grpc    0.2.1    
google-assistant-library 1.0.1    
google-assistant-sdk     0.5.1    
google-auth              1.18.0   
google-auth-oauthlib     0.4.1    
googleapis-common-protos 1.52.0   
greenlet                 0.4.16   
grpcio                   1.30.0   
idna                     2.10     
itsdangerous             1.1.0    
Jinja2                   2.11.2   
MarkupSafe               1.1.1    
oauthlib                 3.1.0    
pathlib2                 2.3.5    
pip                      18.1     
pkg-resources            0.0.0    
protobuf                 3.12.2   
pyasn1                   0.4.8    
pyasn1-modules           0.2.8    
pycparser                2.20     
pyOpenSSL                19.1.0   
requests                 2.24.0   
requests-oauthlib        1.3.0    
rsa                      4.6      
setuptools               40.8.0   
six                      1.15.0   
sounddevice              0.3.15   
tenacity                 4.12.0   
urllib3                  1.25.9   
Werkzeug                 1.0.1    
WSGIserver               1.3      
zope.event               4.4      
zope.interface           5.1.0 

When I run sudo python - or as in the instructions:

(env) pi@VPN:~/orange-assist $ sudo python -m or
Traceback (most recent call last):
File “/usr/lib/python2.7/runpy.py”, line 163, in _run_module_as_main
mod_name, _Error)
File “/usr/lib/python2.7/runpy.py”, line 119, in _get_module_details
code = loader.get_code(mod_name)
File “/usr/lib/python2.7/pkgutil.py”, line 281, in get_code
self.code = compile(source, self.filename, ‘exec’)
File “/home/pi/orange-assist/or.py”, line 28
f = f"output/{f}"
^
SyntaxError: invalid syntax

When I run sudo python3 - or:

(env) pi@VPN:~/orange-assist $ sudo python3 -m or
Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/pi/orange-assist/or.py", line 9, in <module>
    from orangeassist import OrangeAssistant
  File "/home/pi/orange-assist/orangeassist.py", line 3, in <module>
    import google.auth.transport.grpc
ModuleNotFoundError: No module named 'google'

Don’t know if that is of any help?

You will notice that step 7 where the code is run is not run using sudo. I think when you use sudo you jump out of the virtual env.

Okay, there were a lot of mistakes done from my side. I was so sure i messed something up with the environment or something but it was basically just the config.json file that was not set up correctly. It’s working now. Sorry for disturbing, but thanks for your help. :slight_smile:

But, I still have a question. I can write “Turn the lights off” or “Whats the time?” and it works. But, can I for example write “Play Spotify on Livingroom TV”? Why, why not? Cause this is my main reason to install this. I thought i could pass through all commands that works with voice basically. That would be such a good thing I think.

I never fully got it working. I didn’t have a good use case to compel me to spend a lot of time making it work so eventually lost interest. Someone who uses it will have to answer.

This is still limited to what the Google Assistant SDK can provide. It is not a full-fledged Google Home replacement. They mention it directly on their page It’s available for experimental and non-commercial uses only.

With Covid19 and not having to drive the kids to and from school, I might be able to write a binding for this. I know I know :slight_smile: I’ve been talking about it and never had a start. Hopefully the Assistant gRPC is on-par with the python libs

2 Likes

Hi All,
I am getting the following error:

[root@openhab orange-assist]$ python3 -m or
ERROR:root:Failed to register device: {
  "error": {
    "code": 400,
    "message": "Request contains an invalid argument.",
    "status": "INVALID_ARGUMENT"
  }
}

My config.json looks like this:

{
“is_debug”: true,
“is_verbose”: true,
“host”: “0.0.0.0”,
“port”: “2828”,
“username”: “lucky”,
“password”: “charms”,
“device_model_id” : “orangeassist-6a5ea-orangeassist-80mip0”,
“device_id” : “orangeassist”,
“on_success_post_to”: “http://url_to/post_to”,
“credentials_file”: “credentials.json”,
“delete_output_files_sec”: 60,
“screen_mode”: “SCREEN_MODE_UNSPECIFIED”,
“project_id”: “project-914336263871”
}

And my google developer shows this:

Thanks,
Paul

Solved my own problem. The “project-id” that I found on the website when creating the credentials is NOT the project-id you need.

You can find the right project-id in the credential file where you saved the client_secret.
…“project_id”:“orangeassist-6a5ea”…

Could you paste your Habpanel widget code?
The whole solution looks really sharp and works like a charm.
FWIW, I use Python 3.8 on ubuntu bionic.

i got everything working but the html output part doesn’t.

I keep receiving the error:

ERROR:root:‘str’ object has no attribute ‘decode’

My settings are shown below for the request:

{
“request”: “how is my day”,
“uuid”: “8615649201647928”,
“output_html_file”: “output.html”,
“output_audio_file”: null,
“is_play_audio”: false,
“screen_mode”: “OFF”,
“language”: “en-US”,
“is_return_html”: true
}