Page 6 of 15

Re: Domoticz to Google Assistant integration

Posted: Friday 20 September 2019 16:34
by GreenSmart01
Nope. No errors.
Only the google voice sying that she cannot sync with < my project name >

btw i can control my devices, for example turn off all light works.

Re: Domoticz to Google Assistant integration

Posted: Friday 20 September 2019 18:48
by DewGew
Make sure you have latest from github also that homegraph is correct set

Re: Domoticz to Google Assistant integration

Posted: Saturday 21 September 2019 14:00
by GreenSmart01
i have the latest version :-)
can u tell me more about the homegraph correct set?

Re: Domoticz to Google Assistant integration

Posted: Saturday 21 September 2019 15:06
by DewGew
GreenSmart01 wrote: Saturday 21 September 2019 14:00 i have the latest version :-)
can u tell me more about the homegraph correct set?
The Request Sync feature allows a cloud integration to send a request to the Home Graph to send a new SYNC request.

Navigate to the Google Cloud Console API Manager for your project id.
Enable the HomeGraph API. This will be used to request a new sync and to report the state back to the HomeGraph.
Click Credentials
Click 'Create credentials'
Click 'API key'
Copy the API key shown and insert it in SMARTHOMEPROVIDERAPIKEY in config.py.

Re: Domoticz to Google Assistant integration

Posted: Saturday 21 September 2019 15:59
by GreenSmart01
Still the same error :(

Re: Domoticz to Google Assistant integration

Posted: Saturday 21 September 2019 16:53
by GreenSmart01
i have now setup a new project, just from the begin, and it working again :)

Re: Domoticz to Google Assistant integration

Posted: Friday 04 October 2019 23:35
by Failure404
Hi!
Thank you for this great project.
I had it running fine for a few weeks now, but now I seem to be unable to sync devices.
Getting "Synchronization request sent, status_code: 400" when calling "https://[YOUR REVERSE PROXY URL]/sync".
It used to work fine, and I haven't really changed anything.
Anyone else - or is it just me? Not sure how to troubleshoot.

Re: Domoticz to Google Assistant integration

Posted: Sunday 06 October 2019 9:01
by DewGew
Try login to Actions on Google and start ’Test’ again. Then restart your dzga server

Re: Domoticz to Google Assistant integration

Posted: Wednesday 09 October 2019 17:43
by Failure404
Thank you, that seems to do the trick.
On a sidenote, would it be possible to blacklist certain devices so that they don't get exported to Google?

Re: Domoticz to Google Assistant integration

Posted: Wednesday 09 October 2019 19:03
by EscApe
On a sidenote, would it be possible to blacklist certain devices so that they don't get exported to Google?
You can whitelist the devices to be exported to Google by putting them in a Domoticz room and configuring the Domoticz-google-assistant integration to use that room. Look for the line below in default_config.py

Code: Select all

#Idx of Room plan. 0 is all devices.
DOMOTICZ_ROOMPLAN = '0'

Re: Domoticz to Google Assistant integration

Posted: Sunday 27 October 2019 13:21
by jerry
I am trying to get this to work, but please help me with the config: I have a domain setup (mydomain.com) with SSL for controlling domoticz, that's fine. I have the assistent server running on port 3030 on the pi. Works. Followed the steps to get API etc.

But what exactly is the [YOUR REVERSE PROXY URL] ? I assume it is "mydomain.com/", however when I request e.g. mydomain.com/smarthome or /oauth or /token it just gives "domoticz offline". Do I need to setup port forwarding to 3030? That does not seem to work with SSL?

How to I connect the Assisent Server to Domoticz? I feel like I am missing a step... thanks!

Re: Domoticz to Google Assistant integration

Posted: Sunday 03 November 2019 23:38
by Haubke
Yes you have to setup a reverse proxy server. And then open port 443 and 80 on your router. Point them to your reversproxy ip adress. And have certificates installed.

I have a server running google assistant(this program)
Im running nginx as reverse proxy.
I opend router (443,80) to nginx server. Nginx server to local adres port 3030.

Hope you understand. English is not my mothers tongue. Most difficult part is to get nginx running properly.

Re: Domoticz to Google Assistant integration

Posted: Tuesday 05 November 2019 19:27
by DewGew
I need some feedback on beta version. I changed config to Yaml so you can’t use old config.py I also added an interface where user can change config and see connected devices.

Re: Domoticz to Google Assistant integration

Posted: Wednesday 06 November 2019 13:49
by EscApe
Hi DewGew,

Great work! The interface looks good and the integration is working as before. I did not start from scratch though, so I don't know how it will work for new users.

There is also a downside: Exposing the configuration page to the internet is a security risk.It is essential to change the default password and preferably even the username immediately when installing. Do not go on and configure other stuff. Just save the password first and restart
What countermeasures did you include to prevent a brute force attack? There might also be other vulnerabilities.

Seeing the amount of bots trying to acces my router every day, I am really cautious about exposing stuff to the internet. I would prefer this web configuration to be optional and when enabled only respond to local requests.
Bare in mind: If anyone gets acces to the configuration interface they have access to the my google api credentials and keys :shock:

Re: Domoticz to Google Assistant integration

Posted: Wednesday 06 November 2019 15:28
by DewGew
EscApe wrote: Wednesday 06 November 2019 13:49 Hi DewGew,

Great work! The interface looks good and the integration is working as before. I did not start from scratch though, so I don't know how it will work for new users.

There is also a downside: Exposing the configuration page to the internet is a security risk.It is essential to change the default password and preferably even the username immediately when installing. Do not go on and configure other stuff. Just save the password first and restart
What countermeasures did you include to prevent a brute force attack? There might also be other vulnerabilities.

Seeing the amount of bots trying to acces my router every day, I am really cautious about exposing stuff to the internet. I would prefer this web configuration to be optional and when enabled only respond to local requests.
Bare in mind: If anyone gets acces to the configuration interface they have access to the my google api credentials and keys :shock:
Thanks for your feed back. Maybe add another web server to access the interface that is only open for local lan.
Lika a plugin or addon.
At first run the server creates the config.yaml if it not exists with some default settings. Then you can access the interface.
How about yaml is that somthing to keep?

Re: Domoticz to Google Assistant integration

Posted: Wednesday 06 November 2019 20:01
by xury
Hey. Im stuck on
On the top menu click Develop, then on the left navigation menu click on Actions. Enter the URL for fulfillment, e.g. https://[YOUR REVERSE PROXY URL]/smarthome, click Done.
I can't find were I should enter URL for fulfilment?
I don't see it. Please help!

Re: Domoticz to Google Assistant integration

Posted: Wednesday 06 November 2019 20:05
by EscApe
Maybe add another web server to access the interface that is only open for local lan.
Maybe I misunderstand what you are suggesting, but if I add another webserver then I would have two webservers exposing the configuration web interface. One of them still exposed to the internet. Or is there a way I can remove the config interface from one of them myself?

As a workaround I have added this to my nginx.conf

Code: Select all

    location ~^/(login|settings) {
        allow 192.168.1.0/24;
        deny all;
        proxy_pass http://localhost:3030;
    }
I am not 100% sure this is the right way, but it seems to work. I can no longer log in from the internet, but the google api still can. Well... it seems to work for now ;-)

I was unable to figure out how/where the web interface is created in your code on GitHub, otherwise I would make a more detailed suggestion or even a pr. It still think that the convenience of a web interface is great, but as things are now it does not outweigh the security risk.
How about yaml is that somthing to keep?
I don't really have an opinion on that. The configuration file is not that big, so any structure would work for me.

Re: Domoticz to Google Assistant integration

Posted: Thursday 07 November 2019 7:27
by DewGew
xury wrote: Wednesday 06 November 2019 20:01 Hey. Im stuck on
On the top menu click Develop, then on the left navigation menu click on Actions. Enter the URL for fulfillment, e.g. https://[YOUR REVERSE PROXY URL]/smarthome, click Done.
I can't find were I should enter URL for fulfilment?
I don't see it. Please help!
I hope this helps
aog.png
aog.png (76.85 KiB) Viewed 1577 times

Re: Domoticz to Google Assistant integration

Posted: Monday 11 November 2019 11:10
by DewGew
Now you can switch selecor switches:

User: Turn on [Level Name] on [device].
Google Assistant: Turning on [Level Name] on [device]!

Make a git pull or download from: https://github.com/DewGew/Domoticz-Google-Assistant

Re: Domoticz to Google Assistant integration

Posted: Wednesday 13 November 2019 1:24
by BazsoDombiAndras
Hi All!

First of all, thank you DewGew for this Python server, looks like a very promising project!

I'm trying to set it up, but I'm stuck on setting the URLs as per the instructions:

Code: Select all

Navigate back to the Actions on Google Console.

On the top menu click Develop, then on the left navigation menu click on Actions.
Enter the URL for fulfillment, e.g. https://<YOUR REVERSE PROXY URL>/smarthome (replace with your actual URL), click Done.
On the left navigation menu under Account Linking.
Select No, I only want to allow account creation on my website. Click Next.
For Linking Type, select OAuth.
For Grant Type, select Authorization Code for Grant Type.
Under Client Information, enter the client ID and secret from earlier.
Change Authorization URL to https://<YOUR REVERSE PROXY URL>/oauth (replace with your actual URL).
Change Token URL to https://<YOUR REVERSE PROXY URL>/token (replace with your actual URL).
Let's say that the Domoticz Python server is running on 192.168.0.200:3030
I have an Apache reverse proxy and I have set up some redirects like:
domoapp.mydomain.com -> 192.168.0.200:3030/smarthome
domoappoauth.mydomain.com -> 192.168.0.200:3030/oauth
domoapptoken.mydomain.com -> 192.168.0.200:3030/token

The problem is that the above links don't even work on the local server, I mean if I enter 192.168.0.200:3030/smarthome into a browser, I get "not supported". If I enter 192.168.0.200:3030/oauth into the browser, I get "response_type must equal "code". If I enter 192.168.0.200:3030/token into the browser, I get "Page not found!: '/token'".

Could you please clarify what the proper target URLs are on the local server for the smarthome, oauth and token endpoints that need to be specified to Google? I mean what URLs should the reverse proxy redirects point to on the local machine on which the Python server is running? In other words, what are the endpoint URLs to which the Python server responds? Where should the reverse proxy direct the traffic to?

Another thing that is not clear: what should the OAuth credentials (U_NAME and U_PASSWD) be in the config.py? Can I enter any username and password there and something will ask for them? Or should these values be taken from somewhere from Google?

One final thing:

Code: Select all

Select No, I only want to allow account creation on my website. Click Next.
For Linking Type, select OAuth.
For Grant Type, select Authorization Code for Grant Type.
This part never came up during the Google setup process. The Google settings must have changed since the instructions were put together. Now there's no way to say "No, I only want.." and there is no field for specifying Grant type. This is what the Account Linking page looks like today:
accoutnlinking.png
accoutnlinking.png (18.09 KiB) Viewed 1525 times
Thank you!