I’ve found what the problem was
The code was spot on, what I hadn’t counted on was my anal retentive method of keeping a commented version below the version I was working on so I could play and then go back to the original
The first # was the same spacing as the template and the config reads it as a continuation.
The code is now up and running as : -
binary_sensor:
- platform: template
sensors:
bs_pifi01_on:
entity_id: sensor.time, input_boolean.ib_switch_pifi01_on, input_boolean.ib_switch_pifi01_timer_enable, input_boolean.ib_switch_pifi01_timeslot1_enable, input_boolean.ib_switch_pifi01_timeslot2_enable
friendly_name: Pi-Fi-01 Requested On
value_template: >
{% set time = states('sensor.time') %}
{% set occd = is_state('binary_sensor.bs_occupied', 'on') %}
{% set manon = is_state('input_boolean.ib_switch_pifi01_on', 'on') %}
{% set slt1en = is_state('input_boolean.ib_switch_pifi01_timeslot1_enable', 'on') %}
{% set slt1start = states('input_datetime.id_switch_pifi01_tmeslt1_on') [0:5] %}
{% set slt1stop = states('input_datetime.id_switch_pifi01_tmeslt1_off') [0:5] %}
{% set slt2en = is_state('input_boolean.ib_switch_pifi01_timeslot2_enable', 'on') %}
{% set slt2start = states('input_datetime.id_switch_pifi01_tmeslt2_on') [0:5] %}
{% set slt2stop = states('input_datetime.id_switch_pifi01_tmeslt2_off') [0:5] %}
{% set slt1on = (slt1start <= time < slt1stop) if (slt1start < slt1stop) else (slt1start <= time or time < slt1stop) %}
{% set slt2on = (slt2start <= time < slt2stop) if (slt2start < slt2stop) else (slt2start <= time or time < slt2stop) %}
{{ occd and (manon or (slt1on and slt1en) or (slt2on and slt2en)) }}
I’ll continue with the other formats and report back anyway
Thanks to all
Edit: Petro gave me the clue, I tried to start simple and just put {{ not false }}, it came back with same error.