Skip to content
This repository has been archived by the owner on Feb 16, 2024. It is now read-only.

2. Configuration

DewGew edited this page Sep 7, 2023 · 43 revisions

You can access the interface via http://localhost:3030/settings. The default username is admin and the default password is admin. Configuration and Actions on Google must be modified properly. You can also edit config.yaml in Domoticz-Google-Assistant/config folder to change the configuration.¨

Since Domoticz has improved its security, you have to enable Allow Basic Authentication over plain HTTP in menu Security .
Its recomended to add a new user in Domoticz dedicated for DZGA and add devices to this user. See User Management.

Minimal configuration(required):

# Configuration:
port_number: 3030
loglevel: 'Info'
logtofile: true
userinterface: true

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

# Google Assistant Settings:
ClientID: 'clientid_from aog'
ClientSecret: 'clientsecret_from_aog'
  
# Domoticz Settings:
Domoticz:
  ip: 'http://192.168.1.100'
  port: '8080'
  roomplan: '0'
  username: 'username'
  password: 'password'
  switchProtectionPass: '1234' #Set this to false if ask for pin function is not needed

# Report low battry
Low_battery_limit: 9

Next Setup Actions on Google

Additional Configuraton

Portnumber for Domoticz Google Assistant server

port_number: 3030

(Beta) You can overide token by put own key in config.yaml (Reconnect is required):

authToken: YourCoolTokenHere

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 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 configuration.

ngrok_tunnel: false
ngrok_auth_token: 'auth_token'

Use SSL encryption in HTTP server if not using ngrok or reverse proxy

use_ssl: false
ssl_key:  # /path/to/privkey.pem
ssl_cert: # /path/to/fullchain.pem

Set loglevel 'Debug', 'Info' or 'Error'

loglevel: 'Info'

Enable or disable write log to file. Set logtofile to false logs will not show in the LOG tab. Set logtofile to 'Overwrite' or true Log file will be overwritten when dzga server restarts. Set logtofile to 'Append' Logs will append to logfile if dzga server restarts

logtofile: false

Path to log file. If pathToLogFile is commented out, removed or set to '', logs will be saved in Domoticz-Google-Assistant folder.

pathToLogFile: '/tmp'

Enable or disable Userinterface.

userinterface: true

Check for updates

CheckForUpdates: true

Homegraph API key from Google. The Request Sync feature allows a cloud integration to send a request to the Home Graph to send a new SYNC request. NOTE: This is not need if you are using Service account (smart-home-key.json)

Homegraph_API_Key: 'ADD_YOUR HOMEGRAPH_API_KEY_HERE'

Ligths, switches, media, etc. are using domoticz's "Light/Switch" type. So to differentiate them additionaly image names are used.

Image_Override:
  Switch:
    - 'Generic'
  Light:
    - 'Light'
    - 'custom_icon_name'
  Media:
    - 'Media'
    - 'TV'
  Outlet:
    - 'WallSocket'
  Speaker:
    - 'Speaker'
  Fan:
    - 'Fan'
  Heating:
    - 'Heating'
  Kettle:
    - 'custom_icon_name'

Device Configuraton

Nicknames, rooms, ack and report_state can also be set in the Domoticz user interface. New function hide ,hide devices from Google Assistant still but can still see this in UI as type 'Hidden'. Simply put the device configuration in the device description, in a section between 'voicecontrol' tags like:

<voicecontrol>
nicknames = Kitchen Blind One, Left Blind, Blue Blind
room = Kitchen
ack = True
report_state = False
hide = True
</voicecontrol>

Other parts of the description are ignored, so you can still leave other useful descriptions. Every variable should be on a separate line. If there is no such configuration in the Domoticz device it will still try the config:

Device_Config:
  123:
    ack: true
    room: 'Livingroom'
    nicknames:
      - 'Celing light'
      - 'Smart light'
  234:
    room: 'Bedroom'
    report_state: false
    hide: true
    
Scene_Config:
  3:
    room: 'Kitchen'
    nicknames:
        - 'Cool scene'

Device Type
Function to change device type, icon and some behavior depending on the device (e.g open/close instead of on/off).

<voicecontrol>
  devicetype = oven
</voicecontrol>

or in config.yaml:

Device_Config:
  456:
    devicetype: 'oven'

Light or Switch devices can choose types from:

light, ac_unit, bathtub, coffeemaker, doorbell, dishwasher, dryer, fan, heater, kettle, media, microwave, outlet, oven, speaker, switch, vacuum, washer, waterheater, window, door, gate, garage.

For heater, kettle, waterheater, oven you can still use merge_thermo_idx to merge thermostat to control temperature.

Door Contact devices can choose window, gate or garage.

Blind devices can choose window, door, gate or garage.

Selector devices can choose only vacuum

Pushbutton devices can choose doorbell, light, outlet

For thermostat devices only.
Function to merge actual temperature from another temp device or modes from selector device to thermostat. Merged device will automaticly hidden. Levels from selector device supported is: Off - Heat - Cool - Auto - Eco.
Bug Thermostat idx must be a number above Temp/selector idx.

<voicecontrol>
  actual_temp_idx = 123
  selector_modes_idx = 234
</voicecontrol>

or in config.yaml:

Device_Config:
  456:
    actual_temp_idx: '123'
    selector_modes_idx: '234'

For heater/waterheater/kettle/oven devices only.
Function to merge thermostat device to control temperature. Merged device will automaticly hidden.
Bug Thermostat idx must be a number above Temp/selector idx.

<voicecontrol>
  merge_thermo_idx = 123
</voicecontrol>

or in config.yaml:

Device_Config:
  456:
    merge_thermo_idx: '123'

Security device

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'

Chromecast Notification

Subdirectory '/sound' contains mp3 sounds to play. Subfolder '/sound/cache' to contain the tts mp3 files.
Add Chromecast_Name: 'Chromecast name/group' to config.yaml to use notification
Usage speak text "http://dzgaserver:port/say?text-to-speak-sperated-by-minus/nl" (specify language after "/", "en" is default if none)
Usage play mp3 file "http://dzgaserver:port/play?doorbell1.mp3@50" (mp3 file in directory /sound)

In Domoticz it is quite easy to handle with dzVents where you can check on device names and states. Here is an example on a virtual switch called "Speaker" :

return {
   on = { devices = {'Speaker' },
   },
   execute = function(domoticz,device)
     if device.state=="On" then
       domoticz.openURL("http://192.168.178.178:8086/play?doorbell1.mp3@50")
     else
       msg ="Bonjour a tous/fr"
       msg = string.gsub(msg, " ", "-")
       domoticz.openURL("http://192.168.178.178:8086/say?"..msg)
     end   
  end
}

if you want to check the return you can use os.execute('curl "URL"')

Other

Timer funcion (Domoticz version above 4.11687)
You need to add a dzVents script in Domoticz to act like a timer. You can name the script what ever you want.

return {
	on = {
        customEvents = { 'TIMER' },
	},
	execute = function(dzga, item)
	    local device = dzga.devices(item.data.idx)
	    
	    if (device.active and item.data.cancel) then
	        dzga.log('Stop timer for ' .. device.name, dzga.LOG_FORCE)
	        device.cancelQueuedCommands()
            else
               dzga.log('No timer is running for' .. device.name, dzga.LOG_FORCE)
            end
            if  item.data.on == true then
               device.cancelQueuedCommands()
               device.switchOn()
               dzga.log('Switch ' .. device.name .. ' On for: ' .. item.data.time .. ' sec', dzga.LOG_FORCE)
               device.switchOff().afterSec(item.data.time)
            end
	end
}

Next Setup Actions on Google