Be a part of CinemaVision today! Once registered and logged in, you will have access to public chat and your own private messenger, you can view and contribute guides, collaborate on the forums, review downloads, give reputation to your fellow members, contribute content and so much more. Registering is quick and completely free, so what are you waiting for? Sign In Sign Up
So it's been driving me nuts the past few nights running upstairs to attempt to fix code, then test it out back downstairs (yeah I could do it downstairs but trying to read the code on the TV screen from the couch hurts my eyes ) Anyways. My pain, is your gain, incase anyone else is wanting to do the same.
I will have 5 hue lights, two on the sides of the couch, and 3 shining on the walls, however right now I only have 2, with a 3rd on the way today. When it's time for Trivia, I use the Vibrant slides, so I want the lights to do a color loop, however I want each light independent of the other bulbs, basically I don't want the whole room green, then red, then blue, etc. What I've been running in to is one light does job, but the others just stay at a constant color
Heres my code: (IP and Username removed)
# Turn the lights on to a white with a 3 second transitiontime
http://<removed>/groups/10/action
PUT:{"on":true,"sat":75,"bri":254,"hue":41432,"effect":"none", "transitiontime":30}
# Turn on each light and start the color loop, wait 1 seconds before turning on the next light
# else they all turn the same color at once
http://<removed>/lights/30/state
PUT:{"sat":254, "effect":"colorloop"}
#wait 1 second before setting the next light
sleep://1000
So ideally what should happen is the lights turn on to their white-ish color, and then 1 by 1 they should be all color looping after waiting 1 second before going on to the next light. However what's happening is just the one light is color looping while the other transitions to a blue light (the bulb is already at Hue: 41432 and Bri: 254 so when I tell it to saturate to 254 it goes from white to blue) but not picking up on the color loop
It took me a while to figure out why, turns out it's that initial transition time of 3 seconds. While the bulb is transitioning it's not paying attention to the effects command, but does listen to the saturation command.
So how to fix this? While I could remove the initial transition time I don't want the lights to abruptly turn on, so instead let's pause the script again. This time adding an additional sleep command right after all the lights turn on.
so my final code looks like:
# Turn the lights on to a white with a 3 second transitiontime
http://<removed>/groups/10/action
PUT:{"on":true,"sat":75,"bri":254,"hue":41432,"effect":"none", "transitiontime":30}
#wait 3 seconds for the transition to finish
sleep://3000
# Turn on each light and start the color loop, wait 1 seconds before turning on the next light
# else they all turn the same color at once
http://<removed>/lights/30/state
PUT:{"sat":254, "effect":"colorloop"}
#wait 1 second before setting the next light
sleep://1000
Now like I said I only have 2 bulbs in the room right now and I imagine if I had all 5 (god these buggers are expensive!) right away I suspect I would have picked up on the problem right away because as I sleep for 1 second between each bulb that transition would have eventually been completed on the other bulbs leaving it look like only 1 or 2 bulbs didn't catch the code while the rest did.
So it's been driving me nuts the past few nights running upstairs to attempt to fix code, then test it out back downstairs (yeah I could do it downstairs but trying to read the code on the TV screen from the couch hurts my eyes
) Anyways. My pain, is your gain, incase anyone else is wanting to do the same.
I will have 5 hue lights, two on the sides of the couch, and 3 shining on the walls, however right now I only have 2, with a 3rd on the way today. When it's time for Trivia, I use the Vibrant slides, so I want the lights to do a color loop, however I want each light independent of the other bulbs, basically I don't want the whole room green, then red, then blue, etc. What I've been running in to is one light does job, but the others just stay at a constant color
Heres my code: (IP and Username removed)
# Turn the lights on to a white with a 3 second transitiontime
http://<removed>/groups/10/action
PUT:{"on":true,"sat":75,"bri":254,"hue":41432,"effect":"none", "transitiontime":30}
# Turn on each light and start the color loop, wait 1 seconds before turning on the next light
# else they all turn the same color at once
http://<removed>/lights/30/state
PUT:{"sat":254, "effect":"colorloop"}
#wait 1 second before setting the next light
sleep://1000
http://<removed>/lights/29/state
PUT:{"sat":254, "effect":"colorloop"}
So ideally what should happen is the lights turn on to their white-ish color, and then 1 by 1 they should be all color looping after waiting 1 second before going on to the next light. However what's happening is just the one light is color looping while the other transitions to a blue light (the bulb is already at Hue: 41432 and Bri: 254 so when I tell it to saturate to 254 it goes from white to blue) but not picking up on the color loop
It took me a while to figure out why, turns out it's that initial transition time of 3 seconds. While the bulb is transitioning it's not paying attention to the effects command, but does listen to the saturation command.
So how to fix this? While I could remove the initial transition time I don't want the lights to abruptly turn on, so instead let's pause the script again. This time adding an additional sleep command right after all the lights turn on.
so my final code looks like:
# Turn the lights on to a white with a 3 second transitiontime
http://<removed>/groups/10/action
PUT:{"on":true,"sat":75,"bri":254,"hue":41432,"effect":"none", "transitiontime":30}
#wait 3 seconds for the transition to finish
sleep://3000
# Turn on each light and start the color loop, wait 1 seconds before turning on the next light
# else they all turn the same color at once
http://<removed>/lights/30/state
PUT:{"sat":254, "effect":"colorloop"}
#wait 1 second before setting the next light
sleep://1000
http://<removed>/lights/29/state
PUT:{"sat":254, "effect":"colorloop"}
Now like I said I only have 2 bulbs in the room right now and I imagine if I had all 5 (god these buggers are expensive!) right away I suspect I would have picked up on the problem right away because as I sleep for 1 second between each bulb that transition would have eventually been completed on the other bulbs leaving it look like only 1 or 2 bulbs didn't catch the code while the rest did.
Share this post
Link to post
Share on other sites