hue lights strip fade in over time

This forum is archived topics from before the plugin was moved to the new owner. All topics are locked, but are preserved here for future reference.
bsp9493
Posts: 153
Joined: Thu Nov 30, 2017 12:09 pm
Location: Kelowna, BC

hue lights strip fade in over time

Post by bsp9493 »

Hi... sorry if this has been asked, but I can't seem to find the solution

I've been using your plugin for a while (love it)

what i want to do... basically fade a hue light on from 0-50% over a 30 min period


what I have tried
add an action group - set brightness with ramp rate
select my hue device
set brightness to 50
set ramp rate to 540 (I'm guessing 9 minutes is the max)

what happens...
I run the action group, the light turns on to 50%


your help would be appreciated.

Thanx

dave
bsp9493
Posts: 153
Joined: Thu Nov 30, 2017 12:09 pm
Location: Kelowna, BC

Re: hue lights strip fade in over time

Post by bsp9493 »

what happens...
I run the action group, the light turns on to 50% instantly, then will start to increase from a lower percentage over 540 seconds.

What am I doing wrong?
bsp9493
Posts: 153
Joined: Thu Nov 30, 2017 12:09 pm
Location: Kelowna, BC

Re: hue lights strip fade in over time

Post by bsp9493 »

if it helps... this is what the log file looks like

Code: Select all

Nov 29, 2018 at 10:54:02 AM
   Action Group                    hue lightstrip fade in
   Sent Hue Lights                 "masterBedroom - LightStrip" on to 100 with RGB values 0, 0 and 255 at ramp rate 0.0 sec.
   Sent Hue Lights                 "masterBedroom - LightStrip" on to 10 at ramp rate 0.0 sec.
   Sent Hue Lights                 "masterBedroom - LightStrip" on to 50 at ramp rate 540.0 sec.

Nov 29, 2018 at 10:54:25 AM
   Updated                         "masterBedroom - LightStrip" on to 11
   Updated                         "masterBedroom - LightStrip" on to 12
   Updated                         "masterBedroom - LightStrip" on to 13
   Updated                         "masterBedroom - LightStrip" on to 14
User avatar
roussell
Posts: 1108
Joined: Mon Aug 18, 2008 11:45 am
Location: Alabama

Re: hue lights strip fade in over time

Post by roussell »

It’s probably because items in action groups are executed (near)simultaneously, not sequentially. Try setting the ramp rate first and then after a short delay setting the brightness to 50%.

I don’t use this functionality so it’s just a guess but maybe it will get you on the right track.

Terry


Sent from my iPhone using Tapatalk
CliveS
Posts: 864
Joined: Sun Jan 10, 2016 5:31 am
Location: Medomsley, County Durham, UK

Re: hue lights strip fade in over time

Post by CliveS »

Try this but put it in an external file, not an embedded file.

It will give you the 30 Minutes fade in required and you are right 540 seconds is the max but this script will get round that.

30 Nov 2018, 21:18:00
Action Group new action group
Sent Hue Lights "Conservatory Light" off at ramp rate 0.0 sec.
Sent Hue Lights "Conservatory Light" on to 17 at ramp rate 540.0 sec.
30 Nov 2018, 21:18:36
Updated "Conservatory Light" on to 2
30 Nov 2018, 21:19:39
Updated "Conservatory Light" on to 3
30 Nov 2018, 21:20:00
Updated "Conservatory Light" on to 4
30 Nov 2018, 21:20:53
Updated "Conservatory Light" on to 5
30 Nov 2018, 21:21:35
Updated "Conservatory Light" on to 7
30 Nov 2018, 21:22:00
Updated "Conservatory Light" on to 8
30 Nov 2018, 21:22:59
Updated "Conservatory Light" on to 9

Cut out the next 20 minutes of log!!

30 Nov 2018, 21:41:00
Updated "Conservatory Light" on to 43
30 Nov 2018, 21:41:54
Updated "Conservatory Light" on to 44
30 Nov 2018, 21:42:26
Updated "Conservatory Light" on to 45
30 Nov 2018, 21:43:29
Updated "Conservatory Light" on to 47
30 Nov 2018, 21:44:00
Updated "Conservatory Light" on to 48
30 Nov 2018, 21:44:18
Updated "Conservatory Light" on to 49
30 Nov 2018, 21:45:37
Updated "Conservatory Light" on to 50

Code: Select all


import time

plug = indigo.server.getPlugin("com.nathansheldon.indigoplugin.HueLights")
rate = 540

if plug.isEnabled():
	plug.executeAction("setBrightness", indigo.devices["Conservatory Light"].id, props={"brightness":00, "rate":0})
	time.sleep(2)	
	plug.executeAction("setBrightness", indigo.devices["Conservatory Light"].id, props={"brightness":17, "rate":rate})
	time.sleep(rate)
	plug.executeAction("setBrightness", indigo.devices["Conservatory Light"].id, props={"brightness":34, "rate":rate})
	time.sleep(rate)
	plug.executeAction("setBrightness", indigo.devices["Conservatory Light"].id, props={"brightness":50, "rate":rate})

CliveS

Indigo 2024.2.1 : macOS Sequoia 15.6.1 : Mac Mini M2 : 8‑core CPU and 10‑core GPU : 8 GB : 256GB SSD

The best way to get the right answer on the Internet is not to ask a question, it's to post the wrong answer
bsp9493
Posts: 153
Joined: Thu Nov 30, 2017 12:09 pm
Location: Kelowna, BC

Re: hue lights strip fade in over time

Post by bsp9493 »

Thanx for that... that does get me the desired 30 mins, however, same fundamental problem...

instant on to 17, then begins brighten from 1
instant on to 34, then begins brighten from 17
instant on to 50, then begins brighten from 34

your suggestion prompted me to do this (from within a file)

Code: Select all

import time
from time import sleep

plug = indigo.server.getPlugin("com.nathansheldon.indigoplugin.HueLights")
bright = 2

for i in range(25):
     plug.executeAction("setBrightness", indigo.devices["masterBedroom - LightStrip"].id, props={"brightness":bright, "rate":0})
     bright = bright+2
     sleep(72)
just checking my delays, but should be close:)

