I have already tried everything but unfortunately I cannot find it.
Thanks for the help.
Code: Select all
--(dzVentz)--
--Door open and 'DS' is On then no telegram
--Door open and 'DS' is Off then send telegram with name of the door
--DS is Dummy switch that is on when smartphone is at home
--WCD On if 'DS'is Off and door state is Alarm, and switch Off when door state is Normal
--Door is an Kerui D026
--Telegram is not activated yet
local devicesToCheck = {
['name'] = 'Voordeur',
['name'] = 'Garagedeur',
['name'] = 'Schuifdeur',
['name'] = 'test',
}
return
{
active = true,
on =
{
devices =
'Voordeur','Garagedeur','Schuifdeur','test'
},
logging = {
level = domoticz.LOG_DEBUG,
marker = "deur"
},
execute = function(domoticz)
--for i, deviceToCheck in pairs(devicesToCheck) do
local name = deviceToCheck['name']
local state = domoticz.devices(name).state
local light = dz.devices('DS')
local lamp = dz.devices('WCD')
local door = 'Voordeur','Garagedeur','Schuifdeur','test'
execute = function(dz, door)
if state == 'Alarm' and light =='active' then
dz.devices ('WCD').switch.Off()
return
elseif not light.active then
dz.devices ('WCD').switchOn()
domoticz.telegram('Device ' .. name .. ' staat open ', domoticz.PRIORITY_HIGH)
end
end
end
}Code: Select all
2020-11-15 13:25:20.544 Error: EventSystem: in /home/pi/domoticz/dzVents/runtime/dzVents.lua: /home/pi/domoticz/dzVents/runtime/EventHelpers.lua:661: bad argument #1 to 'pairs' (table expected, got string)
2020-11-15 13:25:21.609 Error: EventSystem: in /home/pi/domoticz/dzVents/runtime/dzVents.lua: /home/pi/domoticz/dzVents/runtime/EventHelpers.lua:661: bad argument #1 to 'pairs' (table expected, got string)
2020-11-15 13:25:22.566 Error: EventSystem: in /home/pi/domoticz/dzVents/runtime/dzVents.lua: /home/pi/domoticz/dzVents/runtime/EventHelpers.lua:661: bad argument #1 to 'pairs' (table expected, got string)
2020-11-15 13:25:23.600 Error: EventSystem: in /home/pi/domoticz/dzVents/runtime/dzVents.lua: /home/pi/domoticz/dzVents/runtime/EventHelpers.lua:661: bad argument #1 to 'pairs' (table expected, got string)
2020-11-15 13:25:24.579 Error: EventSystem: in /home/pi/domoticz/dzVents/runtime/dzVents.lua: /home/pi/domoticz/dzVents/runtime/EventHelpers.lua:661: bad argument #1 to 'pairs' (table expected, got string)
2020-11-15 13:25:25.545 Error: EventSystem: in /home/pi/domoticz/dzVents/runtime/dzVents.lua: /home/pi/domoticz/dzVents/runtime/EventHelpers.lua:661: bad argument #1 to 'pairs' (table expected, got string)
2020-11-15 13:25:26.546 Error: EventSystem: in /home/pi/domoticz/dzVents/runtime/dzVents.lua: /home/pi/domoticz/dzVents/runtime/EventHelpers.lua:661: bad argument #1 to 'pairs' (table expected, got string)