Hi all, I am trying to use the below code to gradually increase the brightness of my two Philips LED strip lights but can’t figure out what I need to put in where it references the xxxxxxxxx’s.
let me think for a while on the code. Basic idea is to use an if loop until the level is at the target. Then use a runIn to recall the if loop. How you would get the target in and out is another item. The below may work.
{USE YOUR DEVICE COMMAND TO SET TO THE INITIAL LEVEL)
def fadeIn() {
def target = 90 // 90 percent target
def increment = 5 // 5 percent per increment
def level = device.latestValue(“level”) // may be a different currentValue for your device
if (level <= target) {
level += increment // Adds 5 to level
{YOUR DEVICE COMMAND TO SET LEVEL)
runIn(20, fadeIn) // will run again in 20 seconds
}
}
Thanks i’ll give that a try. This is my first piston that I am working on so struggling a bit with finding the web element that puts in the particular code item.
Is there any way I can directly write the code? Not being able to insert a line is also a bit frustrating at the moment.