Multiple Sensors Of Same Type in configuration.yaml

I’m a VERY new user and having trouble searching for an answer on this:

Trying to get sensors added for multiple devices that are the same.

I have multiple QNAP NAS devices. Per the instructions i added this block to my configuration.yaml file and restarted. But it only picks up the LAST one in the list. If i change the order that becomes the one it picks up. I don’t really see how to specify more than 1 sensor.

Can you advise how that would be done? They are identical devices with just different IP’s.

# NAS1
sensor:
  - platform: qnap
    host: 192.168.1.7
    username: admin
    password: xxxxx
    monitored_conditions:
      - status
# NAS2
sensor:
  - platform: qnap
    host: 192.168.1.8
    username: admin
    password: xxxxx
    monitored_conditions:
      - status

Thanks for any guidance.

Remove the second sensor: and maybe some then empty lines.
The sensors: use a list and a yaml list is just something like this:

listname:
    - item
    - item
...

Edit: Leave everything not prefixed with a dash and not intended in place :wink: You’r items are not just items but dicts (and this is the yaml way of writing them).

You can find a quite good cheat sheet for yaml syntax in the ansible documentation, here.

2 Likes
sensor:
# NAS1
  - platform: qnap
    host: 192.168.1.7
    username: admin
    password: xxxxx
    monitored_conditions:
      - status
# NAS2
  - platform: qnap
    host: 192.168.1.8
    username: admin
    password: xxxxx
    monitored_conditions:
      - status

Should work

1 Like

Boom! That did the trick! Thank you sir!!! I learned a lot on how that’s supposed to flow.

1 Like