In the past years, I’ve come across a few things I like to be automated in my home. It started with a few sensors for temperature monitoring, added Tasmota devices, Shellys and ended with open/close sensors for the doors.
So how to cobble all of this together?
Common usecases are e.g. notifications on low temperatures, trigger a switch or light if movement was detected.
My largest fears were how automations will work in comparison to openHAB.
The main difference between the two system lies in HA using YAML configurations with Jinja2 templating support that evaluate to code vs. actual code that’s being written in a Java-like DSL in OH.
In opposition to OH, HA has things like blueprints and scripts to add to your automations. Everything goes into automations.yaml as a big pile of config.
You can choose to just click together what you need as an automation via the provided UI and fit in pieces of YAML config as you go, if you need non-standart stuff or just want to use evaluations via templates.
I strongly suggest you read up on automation basics in the documentation.
In addition to the basics: As soon as you have recurring tasks, consider to use a blueprint. Before you start to write one yourself, check the forums for available solutions you may reuse or adapt to your usecase.
I prefer the lights in my staircase to turn on and off automatically, especially when it’s after dawn or before sunrise and on motion.
The below code is not perfectly elegant, since you can’t configure the offset for sunrise/sundawn.
Configure a motion sensor as trigger device
Add as many lights or switch devices, groups etc. as you need
configure brightness and how long lights will be on
The time for the light being on depends on three factors: How long does the sensor stay in the activated state and after it does not detect any more movement, the timer.
I want to know when my doors are opened… And also if/when they are closed.
The difficulty here, is to provide a name and the state for a message in a notifier service. With this blueprint you only have to c&p the template snippet into the message field.
I would have preferred a pre-filled variable and evaluated/translated state. But this only works for values that come with the inputs themselfs. The trigger is evaluated on state change and is therefore dynamic :-(
I stole this nifty piece of code from this template and re-arranged it to fit my usecase.
There are 9 temp sensors in my home and I want to monitor all of them, exept e.g. the outdoor ones, because they are allowed to have temperatures below 10°C.
This blueprint checks the states of the sensors every 15 minutes, whis is the trigger, naturally. It’s running through all sensors with temperature and evaluates vs. the temperature threshold.
If the threshold is met, it sends a notification.
And you can set which sensors to ignore.