Page 1 of 1
Custom Message in Notifications
Posted: Friday 19 July 2019 23:54
by Sandolution
Hi all,
I'm trying to use notifications on an alert (dummy) to send myself a Pushover message.
This alert is activated via MQTT. I'm able to trigger the alert and the set Pushover action using the sensor but am struggling with the content of the message itself. I found that $value in the 'custom message' field returns me the state of the alert - 0/1/2/3/ etc. but not the text itself inside of my received Pushover message. What is the variable to use for this text?
Thanks in advance.
Best regards,
Sandolution
Re: Custom Message in Notifications
Posted: Saturday 20 July 2019 13:47
by waaren
Sandolution wrote: ↑Friday 19 July 2019 23:54
I'm trying to use notifications on an alert (dummy) to send myself a Pushover message.
Only variables I can see in see in source are $value and $name. You can use a small dzVents scripts to achieve your goal.
Code: Select all
return
{
on = { devices = { "Alert name" }},
execute = function(dz, item)
dz.log("alert level: " .. item.color)
dz.log("alert text: " ..item.text)
if item.color > dz.ALERTLEVEL_GREEN then
dz.notify("Alert",item.text,(item.color - 2),nil,nil,dz.NSS_PUSHOVER)
end
end
}
When not yet familiar with dzVents please start with reading
Get started Before implementing. Special attention please for
"In Domoticz go to Setup > Settings > Other and in the section EventSystem make sure the checkbox 'dzVents disabled' is not checked. Also make sure that in the Security section in the settings you allow 127.0.0.1 to not need a password. dzVents uses that port to send certain commands to Domoticz. Finally make sure you have set your current location in Setup > Settings > System > Location, otherwise there is no way to determine nighttime/daytime state."
Re: Custom Message in Notifications
Posted: Saturday 20 July 2019 20:30
by Sandolution
Thanks Waaren, that was exactly the functionality I was looking for.
Code has become a bit easier, monitoring the actual item text:
Code: Select all
return
{
on = {
devices = {
"[DU] Pushover Alarm"
}
},
execute = function(dz, item)
if item.text > ' ' then
dz.notify("Alarm",item.text,dz.PRIORITY_HIGH,nil,nil,dz.NSS_PUSHOVER)
end
end
}
Thanks again for the help.