Can you automate a fading lights scene?

Does anybody know of a way to automate a Hue lights scene that fades instead of turning on/off completely?

I like my Hue lights to fade out at night and in in the mornings, but some times I just cannot keep my usual bedtime.

I would like to be able to tell Siri or Alexa ‘Goodnight’ and then have one of them fade the lights over the next 15 minutes while I get ready for bed.

I thought I’d seen an applet for that on ifttt.com, but now I can’t find it. Does anyone know if this is possible?

/Christian

Haha! I laugh because I’m currently working on this right now. I’m approaching this from two fronts:

  1. AutoHotkey on Windows - Using the API to tap into the lights, but keeping the logic within AHK
  2. Siri Shortcuts to trigger an existing “Goodnight” routine <- this is probably what you’re looking at doing

I want this because my kids’ bedtimes are inconsistent and I hate going into the app and navigating to the timers.

Sit tight, your post light a small fire under me and I’ll try to get something moving here soon.

Sounds nice!

I’m all in on Apple’s eco-system (with a recent addition of an Amazon Echo), so Siri (or Alexa) will be the way for me.

I get not wanting to meddle with the settings in the app all the time - that’s not very ‘automated’.

I mean… “we can send a man to the moon”, but we can’t have my pocket computer fade my lights on my bidding.

I’ll keep combing the internet for solutions as well. :slight_smile:

I have some scripts on my Mac that I wrote to talk directly to the Hue bridge that can do this. It essentially sends a command periodically to set a new lighting level. It works well but requires an always on Mac (but could be run from a Raspberry Pi Zero, etc.), a bit of learning about the hub API, and tailoring around your own lighting equipment.

Since you are “all in on Apple”, an easier approach might be just to grab a copy of an iOS app that supports this.

Hue Lights (by LapApps, LLC) seems to do the job just fine, but it isn’t going to win any App Store design awards for aesthetics any time soon. Here’s it running and dimming my living room light over the course of a minute. I assume it is actually doing it in the same way my scripts on my Mac do - lots of commands being issued over the fade period to set the lighting level lower and lower.

There may well be other apps that enable the same sorts of functionality, so it may be worth a bit of a look around.

Hope that helps.

1 Like

Yeah, I found that app too. I can’t remember why I uninstalled it some time ago, but I did. I would like to do this with Siri Shortcuts and I’m almost there. Just a few more tweaks and then I think I’ve got it.

I did configure it to work with Workflow originally when I was just investigating the API. But my issue was that when you want ongoing control rather than just instantaneous, it’s better to hand it off device, otherwise it is effectively monotasking it in iOS.

By running it on something with an accessible scheduler, you can use it to trigger things at intervals that don’t require direct interaction from you like iOS does.

I do however continue to use Shortcuts to trigger the scripts on my Mac directly, and to schedule them (I just use at), and to specify the parameters to attach to them (which bulbs, levels, time, …). As a result I just pick from some common presets or my option to send a custom instruction (where I then select from a set of inter-dependent parameters) and fire that off to the Mac over SSH. It’s fractionally slower then direct interaction, but still feels very fast and personally allows me more freedom and flexibility.

One day maybe iOS will give us the power that desktop OS’s provide, but for now it’s a multi-platform world.

1 Like

Interesting. After digging into the API (a few months back and last night) I found that you cannot directly tell a light or a group to “fade”. There is a transitiontime parameter that takes multiples of 100ms, but because it’s a unit16 datatype it caps out around 65,000 (about a minute).

So, I began searching how others have solved this problem and the only viable answers I found were to run a script with a loop, or use that same app you mentioned above.

While I’m all for running scripts on my PC and am perfectly capable of doing so, I rather liked this challenge of getting it to work universally in Siri Shortcuts. I’m pretty happy with the modulated system I’ve setup for it right now and it appears to be faster than fiddling around with the app.

I do also have some scripts tied to one of my extra keyboards in my multi-keyboard setup that AHK sends commands to my hub. And, I’ve enjoyed that interaction. But, the fade over anything longer than a minute looms over me and I’m determined to solve it.

Edit: Oh my gosh; I’m such an idiot. I had the transitiontime math all screwed up. Turns out I can use it. So, there’s that.

Thanks, I’ll try that one :+1:

Dudes! Check it out!

I found a way that’s not very pretty, but it works for now - until I get around to looking into what fishgeek has made.

I simply made a short cut that starts three different Hue scenes that I already had in my Home setup. In between the scenes, I added a ‘wait-instruction’ so It goes:

I say: “Goodnight”
Siri starts: Wait 30 secs.
Triggers home scene: Evening lights (sets several lights in kitchen and living room to 40%)
Siri waits 60 secs.
Triggers home scene: Night light (sets three lights between my bedroom and my kitchen to 3-5%)
Wait 60 secs.
Triggers home scene: Turn off the lights (turns off all lights)

It’s not quite fading, but for now it works.
I’m going to look into the solution geekfish came up with…

I too played around the Wait command to see if they work in the background (which they do pretty reliably) the only problem is, it ties up your Shortcuts and you can’t execute anything else while that’s going on :wink: