-- Domoticz devices, only switch device lamps = { 'SWITCH_Entre_SwitchA', 'SWITCH_Tvatt_SwitchA', 'SWITCH_Altan_SwitchA', 'SWITCH_Forrad_SwitchA' } function setLampState(state) ret = {} for key, lamp in pairs(lamps) do ret[lamp] = state end return ret end commandArray = {} if (devicechanged['Switch_Utebelysning']) then lampState = devicechanged['Switch_Utebelysning'] commandArray = setLampState(lampState) end return commandArray