Hi I would like to know if i can modify the on off value of a dimmer …
Like this example , off set level to 10% and on set level to 50%
can I do it in the binary light as well?? on 1% of 2%
Thanks a lot!
Sorry for the bad english…
Hi I would like to know if i can modify the on off value of a dimmer …
Like this example , off set level to 10% and on set level to 50%
can I do it in the binary light as well?? on 1% of 2%
Thanks a lot!
Sorry for the bad english…
Right now I can think of a couple of methods to do this, none perfect.
Edit the Json file for the dimmable light. The drawback to this method is that this will affect all the devices of type DimmableLight.
Add code to Startup Lua to intercept the LoadLevelTarget variable of the devices you want, and give it a new value:
<see code below, in Reply #3>
@mcvflorin,
I’m assuming this will still allow the dimmable light to fade to any setting in between, right?
If so can you also add a range that the lights cannot be set to within?
For example allow the light to be set 10-45 and 55-90. This would eliminate the lights ability to be set between 45 and 55.
Can you do this?
Thanks!
The code I previously wrote was flawed. Use this code instead. This allows you to set a minimum, maximum and an excluded values range. If you don’t want to use one of these restrictions, set it to nil (e.g. EXCL_RANGE = nil) or exclude it from the code.
-- User set constants
local DEVICE = 19
local MIN_VALUE = 10
local MAX_VALUE = 80
local EXCL_RANGE = {
START = 45,
STOP = 55
}
local altered = false
function alterLoadLevelTarget (device, service, variable, valueOld, valueNew )
if (not altered) then
value = tonumber (valueNew, 10)
if (MIN_VALUE ~= nil and value < MIN_VALUE) then
altered = true
luup.call_action (service, "SetLoadLevelTarget", {newLoadlevelTarget = tostring (MIN_VALUE)}, device)
elseif (MAX_VALUE ~= nil and value > MAX_VALUE) then
altered = true
luup.call_action (service, "SetLoadLevelTarget", {newLoadlevelTarget = tostring (MAX_VALUE)}, device)
elseif (EXCL_RANGE ~= nil and (value >= EXCL_RANGE.START and value <= EXCL_RANGE.STOP)) then
altered = true
luup.call_action (service, "SetLoadLevelTarget", {newLoadlevelTarget = tostring (valueOld)}, device)
end
else
altered = false
end
end
luup.variable_watch ("alterLoadLevelTarget", "urn:upnp-org:serviceId:Dimming1", "LoadLevelTarget", DEVICE)
Does this “slow” the Vera2 down at all? Say I want this exact code to handle 30 of my switches, and I want a similar code with a different exclusion range to handle another 20 switches. Will this compromise the speed of the system at all?
So i’ve spent an hour testing this out, i’m not getting any code errors, it simply wont work, i’ve tried setting the level from dashboard as well as the switch…
After some extensive testing it seems to be working intermittently but a strange bug is that it will not reflect the light level, only show the desired level even though the actual light itself is set to 89…
This is the only code that i’m relying on currently: http://forum.micasaverde.com/index.php/topic,8019.0.html
Thanks!
That code works only for a single dimmable light. To handle more lights you need this code. It won’t slow down your Vera.
local PARAMS = {
[8] = { -- Device number
MIN_VALUE = 15, -- Minimum value
MAX_VALUE = 70 -- Maximum value
-- Exclusion range is missing, so it won't be used. If any parameter is missing, it means it won't be used.
},
[19] = {
MIN_VALUE = 10,
MAX_VALUE = 80,
EXCL_RANGE = {
START = 45,
STOP = 55
}
}
}
local altered = {}
function alterLoadLevelTarget (device, service, variable, valueOld, valueNew )
if (not altered[device]) then
value = tonumber (valueNew, 10)
if (PARAMS[device].MIN_VALUE ~= nil and value < PARAMS[device].MIN_VALUE) then
altered[device] = true
luup.call_action (service, "SetLoadLevelTarget", {newLoadlevelTarget = tostring (PARAMS[device].MIN_VALUE)}, device)
elseif (PARAMS[device].MAX_VALUE ~= nil and value > PARAMS[device].MAX_VALUE) then
altered[device] = true
luup.call_action (service, "SetLoadLevelTarget", {newLoadlevelTarget = tostring (PARAMS[device].MAX_VALUE)}, device)
elseif (PARAMS[device].EXCL_RANGE ~= nil and (value >= PARAMS[device].EXCL_RANGE.START and value <= PARAMS[device].EXCL_RANGE.STOP)) then
altered[device] = true
luup.call_action (service, "SetLoadLevelTarget", {newLoadlevelTarget = tostring (valueOld)}, device)
end
else
altered[device] = false
end
end
for deviceNo in pairs (PARAMS) do
luup.variable_watch ("alterLoadLevelTarget", "urn:upnp-org:serviceId:Dimming1", "LoadLevelTarget", deviceNo)
end
@mcvflorin,
I havent had a chance to test, but in your example, are you showing 2 devices, #8, and #19 each with their own range? I want to make sure I have the brackets “}” in their proper places and I noticed there is a comma “,” after the min value, but not the max value of the first device, and there is also a comma after the “}” bracket of the first device as well. Should I add one after each remaining device?
[code]
local PARAMS = {
[8] = { – Device number
MIN_VALUE = 15, – Minimum value
MAX_VALUE = 70 – Maximum value
– Exclusion range is missing, so it won’t be used. If any parameter is missing, it means it won’t be used.
},
[19] = {
MIN_VALUE = 10,
MAX_VALUE = 80,
EXCL_RANGE = {
START = 45,
STOP = 55
}
}
[25] = {
MIN_VALUE = 0,
MAX_VALUE = 100,
EXCL_RANGE = {
START = 45,
STOP = 55
}
}
[45] = {
MIN_VALUE = 15,
MAX_VALUE = 70
},
local altered = {}
–CODE CONTINUES[/code]
Thanks!
Yep.
local PARAMS = {
[8] = { -- Device number
MIN_VALUE = 15, -- Minimum value
MAX_VALUE = 70 -- Maximum value
-- Exclusion range is missing, so it won't be used. If any parameter is missing, it means it won't be used.
},
[19] = {
MIN_VALUE = 10,
MAX_VALUE = 80,
EXCL_RANGE = {
START = 45,
STOP = 55
}
},
[25] = {
MIN_VALUE = 0,
MAX_VALUE = 100,
EXCL_RANGE = {
START = 45,
STOP = 55
}
},
[45] = {
MIN_VALUE = 15,
MAX_VALUE = 70
}
}
...
Yes, each device has its own set of parameters. Brackets delimit an array, and all the array items must be separated by a comma.
Would it be possible to modify the Json files for dimmable lights, rename them and upload them as a new device, then set any dimmer in Vera to use these device files instead of the default ones?
I haven’t tried it, but I don’t think that’s gonna work, because MiOS won’t know how to handle that device type.
Best Home Automation shopping experience. Shop at Ezlo!
© 2024 Ezlo Innovation, All Rights Reserved. Terms of Use | Privacy Policy | Forum Rules