Custom Message in Notifications

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
Sandolution
Posts: 2
Joined: Wednesday 02 August 2017 21:12
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Custom Message in Notifications

Post 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
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Custom Message in Notifications

Post 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."
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Sandolution
Posts: 2
Joined: Wednesday 02 August 2017 21:12
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Custom Message in Notifications

Post 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.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest