Trigger problem

alias: Badkamer_vochtigheid te hoog
description: ""
trigger:
  - platform: numeric_state
    entity_id: sensor.badkamer_vochtigheid
    above: 76
condition: []
action:
  - wait_for_trigger:
      - type: no_motion
        platform: device
        device_id: 0275cbe72ac38f137404a9e8e0b781b4
        entity_id: binary_sensor.badkamer_bewegingsmelder_occupancy
        domain: binary_sensor
        for:
          hours: 0
          minutes: 5
          seconds: 0
    timeout:
      hours: 0
      minutes: 0
      seconds: 0
      milliseconds: 0

afbeelding

Action starts 5 minurs after sensor is active, not after 5 minutes not active (after humidity above 76)

what am I doing wrong ?

You should describe what your goal is for this automation.

As it stands, your wait times out immediately and the automation continues… so it doesn’t matter what the state of the occupancy sensor is.

What i want…

When the humidity in the bathroom is to high i want to open my window. Only when there is no one in the bathroom for 5 minutes, otherwise its to cold in the

I think the problem is with the timing, once the automation triggers (humidity above 76) then it is waiting for a change from motion to no motion to be detected, so it will not work if the humidity triggers when no person is in the room.

You could fix this using a template (within your binary_sensor.yaml file) and reference this within the wait_for_trigger step of your automation:

    no_motion:
      friendly_name: "No Motion for 5 Mins"
      device_class: occupancy
      value_template: >-
        {{is_state('binary_sensor.badkamer_bewegingsmelder_occupancy', 'off')  }}
      delay_on: "00:05:00"

The automation action would be:

action:
  - wait_for_trigger:
      - type: state
        entity_id: binary_sensor.no_motion
        to: 'on'

This would mean if someone left the room 3 mins before the humidity went above 76 then the actions would continue a further 2 minutes later which is what I think you are trying to achieve.

I want to achieve that the action takes place 5 minutes after anybody left the bathroom when the humid is above 76 ( always after taking

At the moment the action is already going on when the person is in the shower…

I will try and see what happens. Thanks for thinking with me…

There are cases where the waits are needed because a specific sequence of events needs to happen, but for most automations a good place to start is to use the event closest in time to your actions as your trigger.

alias: Badkamer_vochtigheid te hoog
description: ""
trigger:
  - platform: state
    to: 'off'
    entity_id: binary_sensor.badkamer_bewegingsmelder_occupancy
    for:
      hours: 0
      minutes: 5
      seconds: 0
condition:
  - condition: numeric_state
    entity_id: sensor.badkamer_vochtigheid
    above: 76
action:
  - action to turn on fan

I try this one