Please help getting motion sensor set up

I’m trying to trigger my wyze sense to tell my basement/stairs lights to come on when motion is detected and to automatically turn off 5 minutes later.

I am so far unsuccessful.

The lights work when triggered via app and here is my motion sensor information.

My applicable configuration yaml:

automation:
- alias: Turn on stairs lights with motion detection
  trigger:
    platform: state
    entity_id: binary_sensor.wyzesense_779e9d08
    to: 'On'
  action:
    service: light.turn_on
    entity_id: light.stairs_1
    entity_id: light.stairs_2
    entity_id: light.basement_bulb_1
    entity_id: light.basement_bulb_2

- alias: Turn off Stairs lights 5 minutes after last movement
  trigger:
    platform: state
    entity_id: binary_sensor.wyzesense_779e9d08
    to: 'Off'
    for:
      minutes: 05
  action:
    service: light.turn_off
    entity_id: light.stairs_1
    entity_id: light.stairs_2
    entity_id: light.basement_bulb_1
    entity_id: light.basement_bulb_2

The configuration passes the yaml checker, but I have been unable to successfully trigger the lights to turn on. Any suggestions?

Hi @rdeets - have a read of the linked article below then post your yaml using code blocks (it looks like </> on the posting toolbar). This will enable us to check for simple things like indentation errors.

‘On’ and ‘Off’ are not the same as ‘on’ and ‘off’. It’s the last two you want when checking your states.

Edited OP.

1 Like

Thanks, much clearer. The solution is in my previous post.

Changed to lowercase and restarted and no difference.

You also need to format your light turn on and off action correctly. The entities should be a list, I.e. indented and proceeded with “-“

action:
  service: light.turn_on
    - entity_id: light.stairs_1
    - entity_id: light.stairs_2
    - entity_id: light.basement_bulb_1
    - entity_id: light.basement_bulb_2

Okay, I made those changes, but now I’m getting this error with the configuration checker:

Error loading /config/configuration.yaml: while parsing a block collection in “/config/configuration.yaml”, line 134, column 2 expected , but found ‘’ in “/config/configuration.yaml”, line 139, column 3

Line 134:

- alias: Turn on stairs lights with motion detection

Line 139:

action:

Full Configuration yaml:

# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# Text to speech
tts:
  - platform: google_translate

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
# Example configuration.yaml entry
light:
  - platform: flux_led
    automatic_add: true
    devices:
      192.168.2.175:
        name: "Stairs 1"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.227:
        name: "Stairs 2"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.95:
        name: "Bedroom 1"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.108:
        name: "Bedroom 2"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.25:
        name: "Front_Door_Bulb"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.198:
        name: "Basement Bulb 1"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.29:
        name: "Basement Bulb 2"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.128:
        name: "Living Room Lamp"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.136:
        name: "Entryway Bulb"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.146:
        name: "Diningroom Bulb"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.181:
        name: "Patio Bulb"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.206:
        name: "Bon Desk Bulb"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.209:
        name: "Dining Room Lamp"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.228:
        name: "Living Room 1"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.216:
        name: "Living Room 2"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.179:
        name: "Backyard Bulb"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.252:
        name: "Bathroom Ceiling"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.222:
        name: "Bathroom Sink 1"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.214:
        name: "Bathroom Sink 2"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.148:
        name: "Bathroom Sink 3"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.79:
        name: "Office Bulb 1"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.207:
        name: "Office Bulb 2"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.184:
        name: "Grill Light"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.8:
        name: "Rec Room 1"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.160:
        name: "Rec Room 2"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.31:
        name: "Rec Room 3"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.102:
        name: "Rec Room 4"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.190:
        name: "Hallway Bulb"
        mode: "rgbw"
        protocol: 'ledenet'
binary_sensor:
  - platform: wyzesense
    device: auto
