doesn’t seem to work, while the template itself is just fine, and says True or False.
though there is no error in the log complaining about not being able to evaluate the template because of wrong or missing entity_id’s, I tried to add the entity_id: sensor.time, but that isn’t allowed in the trigger section.
So rebuilding this to a binary sensor to use for the trigger state:
is essentially the same. And yet that works and changes the binary to on and off as desired. Wouldn’t the evaluation of the is_state(‘sensor.master_bedroom_schedule_day’) part suffice? Why does this need the sensor.time?
Thanks!
Fully aware of the above, yes.
i’m using the sensor.time as entity_id (in the binary_sensor) so it works for now. but would have thought that only to be necessary when testing for now() only, not when comparing that to another state… Is my first template to encounter this (guess there’s always a first)
this is the automation (left all the tested options for reference )
- alias: 'Weekend Switch Off Masterbedroom motion sensor'
id: 'Weekend Switch Off Masterbedroom motion sensor'
# initial_state: 'on'
trigger:
platform: state
entity_id: binary_sensor.now_master_bedroom_schedule_day
to: 'on'
# at: '07:00:00' # the time set in the Hue app, which has only day setting, and doesn't recognize weekend
# platform: template
# value_template: >
# {{now().time().strftime('%H:%M') == states('sensor.master_bedroom_schedule_day')}}
condition:
- condition: template
value_template: >
{{ is_state ('sensor.activity_selection', 'Slapen')}}
- condition: template
value_template: >
{{is_state('binary_sensor.workday_sensor','off') or
is_states('input_boolean.home_mode_vacation','on')}}
action:
- service: switch.turn_off
entity_id: switch.master_bedroom_motion_sensor_switch
as you can see I started with time: at 07:00:00 and that only triggers once a day, now I have it triggering every second…