-
-
Notifications
You must be signed in to change notification settings - Fork 41
Voice Notifications
In beta its possible to send voice notification when doorbell rings or smoke is detected. Using custom http action or a dzVents script.
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'
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
}
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"')