I am setting up a Alarm Clock automation and need suggestions on best way to use input_boolean selection to fire if daily state is equal to on.
Here is input_boolean in my configuration.yaml file
input_boolean:
monday:
name: 1_Monday
initial: on
tuesday:
name: 2_Tuesday
initial: on
wednesday:
name: 3_Wednesday
initial: on
thursday:
name: 4_Thursday
initial: on
friday:
name: 5_Friday
initial: on
saturday:
name: 6_Saturday
initial: off
sunday:
name: 7_Sunday
initial: off
Here is the automation I currently use which has the dates listed and I just comment out the days for the alarm to not fire.
#-----------------------------------
#----Wake Up Alarm for Work Days
- id: alarm clock
alias: "Alarm Clock Work Days"
# hide_entity: true
condition:
- condition: time
weekday:
# - mon
- tue
# - wed
- thu
- fri
# - sat
# - sun
trigger:
platform: time
at: '8:00:00' #Changed from after to at per log
action:
- service: media_player.media_play
data:
entity_id: media_player.runeaudio_mpd
- service: light.turn_on
entity_id:
- light.cree_connected_a19_60w_equivalent_fe06c273_10
- light.sengled_e11g13_0306678e_1
- light.sengled_e11g13_03092691_1
- light.sengled_e11g13_03092ed4_1
My schedule changes alot and need a way to just turn on or off each day
What I need is a way to have a condition check each day if input_boolean is on or not then if on run alarm.
That is what I was looking for
Just need to get it working now
I added conditions for all days Mon-Sun
But when I reload automations I get the following error in the log
2017-09-09 21:51:38 ERROR (SyncWorker_0) [homeassistant.util.yaml] mapping values are not allowed here in "/config/automations.yaml", line 63, column 17 2017-09-09 21:51:38 ERROR (MainThread) [homeassistant.bootstrap] Error loading /config/configuration.yaml: mapping values are not allowed here in "/config/automations.yaml", line 63, column 17
Youāve got past errors. See where all those $ end the stings. Also, if you would please use the </> tool when posting code it would keep your formatting and give me a place to start from.
I was able to work out most of what you were trying to say.
You will have to replace the names of the input_booleans below with the names of your input_booleans.
This is valid yaml:
- alias: test
trigger:
platform: time
at: '08:00:00' #Changed from after to at per log
condition:
condition: or
conditions:
- condition : template
value_template: '{{ (now().strftime("%a") == "Mon") and (states.input_mon.state=="on")}}'
- condition : template
value_template: '{{ (now().strftime("%a") == "Tue") and (states.input_tue.state=="on")}}'
- condition : template
value_template: '{{ (now().strftime("%a") == "Wed") and (states.input_wed.state=="on")}}'
- condition : template
value_template: '{{ (now().strftime("%a") == "Thu") and (states.input_thu.state=="on")}}'
- condition : template
value_template: '{{ (now().strftime("%a") == "Fri") and (states.input_fri.state=="on")}}'
- condition : template
value_template: '{{ (now().strftime("%a") == "Sat") and (states.input_sat.state=="on")}}'
- condition : template
value_template: '{{ (now().strftime("%a") == "Sun") and (states.input_sun.state=="on")}}'
action:
- service: media_player.media_play #turn_on
data:
entity_id: media_player.runeaudio_mpd
- service: light.turn_on
entity_id:
- light.cree_connected_a19_60w_equivalent_fe06c273_10
- light.sengled_e11g13_0306678e_1
- light.sengled_e11g13_03092691_1
- light.sengled_e11g13_03092ed4_1
Now that I have this working of course I want to make it better.
Created a input_select to pick the wake up time.
But not sure how to use that variable in my automation
change your trigger to run every 5 minutes.
Then add to your template yet another condition where the current time matches your input time.
There are LOTS of examples of Home Assistant alarm clocks
Hereās one that eventually gets to what you want: