Z wave Motion Light won't turn off after 2 min

Hi,

Can’t get my automations.yaml file right to turn off motion lights in bathroom

#Motion Detected Light on BATHROOM
#- id: 
  alias: 2nd Bathroom Lamp On
  trigger:
    - platform: state
      entity_id: switch.ge_26931_smart_motion_switch_switch_3 #<- This should be your motion sensor or binary_sensor
      to: 'on'
      for: 
        minutes: 2
  #condition:
   #- condition: time
#     after: '20:00:00' # <- motion will only trigger the light on between these times
#     before: '05:00:00'
  action:
    - service: switch.turn_on  # or use homeassistant.turn_on
      entity_id: switch.ge_26931_smart_motion_switch_switch_3 #light.your_light # <- this should be your light entity_id
    
    # Motion Light OFF After 10 Min BATHROOM
#- id: switch.ge_26931_smart_motion_switch_switch_3
  alias: 2nd Bathroom Lamp Off
  trigger:
    - platform: state
      entity_id: switch.ge_26931_smart_motion_switch_switch_3 #<- This should be your motion sensor
      to: 'off'
      for:
        minutes: 3
  action:
    - service: switch.turn_off  #or light.turn_off
      entity_id: switch.ge_26931_smart_motion_switch_switch_3 # or light.your_light # <- this should be your light entity_id

DOES THIS HAVE ANYTHING TO SO WITH IT?

This works for me

- alias: lift licht nacht aan 
  trigger:
  - entity_id: binary_sensor.fibaro_system_fgms001_zw5_motion_sensor_sensor
    platform: state
    to: 'on'
  condition:
    condition: and
    conditions:
      - condition: time
        after: '17:00:00'
        before: 08:45:00
      - condition: state
        entity_id: light.tablet
        state: 'off'
      - condition: state
        entity_id: light.hemel
        state: 'off'
  action:
  - data:
      entity_id: switch.lift
    service: homeassistant.turn_on
    
- alias: lift licht nacht uit
  trigger:
  - entity_id:  binary_sensor.fibaro_system_fgms001_zw5_motion_sensor_sensor
    platform: state
    to: 'off'
    for:
      minutes: '1'
  condition: []
  action:
  - data:
      entity_id: switch.lift
    service: homeassistant.turn_off
1 Like

Yes it does. You need to start each automation with a hyphen. So the top of the first automation should be:

- alias: 2nd Bathroom Lamp On

…and the second:

- alias: 2nd Bathroom Lamp Off

Although, the automations as written are confusing. The first one says “if the switch is on for 2 minutes, turn the switch on” and the second one is saying “if the switch is off for 3 minutes, turn the switch off.”

Based on what I can see here, the trigger in both of those automations should be a motion sensor which is a binary_sensor.

Thank you.
I’ll add the hyphen.

I did not find anything for that device which says binary_sensor. I have other devices that say binary_sensor but not this one.

I basically want the light to turn on with motion for 2 minutes, unless there is motion, then stay on for another 2 min.

I added the turn_off to see if either worked.

The motion sensor you’re talking about would be a binary sensor. That’s what you want in the trigger. Right now you have the switch in both the trigger and action.

Do I just type “binary”?
It’s a light switch and motion all in 1. I have not found binary anything for this.
I have binary for another motion detector but it’s just a motion detector.
Could it be “sensor”.xxx?

BTW, I have this error now.
image

image

the error is pointing to your automations.yaml file which is included at line 43 so the error is in that file.

post your automations again the way they are currently configured.

also post a screenshot of all of the entities associated with the “ge_26931_smart_motion_switch_switch_3” device.

@finity
@jazzyisj
@PodPerson
@Burningstone
@pickerin
Thank you for your replies…

hey bro(finity),
I changed it to switch_4…


image

   #MOTION LIGHT ON on BATHROOM
#- id: 
#- alias: 2nd BATHroom Light. This one TOO
  #trigger:
    #- platform: state
    #- entity_id: sensor.ge_26931_smart_motion_switch_sourcenodeid_4 #<- This should be your motion sensor or binary_sensor
     # to: 'on'
      #for: 
     #   minutes: 2
  #condition:
   #- condition: time
#     after: '20:00:00' # <- motion will only trigger the light on between these times
#     before: '05:00:00'
  #action:
  #- data:
   # - service: switch.turn_on # or switch.turn_on  # or use homeassistant.turn_on
    #- entity_id: switch.ge_26931_smart_motion_switch_switch_4 #light.your_light # <- this should be your light entity_id
    
    
    # MOTION LIGHT OFF After 10 Min BATHROOM
#- id: switch.ge_26931_smart_motion_switch_switch_3
- alias: 2nd BATHroom Light. This one TOO
  trigger:
    - platform: state
      entity_id: sensor.ge_26931_smart_motion_switch_sourcenodeid_4 #<- This should be your motion sensor
      to: 'off'
      for:
        minutes: 3
  action:
   - data:
   - service: switch.turn_off  #or light.turn_off
     entity_id: switch.ge_26931_smart_motion_switch_switch_4 # or light.your_light # <- this should be your light entity_id

REGISTERED ENTITIES for switch_4 (There are a lot). I included ones next to if for visual.
image
image
image
image
image
image

You indentation was incorrect:

- alias: 2nd BATHroom Light. This one TOO
  trigger:
  - platform: state
    entity_id: sensor.ge_26931_smart_motion_switch_sourcenodeid_4 #<- This should be your motion sensor
    to: 'off'
    for:
      minutes: 3
  action:
  - data:
  - service: switch.turn_off  #or light.turn_off
    entity_id: switch.ge_26931_smart_motion_switch_switch_4 # or light.your_light # <- this should be your light entity_id

hi, there… :slightly_smiling_face:

the “sourcenodeid” entity won’t ever change and isn’t the entity you need to look at to trigger the automation.

Since there isn’t a binary_sensor (unless there is and you just didn’t show it…) then you will probably need to end up using the “alarm_level” or the “burglar” sensors to trigger the automation. to do that you’ll need to see what the values of those sensors change to when you activate the motion sensor.

That’s good to know. Now I can mess with the sensors and try it that way.

Thanks Bro!

What is this one for? Why does it have so much data compared to the other switches with the same Node id_14

@finity P.S.
Still getting this error:
image

# MOTION LIGHT OFF After 10 Min BATHROOM
#- id: switch.ge_26931_smart_motion_switch_switch_3
- alias: 2nd BATHroom Light. This one TOO
  trigger:
    - platform: state
      entity_id: sensor.ge_26931_smart_motion_switch_alarm_type_4 #<- This should be your motion sensor
      to: 'off'
      for:
        minutes: 3
  action:
   - data:
   - service: switch.turn_off  #or light.turn_off
     entity_id: switch.ge_26931_smart_motion_switch_switch_4 # or light.your_light # <- this should be your light entity_id
and 
# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# Show the introduction message on startup.
introduction:

# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
# http:
#   base_url: example.duckdns.org:8123

# Discover some devices automatically
discovery:

# Sensors
sensor:
  # Weather prediction
  - platform: yr
  - platform: random
  # Motion
  #- plateform:  state

# Text to speech
tts:
  - platform: google

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml

Remove “data:” in the action section of your automation.

Because that isn’t a “switch”. You can tell that by the fact that it starts with “zwave.xxx” and not “switch.xxx”.

That is the base zwave device itself. You can think of it like the “controller” or “brain” of the individual device that does all of the overhead that is needed for the other auxiliary functions to operate.

@Burningstone
That worked. Thanks!!

Got it. Makes Sense.
Thank you!