Hi,
I’m running the ‘Home Connect’ integration from Bosch/Siemens and my Washing Machine has the entity
binary_sensor.washing_machine_door
enabled.
As I often oversee the native push notifications I’d like to setup a Home Assistant automation with a condition that checks what the last state was of the door (open or closed). If closed, it should send a push notification.
As I’m not a savvy programmer I’m using ChatGPT to create some automations. It suggested the following automation as a test:
trigger:
- platform: event
event_type: test_door_notification
condition:
- condition: template
value_template: >-
{% set two_minutes_ago = now() - timedelta(minutes=2) %}
{% set history = states.history('binary_sensor.washing_machine_door',
start=two_minutes_ago, end=now()) %}
{{ history | selectattr('state', 'eq', 'off') | list | length > 0 }}
action:
- service: notify.mobile_app
data:
message: TEST
title: Test
When I run the automation it always sends the notification, which should not be the case. I already changed the state to ‘Closed’, ‘closed’, ‘Open’ and ‘open’ but this does not change anything.
Can someone help supply a test automation where the condition checks if the door was closed the last 15 minutes?
Thanks in advance!