#Question about setting up multiple binary sensors (motioneye)

1 messages · Page 1 of 1 (latest)

low sedge
#

Hey yall! I'm very new here - currently trying to figure out how to set up multiple motion detector sensors (from motionEye). Currently I have this in my configuration.yaml file:

template:
  trigger:
    - platform: event
      event_type: motioneye.motion_detected
      event_data:
        device_id: dbdca3e09336cba0076004d195e04069
  binary_sensor:
    - name: "Webcam Motion Detected"
      auto_off: 5
      device_class: motion
      state: "true"```
#

And that works great, but how can I add more than one? I'm assuming they both go under "template" but I tried that & it didn't seem to work. Maybe I didn't get the order right. I'll keep tinkering but any suggestions are appreciated.

#

Like, I tried to add my logitech camera's motion detection as well, like this:

template:
  trigger:
    - platform: event
      event_type: motioneye.motion_detected
      event_data:
        device_id: dbdca3e09336cba0076004d195e04069
  binary_sensor:
    - name: "Webcam Motion Detected"
      auto_off: 5
      device_class: motion
      state: "true"
  trigger:
    - platform: event
      event_type: motioneye.motion_detected
      event_data:
        device_id: a529d56ded1c6a49a34649bc8bbbb8c3
  binary_sensor:
    - name: "Logitech Motion Detected"
      auto_off: 5
      device_class: motion
      state: "true"```
#

But it's giving me a "duplicated mapping key" error.


 34 |       auto_off: 5
 35 |       device_class: motion
 36 |       state: "true"
 37 |   trigger:
--------^
 38 |     - platform: event```
#

I think i'm mainly confused by the correlation between the trigger and binary_sensor parts. How does it know that those two entries are correlated? I guess it's having trouble differentiating them when I add more than one?

low sedge
#

I tried this, but it treats both as one sensor:

template:
  trigger:
    - platform: event
      event_type: motioneye.motion_detected
      event_data:
        device_id: dbdca3e09336cba0076004d195e04069
    - platform: event
      event_type: motioneye.motion_detected
      event_data:
        device_id: a529d56ded1c6a49a34649bc8bbbb8c3
  binary_sensor:
    - name: "Webcam Motion Detected"
      auto_off: 5
      device_class: motion
      state: "true"
    - name: "Logitech Motion Detected"
      auto_off: 5
      device_class: motion
      state: "true"```
#

And it's telling me not to do this. (have two "template" mapping keys)

  trigger:
    - platform: event
      event_type: motioneye.motion_detected
      event_data:
        device_id: dbdca3e09336cba0076004d195e04069
  binary_sensor:
    - name: "Webcam Motion Detected"
      auto_off: 5
      device_class: motion
      state: "true"

template:
  trigger:
    - platform: event
      event_type: motioneye.motion_detected
      event_data:
        device_id: a529d56ded1c6a49a34649bc8bbbb8c3
  binary_sensor:
    - name: "Logitech Motion Detected"
      auto_off: 5
      device_class: motion
      state: "true"```
golden creek
#

There are some nice examples in the docs

low sedge
#

Like this one?

template:
  # Define state-based template entities
  - sensor:
      ...
  - binary_sensor:
      ...

  # Define trigger-based template entities
  - trigger:
      ...
    sensor:
      ...
    binary_sensor:
      ...```
golden creek
#

Your initial problem is that you're not providing a list. Start by putting ' - ' before trigger

#

Yes, right. Doesn't look like yours

low sedge
#

Ohh ok! I'll give that a try

golden creek
#

None of your trigger: lines start with -

low sedge
#

WOOO!!! That worked! Thank you :)