Need Mode Help

I’ve been struggling with making my system smart enough to know when I’m home AND it’s night versus day and a similar experience when I’m away. For example: I want the temperature at different levels when it’s day versus night. I also leave the house when it’s both Day and Night time (obviously).

What I’ve done to accommodate this need: Created Home & Night, Home & Day, Away & Night and Away & Day Modes. As of now, my brain is fried and I’m hoping it works better my last attempt at presence based mode management.

Any better ideas? I’m all ears.

I found the best way for this is to use the modes based on the sunrise and sunset. Using this within smartapps, I was able to have the modes and devices act as I wanted them to.

Although, I have some training many years ago, I am by no means a coder. However, by using some smartapps created by others I was able to alter the code to do what I wanted it to do.

Here is a link to a smartapp for my Away Mode.
In short, this app

  • Monitors a set of presence detectors and triggers a mode change when everyone has left.
  • When at least one person returns home, set the mode back to Home (or whatever is defined).
  • The mode is determined based on the Sunrise and Sunset

https://github.com/Sastozki/Away-Mode---Mode-change-/blob/master/awaymode.groovy

Hope this helps.

Great! I’ve installed it and will follow-up RE: Success. I’m hopeful this will work much better than the non-working situation I had before and the cluster I had created earlier today.

Well… I installed the app and it seemed to work great, until I needed the Night Mode to kick in. I kept waiting for it to register Night, but it never did. I ended up manually adjusting the Mode to Night. Any ideas?

To clarify, I did input my Zip.

@bgeeeallstate-com - The problem is there is no event firing for sunset. The cited git repo only fires an event on presence. You’ll have to either fire an event or schedule a cron to change mode if you want it based on time alone. The repo looks like it’ll work great if you come home after dark and mark as “Night” or come home during the day and mark as “Home”.

Ok… So… Admittedly, I have no coding experience and got a little lost on the “get repo” reference. Why would it ask me to input a zip code if it wouldn’t change the mode to Night (sunset)? I need to run ST based on presence and time of day. I was hoping this would allow me to do that.

This is the git repo I was referencing:
https://github.com/Sastozki/Away-Mode---Mode-change-/blob/master/awaymode.groovy#L36

If you look at the install() method, all it simply does is say “when someone’s presence changes, do something.” The problem is that if you are home, the presence never changes, so your mode will never automatically change to night. The best solution is to have something fire an event when day / night change - and subscribe to that event - check your home or away status and if(mode == ‘home’) { /* set mode to night */ }