jaroschek / home-assistant-eaton-ups

Custom Home Assistant integration for Eaton UPS devices and sensors through SNMP.
4 stars 1 forks source link

Unknown error occurred - trying to setup #9

Open thermoscookies opened 6 months ago

thermoscookies commented 6 months ago

Trying to set this up for the first time.

During initial configuration, it gives me an "Unknown error occured". I was able to connect to the UPS using Passler SNMP Tester with the same info to verify the SNMP connection does work on the UPS side.

image image

image

and here is the error info from the HA logs:

Source: /usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py:421
First occurred: 2:49:25 PM (9 occurrences)
Last logged: 3:03:03 PM

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py", line 543, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_middlewares.py", line 114, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 85, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 227, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 233, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 31, in headers_middleware
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 149, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 63, in with_admin
    return await func(self, request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 177, in post
    return await super().post(request, flow_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 72, in wrapper
    result = await method(view, request, data, *args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 110, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 320, in async_configure
    result = await self._async_handle_step(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 416, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/eaton_ups/config_flow.py", line 157, in async_step_v1
    result = api.get([SNMP_OID_IDENT_PRODUCT_NAME, SNMP_OID_IDENT_SERIAL_NUMBER])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/eaton_ups/api.py", line 87, in get
    return __class__.fetch(iterator, 1)[0]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/eaton_ups/api.py", line 145, in fetch
    raise RuntimeError(
RuntimeError: Got SNMP error: None noSuchName 2
jaroschek commented 6 months ago

The error Got SNMP error: None noSuchName is caused, if a requested OID does not exist in the device.

During setup the integration tries to get the product name and serial number from the device using these OIDs:

SNMP_OID_IDENT_PRODUCT_NAME = "1.3.6.1.4.1.534.1.1.2.0"
SNMP_OID_IDENT_SERIAL_NUMBER = "1.3.6.1.4.1.534.1.1.6.0"

Can you check these specific OIDs with your SNMP tester?

I implemented this integration for my Eaton 9PX with a Network-M2 installed using the official OIDs.

What device or network card do you use? If yours is different, it could be possible, that the OIDs are different too. This would be a bummer as I intended to use the official OIDs from Eaton to support as many of their UPSs and network cards as possible.

Could you provide the SNMP MIB (Management Information Base) files for your network card?

thermoscookies commented 6 months ago

Here is the output for those OIDs

----------------------- New Test -----------------------
Paessler SNMP Tester - 23.3.87.552 Computername: BASEMENTPC Interface: (192.168.10.170)
2/7/2024 2:38:01 PM (15 ms) : Device: 192.168.10.68
2/7/2024 2:38:01 PM (19 ms) : SNMP v1
2/7/2024 2:38:01 PM (24 ms) : Custom OID 1.3.6.1.4.1.534.1.1.2.0
2/7/2024 2:38:01 PM (36 ms) : SNMP Datatype: ASN_OCTET_STR
2/7/2024 2:38:01 PM (41 ms) : -------
2/7/2024 2:38:01 PM (45 ms) : Value: Powerware 9130 2000
2/7/2024 2:38:01 PM (48 ms) : Done

----------------------- New Test -----------------------
Paessler SNMP Tester - 23.3.87.552 Computername: BASEMENTPC Interface: (192.168.10.170)
2/7/2024 2:38:14 PM (11 ms) : Device: 192.168.10.68
2/7/2024 2:38:14 PM (15 ms) : SNMP v1
2/7/2024 2:38:14 PM (19 ms) : Custom OID 1.3.6.1.4.1.534.1.1.6.0
2/7/2024 2:38:14 PM (30 ms) : SNMP Datatype: ASN_NULL
2/7/2024 2:38:14 PM (34 ms) : -------
2/7/2024 2:38:14 PM (37 ms) : Value: NULL2
2/7/2024 2:38:14 PM (41 ms) : Done

It's an Eaton 9130, the card just says Network-MS on it.

I was able to get my ups added by rolling back the version.

jaroschek commented 6 months ago

Based on the responses, it seems, that a serial number is not available.

The previous solution of entering the name manually was more reliable and sufficient. So I reverted the config flow back to manual (and even added the missing label to the name input field) and created a new version. This should now work as before.

Karoolus commented 1 month ago

Hi there!

Sorry for reviving this issue, but I seem to have the same problem:


D:\Downloads\SnmpGet>SnmpGet -r:192.168.0.47 -o:.1.3.6.1.4.1.534.1.1.2.0
SnmpGet v1.01 - Copyright (C) 2009 SnmpSoft Company
[ More useful network tools on http://www.snmpsoft.com ]

OID=.1.3.6.1.4.1.534.1.1.2.0
Type=OctetString
Value=Evolution S 2500

D:\Downloads\SnmpGet>SnmpGet -r:192.168.0.47 -o:.1.3.6.1.4.1.534.1.1.6.0
SnmpGet v1.01 - Copyright (C) 2009 SnmpSoft Company
[ More useful network tools on http://www.snmpsoft.com ]

%Failed to get value of SNMP variable. Variable does not exist (noSuchName(2))

It extracts the name, but it fails on the serial number. I am also not able to find it manually using SNMPWalk. Anything I can do on my end?