I have a user variable called CurSceneStue and the remote Is called REM Stue A. The variable "stue_scenes" contains a list of the scenes (push buttons) I would like to cycle through.
My script looks as follows
Code: Select all
commandArray = {}
stue_scenes={"Hue Scene Stue Morgen","Hue Scene Stue Hvid","Hue Scene Stue Film","Hue Scene Stue Aktiv"}
cur_stue=uservariables["CurSceneStue"]
tc=next(devicechanged)
REM_switch=tostring(tc)
if (REM_switch:sub(1,3) == 'REM') then
if (string.match(REM_switch, "Stue A")) then
cur_stue = cur_stue + 1
if (cur_stue==5) then -- turn of lights
cur_stue=1
commandArray['Variable:CurSceneStue'] = 1
else --activate scene
print(stue_scenes[cur_stue])
commandArray[stue_scenes[cur_stue]]='On'
commandArray['Variable:CurSceneStue'] = cur_stue
end
end
end
return commandArray
2017-03-05 21:55:07.760 Error: EventSystem: commandArray in script Remote should only return ['string']='actionstring' or [integer]={['string']='actionstring'}
2017-03-05 21:55:07.761 EventSystem: Script event triggered: Remote
Any idea what is going wrong?