Hey All. If I try this in the templates bit of the ui I get the correct result:
{%- if as_timestamp(now()) - as_timestamp(states.binary_sensor.luke_motion.last_changed) < 10*60 -%} Occupied {%- else -%} Empty {%- endif -%}
But if I add it to my config I get ’ [homeassistant.components.binary_sensor.template] Could not render template Occupied, the state is unknown’
`
binary_sensor:
- platform: template
sensors:
luke_occupancy:
friendly_name: ‘Occupied’
device_class: occupancy
value_template: >
{%- if as_timestamp(now()) - as_timestamp(states.binary_sensor.luke_motion.last_changed) < 10*60 -%}
Occupied
{%- else -%}
Empty
{%- endif -%}
`
Any ideas what I’m doing wrong?[details=Summary]This text will be hidden[/details]