Automation for presence detector switches on smart plug but immediately switches it off again

Heya community!

Probably a dumb question, but I couldn’t find anything here or on search engines about my exact problem. I have an Aqara FP1E presence detector installed in a room and I want to switch on a smart plug when presence is detected but the automation that turns it on seems to turn it off after a few seconds even though presence is still detected according to the FP1E.

My expectation was that it only turns the plug on, not off.

Here’s my automation:

alias: Bad Wohnen (anwesend)
description: ""
triggers:
  - type: present
    device_id: 2c092faf6ca795ad0696e46125c28e98
    entity_id: b2e3c076a4d2fb02881e7f7188ffa7f6
    domain: binary_sensor
    trigger: device
conditions: []
actions:
  - type: turn_on
    device_id: 74ba56b540a0b81fe97746e14da7ba60
    entity_id: c4cc4e7cc332e4676f2f5c3072d42d0d
    domain: light
mode: single

Or, more visual:

And here’s the log (sorry, can’t post more than one image because I’m new)

Hello Pelle,

You are using a device trigger. I personally do not know how they act but apparently it triggers when present and again when present is not there?
¯\(ツ)
I suggest using an entity trigger for this.

Use entity triggers and actions instead:

alias: Bad Wohnen (anwesend)
description: ""
triggers:
  - trigger: state
    entity_id: binary_sensor.[YOUR SENSOR ENTITY ID]
    to: 'on'
actions:
  - action: light.turn_on
    target:
      entity_id: light.[YOUR LIGHT ENTITY ID]

Hey @Sir_Goodenough and @Troon,

Thanks for your response. I’ve already read that article some time ago. I changed the automation accordingly:

alias: "Bad Wohnen: ANWESEND"
description: ""
triggers:
  - trigger: state
    entity_id:
      - binary_sensor.aqara_presence_sensor_fp1e_presence
    to: "on"
conditions: []
actions:
  - action: light.turn_on
    target:
      entity_id: light.hue_smart_plug_bad_wohnen
    data: {}
mode: single

Still having the same issue. Maybe the bloody Hue “Smart” Plug is just broken. I’ll replace it with another and try that out later.

Thanks a lot for the help here. It was the Hue switch that has its own opinion on when to turn on and off. Replaced it with an Osram Zigbee plug and now everything works. :slight_smile: Hooray!

2 Likes