Bug or program error

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
Maxx
Posts: 61
Joined: Saturday 27 January 2018 20:59
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Bug or program error

Post 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.
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: Bug or program error

Post 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).
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
Maxx
Posts: 61
Joined: Saturday 27 January 2018 20:59
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Re: Bug or program error

Post 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
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: Bug or program error

Post 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).
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest