@reclusivemonkey wrote:
I’m trying to create a binary sensor for ‘working from home’. When I try this in the template section of the developer tab it works as expected. However in use it does not perform as expected. The template I am using is;
{{ is_state('device_tracker.slim_charles', 'home') and is_state('calendar.google_work', 'off') and is_state('binary_sensor.workday', 'on') and (now().hour) >= 8 and (now().hour) <= 16 }}
Right now (11:01 AM), in the template tester this is true. But my actual binary sensor reports it as off. I must be missing something really obvious but don’t understand what it is. Here is the full sensor for reference;
platform: template sensors: working_from_home_luke: value_template: >- {{ is_state('device_tracker.slim_charles', 'home') and is_state('calendar.google_work', 'off') and is_state('binary_sensor.workday', 'on') and (now().hour) >= 8 and (now().hour) <= 16 }} icon_template: >- {% if is_state('binary_sensor.working_from_home_luke', 'on') %} mdi:domain {% else %} mdi:domain-off {% endif %}
Posts: 1
Participants: 1