I made the following script to get the actual colors from a Hue lamp:
Code: Select all
local light_ID = '11'
return {
on = {
timer = {
'every minute'
},
httpResponses = {
'Get_colour'
},
devices = {
'Kleur_test'
}
},
execute = function(domoticz, item)
if (item.isTimer) then
domoticz.log('Timer event')
domoticz.openURL({
url = 'http://192.168.1.161/api/???????????????????/lights',
method = 'GET',
callback = 'Get_colour',
})
end
if (item.isHTTPResponse) then
domoticz.log('HTTP reponse was ok')
if (item.statusCode == 200) and (item.isJSON) then
domoticz.log('JSON was detected')
local bri = item.json[light_ID]['state']['bri']
local hue = item.json[light_ID]['state']['hue']
local sat = item.json[light_ID]['state']['sat']
local Naam = item.json[light_ID]['name']
domoticz.log(Naam)
domoticz.log(bri)
domoticz.log(hue)
domoticz.log(sat)
end
else
domoticz.log('There was a problem handling the request', domoticz.LOG_ERROR)
domoticz.log(item, domoticz.LOG_ERROR)
end
end
}
Then I get the following error log:
Code: Select all
2018-02-25 15:04:03.760 dzVents: Info: Handling events for: "Kleur_test", value: "On"
2018-02-25 15:04:03.760 dzVents: Info: ------ Start internal script: Device trigger test: Device: "Kleur_test (Dummy)", Index: 531
2018-02-25 15:04:03.761 dzVents: Error (2.4.1): There was a problem handling the request
2018-02-25 15:04:03.761 dzVents: Error (2.4.1): Method updateWetness is not available for device "Kleur_test" (deviceType=Light/Switch, deviceSubType=Switch). If you believe this is not correct, please report.
2018-02-25 15:04:03.761 dzVents: Error (2.4.1): Method updateSetPoint is not available for device "Kleur_test" (deviceType=Light/Switch, deviceSubType=Switch). If you believe this is not correct, please report.
2018-02-25 15:04:03.761 dzVents: Error (2.4.1): Method updateTempHumBaro is not available for device "Kleur_test" (deviceType=Light/Switch, deviceSubType=Switch). If you believe this is not correct, please report.
2018-02-25 15:04:03.762 dzVents: Error (2.4.1): Method updateLux is not available for device "Kleur_test" (deviceType=Light/Switch, deviceSubType=Switch). If you believe this is not correct, please report.
2018-02-25 15:04:03.762 dzVents: Error (2.4.1): Method updateTemperature is not available for device "Kleur_test" (deviceType=Light/Switch, deviceSubType=Switch). If you believe this is not correct, please report.
2018-02-25 15:04:03.762 dzVents: Error (2.4.1): Method updateCustomSensor is not available for device "Kleur_test" (deviceType=Light/Switch, deviceSubType=Switch). If you believe this is not correct, please report.
2018-02-25 15:04:03.762 dzVents: Error (2.4.1): Method updateDistance is not available for device "Kleur_test" (deviceType=Light/Switch, deviceSubType=Switch). If you believe this is not correct, please report.
2018-02-25 15:04:03.762 dzVents: Error (2.4.1): No value given for 'repeatAfterXXX' command
2018-02-25 15:04:03.762 dzVents: Error (2.4.1): No value given for 'repeatAfterXXX' command
2018-02-25 15:04:03.762 dzVents: Error (2.4.1): No value given for 'repeatAfterXXX' command
2018-02-25 15:04:03.763 dzVents: Error (2.4.1): No value given for 'withinXXX' command
2018-02-25 15:04:03.763 dzVents: Error (2.4.1): An error occured when calling event handler Device trigger test
2018-02-25 15:04:03.763 dzVents: Error (2.4.1): ...z/scripts/dzVents/../../dzVents/runtime/TimedCommand.lua:179: attempt to perform arithmetic on local 'value' (a nil value)
2018-02-25 15:04:03.763 dzVents: Info: ------ Finished Device trigger test