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

Voice Notifications

DewGew edited this page Jan 3, 2023 · 1 revision

Voice Notification from Doorbell or Smokedetector

In beta its possible to send voice notification when doorbell rings or smoke is detected. Using custom http action or a dzVents script.

Custom Http notification

In Domoticz – under Settings>Notifications:

  • For http - Put the URL: https://[yourdzga]//notification
  • In the POST data box put: #MESSAGE and ensure Content-Type is application/json
  • In the HEADER data box put: Authorization: Bearer [YOURAUTHTOKEN]
    You can find your authToken in dzga settings under Dzga Settings

In notifications settings for the device:

  • Custom message put: entity_id|$value (eg. Light123|$value)
    You can find entity_id in dzga settings in devices tab
  • Enable the http toggle
  • In Google home app, sync your devices, then select the doorbell or the smokedetector device, enable notifications.
    Make sure it's in your Google 'Home'

dzVents script

local idx = 123
local url = '192.168.1.123:3030'
local token = 'YOURCOOLTOKEN'  --You can find your authToken in dzga settings under Dzga Settings
local entityId = 'Doorbell123' --You can find entity_id in dzga settings in devices tab

return {
	on = {
		devices = {idx}
	},
	execute = function(domoticz, item)
	    
        domoticz.log(dev, domoticz.LOG_INFO)

		if (item.active) then
            domoticz.openURL({
				url = 'https://'..url..'/notification',
				method = 'POST',
				headers = {
				    Authorization = 'Bearer '..token
				    },
				postData = entityId ..'|'..item.state
				    
			})
			domoticz.log('Funkar det? .', domoticz.LOG_INFO)
		end

	end
}

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" (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")
     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"')