I have an setup based on 2 sensors:
-
sensor.washing_machine
with 2 states"On"
and"Off"
-
binary_sensor.lumi_lumi_sensor_magnet_aq2_opening
door sensor on washing machine with 2 states"Open"
and"Closed"
And have perfectly working automation with notification when I did not pick up laundry after 1 hour after the end of washing. This automation:
alias: Notification pick up wet laundry
trigger:
- platform: state
entity_id:
- sensor.washing_machine
from: "On"
to: "Off"
action:
- delay:
hours: 1
minutes: 0
seconds: 0
milliseconds: 0
- type: is_not_open
condition: device
device_id: 9d418eb2aee29d6e3bb11e8cfb6e7b73
entity_id: binary_sensor.lumi_lumi_sensor_magnet_aq2_opening
domain: binary_sensor
for:
hours: 1
minutes: 0
seconds: 0
- service: notify.mobile_app_sm_g950f
data:
message: Washing finished 1 hour ago
title: Pick up wet laundry
mode: single
My goal here is to extract from above automation new custom template sensor or binary_sensor with value of wet laundry and use it with simplified automation like below or create some custom card on dashboard.
alias: Notification pick up wet laundry (refactored)
trigger:
- platform: state
entity_id:
- sensor.wet_lanudry
from: "Off"
to: "On"
action:
- delay:
hours: 1
minutes: 0
seconds: 0
milliseconds: 0
- service: notify.mobile_app_sm_g950f
data:
message: Washing finished 1 hour ago
title: Pick up wet laundry
mode: single
Can you help me with writing this template sensor? There is a catch: "wet_loundry"
state "On"
is only once after "washing_machine"
goes from "On"
to "Off"
until "binary_sensor.lumi_lumi_sensor_magnet_aq2_opening"
is not "Open"
, so when someone close washing machine door after collecting laundry I do not want to see "wet_loundry"
state as "On"
.