Help with creating sunrise transitions triggered by endpoint

Hello,

I'm trying to use a light to to simulate a sunrise lamp. I'm using Sleep as Android as it can send an event to an endpoint of you're choosing 1 hour before the alarm time. Here's what I've done / where I've gotten stuck.

As far as I can tell the only app that can use endpoints is Rules Machine, so I need to use this to trigger the rest of the actions.

The issue is that I want to fade colors from red to orange to to yellow to white over the durations that I designate. In Rule Machine, for set dimmers/bulbs, I only see 'fade temperature color', but I don't see normal 'fade color', so I can't use this, as like I said, I want to have these transitions exists outside of the realm of just color temperatures.

The other thing I looked into was 'transitions', which I figured I could create the color transitions and durations in there, and then trigger that in RM. But I didn't see a way to trigger them in RM. Also tbh I didn't fully understand the transitions, but I didn't poke around it too much at the time.

Can anyone help me figure out how to set this up?

Essentially it will go:

  • receive pre-alarm event
  • turn on at red, 1% brightness
  • transition to orange at X% brightness over Y duration
  • transition to yellow at X% brightness over Y duration
  • transition to white at X% brightness over Y duration
  • after 2 hours, turn off.

After I get this working, I'll then need to create a button that cancels the lighting progression, in case I wake up early and want it to end (don't want to wake up my partner every time).

Thanks all!

What were you looking at? The closest thing I can think of is the Color Animation app, which sounds like it could do what you want (aside from the fact that you'd need to manually turn it off at the end; it will keep going otherwise). There are other possibilities, including a Scene Transition (maybe what you were thinking of?) or Room Lighting setup, or really a combination of multiple ones you'd need to get where you're going, but those might be more difficult to set up.

As for "triggering" this externally, Rule Machine is one option (you could have a rule that turns on the connector device the Color Animation app will create, for example). You could also expose the device out directly via Maker API -- RM isn't the only app that offers endpoints.

I was looking at Groups and Scenes transitions.

I saw that page on the Color Animation app, but when I went to install it, it didn't show up in my list of Build-in apps, so I assumed it was just an old document or something.

I see some folks in here also don't it have on their built in app list:

No, all the documentation pages should be up-to-date. This one is actually a new document. :slight_smile: Are you on release 2.3.6? (Check Settings > Hub Details to see for sure.) It should be part of this release, though it technically came partway through 2.3.5 so some could still have it then.

If it's not showing up, that's odd but a different issue. I'm assuming you saw the endpoint you could use to try to reload those as part of your search; if not, that is worth a try.

I got it showing now.

I updated it a bit ago and at first it wasn't showing up, but then when I reset browser it did. I guess the app list was cached somewhere or something. I'm going to see if I can accomplish my goal in this app now real quick.

Color Animation seems to not be what I'm wanting here, as it's limit for transition duration is quite low (5s), and I'm wanting the transition to occur for spans of like 10 minutes or so.

I'll look back into Scene Transitions now I suppose, unless you think it may be easier with a Room Lighting setup.

I set up the scenes / transitions in Groups and Scenes, but I don't see a way to trigger them in RM.

You should be able to use the Scene or Scene Transition directly (or an activator device, but you don't need that here):

Ah, thank you, my bad. I completely overlooked that one.

So I think this will definitely cover my use-case, thank you! I have it setup so that it will activate each transition-scene in sequence, along with a delay for the duration of each scene's duration before the given scene. This way they should be offset correctly.

Last question though, is there a way to set up the logic for this, so that if I hit a button by my bedside then it will cancel all subsequent scenes, and just turn everything off? I have a feeling that if I turned it off in a moment, the delayed scenes would still trigger afterwards, so I guess I need to have some conditional to stop that from occurring.

I'm guessing I'll have to wait a duration, and then check the variable and invoke the next scene. As opposed to invoking the scenes with a delay like I am now. Is that correct?

If you're using delays, a "Cancel Rule Timers" on this rule from any rule or (if the delays are marked "cancelable") a "Cancel Delayed Actions" from within this rule will work. The latter is probably more difficult, but setting up a second rule that resoonds to your desired event and does the former should be pretty easy.

You could also add a check before each action to see if the bulbs are on and exit the rule if not, among other ways you might handle this.

Ah good point. thanks.

I also do notice that the transitions have something that says 'optional switch to stop transition'.

I haven't tested yet, but I feel like this means that even if I turn off the light, the transition will continue to run, and to send the updates to the bulb at the given intervals, and that I need to set up some way to cancel it. I could be wrong, but just based on my assumptions about hubitat works, I think this may be the case.

Yes, I believe that is correct (just continues based on its initial calculations about where it needs to go and each step it needs to take to get there).

This is where I like to use Required Expressions and Virtual Switches to help with this scenario. Set up the rule with a required expression of the virtual switch to be off. Make sure to select "Cancel pending actions when Required Expression becomes False." Create a second rule where the virtual switch turn on, it turns off the bulb. The set the button to turn on the virtual switch. Finally, configure the virtual switch to turn itself off after 5 seconds.

The above allows you to cancel the rule, turn off the bulb, and have the rule automatically be ready to run again since the virtual switch turns itself off.