Multi binary_sensor - error

Hello,

I want to make a second binary sensor but I have an error.


duplicated mapping key at line 86, column -607:
    binary_sensor:
    ^

Alone the first one work but when I put my second error

How I can correct this ?

Thx

binary_sensor:

  • platform: template
    sensors:
    motion_cuisinecombi:
    friendly_name: “Mouvement Cuisine”
    device_class: motion
    value_template: >-
    {{ is_state(‘binary_sensor.presence_9’, ‘on’)
    or is_state(‘binary_sensor.fibaro_system_fgms001_motion_sensor_sensor_2’, ‘on’) }}

binary_sensor:

  • platform: template
    sensors:
    motion_maison:
    friendly_name: “Mouvement Maison”
    device_class: motion
    value_template: >-
    {{ is_state(‘binary_sensor.presence_9’, ‘on’)
    or is_state(‘binary_sensor.fibaro_system_fgms001_motion_sensor_sensor_2’, ‘on’)
    or is_state(‘binary_sensor.presence_13’, ‘on’)
    or is_state(‘binary_sensor.presence_5’, ‘on’)
    or is_state(‘binary_sensor.fibaro_system_fgms001_motion_sensor_sensor’, ‘on’)
    or is_state(‘binary_sensor.motion_salle_de_bain’, ‘on’), ‘on’) }}

This is how you define multiple Template Binary Sensors.

binary_sensor:
  - platform: template
    sensors:
      motion_cuisinecombi:
        friendly_name: "Mouvement Cuisine"
        device_class: motion
        value_template: >-
          {{ is_state('binary_sensor.presence_9', 'on')
             or is_state('binary_sensor.fibaro_system_fgms001_motion_sensor_sensor_2', 'on') }}

      motion_maison:
        friendly_name: "Mouvement Maison"
        device_class: motion
        value_template: >-
          {{ is_state('binary_sensor.presence_9', 'on')
             or is_state('binary_sensor.fibaro_system_fgms001_motion_sensor_sensor_2', 'on')
             or is_state('binary_sensor.presence_13', 'on')
             or is_state('binary_sensor.presence_5', 'on')
             or is_state('binary_sensor.fibaro_system_fgms001_motion_sensor_sensor', 'on')
             or is_state('binary_sensor.motion_salle_de_bain', 'on'), 'on') }}

In the future, I suggest you format your code when presenting it on the forum. You are currently presenting it without formatting and it makes it difficult to read and confirm if it is correctly indented.