#automation not working properly

1 messages · Page 1 of 1 (latest)

vagrant furnace
#

Hello everyone,
I have a problem with one of my automations, which doesn't work properly, but only sometimes. I cannot figure out why this is happening.
It's a simple one really, where I have a motion sensor turn on the light in the kitchen, then a mmwave senses presence and a wait for trigger waits for that presence to become clear and upon this happening, the light turns off.
This is all working as it should most of the times, just that there are times when the light will turn on, but never turn off and I don't know why this is happening. Any help would be appreciated.
This is the automation in yaml, but I did it in the gui, if it makes any difference:

description: ""
triggers:
  - type: motion
    device_id: beb15a3669816193a74b24c81f97fd0b
    entity_id: 7645feb9149b47463893c81a413861ac
    domain: binary_sensor
    trigger: device
conditions:
  - condition: or
    conditions:
      - condition: time
        after: "18:01:00"
        before: "00:00:00"
        weekday:
          - mon
          - tue
          - wed
          - thu
          - fri
          - sat
          - sun
      - condition: time
        after: "00:00:00"
        before: "03:00:00"
        weekday:
          - sun
          - sat
          - fri
          - thu
          - wed
          - tue
          - mon
actions:
  - type: turn_on
    device_id: f90ee396cb8b141450b7a82ecd03815e
    entity_id: 222bd61b1301527e42564631abffe914
    domain: switch
  - wait_for_trigger:
      - type: not_occupied
        device_id: 7067262dbc511ac2050e86dd462ff7e2
        entity_id: e69a120f387efb8e1abe059079c65c44
        domain: binary_sensor
        trigger: device
    continue_on_timeout: false
  - type: turn_off
    device_id: f90ee396cb8b141450b7a82ecd03815e
    entity_id: 222bd61b1301527e42564631abffe914
    domain: switch
mode: single

Thank you!

tepid hamlet
#

Please format your code

lusty stratusBOT
#

To format your text as code, enter three backticks on the first line, press Enter for a new line, paste your code, press Enter again for another new line, and lastly three more backticks.
```yaml
example: here
```
Don't forget you can edit your post rather than repeatedly posting the same thing.

vagrant furnace
#

sorry, is it better now?

tepid hamlet
#

Yes

#

Did you verify that the mmWave sensor actually stares with occupied and switches to not occupied? The device triggers obscure what it's actually looking for

#

You'll need to debug this on your system

vagrant furnace
#

well, I did check the states of the mmwave, and I see the state as changed to occupied, and then after some time it goes to clear, but the automation never actually acknowledges this to turn off the light

tepid hamlet
#

Then you should review the automation trace

vagrant furnace
#

I did have it 1 time where the sonoff remained stuck in occupied mode, but that was just 1 time

tepid hamlet
#

That's the only variable here, so you need to check that

vagrant furnace
#

I did check the traces and it just shows a broken line and it gets to the wait for trigger and then nothing. I was looking at it now to hopefully give you a screenshot, but as it happens now it's working fine.

#

I can only see 5 traces. is there another place where I can go back further?

tepid hamlet
#

You can tell it how many you want

vagrant furnace
#

here's something interesting I just saw. this the the automation worked, but after 23 minutes. there was nobody in the kitchen and I confirmed the sensor was showing "clear"

#

don't mind the Cat name, I reused the relay I had in another place

tepid hamlet
#

Seems like your sensor took a long time to report unoccupied

#

Not an automation issue

vagrant furnace
#

this is how the logbook for the sensor looks:

#

now I realize that the ocupancy sensor wasn't occupied at 20 33 when the automation was triggered by the motion sensor.

#

if the sensor was cleared to begin with, that wait for a trigger would not work, would it?

tepid hamlet
#

It will be fine because you're waiting for it to transition from occupied to unoccupied. But again, the device trigger obscures what it's actually doing

vagrant furnace
#

I modified the automation now and added a check to see if the mmwave state is "clear" 5 seconds after the automation triggers.

#

please be more specific about the obscures what it's doing fact you mentioned

tepid hamlet
#

If you used entity triggers, conditions, and actions it would be much clearer what you're doing and easier to debug

#

All the documentation uses entity-based things

#

Anyway, I don't think your change will help, but I guess you can try it

vagrant furnace
#

so you mean instead of using the device as a trigger, I would use one of the entities offered by the device, correct?

tepid hamlet
#

yes, state triggers, conditions, and actions