Hi there.
Sorry for the long post - I want to describe what I currently have that I’d like to automate in HA.
Also, I’d like to state that am just starting with HA and I am wondering if/what/how things can be done. I can code but am no expert. I also manage my own home network, and I thinks I’m doing OK - all this to say I do understant technology (if that makes a difference)
Please don’t hesitate to tell me if I’m going nowhere, or if this can’t be done in HA, or send me back to some documentation I should read before.
Let me describe what I “currently have” that I’d like to port to HA.
Here are the “moving” parts:
- 1 Raspberry pi running Cron to call a Python script to handle my lights
- 4 TP-Link (HS200) light switches
- 1 ESP8266 that act as a “key” to bypass light switching
Using Crontab scheduler on the Raspbery Pi, I call a python script every minute (see note below). That script does this:
- Checks the presence of the ESP8266 on the network (static IP)
If found, exit
If not found
- Checks each light state and switch on/off according to sunrise/sunset
- Send a single email any time a switch was “switched” (ON>Off or Off>On) so that I know it happened when I’m not home
- Also sends an email if a light can’t be reached (offline or lost network connectivity, which happens every once in a while)
It runs every minute so any missed event will be caught:
- Restart of the Pi
- Accidental turning light on during day (happens all the time in the garage where I have multiple light switches)
- …
The reason for using the ESP8266 is to allow my wife to prevent lights from switching on in certain cases:
- When we make fire in the backyard - we don’t want the light on the balcony or shed to turn on
- watching stars with the kids
- …
The ESP8266 is really a dummy web server that only displays a page that reads “Skip”.
It has a static IP on my network.
When we want to skip the lights turning on at night, we just have to plug the device in any USB power source in the house so it’s “up” and the Python code can see it and bypass the light switching.
This is effective and it works like a charm.
Questions:
- Is the above possible to do in HA?
- Use that ESP8266 as a bypass key (so have a condition for checking it’s presence)
- Send an email (I use a personal mail server)
- Can this be “active” constantly (or checked every n minutes) so the state of the lights could be switched if in wrong state?
- Could an email with the state of each lights (one email, not 4) be sent to my local mail server?
- Send a single email when one of the lights was switched
- be notified if a switch can’t be reached (happes every once in a while)
Only send an email per 6 hour period so I don’t get spammed every minute if I’m not home
I know this covers a lot of things that could be quite complex, and I don’t expect a “full recipe”, but any help or recommendations would be helpful!
I’m also happy to chunk it out in separate micro-projects:
- Check presence of ESP8266 - re-use as a condition in an action in HA
- Sent emails - check if same email was sent in the past n hours, if yes, skip email
- …
“Why fix something that isn’t broken?” you ask?
In this particular case, it’s the challenge that is appealing.
Also, I think that if I can move my current process to HA, it will open the door to other cool stuff which are more “custom” - I have plenty of ideas
Cheers,
Zolt