Sensor snmp

I’m really struggling with yaml and the configuration logic of HA.
Most of my configuration lies in integrations so my yaml files are quite small.
But some integrations still require yaml.
I like to have things organized.
Recently i put an apc9630 nmc2 card in my apc ups so i need to create snmp sensors. Later i plan to add other snmp sensors for printer, switch, router,…
My plan is to have several files to define sensors.
To keep things organized i have a very small configuration.yaml file:

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

# Text to speech
  - platform: google_translate

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
sensor: !include_dir_list sensors/
  use_x_forwarded_for: true
    - # Add the IP address of the proxy server

and i created a onduleur.yaml file in config/sensors directory

# APC smt1000 snmp    
- platform: snmp
  name: smt1000_smart_type
  unique_id: smt1000_smart_type
  accept_errors: true

The editor gives no error but when i want to validate the configuration in developper tools i have the following error

Avertissements de configuration
Invalid config for 'sensor' at sensors/onduleur.yaml, line 2: expected a dictionary '', got [{'platform': 'snmp', 'name': 'smt1000_smart_type', 'unique_id': 'smt1000_smart_type', 'host': '', 'baseoid': '', 'accept_errors': True}]

i tried many times but no way to find my error.
Like each time i have such problem i’m lost. Configuring ha is done in such weird way and the change in syntax doesn’t help to find the answer.
Can you point me in the right direction?


sensor: !include_dir_merge_list sensors

Or delete the leading hyphen in onduleur.yaml and un-indent everything.

If you’re using !include_dir_list, each file must contain exactly one entry without the leading hyphen.

Using !include_dir_merge_list allows you to have multiple entries per file, written as a YAML list with leading hyphens.

You’ve used the first option with the formatting of the second.

Thanks that seems to do the trick. I have no more errors but i have not finished to debug it as there is no entity created after config reload.

edit: it seems a configuration reload was not enough. Entities are created after a full restart. :grinning:

1 Like