Hey everyone, I wanted to share a fun DIY project I recently worked on. I’ve been trying to perfect my pool lighting setup, and after some trial and error, I finally got it working perfectly! ![]()
![]()
I’ve been using Hayward pool lights, and while they work great, I wanted more control over the colors and timing. After some research, I decided to try creating a series of scenes using Luup code to automate the color changes and resynchronization process. It was a bit challenging at first, but I managed to figure it out with some help from the community. ![]()
Here’s what I did: I set up a scene that turns the light on, off, and then on again to advance to the next color. To resynchronize the light, I created a function that powers it on, off for 11-14 seconds, and then on again. It took a few attempts, but the code finally worked as intended! ![]()
I also found a helpful guide on the forum that provided a basic structure for the code, which I modified to suit my needs. If anyone is interested, here’s the code I used:
lua
local device = 297
local counter = 6
local delay = 2
local resync_delay = 12
function light_on()
luup.call_action(“urn:upnp-org:serviceId:SwitchPower1”, “SetTarget”, { newTargetValue=“1” }, device)
luup.call_delay(‘light_off’, delay)
end
function light_off()
counter = counter - 1
if counter > 0 then
luup.call_action(“urn:upnp-org:serviceId:SwitchPower1”, “SetTarget”, { newTargetValue=“0” }, device)
luup.call_delay(‘light_on’, delay)
end
end
function light_on_once()
luup.call_action(“urn:upnp-org:serviceId:SwitchPower1”, “SetTarget”, { newTargetValue=“1” }, device)
end
function light_off_once()
luup.call_action(“urn:upnp-org:serviceId:SwitchPower1”, “SetTarget”, { newTargetValue=“0” }, device)
end
function light_resync()
luup.call_delay(‘light_on_once’, delay)
luup.call_delay(‘light_off_once’, delay)
luup.call_delay(‘light_on_once’, resync_delay)
end
light_resync()
light_off()
This setup allows me to cycle through different colors automatically, which adds a nice touch to pool parties and evenings. It’s been a great way to experiment with smart home automation and customize my outdoor space. ![]()
.Pool anyone? ![]()
If anyone has tips or suggestions for improving this setup, I’d love to hear them! Happy DIY-ing! ![]()