Code: Select all
return {
on = {
devices =
{
'Bed José (Action)_single', -- zigbee push button
'Bed MJ (Action)_single', -- zigbee push button
'Beweging slaapkamer (Pir)', -- zigbee motion sensor
},
},
logging =
{
level = domoticz.LOG_DEBUG,
marker = 'nachtverlichting slaapkamer',
},
execute = function(dz, device)
local bj = dz.devices('Bed José (Action)_single')
local bmj = dz.devices('Bed MJ (Action)_single')
local nvs = dz.devices('Nachtverlichting slaapkamer') -- zigbee outlet
local pirslpkmr = dz.devices('Beweging slaapkamer (Pir)')
dz.log('Beweging slaapkamer (Pir), state: ' .. pirslpkmr.state, dz.LOG_DEBUG)
if (bj.state == 'On' or bmj.state == 'On' or pirslpkmr.state == 'On') and nvs.state == 'Off' then
nvs.switchOn().forMin(10)
elseif (bj.state == 'On' or bmj.state == 'On') and nvs.state == 'On' then
nvs.switchOff()
end
end
}
Code: Select all
2024-04-15 13:16:39.655 Zigbee2mqtt: Light/Switch/Switch (Beweging slaapkamer (Pir))
2024-04-15 13:16:39.681 Zigbee2mqtt: General/Voltage (Beweging slaapkamer)
2024-04-15 13:16:39.821 Status: dzVents: Info: Handling events for: "Beweging slaapkamer (Pir)", value: "On"
2024-04-15 13:16:39.825 Status: dzVents: Info: nachtverlichting slaapkamer: ------ Start internal script: Script #1: Device: "Beweging slaapkamer (Pir) (Zigbee2mqtt)", Index: 251
2024-04-15 13:16:39.825 Status: dzVents: Debug: nachtverlichting slaapkamer: Beweging slaapkamer (Pir), state: On
2024-04-15 13:16:39.825 Status: dzVents: Debug: nachtverlichting slaapkamer: Constructed timed-command: On
2024-04-15 13:16:39.825 Status: dzVents: Debug: nachtverlichting slaapkamer: Constructed timed-command: On FOR 600 SECONDS
2024-04-15 13:16:39.825 Status: dzVents: Info: nachtverlichting slaapkamer: ------ Finished Script #1
2024-04-15 13:16:39.828 Status: EventSystem: Script event triggered: /home/mj/domoticz/dzVents/runtime/dzVents.lua
2024
Code: Select all
2024-04-15 13:17:47.945 Zigbee2mqtt: Light/Switch/Switch (Beweging slaapkamer (Pir))
2024-04-15 13:17:47.959 Zigbee2mqtt: General/Voltage (Beweging slaapkamer)
2024-04-15 13:17:48.089 Status: dzVents: Info: Handling events for: "Beweging slaapkamer (Pir)", value: "Off"
2024-04-15 13:17:48.094 Status: dzVents: Info: nachtverlichting slaapkamer: ------ Start internal script: Script #1: Device: "Beweging slaapkamer (Pir) (Zigbee2mqtt)", Index: 251
2024-04-15 13:17:48.094 Status: dzVents: Debug: nachtverlichting slaapkamer: Beweging slaapkamer (Pir), state: Off
2024-04-15 13:17:48.094 Status: dzVents: Debug: nachtverlichting slaapkamer: Constructed timed-command: Off
2024-04-15 13:17:48.094 Status: dzVents: Info: nachtverlichting slaapkamer: ------ Finished Script #1
2024-04-15 13:17:48.097 Status: EventSystem: Script event triggered: /home/mj/domoticz/dzVents/runtime/dzVents.lua
2024
Thanks in advance!