Page 1 of 1
Dimmer "level" property is not there
Posted: Thursday 27 July 2017 8:22
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!
Re: Dimmer "level" property is not there
Posted: Thursday 27 July 2017 8:47
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

Re: Dimmer "level" property is not there
Posted: Thursday 27 July 2017 9:32
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

Ha ha... dutch is worse than swedish

Re: Dimmer "level" property is not there
Posted: Thursday 27 July 2017 13:22
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
Re: Dimmer "level" property is not there
Posted: Thursday 27 July 2017 13:30
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).
Re: Dimmer "level" property is not there
Posted: Thursday 27 July 2017 13:31
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.
Re: Dimmer "level" property is not there
Posted: Thursday 27 July 2017 15:09
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
}
Re: Dimmer "level" property is not there
Posted: Thursday 27 July 2017 15:11
by BakSeeDaa
(I'm still on 2.1)
Re: Dimmer "level" property is not there
Posted: Friday 28 July 2017 8:32
by BakSeeDaa
I'm starting a new thread for this.