Automation duration hue sensor

Hi all, thanks for the great community and domotica platform. It’s very addictive to get more and more configured in our house.

I am hoping I have an easy question:

I have setup an automation for my bathroom sensor. The sensor is a hue sensor from Philips.

What I have done is created an automation with two trigger id’s and a choose action to turn on or turn off depending on status of the sensor. Sensor id “on” and sensor Id “off”.

Unfortunately when taking a shower you are out of the view of the sensor and the lights turn off.

What I am struggling with is: what do i need to add / configure to solve this without having to move the sensor or buy a 2nd sensor.

  1. Duration option set to 20 min under the trigger off?
  2. create a delay under action for trigger id lights off?
  3. timer or state condition ?

I am having trouble finding the right documentation on the differences and best practice

Also : toggle lights instead of on / off doesn’t help. Although I like toggle because it remembers the last state of brightness , how to do that with on/off?

It is much easier for us to help you if you paste the yaml configuration for the automation. In the Automation editor click on three dot menu at the top right hand of the page, then click “Edit in YAML”. Select the complete contents and paste it here.

Sorry! Still learning. Here you go. Sensor aan = sensor ON, sensor uit= sensor OFF.

Trying it with duration, but not sure if this is the right approach.


alias: Badkamer ouders sensor
description: ""
trigger:
  - type: occupied
    platform: device
    device_id: 25f95c92a795567d2549fad0844bcd16
    entity_id: 36a3473c0fd9880fd038f7185d1ff5ba
    domain: binary_sensor
    id: sensoraan
  - type: not_occupied
    platform: device
    device_id: 25f95c92a795567d2549fad0844bcd16
    entity_id: 36a3473c0fd9880fd038f7185d1ff5ba
    domain: binary_sensor
    id: sensoruit
    for:
      hours: 0
      minutes: 20
      seconds: 0
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - sensoraan
        sequence:
          - service: light.turn_on
            data: {}
            target:
              device_id:
                - 3cb6c8bcb30dfd9a95322e73f8a761d7
                - 12a835b8641cdc96042c1001c5649ab4
                - 855244b00ad23d68497e96d980425c02
                - 9a4c9b57d31c3e8c35dd5320059adbe3
      - conditions:
          - condition: trigger
            id:
              - sensoruit
        sequence:
          - service: light.turn_off
            data: {}
            target:
              device_id:
                - 12a835b8641cdc96042c1001c5649ab4
                - 855244b00ad23d68497e96d980425c02
                - 3cb6c8bcb30dfd9a95322e73f8a761d7
                - 9a4c9b57d31c3e8c35dd5320059adbe3
mode: single


Jasper,
If I understand your idea correctly, there is no good solution to this. I have the same problem with our bathrooms and it is so annoying to have the lights go off when showering that we’ve stopped using the motion sensors to turn on the lights. For this to work you would need a way to tell if someone was anywhere within the bathroom, and one motion detector won’t do that. (You could use a humidity sensor to see when the shower is on, and then keep the lights on for longer, though.)

What I’ve done is two things:

  • If you double-click the switch on the wall it will keep the light on even when the motion sensor says to turn it off. (No one remembers this, so we mostly just don’t use the motion sensor.)
  • When it is late at night, I have the motion sensor make the dim night light in the bathroom brighter for 10 minutes. Since no one showers in the middle of the night this isn’t a problem if 10 minutes isn’t enough, but no one notices this either.

If you find anything that can reliably detect presence in a bathroom that would solve the problem, but an automation isn’t going to do that detection for you. :frowning:
-David