I am looking for some configuration advice on how to handle my wifes dynamic work schedule. She is a nurse and the hours that she works is consistent 6:30am to 7pm. However the days that she works doesn’t have any sort of pattern, but she does know her schedule three months in advance. Currently I have an input boolean and if it is turned on the furnace turns on and the lights in the house turn on for her at 5:30am when she gets up, and then at 7:15pm turn on the outside lights.
What I’m looking to automate is the input boolean a month or two in advance. It would be nice to be able to type out the dates that she works and have HA enable to boolean for me.
Does anyone have any ideas on how to accomplish this or has accomplished this in another way.
Correct. If she works that day the boolean is set to yes and if she doesn’t it gets set to no.
I’m open to other ideas too. This is just what I have come up with so far. I just need to find a way to be able to input a months worth of work days and then have it trigger a scene to make the house warm for her in the morning when she gets up and turn some lights on.
The challenge isn’t two dates. His challenge is entering in ~45 dates every three months when she gets her schedule.
I think others have done something similar with the google calendar integration. Basically create calendar entries, with a specific string in the title, that reflect her schedule. Then have an automation that runs everyday and checks the calendar for entries with that string.
Whichever technique you choose, you still have 45 dates to enter. What I have in mind involves a Template Trigger with a simple list of dates (easy to maintain).
Depending on the rest of your setup you could basically tie everything to that. I have e.g. a HomeKit automation to trigger when I stop the alarm on my phone to turn on some lights.
For your 2nd trigger, I assume that is always a constant delta (fixed working period) to her wake-up time so you could implement that with a relative time calculated or scheduled when the first trigger has occurred.
Although, in my case I use device tracking to turn on lights when getting home.
This way, all of it depends on only one manual action: setting your alarm.
Here’s an idea. My Jinja isn’t very good so this may not be the ideal, but hopefully simple-ish to use.
Create 12 helper text inputs, named like working_days_jan, working_days_feb etc. You can then populate these with a comma-separated list of days, like 1,12,14,16,21,29,30 (spaces ignored)
Create a custom sensor, like:
binary_sensor:
- platform: template
name: working_today
value: >
{%- set month = now()|as_timestamp|timestamp_custom('%b')|lower -%}
{%- set days = states('input_text.working_days_'+month) -%}
{%- set days_list = (days|replace(' ','')).split(',') -%}
{%- if (now().day|string) in days_list %}true{%else%}false{%endif -%}
Value is true if it’s currently one of those days, false otherwise.
The following is a Template Binary Sensor containing a list of your wife’s work days (obviously you will need to supply the actual work days). On a work day, the binary sensor’s state will be on otherwise it will be off.