I apologize this took so long. This code is in response to the request from RastusB2 for an equivalent RampDown device that works like the WakeupRamp device I published a year ago.
The attached files implement a binary device that I call RampDown. You can use it to slowly ramp down a set of lights from a maxLevel to a minLevel over a period of time.
Warning: this is for UI4, as I haven’t upgraded yet myself.
To use, upload both of the attached files via the UI and then create a device using:
device type : urn:schemas-upnp-org:device:BinaryLight:1
device file : D_RampDown.xml
impl file : I_RampDown.xml
Once you created the device you might have to refresh the settings to see the Advanced Device variables.
To configure, go to the advanced settings tab in the newly created device and scroll to the bottom:
Devices : this is a list of device id’s for the lights you want to ramp down
RampTimeSecs : this is the ramp time in seconds (default 1800 = 30 minutes)
MaxLevel : this is the start level of brightness (typically 100)
MinLevel : this is the minimum brightness level when the ramping stops (typically 0)
InhibitingDevices : this is a list of device id’s that inhibit the ramping. I use this with virtual devices that specify if you are on vacation or similar reasons for not ramping. (you can leave that blank)
Now, create a scene that will turn this rampdown ramp device on at the time you want the lights to start to go down.
The code sends target levels to all devices in the list every 30 seconds or so, based on your ramp time and MaxLevel. You can set the MinInterval to something larger or smaller than 30 seconds.
The device will turn off automatically when the final light level is reached.
Note: I know you will probably want the feature that starts the ramping from the light level the light currently has. This is difficult to do as the reading of the level Vera provides me is often wrong and not the same as the actual light level. So I doubt I can get that to work.
Enjoy, and let me know if you have problems.
-ZMaF