2. add an INPUT_BOOLEAN
# my timer test
timer_on_off:
initial: off
3. add 2 variables to the INPUT_DATETIME
# variable for my timer test
light_start:
name: Set ON time & date
initial: 00:00
has_date: true
has_time: true
light_end:
name: Set OFF time & date
initial: 00:00
has_date: true
has_time: true
sensor.time_date
4. Configure 2 automations to check between the set point to the current hours & date
automations.yaml
#####################
# my timer test on #
#####################
- id: Test_Timer_on_off_Start
alias: "Timer Start"
initial_state: 'on'
trigger:
platform: template
value_template: "{{ states('sensor.time_date') == (states.input_datetime.light_start.attributes.timestamp | int | timestamp_custom('%H:%M, %y-%m-%d', False)) }}"
condition:
condition: state
entity_id: input_boolean.timer_on_off
state: 'on'
action:
- service: switch.turn_on
entity_id: switch.neo_coolcam_wall_switch_1_channel_switch
#####################
# my timer test off #
#####################
- id: Test_Timer_on_off_Stop
alias: "Timer Stop"
initial_state: 'on'
trigger:
platform: template
value_template: "{{ states('sensor.time_date') == (states.input_datetime.light_end.attributes.timestamp | int | timestamp_custom('%H:%M, %y-%m-%d', False)) }}"
condition:
condition: state
entity_id: input_boolean.timer_on_off
state: 'on'
action:
- service: switch.turn_off
entity_id: switch.neo_coolcam_wall_switch_1_channel_switch
- delay: 0:00:03
- service: input_boolean.turn_off
entity_id: input_boolean.timer_on_off
5. restart HA
6. configure the ui-lovelace.yaml
type: entities
title: Timer Test
show_header_toggle: false
entities:
- input_boolean.timer_on_off
- input_datetime.light_start
- input_datetime.light_end
Comments