error in lofile/script script works fine
Posted: Sunday 29 January 2017 18:33
Script works perfect, when activate, it puts my receiver on and when the tv is of, it sets my receiver to radio otherwise its tv.
I got still one error in my logfile, can somebody fix this, i cant. find it...
2017-01-29 18:30:58.458 Hardware Monitor: Fetching data (System sensors)
2017-01-29 18:31:00.172 Error: EventSystem: in Denon aanuit: [string "commandArray = {}..."]:8: attempt to index global 'devicechanged' (a nil value)
Could it be dat i use a commandarray[1] , should i leave the "[1]" out?
SCRIPT for device "Denon aanuit"
commandArray = {}
IP = '192.168.178.176' --IP of denon
IPTV = '192.168.178.13' --IP of tv
DEV='Denon aanuit'
MAXLEVEL=50
if devicechanged[DEV] == 'On' then
local play = 'curl --url "http://' .. IP .. '/MainZone/index.put.asp?cmd0=PutZone_OnOff%2FON" &'
os.execute(play)
ping_success=os.execute('ping -c1 192.168.178.13')
if ping_success then
commandArray[1]={['Denon mode']='Set Level 20'} -- switch demo mode op tv zetten
else
commandArray[1]={['Denon mode']='Set Level 10'}-- switch deno mode op radio zetten
end
elseif devicechanged[DEV] == 'Off' then
local play = 'curl --url "http://' .. IP .. '/MainZone/index.put.asp?cmd0=PutZone_OnOff%2FOFF" &' -- oud local play = 'curl --url "http://' .. IP .. '/MainZone/index.put.asp?cmd0=PutVolumeMute%2Fon" &' --mute
os.execute(play)
end
if devicechanged[DEV] then
NewLevel = otherdevices_svalues[DEV]
if NewLevel ~= "Off" and NewLevel ~= "0" then
if tonumber(NewLevel) > MAXLEVEL then --volume maxlevel
NewLevel = MAXLEVEL
end
SendLevel = NewLevel - 80 --79.5
os.execute ("curl http://" .. (IP) .. "/MainZone/index.put.asp?cmd0=PutMasterVolumeSet/" .. (SendLevel))
end
end
return commandArray
I got still one error in my logfile, can somebody fix this, i cant. find it...
2017-01-29 18:30:58.458 Hardware Monitor: Fetching data (System sensors)
2017-01-29 18:31:00.172 Error: EventSystem: in Denon aanuit: [string "commandArray = {}..."]:8: attempt to index global 'devicechanged' (a nil value)
Could it be dat i use a commandarray[1] , should i leave the "[1]" out?
SCRIPT for device "Denon aanuit"
commandArray = {}
IP = '192.168.178.176' --IP of denon
IPTV = '192.168.178.13' --IP of tv
DEV='Denon aanuit'
MAXLEVEL=50
if devicechanged[DEV] == 'On' then
local play = 'curl --url "http://' .. IP .. '/MainZone/index.put.asp?cmd0=PutZone_OnOff%2FON" &'
os.execute(play)
ping_success=os.execute('ping -c1 192.168.178.13')
if ping_success then
commandArray[1]={['Denon mode']='Set Level 20'} -- switch demo mode op tv zetten
else
commandArray[1]={['Denon mode']='Set Level 10'}-- switch deno mode op radio zetten
end
elseif devicechanged[DEV] == 'Off' then
local play = 'curl --url "http://' .. IP .. '/MainZone/index.put.asp?cmd0=PutZone_OnOff%2FOFF" &' -- oud local play = 'curl --url "http://' .. IP .. '/MainZone/index.put.asp?cmd0=PutVolumeMute%2Fon" &' --mute
os.execute(play)
end
if devicechanged[DEV] then
NewLevel = otherdevices_svalues[DEV]
if NewLevel ~= "Off" and NewLevel ~= "0" then
if tonumber(NewLevel) > MAXLEVEL then --volume maxlevel
NewLevel = MAXLEVEL
end
SendLevel = NewLevel - 80 --79.5
os.execute ("curl http://" .. (IP) .. "/MainZone/index.put.asp?cmd0=PutMasterVolumeSet/" .. (SendLevel))
end
end
return commandArray