Can someone please tell me if this is possible and how I can write it (contact sensor/ lights

I can’t seem to make a rule. Contact sensor (door) open, turn light on (hue). Contact sensor closed, lights off, but a 15 second delay so I can get into bed.
Also, not important but is there a way to make the lights “reverse dim” on open? 0-100 instant hurts my eyes. I’m in a wheelchair so it takes me 15-20 secs to get into bed. Eventually once I find a reliable bed sensor I’d make a rule that the lights won’t turn off until I’m in bed.
Thank you

For the contact sensor, you could write a rule that does this, but it might be easier to "translate" the contact sensor into a motion sensor so you can use it in standard motion-lighting-type apps instead. Here is a post from staff that allows you to do that: Motion Lighting conundrum.

For the dimming feature you asked, the "Set Level" command on almost any device lets you specify both a level and transition time, so if you use this instead of on (or off), you can control how fast it happens. This works in either direction. (A small note: enabling "prestaging" will make the bulb not turn on with a Set Level if it is off, since that is what the "staging" thing means. But this setting is off by default and not supported on all devices anyway.) So you can do something like "Set Level" to 100% with a transition time of 15 seconds and have it slowly fade to 100 over that time. Not all apps let you do this, and some call it something like "fade time" instead.

If you did want to do this with Rule Machine, something like this should work:

Trigger: Contact sensor opened

Actions:

Cancel Delayed Actions
Dim: Hue Light: 100% --> fade 15
Wait for events: Contact sensor closed
Delay: 0:00:20 (cancelable)
Off: Hue Lights

That being said, that rule might not do exactly what you want unless you want the lights to turn off every time you close the door (which I suppose you might if going to bed and wanting the lights to turn off is the only reason you'd close it; what I mean is just that, as you can observe, it ignores other things you might care about in the room like motion sensors).

7 Likes

Thank you, sir, this is something I’d NEVER figure out on my own

Just my opinion. Automating things that can have consequential errors due to variability is to me a very frustrating exercise. Instant darkness a second or two early could be painful. What would be wrong with a bedside "good night" switch that turned off the lights when you were comfortably settled?
I use an Amazon Fire TV remote. The Fire TV device doesn't even need to be attached to a TV for the remote to work. You can also pair more than one remote to a Fire TV device. You then have push to talk to have Alexa control any and all of your light. I am sure this would be the same for Android TV devices.

2 Likes

I’ll look into that

Also, when the lights turn off, use set level to 0 before off. Otherwise, when they turn back on, they will be at full brightness.

1 Like

So after “delay” before off?

As-written, my rule will not turn the lights on to full brightness immediately due to the fade time on "Set Level." Bulbs may differ here, but Hue Bridge bulbs (and every Zigbee bulb I've tried even when directly paired to Hubitat) don't do anything unexpected. They will slowly ramp over the 15 seconds to the specified destination level (starting from off/dim if they were off to start). Additionally, with Hue bulbs, a setLevel(0) will just turn the device off while "remembering" its previous level, being effectively equivalent to the off() command. Devices may differ a bit here, but this is what most of them do.

But a related point: some devices may respond to a transition/fade time even with a "Set Level to 0%" command, so a setLevel(0,15) or "Set Level to 0% with a fade time of 15 seconds" might make the light fade slowly down instead of turning more or less immediately off as I originally suggested. This might be better if you want time to fix the problem before the lights turn off if the fact that they are turning off is, indeed, a problem. :slight_smile:

Because I’m slow :stuck_out_tongue_closed_eyes:, should I add that set level or no?

I don't think there's any point in doing a setLevel(0), which for Hue bulbs (and most) is the same as off(). Doing both, since they are the same, would also have no added benefit. So, if it were me, I'd either leave it the way I wrote or consider using "Set Level" to 0% with a transition time instead of "Off" (the only thing here that would make this different) if you want a more slow fade to off.

Thank you.

Ive finally got to play with it through the lighting app. Works well but “turn off when closed” is in minutes, anyway to make it 30 secs?

Unless something like "0.5" works (I've never tried), then I don't think so.

Nope, but thx

How do you pair the remote to he?

Fire TV remotes can be used for voice control with Alexa. So you would use the Hubitat Alexa skill, just the same as anyone with an Echo speaker (or other amazon device with built-in Alexa voice control).

The remote itself doesn’t know anything about hubitat, Alexa in the cloud is the integration point.

Oh, it’s be cloud dependent?

Essentially everything for an alexa-enabled device requires an active internet connection. The AI for responding to your voice commands can’t live on-device.

1 Like

But how the buttons work? Like map the buttons

Re-read @zarthan's post below. He does not mention using any buttons on the FireTV remote except the Push-To-Talk button, to allow a personal microphone to receive Alexa commands.

Note: You also need an Amazon FireTV box up and running on your network for this to work.

I have an Amazon Echo Dot on my nightstand that I can just talk to in order to turn off lights, or whatever. Much simpler, IMHO.

We also also have Lutron Pico remotes on each nightstand to control things without requiring voice commands, which might wake up a sleeping spouse.

2 Likes