Send Notification from device subtype text

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
User avatar
McMelloW
Posts: 434
Joined: Monday 20 November 2017 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.1
Location: Harderwijk, NL
Contact:

Send Notification from device subtype text

Post by McMelloW »

Hi to all

For my SolarEdge Inverter I have a device subtype Text. Is show the status of my inverter as a text.
When the status is Fault or Off I would like to receive a notification. However these devices do not have the notification option.

Who knows the trick to send a notification on these status values from this device

Thanks in advace
Greetings McMelloW
User avatar
waltervl
Posts: 6689
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: Send Notification from device subtype text

Post by waltervl »

I would setup a dzvents script:
trigger on the text device change
read the text contents
if text contains Fault or Off send a notification.

Something like below (not tested so you probably have to tweak some things)

Code: Select all

return
{
    on =
    {
        devices = { 'YourSolaredgetextdevice'}
    },

    execute = function(domoticz, item)
       if item.text == 'Off' or item.text == 'Fault' then
          domoticz.notify('Solar edge issue!',
                        'Solar edge is Off or in Fault',
                        domoticz.PRIORITY_LOW)
        end
}
Below the notify function from the wiki https://www.domoticz.com/wiki/DzVents:_ ... _scripting
notify(subject, message [,priority][,sound][,extra][,subsystem][,delay]3.0.10 ): Function. Send a notification (like Prowl). Priority can be like domoticz.PRIORITY_LOW, PRIORITY_MODERATE, PRIORITY_NORMAL, PRIORITY_HIGH, PRIORITY_EMERGENCY. extra is notification subsystem specific. For NSS_FIREBASE you can use this field to specify the target mobile (‘midx_1’, midx_2, etc..). For sound see list of dzVents Constants for the SOUND constants below. subsystem defaults to all subsystems but can be one subsystem or a table containing one or more notification subsystems. See list of dzVents Constants for domoticz.NSS_subsystem types. Delay is delay in seconds
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
McMelloW
Posts: 434
Joined: Monday 20 November 2017 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.1
Location: Harderwijk, NL
Contact:

Re: Send Notification from device subtype text

Post by McMelloW »

@waltervl

Thanks for your example. I will try this out.

Got it working in test situation. It is now in production an have wait for live status changes.
Greetings McMelloW
User avatar
McMelloW
Posts: 434
Joined: Monday 20 November 2017 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.1
Location: Harderwijk, NL
Contact:

Re: Send Notification from device subtype text

Post by McMelloW »

waltervl wrote: Thursday 09 May 2024 0:00 I would setup a dzvents script:
trigger on the text device change
read the text contents
if text contains Fault or Off send a notification.

Something like below (not tested so you probably have to tweak some things)

Code: Select all

return
{
    on =
    {
        devices = { 'YourSolaredgetextdevice'}
    },

    execute = function(domoticz, item)
       if item.text == 'Off' or item.text == 'Fault' then
          domoticz.notify('Solar edge issue!',
                        'Solar edge is Off or in Fault',
                        domoticz.PRIORITY_LOW)
        end
}
Hi Waltervl.
I have turned things around, only whenthe status is Producing or Sleeping I will not send a notification. These are the normal day and night status. All other status may send a notification. Somehow my equation does not work correct, because notifications are send with Producing or Sleeping Can you tell me what is wrong.

Code: Select all

return
{
    
    on =
    {
        devices = { 'SE - Status'}
    },

    execute = function(domoticz, item)
       if (item.text ~= 'Sleeping') or (item.text ~= 'Producing') then
          domoticz.notify('SolarEdge Status notification!',
                        'SolarEdge Status is now: ' .. item.text,
                        domoticz.PRIORITY_HIGH)
        end
    end    
}
Greetings McMelloW
User avatar
waltervl
Posts: 6689
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: Send Notification from device subtype text

Post by waltervl »

Is the status exactly Sleeping or Producing?
Perhaps put an extra log statement in it to get the real text value.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
habahabahaba
Posts: 267
Joined: Saturday 18 March 2023 14:44
Target OS: Windows
Domoticz version: 2024.4
Contact:

Re: Send Notification from device subtype text

Post by habahabahaba »

try

Code: Select all

if (item.text ~= 'Sleeping' and item.text ~= 'Producing') then
          domoticz.notify('SolarEdge Status notification!',
                        'SolarEdge Status is now: ' .. item.text,
                        domoticz.PRIORITY_HIGH)
        end
User avatar
McMelloW
Posts: 434
Joined: Monday 20 November 2017 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.1
Location: Harderwijk, NL
Contact:

Re: Send Notification from device subtype text

Post by McMelloW »

habahabahaba wrote: Sunday 12 May 2024 17:06 try

Code: Select all

if (item.text ~= 'Sleeping' and item.text ~= 'Producing') then
          domoticz.notify('SolarEdge Status notification!',
                        'SolarEdge Status is now: ' .. item.text,
                        domoticz.PRIORITY_HIGH)
        end
Thanks @habahabahaba, an AND operator did the trick. it works perfect now.

@waltervl The real value of item.text was already included in the notification text. So I am able to see it already.
Greetings McMelloW
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest