Open xitation opened 7 months ago
Looks like my version of HA ships with pysnmp-lextudio
# docker exec -it homeassistant bash
homeassistant:/config# pip list |grep snmp
pysnmp-lextudio 6.0.11
pysnmpcrypto 0.0.4
I updated the deps in your package to request this instead and it appears to resolve the issue.
I've lodged a PR for you to consider.
Thanks.
Xi.
Seems I'm unable to progress, attempting setup now fails.
Apr 09 13:34:57 Xi-Hassio-1 homeassistant[466]: 2024-04-09 23:34:57.817 ERROR (MainThread) [custom_components.powerpanel] Unable to connect to snmp: Traceback (most recent call last):
Apr 09 13:34:57 Xi-Hassio-1 homeassistant[466]: File "/config/custom_components/powerpanel/config_flow.py", line 57, in async_step_user
Apr 09 13:34:57 Xi-Hassio-1 homeassistant[466]: PowerPanelSnmpMonitor(ipaddress, port, username, scanInterval)
Apr 09 13:34:57 Xi-Hassio-1 homeassistant[466]: File "/config/custom_components/powerpanel/sensor.py", line 308, in __init__
Apr 09 13:34:57 Xi-Hassio-1 homeassistant[466]: self.update_stats() # try this to throw error if not working.
Apr 09 13:34:57 Xi-Hassio-1 homeassistant[466]: ^^^^^^^^^^^^^^^^^^^
Apr 09 13:34:57 Xi-Hassio-1 homeassistant[466]: File "/config/custom_components/powerpanel/sensor.py", line 424, in update_stats
Apr 09 13:34:57 Xi-Hassio-1 homeassistant[466]: data = __class__.get(
Apr 09 13:34:57 Xi-Hassio-1 homeassistant[466]: ^^^^^^^^^^^^^^
Apr 09 13:34:57 Xi-Hassio-1 homeassistant[466]: File "/config/custom_components/powerpanel/sensor.py", line 349, in get
Apr 09 13:34:57 Xi-Hassio-1 homeassistant[466]: handler = hlapi.getCmd(
Apr 09 13:34:57 Xi-Hassio-1 homeassistant[466]: ^^^^^^^^^^^^^
Apr 09 13:34:57 Xi-Hassio-1 homeassistant[466]: File "/usr/local/lib/python3.12/site-packages/pysnmp/hlapi/asyncio/sync/cmdgen.py", line 104, in getCmd
Apr 09 13:34:57 Xi-Hassio-1 homeassistant[466]: return loop.run_until_complete(future)
Apr 09 13:34:57 Xi-Hassio-1 homeassistant[466]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Apr 09 13:34:57 Xi-Hassio-1 homeassistant[466]: File "/usr/local/lib/python3.12/asyncio/base_events.py", line 661, in run_until_complete
Apr 09 13:34:57 Xi-Hassio-1 homeassistant[466]: self._check_running()
Apr 09 13:34:57 Xi-Hassio-1 homeassistant[466]: File "/usr/local/lib/python3.12/asyncio/base_events.py", line 620, in _check_running
Apr 09 13:34:57 Xi-Hassio-1 homeassistant[466]: raise RuntimeError('This event loop is already running')
Apr 09 13:34:57 Xi-Hassio-1 homeassistant[466]: RuntimeError: This event loop is already running
I entered values as follows ip address snmp port (163) - I run other SNMP daemon on same host so need other port snmp community string refresh invterval
I've confirmed that the Powerpanel instance is working with snmpwalk and I get returned values with the same values I'm using on addon.
Hey! Sorry I didn't realize my notifications where turned off..
Your two issues here are all related to pysnmp
. Getting pysnmp
to install is a bit of a hassle.
I didn't realize pysnmp-lextudio
was there, using it will be fine. It does cause your second issue there, however. When we call hlapi.getCmd
here we're already running in an event loop, but that method then tries to create it's own event loop for whatever reason. This is causing that second error.
Reading https://github.com/home-assistant/core/issues/110100#issuecomment-1989501420
, it seems using pysnmp-lextudio==5.0.34
fixes this issue. Try to see if that works for you, and if it does I'll merge it on in. Thanks!
And what you entered into the config flow should work, sorry about the text being missing there 😅
Make sure you're using SNMPv1, there's no SNMPv3 support ... yet.
Hi @C0Newb,
Gave it a crack just now, still throwing an error.
Apr 15 04:02:17 Xi-Hassio-1 homeassistant[466]: 2024-04-15 14:02:17.217 INFO (SyncWorker_21) [homeassistant.util.package] Attempting install of pysnmp-lextudio==5.0.34
Apr 15 04:03:07 Xi-Hassio-1 homeassistant[466]: 2024-04-15 14:03:07.794 ERROR (MainThread) [custom_components.powerpanel] Unable to connect to snmp: Traceback (most recent call last):
Apr 15 04:03:07 Xi-Hassio-1 homeassistant[466]: File "/config/custom_components/powerpanel/config_flow.py", line 57, in async_step_user
Apr 15 04:03:07 Xi-Hassio-1 homeassistant[466]: PowerPanelSnmpMonitor(ipaddress, port, username, scanInterval)
Apr 15 04:03:07 Xi-Hassio-1 homeassistant[466]: File "/config/custom_components/powerpanel/sensor.py", line 308, in __init__
Apr 15 04:03:07 Xi-Hassio-1 homeassistant[466]: self.update_stats() # try this to throw error if not working.
Apr 15 04:03:07 Xi-Hassio-1 homeassistant[466]: ^^^^^^^^^^^^^^^^^^^
Apr 15 04:03:07 Xi-Hassio-1 homeassistant[466]: File "/config/custom_components/powerpanel/sensor.py", line 424, in update_stats
Apr 15 04:03:07 Xi-Hassio-1 homeassistant[466]: data = __class__.get(
Apr 15 04:03:07 Xi-Hassio-1 homeassistant[466]: ^^^^^^^^^^^^^^
Apr 15 04:03:07 Xi-Hassio-1 homeassistant[466]: File "/config/custom_components/powerpanel/sensor.py", line 349, in get
Apr 15 04:03:07 Xi-Hassio-1 homeassistant[466]: handler = hlapi.getCmd(
Apr 15 04:03:07 Xi-Hassio-1 homeassistant[466]: ^^^^^^^^^^^^^
Apr 15 04:03:07 Xi-Hassio-1 homeassistant[466]: File "/usr/local/lib/python3.12/site-packages/pysnmp/hlapi/asyncio/sync/cmdgen.py", line 104, in getCmd
Apr 15 04:03:07 Xi-Hassio-1 homeassistant[466]: File "/usr/local/lib/python3.12/asyncio/base_events.py", line 661, in run_until_complete
Apr 15 04:03:07 Xi-Hassio-1 homeassistant[466]: self._check_running()
Apr 15 04:03:07 Xi-Hassio-1 homeassistant[466]: File "/usr/local/lib/python3.12/asyncio/base_events.py", line 620, in _check_running
Apr 15 04:03:07 Xi-Hassio-1 homeassistant[466]: raise RuntimeError('This event loop is already running')
Apr 15 04:03:07 Xi-Hassio-1 homeassistant[466]: RuntimeError: This event loop is already running
Apr 15 04:03:07 Xi-Hassio-1 homeassistant[466]:
Hi There,
I get the following errors when attempting to install your addon, on Home Assistant version 2024.4.2.
Thanks.