Time Input Sliders Help

Errm the very first post shows how to set things up as you want them using input_select, but if you read thru’ the thread it show how to do it using input_sliders (now renamed to input_number - but they do the same thing and the code is the same).

So…

in input_number.yaml

alarmhour:
  name: Alarm Hour
  icon: mdi:timer
  initial: 06
  min: 0
  max: 23
  step: 1
alarmmins:
  name: Alarm Minutes
  icon: mdi:timer
  initial: 00
  min: 0
  max: 59
  step: 1
alarmfinishhr:
  name: Finish Hour
  icon: mdi:watch-export
  initial: 07
  min: 0
  max: 23
  step: 1
alarmfinishmins:
  name: Finish Minutes
  icon: mdi:watch-export
  initial: 05
  min: 0
  max: 55
  step: 5

Automation.yaml

###############################################################################################
#                                                                                             #
# Alarm Clock                                                                                 #
#                                                                                             #
#                                                                                             #
###############################################################################################
        
 - alias: 'Wake Me Up'
   initial_state: 'on'
   trigger:
     - platform: time
       minutes: '/1'
       seconds: '0'
   condition:
      condition: or
      conditions:
        - condition: and
          conditions:
            - condition: state
              entity_id: input_boolean.alarmstatus
              state: 'on'
            - condition: state
              entity_id: input_boolean.alarmweekday
              state: 'on'
            - condition: time
              weekday:
                - mon
                - tue
                - wed
                - thu
                - fri
                - sat
            - condition: template
              value_template: '{{ now().time().strftime("%R") == states.sensor.alarm_time.state }}'
        - condition: and
          conditions:
            - condition: state
              entity_id: input_boolean.alarmstatus
              state: 'on'
            - condition: state
              entity_id: input_boolean.alarmweekday
              state: 'off'
            - condition: template
              value_template: '{{ now().time().strftime("%R") == states.sensor.alarm_time.state }}'
   action:
     - service: tts.google_say
       data:
         entity_id: media_player.speaker_1
         message: "Good morning Sir. Time to Wake Up!"         
     - service: switch.turn_on
       entity_id: 
         - switch.zw_bedroomsunlamp_switch
         - switch.rfl_bedroom_pcmonitorandsound
     - service: light.turn_on
       entity_id: 
         - light.rfl_bedroom_ceiling_light
         - light.rfl_bedroom_uplightredbottomlamp
     - service: light.turn_on
       data:
         entity_id: light.zw_uplight_dimmer_level
         brightness_pct: 70
     - delay: '00:00:20'
     - service: switch.turn_on
       entity_id: switch.veho_power
                   
 - alias: Turn off Alarm
   initial_state: 'on'
   trigger:
     - platform: time
       minutes: '/1'
       seconds: '0'   
   condition:
     - condition: template
       value_template: '{{ now().time().strftime("%R") == states.sensor.alarm_time_fin.state }}'     
   action:
     - service: homeassistant.turn_off
       entity_id:
         - light.rfl_bedroom_ceiling_light
         - light.rfl_bedroom_uplightredbottomlamp
         - switch.zw_bedroomsunlamp_switch
         - switch.rfl_bedroom_pcmonitorandsound
         - switch.zw_tvandsoundbar_switch

I have an input_boolean to turn it on and off as well. There are other ways probably more efficient but this works. There are new components which would probably make this better but I haven’t got round to looking at them yet. The alarm thread does have many other examples of how you could achieve what you want.

Hopefully that helps you get yours setup :slight_smile:

The card in the frontend looks like this…
image

1 Like