automation:
 - alias: Turn on stairs lights with motion detection
   trigger:
    platform: state
    entity_id: binary_sensor.wyzesense_779e9d08
    to: 'on'
  action:
       service: light.turn_on
      - entity_id: light.stairs_1
      - entity_id: light.stairs_2
      - entity_id: light.basement_bulb_1
      - entity_id: light.basement_bulb_2

 - alias: Turn off Stairs lights 5 minutes after last movement
   trigger:
    platform: state
    entity_id: binary_sensor.wyzesense_779e9d08
    to: 'off'
    for:
      minutes: 05
  action:
  service: light.turn_off
    - entity_id: light.stairs_1
    - entity_id: light.stairs_2
    - entity_id: light.basement_bulb_1
    - entity_id: light.basement_bulb_2

Sorry I was on my phone and not concentrating. It should be like this:

action:
  service: light.turn_on
  entity_id: 
    - light.stairs_1
    - light.stairs_2
    - light.basement_bulb_1
    - light.basement_bulb_2

Okay, my current configuration.yaml starting at line 133:

automation:
 - alias: Turn on stairs lights with motion detection
   trigger:
    platform: state
    entity_id: binary_sensor.wyzesense_779e9d08
    to: 'on'
action:
  service: light.turn_on
  entity_id: 
    - light.stairs_1
    - light.stairs_2
    - light.basement_bulb_1
    - light.basement_bulb_2
 - alias: Turn off Stairs lights 5 minutes after last movement
   trigger:
    platform: state
    entity_id: binary_sensor.wyzesense_779e9d08
    to: 'off'
    for:
      minutes: 5
action:
  service: light.turn_off
  entity_id: 
    - light.stairs_1
    - light.stairs_2
    - light.basement_bulb_1
    - light.basement_bulb_2

And current error:

Error loading /config/configuration.yaml: while parsing a block mapping in “/config/configuration.yaml”, line 3, column 1 expected , but found ‘’ in “/config/configuration.yaml”, line 146, column 2

Line 3:

default_config:

Line 146:

- alias: Turn off Stairs lights 5 minutes after last movement

Your indentation is all over the place. This is very important in YAML. Pick a standard (2 spaces is common) and stick to it.

e.g. this:

   trigger:
    platform: state
    entity_id: binary_sensor.wyzesense_779e9d08
    to: 'on'

Should be:

   trigger:
     platform: state
     entity_id: binary_sensor.wyzesense_779e9d08
     to: 'on'

This:

action:
  service: light.turn_off
  entity_id: 
    - light.stairs_1

Should be:

   action:
     service: light.turn_off
     entity_id: 
       - light.stairs_1
      ...etc

Also you may have a fancy quote ‘’ somewhere instead of '' or that may just be due to your copy/paste. Fix all the indentation problems first.

Really getting confused. I ran it through Atom’s YAML Editor and everything seems to be lined up, and I’m no longer getting the configuration error, but the motion detector is still not triggering the lights.

Configuration yaml:


# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# Text to speech
tts:
  - platform: google_translate

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
# Example configuration.yaml entry
light:
  - platform: flux_led
    automatic_add: true
    devices:
      192.168.2.175:
        name: "Stairs 1"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.227:
        name: "Stairs 2"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.95:
        name: "Bedroom 1"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.108:
        name: "Bedroom 2"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.25:
        name: "Front_Door_Bulb"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.198:
        name: "Basement Bulb 1"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.29:
        name: "Basement Bulb 2"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.128:
        name: "Living Room Lamp"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.136:
        name: "Entryway Bulb"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.146:
        name: "Diningroom Bulb"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.181:
        name: "Patio Bulb"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.206:
        name: "Bon Desk Bulb"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.209:
        name: "Dining Room Lamp"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.228:
        name: "Living Room 1"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.216:
        name: "Living Room 2"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.179:
        name: "Backyard Bulb"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.252:
        name: "Bathroom Ceiling"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.222:
        name: "Bathroom Sink 1"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.214:
        name: "Bathroom Sink 2"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.148:
        name: "Bathroom Sink 3"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.79:
        name: "Office Bulb 1"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.207:
        name: "Office Bulb 2"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.184:
        name: "Grill Light"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.8:
        name: "Rec Room 1"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.160:
        name: "Rec Room 2"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.31:
        name: "Rec Room 3"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.102:
        name: "Rec Room 4"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.190:
        name: "Hallway Bulb"
        mode: "rgbw"
        protocol: 'ledenet'