d
nsheldon
Posts: 2469
Joined: Mon Aug 09, 2010 2:12 pm
Location: CA
Contact:

Re: hue lights strip fade in over time

Post by nsheldon »

Hi Dave.

Yea, for a 30 minute fade, you'd have to use a script like CliveS suggested. The 540 second limit in the Hue Lights plugin is somewhat arbitrary because I couldn't find any Hue API documentation on exactly how long a transient time is allowed by the Hue bridge. So the limit is intended to maintain consistency with other Indigo supported hardware (namely the INSTEON dimmers which has a 540 second max transition time).

As for the lights initially coming on to a higher value than the destination brightness, that's likely a bug in either the light behavior itself or how the Hue bridge sends the ZigBee commands to the lights. The Hue Lights plugin sends all parameters related to a brightness change request in a single command to the Hue bridge. So if you select an Indigo action to brighten a Hue bulb to 50% brightness with a ramp rate of 540 seconds, the Hue Lights plugin sends a single command to the Hue bridge that tells it to set the light to 50% brightness with a transition time of 540 seconds. If there's a way to prevent the light from going on to a brighter level before starting the transition, I wasn't able to find info on that in the Hue API.

Sorry I couldn't help more. I'm glad the Python scripting option appears to be working as a workaround though.
CliveS
Posts: 864
Joined: Sun Jan 10, 2016 5:31 am
Location: Medomsley, County Durham, UK

Re: hue lights strip fade in over time

Post by CliveS »

Nathan,
Could you not use

Code: Select all

   plug.executeAction("setBrightness", indigo.devices["Conservatory Light"].id, props={"brightness":00, "rate":0})
   time.sleep(2)   
   plug.executeAction("setBrightness", indigo.devices["Conservatory Light"].id, props={"brightness":xx, "rate":rate})


That worked fine when I was writing the script, what I don't understand is why my script increased gradually over 30 minutes as seen by the log but when @bsp9493 ran it he still got
instant on to 17, then begins brighten from 1
instant on to 34, then begins brighten from 17
instant on to 50, then begins brighten from 34
all I can think is he has an RGB device and mine was plain original white.

anyway he got it working and his code looks more eloquent than mine :)
CliveS

Indigo 2024.2.1 : macOS Sequoia 15.6.1 : Mac Mini M2 : 8‑core CPU and 10‑core GPU : 8 GB : 256GB SSD

The best way to get the right answer on the Internet is not to ask a question, it's to post the wrong answer
bsp9493
Posts: 153
Joined: Thu Nov 30, 2017 12:09 pm
Location: Kelowna, BC

Re: hue lights strip fade in over time

Post by bsp9493 »

Thanx Nathan... kinda figured it was something to do with hue itself as the command and the logic makes sense..

Nice gradual transition from off to 50% brightness this morning:).

Now to see if i can get fancy and transition some sunrise colours in there - LOL

Thanx again guys!

d
Locked

Return to “Archives”