Motion sensor showing as event that can't be used in automation

I just purchased a few sensors from Govee (motion sensors and window/door). The bluetooth integration is working great, they show up on the dashboard and report motion and battery life on the device info. However, the motion is showing up as event. When I try to set up an automation, it won't let me select the sensor as a trigger for my lights or whatever else. The only option is battery state.
Is there a work around that I can do, or something I am missing here? I have searched and searched.

The best information that i have come across is to make a template, however I am still having trouble or maybe I don't know what I am doing, however, I am willing to learn.

Use a State trigger, not a Device trigger.

I can't seem to find an example. When I try an automation, there is no state trigger available.

type state in the search box for the trigger

LiQuid_cOOled has showed how to find them in the Automaiton Editor, more information can be found in the docs:

1 Like

Thank you much. I guess I got stuck in a rabbit hole of old examples. I thought I had to write custom YAML templates to create binary sensor's.

This worked and was extremely easy!!!.

OK - we have the light turning on with motion. Step 1, works great.
I can't seem to get the opposite to turn off when no motion is detected for hh,mm,ss. When I trace the event trigger, the "state" is just a timestamp (not "on" or "motion detected").

I am not sure how to set the opposite state and start a timer to check if no motion. Any last help would be appreciated.

Please follow the Community Question Guidelines by posting your automation’s YAML configuration… it makes it a lot easier for us to spot any possible issues that may be hard to spot in a screenshot of the UI Automation Editor or to glean from a written description.

From what I can tell from comments about the Govee H5121 Motion Sensor, it seems to only offer motion detector with a 1 minute cool-down. That would explain why you have an event entity instead of the more common binary_sensor entity. The device itself does not seem to support "when no motion is detected". So, your option would be to basically do the same trigger as your "turn on" automation, but with a duration... basically assuming that if the event entity's timestamp doesn't change, then it must mean no one is moving.

Thanks for the steer. Apologize for the lack of format, still new to this HA and forums. However I am here to learn, so please correct me if I do something that is frowned upon.

I ended up trying to make it work with this code here. I still need to do additonal testing, but I think its doing what I want. I need to make sure that the additonal motion presence isnt going to turn the light off when we are still walking around.

alias: stair_top_automation
description: ""
triggers:
  - trigger: state
    entity_id:
      - event.gv5121456b_motion
conditions:
  - condition: state
    entity_id: light.basement_stair_top
    state:
      - "off"
actions:
  - action: light.turn_on
    metadata: {}
    target:
      entity_id: light.basement_stair_top
    data: {}
  - delay:
      hours: 0
      minutes: 3
      seconds: 0
      milliseconds: 0
  - action: light.turn_off
    metadata: {}
    target:
      entity_id: light.basement_stair_top
    data: {}
mode: single

I'd suggest reviewing Automation Modes

mode: single may not be ideal for your scenario vs mode: restart

You are in great hands, Didgeridrew's advice is second to none when dealing with Automations!

You may find yourself in a loop of the light turning off on you. As LiQuid_cOOled mentioned the automation is currently in single mode, which means that new trigger events will be ignored until after the light.turn_off action runs.

Generally, it's best to avoid delays wherever possible. So, using two triggers and a Trigger condition we can require the same amount of time to pass, without locking up the automation... even with the mode set to single:

alias: stair_top_automation
description: ""
triggers:
  - id: Motion
    trigger: state
    entity_id:
      - event.gv5121456b_motion
  - id: No Motion
    trigger: state
    entity_id:
      - event.gv5121456b_motion
    for: "00:03:00"
conditions: []
actions:
  - if:
      # This branch needs to capture all Motion triggers, so we only use that condition.
      - condition: trigger
        id: Motion
    then:
      - alias: Check if light is "off"
        condition: state
        entity_id: light.basement_stair_top
        state:
          - "off"  
      - action: light.turn_on
        metadata: {}
        target:
          entity_id: light.basement_stair_top
        data: {}
    else:
      # Since all Motion triggers are captured above, only No Motion triggers will reach here.
      - action: light.turn_off
        metadata: {}
        target:
          entity_id: light.basement_stair_top
        data: {}
mode: single

Isn't this your state entity here?

What does that entity show in dev tools when there's motion or no motion?

I think you missed this caveat :down_arrow:

Ah, I was confused by the "instead" as it seemed from the image like the integration created both the binary sensor entity and an event entity. What's the sensor for?

I agree it seem like that should be the case.... But, in the image there aren't any events in the Activity log for the sensor... just for the event entity.

Motion in the OP's basement and your instincts are on point. A binary sensor would be the norm.

The device is not creating the normal Occupancy entity and appears to only log an event

My gut tells me it's integration via BT is the issue!

My setup that this solved:

I have a Govee H5121 motion sensor in my bathroom connected to Home Assistant via an ESP32-WROOM-32 running ESPHome as a BLE proxy. The ESP32 picks up the BLE advertisements from the H5121 and relays them to HA through the govee_ble integration. I'm using two LIFX Mini bulbs (Tubmini and Showermini) as the lights I want to trigger.

I spent weeks stuck on this exact problem. The motion sensor was clearly working — I could see the events firing in Developer Tools → States, the entity event.bathroom_sensor_motion was updating its timestamp every time I walked past. But when I went to create an automation, I was using the Device trigger and the only option available was battery state. Motion was nowhere to be found in the trigger dropdown.

After finding this thread, the fix was exactly as @Didgeridrew said — use a State trigger instead of a Device trigger, pointed at the event entity. Leaving "From" and "To" blank fires on any state change.

I ended up creating two automations:

Night (11 PM–7 AM): Motion → LIFX bulbs go dim pink/purple at 5%, off after 5 min
Day (7 AM–11 PM): Motion → LIFX bulbs go neutral white 4000K at 80%, with mode: restart so each new motion event resets the 5-minute inactivity timer. Fades off over 30 seconds if no motion for 5 min.
The mode: restart trick is key since the H5121 only fires "motion detected" events (no "motion cleared"), so every new event restarts the countdown.

Thanks for the answer — this had me stumped for a month.