#Bathroom light with motion based night light automation - struggling

1 messages · Page 1 of 1 (latest)

arctic dawn
#

Ive got a smart bulb a signee motion sensor and a zigbee smart button and using these items I wish to configure my bathroom light as follows:

  1. During day - button toggles light on and off at full brightness

  2. During night - motion sensor toggles light on and will go off after the 90sec cool down if motion stops being detected

  3. Also during night - if light is lit dimly because it has been activated by motion I want the button to set it to full brightness and only to be turned off again at that point by the button (overriding the motion sensor).

I’ve got the first two parts working in a single automation with trigger IDs and choose conditions but as soon as I try to add the third part it goes wrong.

Anyway available/willing to help me 121 on this?

Thanks

jovial pumice
#

Not the HA expert, but I think you will need to add a variable here.

So, create helper of type Toggle (input boolean) and: if night and button used to turn on the light: set it to On. Then, on item (2), after cool down of 90sec, don't do anything if toggle helper is On.

That's what I would try.

wanton iron
#

If you really want this, you will need a helper.

But you could also use the brightness level to check how it was turned on. Only downside is that if you manually dim it might act different (aka, even if you turn it on manual, then make it lit dimly, it will turn off by motion)

Can you share what you have? Please read how to post code before you post it here.

arctic dawn
#

Ah ok I’m not to great on understanding helpers.

This is my automation so far which works for intentions 1 and 2, but everytime I attempt at doing the 3rd one it breaks it - so I’m getting it wrong - maybe I’m trying to do too much in one automation and it needs splitting down into multiple?

​`
alias: Bathroom light control
triggers:

  • entity_id:
    • binary_sensor.aqara_motion_bathroom
      to: "on"
      id: motion_detected
      trigger: state
  • entity_id:
    • binary_sensor.aqara_motion_bathroom
      to: "off"
      for:
      hours: 0
      minutes: 0
      seconds: 0
      id: motion_cleared
      trigger: state
  • event_type: zha_event
    event_data:
    command: single
    id: button_pressed
    trigger: event
    conditions: []
    actions:
  • choose:
    • conditions:
      • condition: trigger
        id: motion_detected
      • condition: numeric_state
        entity_id: sensor.dummy
        below: 30
        sequence:
      • action: light.turn_on
        metadata: {}
        data:
        brightness_pct: 1
        target:
        entity_id: light.bathroom_light
    • conditions:
      • condition: trigger
        id: button_pressed
      • condition: template
        value_template: |
        {{ trigger.event.data.device_ieee == "00:15:8d:00:8b:87:5f:32" }}
        sequence:
      • action: light.toggle
        metadata: {}
        data:
        brightness_pct: 100
        target:
        entity_id: light.bathroom_light
    • conditions:
      • condition: trigger
        id: motion_cleared
      • condition: numeric_state
        entity_id: sensor.dummy
        below: 30
        sequence:
      • action: light.turn_off
        metadata: {}
        data: {}
        target:
        entity_id: light.bathroom_light
        mode: restart
        ​`
wanton iron
arctic dawn
#

Yes dummy sensor is currently my light sensor for testing purposes - once I know it works I will probably use another light sensor or just a sunset/sunrise sensor or something.

#

Seems to be worming, will test for a few days - thanks.

I see you got rid of the template conditions and found another way - that is how ChatGPT wrote it with template conditions

wanton iron