binary_sensor:
  - platform: wyzesense
    device: auto
automation:
  - alias: Turn on stairs lights with motion detection
    trigger:
     platform: state
     entity_id: binary_sensor.wyzesense_779e9d08
     to: 'on'
    action:
     service: light.turn_on
     entity_id: 
       - light.stairs_1
       - light.stairs_2
       - light.basement_bulb_1
       - light.basement_bulb_2
  - alias: Turn off Stairs lights 5 minutes after last movement
    trigger:
     platform: state
     entity_id: binary_sensor.wyzesense_779e9d08
     to: 'off'
     for:
      minutes: 5
    action:
     service: light.turn_off
     entity_id: 
       - light.stairs_1
       - light.stairs_2
       - light.basement_bulb_1
       - light.basement_bulb_2

Still plenty of indentation errors. Here, try this:

# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# Text to speech
tts:
  - platform: google_translate

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
# Example configuration.yaml entry
light:
  - platform: flux_led
    automatic_add: true
    devices:
      192.168.2.175:
        name: "Stairs 1"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.227:
        name: "Stairs 2"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.95:
        name: "Bedroom 1"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.108:
        name: "Bedroom 2"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.25:
        name: "Front_Door_Bulb"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.198:
        name: "Basement Bulb 1"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.29:
        name: "Basement Bulb 2"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.128:
        name: "Living Room Lamp"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.136:
        name: "Entryway Bulb"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.146:
        name: "Diningroom Bulb"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.181:
        name: "Patio Bulb"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.206:
        name: "Bon Desk Bulb"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.209:
        name: "Dining Room Lamp"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.228:
        name: "Living Room 1"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.216:
        name: "Living Room 2"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.179:
        name: "Backyard Bulb"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.252:
        name: "Bathroom Ceiling"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.222:
        name: "Bathroom Sink 1"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.214:
        name: "Bathroom Sink 2"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.148:
        name: "Bathroom Sink 3"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.79:
        name: "Office Bulb 1"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.207:
        name: "Office Bulb 2"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.184:
        name: "Grill Light"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.8:
        name: "Rec Room 1"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.160:
        name: "Rec Room 2"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.31:
        name: "Rec Room 3"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.102:
        name: "Rec Room 4"
        mode: "rgbw"
        protocol: 'ledenet'
      192.168.2.190:
        name: "Hallway Bulb"
        mode: "rgbw"
        protocol: 'ledenet'
binary_sensor:
  - platform: wyzesense
    device: auto
automation:
  - alias: Turn on stairs lights with motion detection
    trigger:
      platform: state
      entity_id: binary_sensor.wyzesense_779e9d08
      to: 'on'
    action:
      service: light.turn_on
      entity_id: 
        - light.stairs_1
        - light.stairs_2
        - light.basement_bulb_1
        - light.basement_bulb_2

  - alias: Turn off Stairs lights 5 minutes after last movement
    trigger:
      platform: state
      entity_id: binary_sensor.wyzesense_779e9d08
      to: 'off'
      for:
        minutes: 5
    action:
      service: light.turn_off
      entity_id: 
        - light.stairs_1
        - light.stairs_2
        - light.basement_bulb_1
        - light.basement_bulb_2

Okay. I tried your configuration and it seems to be working in the history tab, but the lights aren’t actually turn them on.

And when I try to manually turn them on in homeassistant, they do nothing when enabled and just flash quickly when disabled.

Then there seems to be a problem with your flux_led setup. Which I know nothing about sorry.

Get the lights working manually first, then try the automation again.