Page 1 of 1

Bug or program error

Posted: Sunday 25 February 2018 15:14
by Maxx
All,

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
}
This script works fine until I trigger the device "Kleur_test". (A dummy switch)
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 
Can somebody make sense of it? I do not use the trigger input in this script but when I try it still will give these errors.

Re: Bug or program error

Posted: Sunday 25 February 2018 17:28
by dannybloe
Please turn on debug logging and inspect the logs. Also make sure there are no other scripts that are triggered by this device.
It looks like there is some script that is trying to run all these update commands.

Check your script folders (scripts/dzVents/scripts, scripts/dzVents/generated_scripts).

Re: Bug or program error

Posted: Sunday 25 February 2018 19:28
by Maxx
Disabled all other scripts, still the same happens.
Something else strange, the dummy switch device "Kleur_test" used to have "on" or "off", it now says "Sound 0"

I will do some more checking, must be something stupid I am not seeing at the moment

Re: Bug or program error

Posted: Sunday 25 February 2018 20:18
by dannybloe
I guess your domoticz is messed up somehow. Don't think this is dzVents related. But still, closely inspect the log when you turn dzVents into debug logging mode (Domoticz settings).