#----------------------------------- #----Wake Up Alarm for Work Days
- id: three
alias: "Alarm Clock Work Days"
# hide_entity: true
condition:
condition: or
conditions:
- condition: template
value_template: '{{ (now().strftime("%a") == "Mon") and (states.input_boolea$
- condition: template
value_template: '{{ (now().strftime("%a") == "Tue") and (states.input_boolea$
- condition: template
value_template: '{{ (now().strftime("%a") == "Wed") and (states.input_boolea$
- condition: template
value_template: '{{ (now().strftime("%a") == "Thu") and (states.input_boolea$
- condition: template
value_template: '{{ (now().strftime("%a") == "Fri") and (states.input_boolea$
- condition: template
value_template: '{{ (now().strftime("%a") == "Sat") and (states.input_boolea$
- condition: template
value_template: '{{ (now().strftime("%a") == "Sun") and (states.input_boolea$
trigger:
platform: time
at: '08:00:00' #Changed from after to at per log
action:
- 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
- service: tts.google_say
entity_id: media_player.ccaudio_media
data_template:
message: >
Time to get your out of bed!
Todays temperature will be a high of {{states.sensor.yweather_temperature_$
and a low of {{states.sensor.yweather_temperature_min.state}}
Weather conditions will be {{states.sensor.yweather_condition.state}}.
- delay: '00:00:15'
- service: media_player.media_play
data:
entity_id: media_player.runeaudio_mpd
This is quite a pain in the ass. Triggers do not allow for value_templates to be added into the ‘at:’ category. So you have to work around that. The way to do that is creating a automation that fires at a time increment, but only fires based on a specific condition. This is a work around by the way. Appdaemon can do this without this funky BS:
- alias: something
trigger:
platform: time
minute: "/1"
condition:
condition: and
conditions:
- condition: template
value_template: >
{% set hour, minute, second = alarmtime.split(':') %}
{{ now().hour == hour | int and now().minute == minute | int }}
- condition: or
# add your input boolean conditions here
This is off the top of my head so the syntax might be wrong. Check it against the documentation when you attempt to implement it.
That would work as well. Still a work around. The general idea of that is to trigger off a template using sensor.time. Which means you need to track time in your HA instance.
I think you are just missing some logic here that ties what you see on the screen (and interact with) and what goes on in the background to make the result what you want it to be.
So, in this case, you want a dropdown box (an input select) with some pre-defined times. When you select the time, you want that time to trigger the alarm.
An input select contains ‘strings’ not ‘times’, so you must convert the contents of the input_select before anything else. You can use an input datetime to hold the time. (I’m not quite sure why you’re not using this as the frontend, but that’s not important to actually answering your question).
Then you need a template trigger, because you want it to change (not be hard coded).
You have to create a time sensor in your configuration.yaml for the frontend sensor to compare against
# ---- Time & Date
- platform: time_date
display_options:
- 'time'
This gives you something to compare against for current time
Instead of the input_select I was trying to use create a input_datetime
This will let you from the frontend enter any time you want.
Enter time in military format 08:20 for 6:20PM it will convert it.
input_datetime:
only_time:
name: Input with only time
has_date: false
has_time: true
Now in my above code replace
trigger:
platform: time
at: '08:00:00' #Changed from after to at per log
With this code to compare sensor against input_datetime