So I’m working on my setup of home assistant. I’ve got specific automation questions, but I want to ask some basic HA questions up front. So… this is my understanding:
Automations need to have both a trigger and an action. Conditions come after a trigger to set whether or not an action takes place. Scripts are a way to have multiple actions happen in a sequence? I don’t think I understand the context of templates at all. Am I in the right ballpark?
I’ve got a very basic setup. I have 3 zones in my apartment (bedroom, living room, and hallway) that I monitor with three Aeotec MultiSensor 6 sensors. In each zone I have a Dimplex electric wall radiator plugged into a TZ88 Z-Wave Smart Energy Plug. It’s all tied into my RP3 via a Aeon Labs Aeotec Z-Stick (Gen 5). Right now I have 3 instances of this very simple automations in each zone running in Home Assistant:
automation 2: - alias: _Temp Bedroom High
trigger: - platform: numeric_state entity_id: sensor.aeotec_zw100_multisensor_6_temperature above: 73
action: service: homeassistant.turn_off entity_id: - switch.wenzhou_tkb_control_system_tz88e_smart_energy_plugin_switch_switch
alias: _Temp Bedroom Low
trigger:
platform: numeric_state entity_id: sensor.aeotec_zw100_multisensor_6_temperature below: 69
action: service: homeassistant.turn_on entity_id: - switch.wenzhou_tkb_control_system_tz88e_smart_energy_plugin_switch_switch
This works well and has been stable over the last month or so. But I’m wanting to add some flexibility to my setup. I’m wanting to have my HA setup see if I am home. If I’m home and awake, the above default is brilliant. When I go to work, I’m editing the temps manually (to lower defaults to save energy) until I figure this all out. I’d like HA to know if I’m not home and at work, or not home and not working. I’m thinking of using a mixture of Owntracks, Google calendar, and/or NMAP?
Basically I want HA to:
-
know that I’m leaving home for work and turn down the default temps - know that I’m leaving home, but I’m not scheduled to work
-
know that I’m leaving work, and turn my heat back up to the normal defaults.
-
know that I’m coming home, but I’m not at work and to turn my heat back to the normal defaults.
-
know that I’m at home, sleeping, and to turn down the default temps.
-
know that I have to work in the morning, and turn the heat up to the defaults an hour before I wake up.
In terms of leaving for work, I think this could be done using Owntracks, but I found that by itself it’s not consistently reliable (will show me as not being home, when I am home) so I think maybe using another component (like Google Calendar, for example) might be helpful.
In terms of leaving home when I’m not working, I’m thinking HA could use the Google Calendar component to flag me as not working.
In terms of leaving work, my clockout time at work is pretty consistent. I also run Tasker on my phone at work (to stay on the work wifi and keep my phone on silent). Thinking maybe I could send HA an http post (via exit task maybe?).
Say I’m not working, but out at a bar. HA has turned down the defaults, I’m thinking of a way to signal to HA I’m on my way home and to return to normal defaults. I don’t think there’s a reliable way to do this automatically, but maybe a tasker shortcut to send a http post to HA saying I’m on my way home?
I think I can accomplish the sleeping piece in terms of falling asleep I think I accomplish by using the the Fitbit component. The waking up bit I think maybe setting a default time based on if I’m working or not (again, google calendar component.
My issue is understanding how to piece each one of these things together. I think I’m confused exactly on how conditions, scripts, and templates fit together to make a lot of these happen. Are they separate automations? I’m seeking clarity.
Any suggestions on resources that are easy to understand? I’ve watched (and get a lot of help) the videos put together by Bruh Automation. To my unmathematical brain the explanations on the HA website seem like they’re written in a language I currently don’t completely understand. Any suggestions? Up to this point I’ve just kind of cobbled together other people’s posted code.