Page 1 of 1

how to pass a table to the notify function?

Posted: Sunday 13 May 2018 20:02
by papoo
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

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

Posted: Wednesday 16 May 2018 7:59
by dannybloe
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).

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

Posted: Wednesday 16 May 2018 9:26
by waaren
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

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

Posted: Thursday 17 May 2018 18:47
by papoo
thanks for this