Help with SNMP Sensors

Hi

Here the part of the configuration file for the snmp sensor

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: 30 
    device_class: 'temperature'
    state_class: 'measurement'

As you can see Im using WD EX2 and i have tried several names.

Is that useful?

Regards

Andy

Try to put the name in quotes, either single or double.

Hi Wally

Tried that , changed it to “WD” still no good.

Its got to be something basic I’m doing wrong

Regards

Andy

I’m kinda wondering if its your YAML config that is causing the problem…
Anyway, here are a couple of other suggestions to try; not to get it to work but
provide some more insight as to what the problem may be:

  • configure the host with an IP address that doesn’t exist on your network.
    You should see an error about not being able to contact the host.
  • Change the OID to something not found in your MIB Browser. See if you get an error.
  • Post what your MIB Browser is showing for the real OID you want to use.

Hi,

Some good ideas which I tired.

Changing the IP did result in an errors in the log that proved the real IP is working fine . These errors were tiemout errors as the snmp sensor was setup with the last result saying No SNMP response received before timeout ,

Putting it back to the real host , those errors disappeared but then replaced by these regarding the OID

2024-09-29 11:09:44.422 DEBUG (MainThread) [homeassistant.components.snmp.sensor] SNMP OID .1.3.6.1.4.1.5127 received type=<class ‘pysnmp.proto.rfc1905.NoSuchObject’> and data
2024-09-29 11:09:44.423 ERROR (MainThread) [homeassistant.components.snmp.sensor] SNMP error for OID .1.3.6.1.4.1.5127: No Such Object currently exists at this OID
2024-09-29 11:09:44.424 ERROR (MainThread) [homeassistant.components.sensor] Error adding entity sensor.wd for domain sensor with platform snmp

These clearly point to the OID as the problem in my view.

then I tried two differnet MIB browser to check I was reading leaf nodes and the OID value was correct which both are.

This is what the MIB browser output is of that leaf node

“Name”,“Full Name”,“OID”,“Type”,“Access”,“Indexes”,“MIB Module”,“Description”

“mycloudex2ultraTemperature”,“.iso.org.dod.internet.private.enterprises.WD.productID.projectID.modelID.submodelID.nasAgent.mycloudex2ultraTemperature”,"

.1.3.6.1.4.1.5127.1.1.1.8.1.7",“DISPLAYSTRING”,“read-only”,“”,“MYCLOUDEX2ULTRA-MIB”,“The temperature of the system.”

All that done , whilst I feel I know the problem now I have no idea how ot fix it.

my config is this

sensor:
  - platform: snmp
    name: "WD"
    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: 30 
    device_class: 'temperature'
    state_class: 'measurement'

do i have anything wrong here such as device or state class

This is giving me a headache … :frowning:

It is saying that it can’t read .1.3.6.1.4.1.5127
Maybe that node is not included in the public community view.
Do you log in with version 2c and public community when you are using your MIB browser?

Finally working , well sort of.

I figured out it was the OID so I enabled SNMP on a windows 11 PC , and that worked fine with a MIB Browser. However I couldn’t find which value to use and found on a Microsoft web site a generic OID.

I used that and had to # the unit of measurement, device and state class and then a reboot later I finally have an entity in the snmp integration.

So what I need to do is understand what values from the mib browser I can use , I thought they must be OID , but I think I can use timeticks, integer etc but not sure

But a good step forward thou

Regards

Andy

Googling around I found the MIB for this product (please ignore the issue in that post as it is irrelevant). So I think you have the correct OID.
However, another HA Forum user recently posted having an OID problem with pysnmp. His error was different from yours, but his solution was to add an instance index .0 (even though its a scalar) to the end of the OID.

So in summary, try: baseoid: 1.3.6.1.4.1.5127.1.1.1.8.1.7.0

Hi,

I found the same post and tried a few of those OID’s but none worked for me.

In fact they resulted in the same error as previous with no entity being created.

The problem is , its very trial & error needing a restart each time , so Ive come to the conclusion I’ll have to dig around until I find the right ones.

Thank you for taking the time to help

Regards

Andy

Everything coming from SNMP v2c is either string or INT32.

If your temperature sensor is measuring 72.85 °C, then the SNMP value might be 7285, which might be out of range for a temperature sensor in HA.

Hi

So I took the note it should be an Integer and changed my config , which worked and displayed the entity with the correct value. So happy days

However I then took the xml output from the MIB browser and changed my config to use an Octet string value instead and very strangely despite several reboots the original SNMP entity remained.

I will of course change it back to an integer but I cant explain why that is happening .

Also now I have it working and creating one sensor , how do I include more to have multiple sensors for that device .

Do I just add more OID lines or repeat the same config but with different sensor names

many thanks

Andy

Should be something like

sensor:
  - platform: snmp
    name: "WD"
    etc. etc.
  - platform: snmp
    name: "NAME2"
    etc. etc.

When you’re finished, it would be good to post your final config for others to see in the future.

Thank you , yes I will as it might help somebody who are like me stuck, and thank you for the help.

I have been playing with it today and from the xml output of the snmpwalk if I use integers they seem so work

If I use Octetstring doesn’t in any way. (with or without a . at the front, extra 0 on the end as I read in another post … confusing

However the values I need are octetstrings not integers … so even thou I have it working with integers , its pretty useless .

I have seen other posts where they are not using OIDs and have text values so i’m still very confused how the snmp integration works. I have read the documentation on it several times but its very basic and limited info.

So I have a question to anyone who see’s this… does anyone have a WD EX2 that they have done this with, as I am now considering wiping it clean and selling it on ebay…

Appreciate all the help to date as well … thank you Andy