Hacker News new | ask | show | jobs
by francis-io 1593 days ago
Home Assistant has home zones. You can trigger events based on being home, away, or the trigger between both states.

My current favorite automation is to turn off my lights when I go to sleep by plugging my phone in to charge. The basic logic is:

* IF it's 1AM OR I transition from Away to Home OR My mobile starts charging CONDITIONAL My location is AWAY OR the time is between 21:00 and 03:00 THEN Turn my office, kitchen and bedroom lights off *

It's a bit complex to get your head around, but the basic idea is, my lights turn off at 1 AM, or I leave the house, or my phone starts charging after 9 PM. This allows me to go to bed early (I'm a night owl) by just charging my phone. It wont trigger in the day based on the conditional.

2 comments

I do the same but have some additional logic including “is bedroom occupied” and “is bedroom door closed”.

I combine those and a few other things into a hybrid Boolean sensor called “sleep conditions”

At any point in time the “sleep conditions” sensor is calculated as “true” or “false” - ie. does it look like I’m likely to be going to sleep.

So when my phone is placed on charge AND sleep conditions = true, my automation goes into sleep mode triggering lights off, setting wake up alarm etc

It seems trivial, but simply putting your phone on a wireless charger at night and having everything react automatically is quite gratifying!

I like this approach. This kind of house-wide reaction to putting my phone on a wireless charger would make me more trusting of the damn things. I only used one briefly, twice in a month where my phone didn't charge, then died, and having no alarm to wake me in the morning all because my phone wasn't perfectly positioned on the pad soured me on the idea.
Ha, I do the same thing, though for me it's the combination of charging and setting the phone to silent.