DewGew / Domoticz-Google-Assistant

Google Assistant for Domoticz
https://github.com/DewGew/Domoticz-Google-Assistant/wiki
Apache License 2.0
79 stars 41 forks source link

Followed the guide, but /oauth and others not exposed from domoticz webserver #186

Closed jpveen closed 4 years ago

jpveen commented 4 years ago

Describe the bug:
I followed the install and config guide, but /oauth not exposed from domoticz webserver. So when trying to setup googlehome I get a 404 on /oauth

2020-08-20 14:25:36 - INFO - Connecting to Domoticz on http://localhost:80
2020-08-20 14:25:36 - INFO - ========
2020-08-20 14:25:36 - INFO - Started DZGA v1.8.5 server at port 3030
2020-08-20 14:25:36 - INFO -
2020-08-20 14:25:36 - INFO -    Visit http://localhost:3030/settings to access the user interface
2020-08-20 14:25:36 - INFO -
2020-08-20 14:25:36 - INFO - =========
2020-08-20 14:25:36 - INFO - Visit the Actions on Google console at http://console.actions.google.com
2020-08-20 14:25:36 - INFO - Under Develop section, replace the fulfillment URL in Actions with:
2020-08-20 14:25:36 - INFO -    https://[your public url]/smarthome
2020-08-20 14:25:36 - INFO -
2020-08-20 14:25:36 - INFO - In Account linking, set the Authorization URL to:
2020-08-20 14:25:36 - INFO -    https://[your public url]/oauth
2020-08-20 14:25:36 - INFO -
2020-08-20 14:25:36 - INFO - Then set the Token URL to:
2020-08-20 14:25:36 - INFO -    https://[your public url]/token
2020-08-20 14:25:36 - INFO -
2020-08-20 14:25:36 - INFO - Finally press 'SAVE' and then 'TEST' button
2020-08-20 14:25:36 - INFO - =======

Contents of config.yaml

# Configuration:
port_number: 3030
# Debug, Info or Error
loglevel: 'Info'
# Set logtofile: 'false' logs will not show in the LOG tab. Set logtofile: 'Overwrite' or true Log file will be overwritten when dzga server restarts
# Set logtofile: 'Append' Logs will append to logfile when dzga server restarts
logtofile: Append
# If pathToLogFile is commented, removed or set to '', logs will be saved in Domoticz-Google-Assistant folder
pathToLogFile: ''
# Enable or disable UI
userinterface: true
# Check for updates
CheckForUpdates: true
# Change pidfile name and path if needed
# PidFile: '/var/run/dzga.pid'

# Instantly create a public HTTPS URL. Don't have to open any port on router and do not require a reverse proxy.
# When ngrok_tunnel set to True the auth token is required to keep the tunnel alive.
# Create account at ngrok.com and paste the token in this file.
# Ngrok assigns random urls. When server restart the server gets a new url.
ngrok_tunnel: false
ngrok_auth_token: 'auth_token'

# Use SSL encryption in HTTP server if not using ngrok
use_ssl: false
ssl_key:  # /path/to/privkey.pem
ssl_cert: # /path/to/fullchain.pem

# Login on Google Home app and configuration interface
auth_user: 'admin'
auth_pass: 'hidden'

# Domoticz Settings:
Domoticz:
  ip: 'http://localhost'
  port: '80'
  roomplan: '0'
  username: 'domoticz'
  password: 'hidden'
  switchProtectionPass: 'false' #Set this to false if ask for pin function is not needed

# Report low battry
Low_battery_limit: 9

#Additional nicknames and room configuration
#Comment out or delete section below if not needed
Device_Config:
  123:
    ack: true
    room: 'Livingroom'
    nicknames:
      - 'Celing light'
      - 'Smart light'
  234:
    room: 'Bedroom'
    report_state: false
    hide: true
  345: # For thermostat devices only, Bug Thermostat idx must be a number above Temp idx
    room: 'Hallway'
    actual_temp_idx: '321' # Merge Actual temp from another temp device
    selector_modes_idx: '392' # Merge Modes from selector device

Scene_Config:
  3:
    room: 'Kitchen'
    nicknames:
        - 'Cool scene'

# Stream security Camera:
# In domoticz you need to attach a switch to your camera (create a switch then in Settings/Camera, add the switch to the camera).
Camera_Stream:
  Enabled: false
  Cameras:
    Idx:
      - '123'
      - '234'
      - '345'
    Camera_URL:
      - 'http://your.web.server/cam/cam.m3u8'
      - 'https://content.jwplatform.com/manifests/yp34SRmf.m3u8'
      - 'http://user:password@192.168.1.102:8080/mp4/cctv/camera2/s.mp4'

# User-friendly name for the level in your language..
# See: https://developers.google.com/actions/smarthome/traits/#supported-languages
Armhome:
  level_synonym:
    - 'zuhause und bewachen'
    - 'Level 1'
    - 'SL1'
  lang: 'de'
Armaway:
  level_synonym:
    - 'weg und bewachen'
    - 'Level 2'
    - 'SL2'
  lang: 'de'

Desktop (please complete the following information):

** additional info Domoticz is installed in ~/dev-domoticz (instead of ~/domoticz). Can that be the cause?

DewGew commented 4 years ago

Make local deployment available trough HTTPS with valid certificate with one below:

jpveen commented 4 years ago

My domoticz is available using a public https:// url with . But for example https://mydomain.com/oauth and https://mydomain.com/smarthome produce a 404.

In the guide I see the following text: _Instantly create a public HTTPS URL. Don't have to open any port on router and do not require a reverse proxy. NOTE: Ngrok assigns random urls. When server restart the server gets a new url. When ngroktunnel set to true the auth token is required to keep the tunnel alive. Create account at ngrok.com and paste the token in configuration.

Does this mean I need either to create a public HTTPS URL for the dgza webserver on p3030 OR have to use ngrok OR have to configure reverse proxy?

DewGew commented 4 years ago

You can access /settings ?

jpveen commented 4 years ago

yes, but only on http://x.x.x.x:3030/settings So not on https://public-url/settings. The public url points to domoticz, not to dgza. So thats why I asked if dgza itself needs to be exposed externally ;-)

jpveen commented 4 years ago

I configured a public https URL for the dzga webserver, and this works. Maybe useful to others to know that external connectivity to dgza is required from Google.