Help with SNMP Sensors

Hi, Im not new to HA but fairly green when it comes to SNMP and creating sensors

I have a WD EX2 NAS box and I would like to monitor this in HA.

My only way of doing this seems to be via SNMP.

So I have used a MIB Browser to grab the available OIDs from

And my question/s are

Am I right that I can create sensors in the configuration yaml file and then display their status via a dashboard?

If so what do I need to add to the configuration yaml file , any simple examples would be helpful so I can try to get my head around this.

All help is appreciated thank you .

Please keep it simple as me and snmp / sensors are not good friends as yet :slight_smile:

regards Andy

SNMP sensors are quite simple to set up.

The hard part is actually finding the OIDs and that you have done already.
There are just two things to check in your findings.

  1. OIDs consist only of numbers separated by dots. If yours have text then you have a MIB file loaded. The pure IODs should still be visible somewhere in the MIB browser.
  2. The MIB browsers can often figure out to take the first leaf below a branch OID and show that. That means you might have stored a branch OID and not the leaf OID just below. HA only accept th leaf OID, so either check it before hand or later if no value is shown then.

Ok thank you for the info. I have an MIB browser and exported and imported the MIB file as you suggested I might have so I will check this , good pointer.

regards

Andy

Hi

After reading the snmp guide and using a MIB browser I added this to my configuration yaml, but I cannot find the sensor value anywhere. What am I doing wrong?

sensor 5:
  - platform: snmp
    name: "WD EX2"
    host: 192.168.2.117
    baseoid: 1.3.6.1.4.1.5127.1.1.1.8.1.7
    accept_errors: true
    unit_of_measurement: "degrees"
    value_template: "{{((value | int) / 6000) | int}}"re

Sensor 5: looks wrong.
Try just sensor:

I used sensor 5 as I have other sensors such as sensor 4 which work fine. But I tried changing it to sensor and restarted HA but with no luck.

Where should the sensor appear, I looked in devices, entities and tried adding a sensor to a dashboard but couldn’t find the entity

just to add, i can see snmp in integrations and it states 1 entity but when i try to view the entity there is nothing there.

Could it be the OID is wrong and therefore no value is returned ?

When the OID is wrong, then it will usually be unavailable instead, but check the logs.
It should be an entity named something with wd, I think.

Hi, Thanks for the help , but I cant get it to work.

I did as you suggested and changed the name to a simple wd

I rechecked the wd snmp setting and its set to on with public access

All i get is no data when I go to the SNMP integration and click on the entity

I also checked in the MIB Browser and it is a leaf OID I am using.

I’m going to add in a few more OIDs to see if the entity count increases, and hopefully one might work.

regards Andy

Is the authentication correct?
SNMP version?
Community for v1 and v2 or username for v3?

Hi

I think I am at the point of giving me up , its driving me mad.

The WD EX2 is set as follows

SNMP all versions v2c and V3
v2c is set to public
v3 as a user and set to NoAuthNoPriv

I have set the name in my config yaml to the same as the leaf sensor just in case it was that.

I have double checked the OID which in the MIB broswer had a number starting with a .
so tried in in the config yaml with and without the .

But none of these as made any difference

I did a reload after each change , but no good.

Now there is not even an entity showing up under the snmp intergration

So sadley for now I’m beaten .

Can somebody please write a better snmp intergration …

Thanks for your help WallyR

Regards Andy

Can you post your YAML again?
The one you have posted earlier are missing important entries, like community and version.

Don’t know if this will help, but taking my config and modifying it for your situation…

Assuming your SNMP device supports v2c, and that your SNMP device has been configured to use the community string “public”, then see if the following works for you:

sensor:
  - platform: snmp
    name: WD EX2
    host: 192.168.2.117
    community: public
    version: 2c
    baseoid: 1.3.6.1.4.1.5127.1.1.1.8.1.7
    unit_of_measurement: '°C'
    scan_interval: 300 
    device_class: 'temperature'
    state_class: 'measurement'

In UI-DevTools->States, look for sensor.wd_ex2.

If this works, then you can try the value template as: "{{ (value | int) / 6000) | int}}"

I think HA wants a dot as first character in the OID too, but try first without.

Hi

Firstly , thank you very much for taking the time to provide the update.

I have tried your config with and without the . but sadly still not working.

I do have the entity back in the SNMP integration but showing no data

I check in dev tools , states and no sensor created.

So stil lost …

Going to give it a rest for a day and pick it up again tomorrow

Many thanks for all the help

Regards

Andy

You should try enabling “debug” to your HA logger for snmp in your configuration.yaml. It should look something like:

logger:
  default: blah blah
  logs:
    homeassistant.components.snmp: debug

Restart HA and see what the logs say.

I’m curious, if sensor.wd_ex2 is not in the developers tools under state, then what is the name of the entity that the SNMP Integration says it has?

Regarding the question of OID, the device is using an enterprise MIB, and the OID starts at the beginning of the OID tree as 1.3.6.1.4.1.x.x.x.x which corresponds to iso(1).org(3).dod(6).internet(1).private(4).enterprises(1). Syntactically, I don’t see a reason for it to begin with a dot. There is not anything in the docs to indicate it should or could begin with a dot.

Hi,

Maybe a good idea re the logger , but I have no idea how to do that . Will look to see if I can work it out though.

Re the entity, maybe I am confusing everyone with my description. What I am referring to is when I go into setting / integrations snmp it says 1 Entity.

But when I click on it to display it ( as happens on other integrations) the is nothing there , just a black page with the headers and a note in the middle saying no data.

Hope that explains a bit better

Regards

Andy

Hi

So I managed to enable the logger , very easy to do, and what I found in the logs was

ERROR (MainThread) [homeassistant.components.sensor] Error adding entity sensor.wd_ex2 for domain sensor with platform snmp

At least that explains why no entity is shown , but I dont understand what this error really means… Any ideas please

Regards

Andy

Unfortunately the error doesn’t tell you much. The SNMP Integration is trying to create a sensor by “inheriting” from the sensor integration and thus the SNMP integration is telling the sensor integration to create an SNMP sensor, but the sensor integration is not happy about something.
I suggest you post your configuration.yaml for your sensor: (which will include your SNMP config).

Try
name: "WD EX2"