I have a couple of events setup on my system that seem to be conflicting. Was wondering if anyone has a workaround.
At sunset, set the mode to “night”. Do not perform this if I am set to “away”.
When I leave the house, set to “away”. When I return, set to “home”.
The issue is (if it’s not already obvious) when I don’t get home until after sunset. My house is then set to “home” and not “night”. This is an issue because I have a number of other events that only fire when the mode is in “night”.
I suspect there’s an event that fires at sunset that looks like this:
if (mode != away && sunset)
{
mode = night;
}
what I think I need is something else that looks like this:
if (mode.changed() && mode == home)
{
if (time > sunset && time < sunrise)
{
mode = night;
}
}
Basically, a check to see if we missed the event to change the mode to night.
I am afraid this is one of those instances where SmartThings is not very smart. We all want different behavior when we are away, but upon returning, we want our homes behavior restored to NOT away behavior, and any settings that are appropriate for being “not away” at any given time that may occur.
But for now, you’ll need to abandon the ‘stock’ apps for one that supplies this additional conditional. Have a look at the ‘Sunrise/Sunset’ example for calculating those times, and add them to a mode change SmartApp with that other conditional.
Gotta go play golf right now so don’t have time to look into it for you, but if no one beats me to it I’ll have a look after I get back. In the meantime, you might want to consider anything else you might want to do on arrival other than setting the proper mode at the proper time.
Thanks for the reply! Don’t spend too much time trying to write anything - I’m a software engineer so I can (hopefully) do it myself. I just wanted to see if a solution existed before I started digging.