how to pass a table to the notify function?

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
User avatar
papoo
Posts: 126
Joined: Friday 22 January 2016 22:14
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10
Location: France
Contact:

how to pass a table to the notify function?

Post 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
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

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

Post 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).
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

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

Post 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
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
papoo
Posts: 126
Joined: Friday 22 January 2016 22:14
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10
Location: France
Contact:

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

Post by papoo »

thanks for this
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest