Page 9 of 15

Re: Domoticz to Google Assistant integration

Posted: Saturday 07 December 2019 21:37
by DewGew
EddyG wrote: Saturday 07 December 2019 9:37 I have setup dzga with "roomplan: '0' " and got ALL devices. This creates some minor problems with voice recognition on Google Home.
Is it possible to have more then 1 room? Like roomplan: '1,2,3'?
Or should I rename some devices, which I rather would not do, because of scripting.
I would like to know this, because I already setup a lot of devices and I am looking for a lot of work if it would not work.
Easiet is to create a room for your ”Google” devices then add the room Idx in config.yaml under Domoticz settings Or
Create a user in domoticz and add those devices you want to use in google assistant.

Re: Domoticz to Google Assistant integration

Posted: Sunday 08 December 2019 13:54
by EddyG
I did that. Lot of work. But it works.
I already have a lot of roomplans. Maybe a suggestion for the future to be able to use more than 1 roomplan.

Re: Domoticz to Google Assistant integration

Posted: Tuesday 10 December 2019 21:04
by Xavier82
Hi guys,

After a lot trying I finally got it fixed to install the Domoticz Google Assistant on my Pi.
I followed all steps and created account and project in Google.
I use the Ngrok settings in the config.yaml file for this:
ngrok_tunnel: TRUE
ngrok_auth_token: 'MY TOKEN CREATED AT NGROK'

When performing the "sync Devices" I see all active devices found in Domoticz become visible in the Domoticz Google Assistant.
When checking the log I see this:
2019-12-10 20:58:10 - DEBUG - Starting new HTTPS connection (1): homegraph.googleapis.com:443
2019-12-10 20:58:10 - DEBUG - https://homegraph.googleapis.com:443 "POST /v1/devices:requestSync?key=MYKEY HTTP/1.1" 400 None.

When talking to Google ("Hey Google" put light off command) Google tells me it is executing the command but nothing happens.
I have read a lot in these threads and my conclusion is that NGrok in this application can't be used because there is no SSL supported?
Is this correct? What can I do to get this fixed?

So my Domoticz setup is on a Rpi3B-model, the application/server "Domoticz Google Assistant" is on the same Rpi.
I checked multiple times the action fullfilment URL and the token and Auth URL.
But it seems Google can't talk/interface with this application.

Help is appreciated!

Re: Domoticz to Google Assistant integration

Posted: Wednesday 11 December 2019 9:20
by DewGew
Xavier82 wrote: Tuesday 10 December 2019 21:04 Hi guys,

After a lot trying I finally got it fixed to install the Domoticz Google Assistant on my Pi.
I followed all steps and created account and project in Google.
I use the Ngrok settings in the config.yaml file for this:
ngrok_tunnel: TRUE
ngrok_auth_token: 'MY TOKEN CREATED AT NGROK'

When performing the "sync Devices" I see all active devices found in Domoticz become visible in the Domoticz Google Assistant.
When checking the log I see this:
2019-12-10 20:58:10 - DEBUG - Starting new HTTPS connection (1): homegraph.googleapis.com:443
2019-12-10 20:58:10 - DEBUG - https://homegraph.googleapis.com:443 "POST /v1/devices:requestSync?key=MYKEY HTTP/1.1" 400 None.

When talking to Google ("Hey Google" put light off command) Google tells me it is executing the command but nothing happens.
I have read a lot in these threads and my conclusion is that NGrok in this application can't be used because there is no SSL supported?
Is this correct? What can I do to get this fixed?

So my Domoticz setup is on a Rpi3B-model, the application/server "Domoticz Google Assistant" is on the same Rpi.
I checked multiple times the action fullfilment URL and the token and Auth URL.
But it seems Google can't talk/interface with this application.

Help is appreciated!
I got it working (even without auth_token). You can you reach the settings page. Is there any waring for certifacates? And make sure you press 'Test' button also after saving in action on google.
Dubble check your 'homegraph_api_key' it seems not to be valid but it should work anyway.

Re: Domoticz to Google Assistant integration

Posted: Wednesday 11 December 2019 10:59
by Xavier82
Hi DewGew,

I have recreated a new API key.
I used this new API key in de config file.
Rebooted the server.
Copied the new ngrok urls to actions on Google.
I then did a "sync devices"
and gues what.....

Now I get:
2019-12-11 10:50:22 - DEBUG - https://homegraph.googleapis.com:443 "POST /v1/devices:requestSync?key=MY_KEY HTTP/1.1" 200 None.

Just checked if its working and it does!
The only difference now is that I have created a new API key for this to work.

Anyways, thanks for helping :)

Re: Domoticz to Google Assistant integration

Posted: Thursday 12 December 2019 7:31
by DewGew
Xavier82 wrote: Wednesday 11 December 2019 10:59 Hi DewGew,

I have recreated a new API key.
I used this new API key in de config file.
Rebooted the server.
Copied the new ngrok urls to actions on Google.
I then did a "sync devices"
and gues what.....

Now I get:
2019-12-11 10:50:22 - DEBUG - https://homegraph.googleapis.com:443 "POST /v1/devices:requestSync?key=MY_KEY HTTP/1.1" 200 None.

Just checked if its working and it does!
The only difference now is that I have created a new API key for this to work.

Anyways, thanks for helping :)
Sounds great. If homegraph api key is not valid the sync button in settings does not work, But it work by voice in google assistant without the key.

Re: Domoticz to Google Assistant integration

Posted: Friday 13 December 2019 15:47
by ricorico94
Hi,

Installation process still seem unclear to me when having to rely on NGROK as wiki simply states "use NGROK and let's encrypt".
@ProfaNe: would you mind writing a tutorial on how to setup google assistant when relying on NGROK (and let's encrypt ? not sure if it's required then).

@Dewgew : wiki explains that server could be run on another server than Domoticz :
- Could I imagine installing the server in my house to control domoticz running on a PI in another person's house ? (if I could avoid chaning settings of the domoticz of the other person's domoticz, it would be more simple. That domoticz is visible from internet through port forwarding, but not sure how I could setup there any extra ngrok or reverse proxy, etc.)
- in case previous question is feasible, is there ay ay to host the server on s ingle pi to control 2 different domoticz installatiosn ? (control my own and also the other person's domoticz)
- and in case I want to uninstall the google assistant, which steps should I follow to unsinstall and clean my PI ?

br,
Ricorico94

Re: Domoticz to Google Assistant integration

Posted: Friday 13 December 2019 19:45
by EldigoR
Anyone facing issue with version 1.3.8?
I'm getting these errors on startup

Code: Select all

Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "Domoticz-Google-Assistant/__main__.py", line 5, in <module>
    from server import *
  File "Domoticz-Google-Assistant/server.py", line 6, in <module>
    from smarthome import *
  File "Domoticz-Google-Assistant/smarthome.py", line 3, in <module>
    from auth import *
  File "Domoticz-Google-Assistant/auth.py", line 3, in <module>
    from req_handler import *
  File "Domoticz-Google-Assistant/req_handler.py", line 6, in <module>
    from const import (SESSION_TIMEOUT, Auth, AUTH_CODE_TIMEOUT)
  File "Domoticz-Google-Assistant/const.py", line 2, in <module>
    from helpers import configuration
  File "Domoticz-Google-Assistant/helpers.py", line 6, in <module>
    from pip._internal import main as pip
ModuleNotFoundError: No module named 'pip._internal'
Version 1.3.7 works fine..

Running Ubuntu 18.04 LTS with the lasted update

Re: Domoticz to Google Assistant integration

Posted: Friday 13 December 2019 20:12
by EldigoR
EldigoR wrote:Anyone facing issue with version 1.3.8?
I'm getting these errors on startup

Code: Select all

Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "Domoticz-Google-Assistant/__main__.py", line 5, in <module>
    from server import *
  File "Domoticz-Google-Assistant/server.py", line 6, in <module>
    from smarthome import *
  File "Domoticz-Google-Assistant/smarthome.py", line 3, in <module>
    from auth import *
  File "Domoticz-Google-Assistant/auth.py", line 3, in <module>
    from req_handler import *
  File "Domoticz-Google-Assistant/req_handler.py", line 6, in <module>
    from const import (SESSION_TIMEOUT, Auth, AUTH_CODE_TIMEOUT)
  File "Domoticz-Google-Assistant/const.py", line 2, in <module>
    from helpers import configuration
  File "Domoticz-Google-Assistant/helpers.py", line 6, in <module>
    from pip._internal import main as pip
ModuleNotFoundError: No module named 'pip._internal'
Version 1.3.7 works fine..

Running Ubuntu 18.04 LTS with the lasted update
Solved it with:

Code: Select all

python3 -m pip install --user --upgrade pip

Re: Domoticz to Google Assistant integration

Posted: Friday 13 December 2019 21:12
by DewGew
ricorico94 wrote: Friday 13 December 2019 15:47 Hi,

Installation process still seem unclear to me when having to rely on NGROK as wiki simply states "use NGROK and let's encrypt".
@ProfaNe: would you mind writing a tutorial on how to setup google assistant when relying on NGROK (and let's encrypt ? not sure if it's required then).

@Dewgew : wiki explains that server could be run on another server than Domoticz :
- Could I imagine installing the server in my house to control domoticz running on a PI in another person's house ? (if I could avoid chaning settings of the domoticz of the other person's domoticz, it would be more simple. That domoticz is visible from internet through port forwarding, but not sure how I could setup there any extra ngrok or reverse proxy, etc.)
- in case previous question is feasible, is there ay ay to host the server on s ingle pi to control 2 different domoticz installatiosn ? (control my own and also the other person's domoticz)
- and in case I want to uninstall the google assistant, which steps should I follow to unsinstall and clean my PI ?

br,
Ricorico94
You can install dzga on an other computer. If its outside your lan you need to expose your domoticz instance to internet.
For unistall just delete Domoticz-Google-Assistant folder.
If you run the installer script first run ’sudo systemtcl stop dzga’ then ’sudo systemtcl disable dzga’

Re: Domoticz to Google Assistant integration

Posted: Sunday 15 December 2019 17:06
by ProfaNe
ricorico94 wrote: Friday 13 December 2019 15:47 Installation process still seem unclear to me when having to rely on NGROK as wiki simply states "use NGROK and let's encrypt".
@ProfaNe: would you mind writing a tutorial on how to setup google assistant when relying on NGROK (and let's encrypt ? not sure if it's required then).
You can use the Ngrok option or a domain with certificate to expose your installation. A tutorial is a little useless since there is not much to do. Create account at ngrok. Paste the token in the config file. When you start DZGA you will be notified that you are using Ngrok and it shows the public URL you have to use with Google.

Re: Domoticz to Google Assistant integration

Posted: Monday 16 December 2019 13:12
by Xavier82
Does any one knows how to only sync devices from Domoitcz Dashboard?
I want to be able to select which devices can be synced with Google Assistent.
Now all my devices are synced....

Re: Domoticz to Google Assistant integration

Posted: Monday 16 December 2019 15:26
by cyberclwn
Xavier82 wrote: Monday 16 December 2019 13:12 I want to be able to select which devices can be synced with Google Assistent.
Read a few posts back :)
DewGew wrote: Saturday 07 December 2019 21:37 Create a user in domoticz and add those devices you want to use in google assistant.

Re: Domoticz to Google Assistant integration

Posted: Monday 16 December 2019 19:34
by rvanderven
Does anyone have a complete uptodate description of the creation of the Google Action credentials and API keys?
To me it looks like things on the Google site have changed since the description is created.
Eg. When enabling HomeGraph for my project I could't create an API key via the credentials, only by going back to https://console.cloud.google.com/apis/c ... roject=<My project>
When clicking Test and entering a phrase I received the message that it was not possible to use this in the webbrowser.

After entering all details in config.yaml I started dzga service and after login with the /settings url I was able to login.
Clicking on the Sync devices resulted in the message: "Homegraph API key not valid!"
The dzga.log mentions error 404
2019-12-16 19:10:00 - ERROR - {
"error": {
"code": 404,
"message": "Requested entity was not found.",
"status": "NOT_FOUND"
}

I tried all kinds of things, but I am completely stuck.
I have setup my own domain and installed a reverse proxy on my synology encrypted with Letsencrypt.
I can reach the dzga installation from outside and am able to login.

Re: Domoticz to Google Assistant integration

Posted: Monday 16 December 2019 21:06
by EddyG
My setup is the same (Synology, reverse proxy and letsencrypt)
So it is valid to state that indeed the log "Homegraph API key not valid" is correct.
So redo the steps for creating that Homegraph API key.
An other way is to ask Google Home to synchronize devices. Does that work?

Re: Domoticz to Google Assistant integration

Posted: Tuesday 17 December 2019 10:10
by DewGew
rvanderven wrote: Monday 16 December 2019 19:34 Does anyone have a complete uptodate description of the creation of the Google Action credentials and API keys?
To me it looks like things on the Google site have changed since the description is created.
Eg. When enabling HomeGraph for my project I could't create an API key via the credentials, only by going back to https://console.cloud.google.com/apis/c ... roject=<My project>
When clicking Test and entering a phrase I received the message that it was not possible to use this in the webbrowser.

After entering all details in config.yaml I started dzga service and after login with the /settings url I was able to login.
Clicking on the Sync devices resulted in the message: "Homegraph API key not valid!"
The dzga.log mentions error 404
2019-12-16 19:10:00 - ERROR - {
"error": {
"code": 404,
"message": "Requested entity was not found.",
"status": "NOT_FOUND"
}

I tried all kinds of things, but I am completely stuck.
I have setup my own domain and installed a reverse proxy on my synology encrypted with Letsencrypt.
I can reach the dzga installation from outside and am able to login.
Maybe you missed to enable the Homegraph API

Edit: I updated wiki

Re: Domoticz to Google Assistant integration

Posted: Tuesday 17 December 2019 17:09
by EddyG
I installed beta 1.4.0. I see in the logging that there is a sync with the new sync method.
How does that work, because Google tells me some minor differences in the Temperature compared to Domoticz.
So how does a Temperature get synchronized? When I ask Google there is no logging of that request and no error(s) too.
And Yes, I have the smart-home-key.json file in the Domoticz-Google-Assistant dir.
This is in the logfile:

Code: Select all

2019-12-17 16:54:54 - DEBUG - Starting new HTTPS connection (1): homegraph.googleapis.com:443
2019-12-17 16:54:55 - INFO - Request {
  "requestId": "1205332055124xxxxxx",
  "inputs": [
    {
      "intent": "action.devices.SYNC"
    }
  ]
}

Re: Domoticz to Google Assistant integration

Posted: Tuesday 17 December 2019 19:43
by DewGew
EddyG wrote: Tuesday 17 December 2019 17:09 I installed beta 1.4.0. I see in the logging that there is a sync with the new sync method.
How does that work, because Google tells me some minor differences in the Temperature compared to Domoticz.
So how does a Temperature get synchronized? When I ask Google there is no logging of that request and no error(s) too.
And Yes, I have the smart-home-key.json file in the Domoticz-Google-Assistant dir.
This is in the logfile:

Code: Select all

2019-12-17 16:54:54 - DEBUG - Starting new HTTPS connection (1): homegraph.googleapis.com:443
2019-12-17 16:54:55 - INFO - Request {
  "requestId": "1205332055124xxxxxx",
  "inputs": [
    {
      "intent": "action.devices.SYNC"
    }
  ]
}
Note that this is still in beta..
New function is report state. With this dzga reports state to google to reduce quiering amount and time. So google reports back latest known state. This is might not optimal for some devices like temperatures. So I added function to disable report state on specific device.
Just add

Code: Select all

report_state: false
to "Device_Config" in configuration or <voicecontrol>report_state = False</voicecontrol> in device description. That device should query direct from domoticz.
I haven’t tested fully yet.

Edit: If you want use dzga as before, just delete json file and add the homegraph_api_key.

Re: Domoticz to Google Assistant integration

Posted: Tuesday 17 December 2019 23:41
by Xavier82
cyberclwn wrote: Monday 16 December 2019 15:26
Xavier82 wrote: Monday 16 December 2019 13:12 I want to be able to select which devices can be synced with Google Assistent.
Read a few posts back :)
DewGew wrote: Saturday 07 December 2019 21:37 Create a user in domoticz and add those devices you want to use in google assistant.
Found it.
Could you a bit more specific? What should be done when creating a user? what are the settings?

Re: Domoticz to Google Assistant integration

Posted: Wednesday 18 December 2019 7:59
by DewGew
Xavier82 wrote: Tuesday 17 December 2019 23:41
cyberclwn wrote: Monday 16 December 2019 15:26
Xavier82 wrote: Monday 16 December 2019 13:12 I want to be able to select which devices can be synced with Google Assistent.
Read a few posts back :)
DewGew wrote: Saturday 07 December 2019 21:37 Create a user in domoticz and add those devices you want to use in google assistant.
Found it.
Could you a bit more specific? What should be done when creating a user? what are the settings?
In domoticz, Goto 'Setup' -> 'More Options' ->'Edit Users'

Choose or add user. Then click 'Set Devices'
Move devices to the right column. Those will be active for this user. If none is selected in the right column, all devices will be active for this user.
Dont forget to click 'Save'