I have dimmers that don’t really need to work as dimmers, so I’m trying to make sure that if people in the house accidentally dim the light to something less than 100, I turn it to 100, or off using automation.
I’m fine writing luup code, but I can’t figure out how to get triggered if a light goes to less than 100 other than polling the devices.
function no_dimming (lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
if ( tonumber( lul_value_new ) < tonumber( lul_value_old ) ) then
luup.call_action(‘urn:upnp-org:serviceId:Dimming1’, ‘SetLoadLevelTarget’, { newLoadlevelTarget=‘0’ }, lul_device)
else
luup.call_action(‘urn:upnp-org:serviceId:Dimming1’, ‘SetLoadLevelTarget’, { newLoadlevelTarget=‘100’ }, lul_device)
end
end[/code]
In the first line you must change the 12 to the device id of the dimmer you want controlled. If you have more than one dimmer, repeat ONLY the first line changing the device id accordingly.
Once you have made all the changes click “Go,” close the MiOS developer window and restart your system (clicking the restart circle arrows in the upper right will work).
Thanks for the tip. I was trying to play around with variable_watch, but tried to use it in lua code in scenes and it seemed to do nothing.
The code you posted seems to have some effect, but it is not reliable. I think that might be because Vera2 isn’t seeing instantaneous updates to dimmer levels. So I guess it takes an entire poll interval to actually trigger the variable change.
Do you have experience with reliable use of variable_watch?
I ran the code on my system and found it responded within a second or so. I understand that newer devices have an instant status feature. Search for the “hail” feature and/or “instant status.” Also see this post with some discussion on the same issue http://forum.mios.com/index.php?topic=4687.msg25748#msg25748
I suppose you could set your poll frequency to a lower value and check status every 15-20 seconds rather than every 60.
So is there a list of switches that provide better instant/almost instant status than the devices I use? I currently have a mixture of ACT/Homepro and GE/Jasco switches.
Neither seems to be completely reliable in terms of Vera seeing changes. It works about 60% of the time, another 20% there’s a long delay, and the remaining 20%, Vera never figures out that something has changed until I poll the node manually.
I’m not aware of a list of switches with that information. I tested the code on a GE/Jasco dimmer. Someone better versed on the z-wave Group 1 vs Group 255 and Instant Status vs Hail features might be able to direct you to better information. As I understand it, devices with instant status tell the controller what happened as soon as something happens; devices with the hail feature tell the controller you might want to poll me, something changed; older devices with neither wait to be polled to report status. Could explain the different outcomes.
@Guard, how would you change this to accomplish the following
If dimmer level is set >90%, then set the dimmer back down to 89%. This would keep someone for setting the Dim level >90%.
@Guard, how would you change this to accomplish the following
If dimmer level is set >90%, then set the dimmer back down to 89%. This would keep someone for setting the Dim level >90%.