return { on = { devices = {'Przycisk'} }, logging = { level = domoticz.LOG_DEBUG, marker = 'Multi Przycisk', }, execute = function(domoticz, device) local lamp1 = domoticz.devices('Lampa') local lamp2 = domoticz.devices('Lampa1') if (device.name == 'Przycisk' and device.state == 'On' ) then if (lamp1.state == 'Off' and lamp2.state == 'Off') then lamp1.switchOn() elseif (lamp1.state == 'On' and lamp2.state == 'Off' and lamp1.lastUpdate.secondsAgo <= 3) then lamp2.switchOn() elseif (lamp1.state == 'On' and lamp2.state == 'Off' and lamp1.lastUpdate.secondsAgo > 3) then lamp1.switchOff() elseif (lamp1.state == 'On' and lamp2.state == 'On') then lamp1.switchOff() lamp2.switchOff() end end end }