Hello I am fairly new to Home Assistant and this is my first post so if I miss something please excuse me. I need help with I believe might be a value-template issue. I am trying to automate a light by time input. Here is what I have so far. I have a switch that is working and when I execute the automation manually in Home Assistant that also works. The issue is when I ask it to start based on time input it does not work or create any error logs that I can find. I checked to make sure all entities are in place and they are.
################################################################################
Timer Input Box Information
################################################################################
input_boolean:
chicken_coop_light_timer_on_enabled:
name: “chicken_coop_light ON timer”
initial: off
icon: mdi:timer
chicken_coop_light_timer_off_enabled:
name: “chicken_coop_light OFF timer”
initial: off
icon: mdi:timer-off
input_datetime:
turn_chicken_coop_light_on_time:
name: “Turn Chicken Coop Light on at”
has_time: true
has_date: false
initial: “06:00”
turn_chicken_coop_light_off_time:
name: “Turn Chicken Coop Light off at”
has_time: true
has_date: false
initial: “20:00”
################################################################################
Chicken Coop Timer Automation Information
################################################################################
#TURN CHICKEN COOP LIGHT ON AT SPECIFIC TIME
- id: ‘ChickenCoopLightOn’
alias: Turn on Chicken Coop Light with Timer
trigger:
platform: template
value_template: “{{ states(‘sensor.time’) == (state_attr(‘input_datetime.turn_chicken_coop_light_on_time’, ‘timestamp’) | int | timestamp_custom(’%H:%M’, False)) }}”
condition:- condition: state
entity_id: input_boolean.chicken_coop_light_timer_on_enabled
state: ‘on’
action:
entity_id: switch.chickencoop
service: switch.turn_on
- condition: state
#TURN CHICKEN COOP LIGHT OFF AT SPECIFIC TIME
- id: ‘ChickenCoopLightOff’
alias: Turn off Chicken Coop Light with Timer
trigger:
platform: template
value_template: “{{ states(‘sensor.time’) == (state_attr(‘input_datetime.turn_chicken_coop_light_on_time’, ‘timestamp’) | int | timestamp_custom(’%H:%M’, False)) }}”
condition:- condition: state
entity_id: input_boolean.chicken_coop_light_timer_on_enabled
state: ‘on’
action:
entity_id: switch.chickencoop
service: switch.turn_off
- condition: state
Any help would be greatly appreciated
2 posts - 2 participants