Music and lights on but only after sunset when coming home?

I’m trying to do the following when someone arrives home:

  • Turn on the music - Same level as previous
  • Turn on the lights (only after sunset) - 40%

I tried doing this with a standard scene and trigger, but:

  • the level seems to apply to both speakers and lights, making the speaker too loud!
  • it doesn’t appear to be an option to presence AND after sunset, it appears to be OR (triggers on one or the other)

I tried setting up two routines, one for music and one for lights, both triggered when someone comes home, but it appears the presence sensing only triggers one routine (ignores the second one), so I need to find a way to have one routine to trigger both music and lights…

It looks like this might be possible on the Android version from some screenshots, but I’m on iOS…

Any tips?

I’m vaguely aware of custom code sources, but I’m hoping to do this without copy & pasting code to keep it simple :slight_smile:

I think I just found a partial answer here:

  1. Routine to change mode to “Sunset”
  2. Routine that uses Presence detection, but only runs if in ‘Sunset’ mode

That would partially work, but doesn’t address the music (I think), as the ideal would be:

When I come home, always turn on the music
AND turn on the lights (but only after sunset)

Can anyone help with this? Not managed to find a solution…

You should be able to Just use two routines, one for the music and one for the lights. Then restrict the one for the lights to only run between sunset and sunrise, or at specific times a day, or in specific moments, however you want to restrict it.

You might be able to do the whole thing with just one rule in rule machine, I’m not sure. The people in the following thread should be able to help:

i don’t know why two routines didn’t work for you the first time, you can definitely have one person’s presence trigger multiple lighting automations or smartapps. So maybe there’s just some issue with routines? But there are a lot of other ways to do the same thing.

Hi JD - So, it turns out both routines CAN trigger (as you said), but the triggering itself is extremely sporadic and unreliable (just triggered by iPhone’s, not physical sensor).

I might try it with the physical sensor for a bit just to identify if it’s the iPhone geofencing that’s the issue…

Separately, the routine definitely triggers if someone comes home OR sunrise/sunset (i.e. it’ll trigger if away from home when it’s sunset). Ideally I want someone home AND sunset, but that does not appear to be possible?

Does anyone else have any tips for “coming home AND sunset”?

Currently routines trigger on “coming home OR sunset”, which seems an odd way to combine rules…

Would be great to do this with the default app, but sounds like I may have to ‘hack’ what seems like basic functionality with the Rule Machine?

Did you ask in the peer assistance thread I linked to above? I’m pretty sure you can do this in rule machine, but the folks there will be able to tell you. :sunglasses:

I was hoping to do it with the “normal” app (as would expect this sort of basic logic), but sounds like I’ll need Rule Machine after all! I’ll ask there, thanks :slight_smile:

1 Like

I have some of this working using the Smart Lighting app combined with presence sensors and motion sensors. Basically when anyone of the family come home ST is set from Away to Home, Smart Lighting uses the motion sensors as a trigger to turn the lights on but only when the mode is set to Home and only after Sunset and before Sunrise. I haven’t controlled my Sonus with this yet but there is the option to do this also within Smart Lighting.

Hope that helps.

Thanks Andy! Oddly I came to this conclusion just yesterday as I’m still getting my head around Routines and SmartApps, as there seems to be a LOT of cross-over!

Good to know about the Sonos as well - I wouldn’t have guessed to look or speakers under lighting controls!

I don’t have the motion sensors setup, but may need to do that, otherwise I have a presence race-condition…

  • Presence detected, set home to “Home”
  • Presence detected, turn on lights and Sonos if after sunset, and home set to ‘Home’

Because they’re based on the same trigger, the second one could be attempted before the first (and nothing would happen…)


HHHHmmmhmhmhmhmmmmmmmm… how’s about…

  • Presence detected, turn on lights and Sonos if after sunset, and home set to ‘Away’
  • Presence detected, set home to “Home”

Same race condition issue (so may have to do it another way), but doing it this way would mean lights and music come on when one person comes home, but doesn’t startle someone if a second person comes home?

Until recently I had been using the Routines to do all my Home/Away lighting controls but this stopped working well since the clocks went back and the lighter evenings started. This left me with the scenario that as my Daughter came home from school the presence sensor in her bag was triggering the I’m Back Routine and turning lights on when there was still hours of daylight left, not ideal.

I bought the additional motion sensors to gain better intelligence over the Good Morning and Goodbye Routines plus I liked having temp sensors around the house, I want to use this later information to better control the heating system.

So now I have presence sensors to control I’m Back and Goodbye Routines to set the house modes. Then the motion sensors control the lighting in each room based on movement, daylight and house mode.

From my experience you will be best to separate the two triggers. Use the Routines to set the house mode by presence but then have that as a condition variable within a Smartapp to set the lighting on another trigger like motion. Having said that there are lots of triggers within the Smart Lighting app. The best way might be using the Rules Engine app but I haven’t needed that yet.

The limitations I’ve found so far is that I haven’t worked out how to set the Hues lights to a level, only on or off. I assume this will be the same for the Sonos,as it’s only seen as a switch within Smart Lighting.

Thanks Andy! Regarding the lighting level, that’s definitely possible in Smart Lighting (you can set colour too!). It’s a guess, but ‘dimmer level’ may also apply to speaker volume…

I tried this the other night but it fails to then turn on the light let alone set the level. I don’t think ST sees the Hues bulb as a dimmer?