how to pass a table to the notify function?

Easy to use, 100% Lua-based event scripting framework.
Post Reply
User avatar
papoo
Posts: 97
Joined: Friday 22 January 2016 23:14
Target OS: Raspberry Pi
Domoticz version: 4.9
Location: France
Contact:

how to pass a table to the notify function?

Post by papoo » Sunday 13 May 2018 20:02

hi all,
when i do this

Code: Select all

domoticz.notify(' subject','Message',domoticz.PRIORITY_EMERGENCY, '','',{domoticz.NSS_PUSHBULLET, domoticz.NSS_HTTP})
the notification work correctly,
but when i want to pass ta table variable in the fonction like

Code: Select all

local subsystem = {domoticz.NSS_PUSHBULLET, domoticz.NSS_HTTP}
domoticz.notify(' subject','Message',domoticz.PRIORITY_EMERGENCY, '','',subsystem)
all notification are play not only NSS_PUSHBULLET and NSS_HTTP

dannybloe
Posts: 1473
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi
Domoticz version:
Location: Ermelo
Contact:

Re: how to pass a table to the notify function?

Post by dannybloe » Wednesday 16 May 2018 7:59

I really have no idea why that would be. Looking at the internals there should be no difference. It checks if the 6th parameter is a table and then turns it into a ;-separated string (in case you're interested: dzVents/runtime/Domoticz.lua, function self.notify).
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.

User avatar
waaren
Posts: 920
Joined: Tuesday 03 January 2017 15:18
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: how to pass a table to the notify function?

Post by waaren » Wednesday 16 May 2018 9:26

I tried papoo's examples and they both produce exactly the same string for sendCommand.

You can check for yourself by adding print('SendNotification' .. data) as last line in

function self.notify

of Domoticz.lua
Raspberry (debian stretch via berryboot on Synology DS916+) , Domoticz (almost) latest Beta, , dzVents 2.6, RFLink, RFXtrx433e, P1, Youless, Harmony, Hue, Yeelight, Xiaomi, HomeWizard, Zwave, Amazon echo

User avatar
papoo
Posts: 97
Joined: Friday 22 January 2016 23:14
Target OS: Raspberry Pi
Domoticz version: 4.9
Location: France
Contact:

Re: how to pass a table to the notify function?

Post by papoo » Thursday 17 May 2018 18:47

thanks for this

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests