Wow, nice to hear
This is a perfect example for the use of AppDaemon for your automations. There is only so much you can do with Home Assistant’s internal automation system, while AppDaemon has no limitations on the automations you can do, no matter how specific and detailed you need them to be.
I have moved all of my internal Automations over to AppDaemon and now I can change my automations on the fly without restarting Home Assistant.
Scheduling something as specific as every other weekend would be easy as AppDaemon gives you direct access to all of Python, so you can use any python module, including google calendar access, as well as more advanced date scheduling scenarios.
I’m also a BIG proponent of Node-Red, HA Bridge and HADashboard… the combination of Home Assistant, AppDaemon, Node-Red, HA Bridge and HADashboard have made my home a powerhouse of automation!!!
Being such a booster, maybe you should do tutorial for newbies getting started with AppDaemon. I know you have the skills to do a great job with this and it would help a lot of people out who may feel the AD is ‘just for programmers’?
I know Andrew would appreciate the help and we could add it to the knowledge base.
Hoping I haven’t put @jbardi on the spot; I just respect his skills. (If I have, please accept my apologies.)
That would be very nice… I still think Daemon is something out of Poltergeist…
p.s. In the AppDaemon Q&A there is already some content to use AppDaemon for dumies like me (starts here AppDaemon Q&A) but we are actually stuck.
I may have found a painfully long resolution to this. Time & Date - Home Assistant
For one year you would have to create up to 26 automations and edit them at the start of each new year!!! Hopefully there will be a better way to go about this by then.
Anyway would something like this work?
- alias: automation for schedule 1of26
trigger:
platform: state
entity_id: sensor.date
state: '2016-10-05'
condition:
condition: state
entity_id: sensor.time
state: '16:33'
action:
service: service.do_something
entity_id: entity.you_want
Now you just have to do this again and again for every date and time you need, at least through 2016 (Potentially 8 automations).
Regards
Would also love a walk through to get started. I’m using Docker for all my components/setup and would love to add AppDaemon and Node-Red (and HADashboard) to beef it up. My big thing is finding AppDaemon examples and a “starting point”.
Coming across this while looking for an “every other week” for a “take out the recyclables” reminder.
I don’t think that this particular example would work - at least as it is. I think you need the time to be the trigger and the time and the condition would be the date. Otherwise, you’d get a trigger as the date changes, but the condition would halt it.
I got thinking - a date can be formatted as “week of year” (the first week of Jan is 1, the last week of Dec is 52). I wonder if you could format “today’s” date like that, then check to see if the result is even or odd.
You are correct, I did not test the automation. I was just looking for a way to run a service on a specific date and time within HA.
This does work…
- alias: automation time and date
trigger:
platform: state
entity_id: sensor.time
state: '12:30'
condition:
condition: state
entity_id: sensor.date
state: '2016-10-05'
action:
service: switch.turn_on
entity_id: switch.wemo_switch
Thanks again!
By the way I have solved this via IFTT which as least up till now works reliable.
- Created the events I need in Google calendar
- Created a select_input in HASS (in my case with three option: Away, Sleep, Warm)
- Created the recipes in IFTT (search for keyword). One for each input select value (so 3). For people that don’t know how to do this, check out Bruhs video https://www.youtube.com/watch?v=-Tkb04xRs-o)
- Recipes switch the HASS input_select to the appropriate value
- Hass Automation triggers on value input_select
First I had input Booleans but as the IFTT automation triggers an ‘ON’ only, I had to make automation to put it off when anther boolean goes ‘ON’. Much easier to just use input_select
i am a very big fan off appdaemon but making a automation going every other week could also be done with a template which determines if the week is odd or even.
value_template: {%if (now.isocalendar()[1]/2)|round(0)==(now.isocalendar()[1]/2)%}true{%else%}false{%endif%}
this gives true for even week and fals for odd weeks.
Hello,
Would like to set similar but for days not weeks
Thanks
Do you mean you want a template that will evaluate to true every other day? If so:
{{ now().timetuple().tm_yday % 2 == 0 }}
The caveat being that it will probably be wrong on January 1, since most years have an odd number of days.
EDIT: Wait! This is probably better:
{{ now().timestamp()|int % 2 == 0 }}
Would like to give true on odd days and false on even days
{{ now().timestamp()|int % 2 == 1 }}
By “odd days”, do you mean odd days of the month? I thought you just wanted something that was true every other day, continually. So, for example, if it is true on January 31, do you want it to be true or false on February 1?
Thanks so much!
I would like to fire automations every odd day of the month or vice versa
For example: automation should run on 1-3-5…31 dated days
Or should run 2-4-6…30th days of the month
If 2 days have same out put for the last of the month it doesn’t matter
Thanks again
Ok, for true on even numbered days of the month:
{{ now().day % 2 == 0 }}
and for true on odd numbered days of the month:
{{ now().day % 2 == 1 }}
Really appreciate your support!
Many thanks