Dimmer "level" property is not there

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

Moderator: leecollings

Post Reply
BakSeeDaa
Posts: 485
Joined: Thursday 17 September 2015 10:13
Target OS: Raspberry Pi / ODroid
Domoticz version:

Dimmer "level" property is not there

Post by BakSeeDaa »

The wiki says that dimmers should have a "level" property. It's NIL for my dimmers.
level: Number. For dimmers and other 'Set Level..%' devices this holds the level like selector switches.
I do have a "lastLevel" though.

This piece of code fails:

Code: Select all

if ((domoticz.devices('lv2 Tak kök').level < 99) or (domoticz.devices('lv2 Tak kök').state ~= 'On')) then
with the error:

Code: Select all

attempt to compare nil with number

Code: Select all

	[41] = {
		["rawData"] = {
			[1] = "0";
		};
		["switchTypeValue"] = 7;
		["batteryLevel"] = 255;
		["id"] = 158;
		["deviceType"] = "Light/Switch";
		["signalLevel"] = 12;
		["description"] = "";
		["changed"] = false;
		["timedOut"] = false;
		["subType"] = "Switch";
		["data"] = {
			["hardwareID"] = 4;
			["hardwareTypeValue"] = 21;
			["_state"] = "Off";
			["icon"] = "dimmer";
			["hardwareType"] = "OpenZWave USB";
			["hardwareName"] = "ZWaveUSB";
			["maxDimLevel"] = 100;
			["_nValue"] = 0;
		};
		["lastLevel"] = 8;
		["name"] = "lv2 Tak kök";
		["lastUpdate"] = "2017-07-26 15:30:39";
		["baseType"] = "device";
		["switchType"] = "Dimmer";
		["deviceID"] = "00001501";
	};
Cheers!
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: Dimmer "level" property is not there

Post by dannybloe »

Yes, that's fixed in 2.2.0 (famous last words)
Oh, and it doesn't help if you give your devices such weird names :lol:
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
BakSeeDaa
Posts: 485
Joined: Thursday 17 September 2015 10:13
Target OS: Raspberry Pi / ODroid
Domoticz version:

Re: Dimmer "level" property is not there

Post by BakSeeDaa »

dannybloe wrote:Yes, that's fixed in 2.2.0 (famous last words)
Oh, and it doesn't help if you give your devices such weird names :lol:
Ha ha... dutch is worse than swedish ;)
BakSeeDaa
Posts: 485
Joined: Thursday 17 September 2015 10:13
Target OS: Raspberry Pi / ODroid
Domoticz version:

Re: Dimmer "level" property is not there

Post by BakSeeDaa »

It's Off Topic but I'm not sure if this is a known problem.

I cant get dzVents to trigger on device indexes. That should work, shouldn't it?

I have a table named triggerDevices:

Code: Select all

{ [1] = dl*,[2] = wl*,[3] = md*,[4] = pb*,[5] = Re-arm Z2-Z4,[6] = Disarm Z2-Z4,[7] = GCal Tvättstuga (-10:10),[8] = schLaundry,[9] = Spider-Pig Button,[10] = Sovrumsknappen,[11] = 554,[12] = 550,[13] = 555,[14] = 551,[15] = 556,[16] = 552,[17] = 557,[18] = 553,[19] = Z1 Status,[20] = Z2 Status,[21] = Z3 Status,[22] = Z4 Status,[23] = Z1 Arming Mode,[24] = Z2 Arming Mode,[25] = Z3 Arming Mode,[26] = Z4 Arming Mode,}
and the following lua code:

Code: Select all

return {
	active = true,
	on = {
		devices = triggerDevices
	},
It won't trigger for device with idx = 550
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: Dimmer "level" property is not there

Post by dannybloe »

You have to pass a table without indices:

Code: Select all

local devs = {
	'devA', 
	'devB',
	550,
	'devC'
}
...
on = {
	devices = devs
}
Because it also supports this:

Code: Select all

local devs = {
	['devA'] = {'at 15:00-16:40}, 
	'devB',
	550 = {'mon,tue,fri'},
	'devC'
}
...
on = {
	devices = devs
}
That should work (famous last words).
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: Dimmer "level" property is not there

Post by dannybloe »

If it still doesn't work then I'm talking out of my neck and there's something wrong with 550. If so, try to make a trigger with 550 alone and see if that works.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
BakSeeDaa
Posts: 485
Joined: Thursday 17 September 2015 10:13
Target OS: Raspberry Pi / ODroid
Domoticz version:

Re: Dimmer "level" property is not there

Post by BakSeeDaa »

This works:

Code: Select all

return {
	active = true,
	logging = {
		level = domoticz.LOG_INFO, -- Select one of LOG_DEBUG, LOG_INFO, LOG_ERROR, LOG_FORCE to override system log level
		marker = "TEST"
	},
	on = {
		devices = {
			'dl1a Altandörr v-rum',
		},
	},
	execute = function(domoticz, device)

		domoticz.log('Triggered by device: '..device.name, domoticz.LOG_INFO)
		domoticz.log('Device state: '..device.state, domoticz.LOG_INFO)
		domoticz.log('Device lastUpdate.raw: '..device.lastUpdate.raw, domoticz.LOG_INFO)

	end
}
Here is the log output from the above:

Code: Select all

2017-07-27 15:06:03.371 dzVents: Info: TEST: ------ Start external script: testa.lua: Device: "dl1a Altandörr v-rum (ZWaveUSB)", Index: 223
2017-07-27 15:06:03.372 dzVents: Info: TEST: Triggered by device: dl1a Altandörr v-rum
2017-07-27 15:06:03.372 dzVents: Info: TEST: Device state: Open
2017-07-27 15:06:03.372 dzVents: Info: TEST: Device lastUpdate.raw: 2017-07-27 15:06:03
2017-07-27 15:06:03.373 dzVents: Info: TEST: ------ Finished testa.lua
This code however doesn't trigger my script:

Code: Select all

return {
	active = true,
	logging = {
		level = domoticz.LOG_INFO, -- Select one of LOG_DEBUG, LOG_INFO, LOG_ERROR, LOG_FORCE to override system log level
		marker = "TEST"
	},
	on = {
		devices = {
			223,
		},
	},
	execute = function(domoticz, device)

		domoticz.log('Triggered by device: '..device.name, domoticz.LOG_INFO)
		domoticz.log('Device state: '..device.state, domoticz.LOG_INFO)
		domoticz.log('Device lastUpdate.raw: '..device.lastUpdate.raw, domoticz.LOG_INFO)

	end
}
BakSeeDaa
Posts: 485
Joined: Thursday 17 September 2015 10:13
Target OS: Raspberry Pi / ODroid
Domoticz version:

Re: Dimmer "level" property is not there

Post by BakSeeDaa »

(I'm still on 2.1)
BakSeeDaa
Posts: 485
Joined: Thursday 17 September 2015 10:13
Target OS: Raspberry Pi / ODroid
Domoticz version:

Re: Dimmer "level" property is not there

Post by BakSeeDaa »

I'm starting a new thread for this.
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 1 guest