Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SNMP Sensor #71368

Closed
lzzsalvo opened this issue May 5, 2022 · 73 comments · Fixed by #71901
Closed

SNMP Sensor #71368

lzzsalvo opened this issue May 5, 2022 · 73 comments · Fixed by #71901

Comments

@lzzsalvo
Copy link

lzzsalvo commented May 5, 2022

The problem

Hello,
with the Core 2022.5 version I'm having problems with sensors on the snmp platform.
Entities are not generated and I cannot view their status. With version 2022.4.7 everything works fine.
I state that I used the same configuration and same yaml
Below is an example of a sensor:

  • platform: snmp
    name: "Port1"
    host: 192.168.0.10
    community: #######
    baseoid: .1.3.6.1.2.1.2.2.1.8.1
    accept_errors: true
    default_value: 2

  • platform: snmp
    name: "Port2"
    host: 192.168.0.10
    community: #######
    baseoid: .1.3.6.1.2.1.2.2.1.8.2
    accept_errors: true
    default_value: 2

  • platform: snmp
    name: "Port3"
    host: 192.168.0.10
    community: #######
    baseoid: .1.3.6.1.2.1.2.2.1.8.3
    accept_errors: true
    default_value: 2

What version of Home Assistant Core has the issue?

2022.5.0

What was the last working version of Home Assistant Core?

2022.4.7

What type of installation are you running?

Home Assistant OS

Integration causing the issue

No response

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

@probot-home-assistant
Copy link

snmp documentation
snmp source
(message by IssueLinks)

@supersebbo
Copy link

I am also having this issue.

@supersebbo
Copy link

Logger: homeassistant.components.sensor
Source: helpers/entity_platform.py:297
Integration: Sensor (documentation, issues)
First occurred: 00:50:57 (2 occurrences)
Last logged: 00:50:57

Setup of platform snmp is taking longer than 60 seconds. Startup will proceed without waiting any longer.

@supersebbo
Copy link

@bieniu Looks like your PR to change from pysnmp to pysnmplib might have caused this. Did you test with any SNMP sensor entities?

@claymen
Copy link

claymen commented May 6, 2022

Seeing the same issues here after upgrading to 2022.5, logs are flooded with the following, and not getting any SNMP data. It will work for a few polls after a restart but then fails. Running within a container setup.

2022-05-06 08:42:45 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-06 08:42:55 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-06 08:43:05 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-06 08:43:15 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10

Rolling back to 2022.4.x and it works instantly again.

As an example of the YAML code, have tested with and without the scan_interval set, and confirmed same L2 network segment, no firewall in between, and obviously that it works after rolling back to 2022.4.x

  - platform: snmp
    name: APC UPS Time Remaining
    host: x.x.x.x
    baseoid: 1.3.6.1.4.1.318.1.1.1.2.2.3.0
    #scan_interval: 10

@bieniu
Copy link
Member

bieniu commented May 6, 2022

Did you test with any SNMP sensor entities?

Of course, the change was tested on Python 3.9 and 3.10 with sensors from my printer. I tested it again this morning and have no warnings.

Add this to your configuration.yaml file, restart HA and publish the log here when there are warnings in the log:

logger:
  default: warning
  logs:
    homeassistant.components.snmp: debug
    pysnmp: debug

@claymen
Copy link

claymen commented May 6, 2022

Added those debug options and here is the full log after restarting, still 2022.5, will pull 2022.5.1 shortly.

2022-05-06 15:35:05 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration xiaomi_cloud_map_extractor which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-05-06 15:35:05 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration nodered which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-05-06 15:35:05 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration huawei_solar which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-05-06 15:35:05 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-05-06 15:35:05 WARNING (SyncWorker_3) [homeassistant.loader] We found a custom integration bureau_of_meteorology which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-05-06 15:35:05 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration dwains_dashboard which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-05-06 15:35:05 WARNING (SyncWorker_4) [homeassistant.loader] We found a custom integration garbage_collection which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-05-06 15:35:06 WARNING (MainThread) [homeassistant.components.sensor] Configuration of the Tautulli platform in YAML is deprecated and will be removed in Home Assistant 2022.6; Your existing configuration for host x.x.x.x has been imported into the UI automatically and can be safely removed from your configuration.yaml file
2022-05-06 15:35:15 WARNING (MainThread) [homeassistant.components.sensor] Setup of sensor platform snmp is taking over 10 seconds.
2022-05-06 15:35:15 WARNING (MainThread) [homeassistant.components.sensor] Setup of sensor platform snmp is taking over 10 seconds.
2022-05-06 15:35:15 WARNING (MainThread) [homeassistant.components.sensor] Setup of sensor platform snmp is taking over 10 seconds.
2022-05-06 15:35:16 WARNING (MainThread) [homeassistant.helpers.entity] Update of camera.xiaomi_cloud_map_extractor is taking over 10 seconds
2022-05-06 15:36:05 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: sensor.snmp_10, sensor.snmp_12, sensor.snmp_13
2022-05-06 15:36:05 ERROR (MainThread) [homeassistant.components.sensor] Setup of platform snmp is taking longer than 60 seconds. Startup will proceed without waiting any longer.
2022-05-06 15:36:05 ERROR (MainThread) [homeassistant.components.sensor] Setup of platform snmp is taking longer than 60 seconds. Startup will proceed without waiting any longer.
2022-05-06 15:36:05 ERROR (MainThread) [homeassistant.components.sensor] Setup of platform snmp is taking longer than 60 seconds. Startup will proceed without waiting any longer.
2022-05-06 15:36:06 ERROR (SyncWorker_3) [root] Uncaught exception
RuntimeError: module compiled against API version 0xf but this version of numpy is 0xe
2022-05-06 15:37:46 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-06 15:37:46 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.apc_ups_output_voltage is taking over 10 seconds
2022-05-06 15:37:46 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.apc_ups_output_active_power is taking over 10 seconds
2022-05-06 15:37:56 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-06 15:38:06 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-06 15:38:16 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-06 15:38:26 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-06 15:38:36 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-06 15:38:46 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-06 15:38:56 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-06 15:39:06 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-06 15:39:16 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-06 15:39:26 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-06 15:39:36 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-06 15:39:46 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-06 15:39:56 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-06 15:40:06 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-06 15:40:10 WARNING (Recorder) [homeassistant.components.sensor.recorder] sensor.grid_reactive_power has unit var which is unsupported for device_class power
2022-05-06 15:40:10 WARNING (Recorder) [homeassistant.components.sensor.recorder] sensor.grid_reactive_power_2 has unit kVarh which is unsupported for device_class energy
2022-05-06 15:40:16 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-06 15:40:26 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-06 15:40:36 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-06 15:40:46 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-06 15:40:56 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-06 15:41:06 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-06 15:41:16 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-06 15:41:26 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-06 15:41:36 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-06 15:41:46 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-06 15:41:56 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-06 15:42:06 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-06 15:42:16 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-06 15:42:26 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10

This is my full SNMP config

  # APC UPS SNMP
  - platform: snmp
    name: APC UPS Time Remaining
    host: x.x.x.x
    baseoid: 1.3.6.1.4.1.318.1.1.1.2.2.3.0
    #scan_interval: 10

  - platform: snmp
    name: APC UPS State of Charge
    host: x.x.x.x
    baseoid: 1.3.6.1.4.1.318.1.1.1.2.2.1.0
    #scan_interval: 10
    unit_of_measurement: "%"

  - platform: snmp
    name: APC UPS Battery Voltage
    host: x.x.x.x
    baseoid: 1.3.6.1.4.1.318.1.1.1.2.2.8.0
    #scan_interval: 10
    unit_of_measurement: V

  - platform: snmp
    name: APC UPS Battery Temperature
    host: x.x.x.x
    baseoid: 1.3.6.1.4.1.318.1.1.1.2.2.2.0
    #scan_interval: 10
    unit_of_measurement: °C
    
  - platform: snmp
    name: APC UPS Input Voltage
    host: x.x.x.x
    baseoid: 1.3.6.1.4.1.318.1.1.1.3.2.1.0
    #scan_interval: 10
    unit_of_measurement: V

  - platform: snmp
    name: APC UPS Input Frequency
    host: x.x.x.x
    baseoid: 1.3.6.1.4.1.318.1.1.1.3.2.4.0
    #scan_interval: 10
    unit_of_measurement: Hz

  - platform: snmp
    name: APC UPS Output Load
    host: x.x.x.x
    baseoid: 1.3.6.1.4.1.318.1.1.1.4.2.3.0
    #scan_interval: 10
    unit_of_measurement: "%"

  - platform: snmp
    name: APC UPS Output Apparent Power
    host: x.x.x.x
    baseoid: 1.3.6.1.4.1.318.1.1.1.4.2.9.0
    #scan_interval: 10
    unit_of_measurement: VA

  - platform: snmp
    name: APC UPS Output Active Power
    host: x.x.x.x
    baseoid: 1.3.6.1.4.1.318.1.1.1.4.2.8.0
    #scan_interval: 10
    unit_of_measurement: W

  - platform: snmp
    name: APC UPS Output Current
    host: x.x.x.x
    baseoid: 1.3.6.1.4.1.318.1.1.1.4.2.4.0
    #scan_interval: 10
    unit_of_measurement: A

  - platform: snmp
    name: APC UPS Output Voltage
    host: x.x.x.x
    baseoid: 1.3.6.1.4.1.318.1.1.1.4.2.1.0
    #scan_interval: 10
    unit_of_measurement: V

  - platform: snmp
    name: APC UPS Output Frequency
    host: x.x.x.x
    baseoid: 1.3.6.1.4.1.318.1.1.1.4.2.2.0
    #scan_interval: 10
    unit_of_measurement: Hz

  - platform: snmp
    name: APC UPS Output Energy Usage
    host: x.x.x.x
    baseoid: 1.3.6.1.4.1.318.1.1.1.4.3.6.0
    #scan_interval: 10
    unit_of_measurement: kWh
    value_template: "{{((value | int) / 100) | round(2) }}"

@claymen
Copy link

claymen commented May 6, 2022

Same thing under 2022.5.1, which makes sense as none of this was really changed. For reference the system it's running on is an Intel i7-12700, 64GB of RAM, and a NVMe SSD.

@claymen
Copy link

claymen commented May 6, 2022

I flipped debug on for everything and filtered for "snmp"

2022-05-06 16:19:06 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'huawei_solar': 4.214174, 'xiaomi_miio': 4.033029, 'sensor.snmp_5': 3.842808, 'sensor.snmp_9': 3.842665, 'sensor.snmp_10': 3.842632, 'sensor.snmp_11': 3.842599}
2022-05-06 16:19:07 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'huawei_solar': 5.214868, 'xiaomi_miio': 5.033723, 'sensor.snmp_5': 4.843502, 'sensor.snmp_9': 4.843359, 'sensor.snmp_10': 4.843326, 'sensor.snmp_11': 4.843293}
2022-05-06 16:19:08 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'huawei_solar': 6.216574, 'xiaomi_miio': 6.035429, 'sensor.snmp_5': 5.845208, 'sensor.snmp_9': 5.845065, 'sensor.snmp_10': 5.845032, 'sensor.snmp_11': 5.844999}
2022-05-06 16:19:09 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'huawei_solar': 7.217221, 'xiaomi_miio': 7.036076, 'sensor.snmp_5': 6.845855, 'sensor.snmp_9': 6.845712, 'sensor.snmp_10': 6.845679, 'sensor.snmp_11': 6.845646}
2022-05-06 16:19:10 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'huawei_solar': 8.218144, 'xiaomi_miio': 8.036999, 'sensor.snmp_5': 7.846778, 'sensor.snmp_9': 7.846635, 'sensor.snmp_10': 7.846602, 'sensor.snmp_11': 7.846569}
2022-05-06 16:19:11 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'huawei_solar': 9.219402, 'xiaomi_miio': 9.038257, 'sensor.snmp_5': 8.848036, 'sensor.snmp_9': 8.847893, 'sensor.snmp_10': 8.84786, 'sensor.snmp_11': 8.847827}
2022-05-06 16:19:12 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'huawei_solar': 10.220597, 'xiaomi_miio': 10.039452, 'sensor.snmp_5': 9.849231, 'sensor.snmp_9': 9.849088, 'sensor.snmp_10': 9.849055, 'sensor.snmp_11': 9.849022}
2022-05-06 16:19:12 WARNING (MainThread) [homeassistant.components.sensor] Setup of sensor platform snmp is taking over 10 seconds.
2022-05-06 16:19:12 WARNING (MainThread) [homeassistant.components.sensor] Setup of sensor platform snmp is taking over 10 seconds.
2022-05-06 16:19:12 WARNING (MainThread) [homeassistant.components.sensor] Setup of sensor platform snmp is taking over 10 seconds.
2022-05-06 16:19:12 WARNING (MainThread) [homeassistant.components.sensor] Setup of sensor platform snmp is taking over 10 seconds.
2022-05-06 16:19:13 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 10.849741, 'sensor.snmp_9': 10.849598, 'sensor.snmp_10': 10.849565, 'sensor.snmp_11': 10.849532, 'sensor.huawei_solar': 0.158878}
2022-05-06 16:19:14 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 11.850282, 'sensor.snmp_9': 11.850139, 'sensor.snmp_10': 11.850106, 'sensor.snmp_11': 11.850073, 'sensor.huawei_solar': 1.159419}
2022-05-06 16:19:15 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 12.851895, 'sensor.snmp_9': 12.851752, 'sensor.snmp_10': 12.851719, 'sensor.snmp_11': 12.851686, 'sensor.huawei_solar': 2.161032}
2022-05-06 16:19:16 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 13.853415, 'sensor.snmp_9': 13.853272, 'sensor.snmp_10': 13.853239, 'sensor.snmp_11': 13.853206, 'sensor.huawei_solar': 3.162552}
2022-05-06 16:19:17 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 14.854266, 'sensor.snmp_9': 14.854123, 'sensor.snmp_10': 14.85409, 'sensor.snmp_11': 14.854057}
2022-05-06 16:19:18 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 15.857677, 'sensor.snmp_9': 15.857534, 'sensor.snmp_10': 15.857501, 'sensor.snmp_11': 15.857468}
2022-05-06 16:19:19 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 16.858288, 'sensor.snmp_9': 16.858145, 'sensor.snmp_10': 16.858112, 'sensor.snmp_11': 16.858079}
2022-05-06 16:19:20 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 17.85975, 'sensor.snmp_9': 17.859607, 'sensor.snmp_10': 17.859574, 'sensor.snmp_11': 17.859541}
2022-05-06 16:19:21 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 18.860841, 'sensor.snmp_9': 18.860698, 'sensor.snmp_10': 18.860665, 'sensor.snmp_11': 18.860632}
2022-05-06 16:19:22 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 19.862232, 'sensor.snmp_9': 19.862089, 'sensor.snmp_10': 19.862056, 'sensor.snmp_11': 19.862023}
2022-05-06 16:19:23 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 20.864847, 'sensor.snmp_9': 20.864704, 'sensor.snmp_10': 20.864671, 'sensor.snmp_11': 20.864638}
2022-05-06 16:19:24 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 21.86656, 'sensor.snmp_9': 21.866417, 'sensor.snmp_10': 21.866384, 'sensor.snmp_11': 21.866351}
2022-05-06 16:19:25 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 22.867817, 'sensor.snmp_9': 22.867674, 'sensor.snmp_10': 22.867641, 'sensor.snmp_11': 22.867608}
2022-05-06 16:19:26 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 23.868937, 'sensor.snmp_9': 23.868794, 'sensor.snmp_10': 23.868761, 'sensor.snmp_11': 23.868728}
2022-05-06 16:19:27 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 24.870424, 'sensor.snmp_9': 24.870281, 'sensor.snmp_10': 24.870248, 'sensor.snmp_11': 24.870215}
2022-05-06 16:19:28 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 25.873783, 'sensor.snmp_9': 25.87364, 'sensor.snmp_10': 25.873607, 'sensor.snmp_11': 25.873574}
2022-05-06 16:19:29 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 26.875091, 'sensor.snmp_9': 26.874948, 'sensor.snmp_10': 26.874915, 'sensor.snmp_11': 26.874882}
2022-05-06 16:19:30 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 27.876333, 'sensor.snmp_9': 27.87619, 'sensor.snmp_10': 27.876157, 'sensor.snmp_11': 27.876124}
2022-05-06 16:19:31 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 28.878335, 'sensor.snmp_9': 28.878192, 'sensor.snmp_10': 28.878159, 'sensor.snmp_11': 28.878126}
2022-05-06 16:19:32 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 29.880512, 'sensor.snmp_9': 29.880369, 'sensor.snmp_10': 29.880336, 'sensor.snmp_11': 29.880303}
2022-05-06 16:19:33 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 30.885037, 'sensor.snmp_9': 30.884894, 'sensor.snmp_10': 30.884861, 'sensor.snmp_11': 30.884828}
2022-05-06 16:19:33 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-06 16:19:34 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 31.886591, 'sensor.snmp_9': 31.886448, 'sensor.snmp_10': 31.886415, 'sensor.snmp_11': 31.886382}
2022-05-06 16:19:35 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 32.888177, 'sensor.snmp_9': 32.888034, 'sensor.snmp_10': 32.888001, 'sensor.snmp_11': 32.887968}
2022-05-06 16:19:36 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 33.890134, 'sensor.snmp_9': 33.889991, 'sensor.snmp_10': 33.889958, 'sensor.snmp_11': 33.889925}
2022-05-06 16:19:37 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 34.891858, 'sensor.snmp_9': 34.891715, 'sensor.snmp_10': 34.891682, 'sensor.snmp_11': 34.891649}
2022-05-06 16:19:38 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 35.894811, 'sensor.snmp_9': 35.894668, 'sensor.snmp_10': 35.894635, 'sensor.snmp_11': 35.894602}
2022-05-06 16:19:39 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 36.896484, 'sensor.snmp_9': 36.896341, 'sensor.snmp_10': 36.896308, 'sensor.snmp_11': 36.896275}
2022-05-06 16:19:40 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 37.897801, 'sensor.snmp_9': 37.897658, 'sensor.snmp_10': 37.897625, 'sensor.snmp_11': 37.897592}
2022-05-06 16:19:41 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 38.899037, 'sensor.snmp_9': 38.898894, 'sensor.snmp_10': 38.898861, 'sensor.snmp_11': 38.898828}
2022-05-06 16:19:42 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 39.900863, 'sensor.snmp_9': 39.90072, 'sensor.snmp_10': 39.900687, 'sensor.snmp_11': 39.900654}
2022-05-06 16:19:43 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 40.901325, 'sensor.snmp_9': 40.901182, 'sensor.snmp_10': 40.901149, 'sensor.snmp_11': 40.901116}
2022-05-06 16:19:43 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-06 16:19:44 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 41.902921, 'sensor.snmp_9': 41.902778, 'sensor.snmp_10': 41.902745, 'sensor.snmp_11': 41.902712}
2022-05-06 16:19:45 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 42.904393, 'sensor.snmp_9': 42.90425, 'sensor.snmp_10': 42.904217, 'sensor.snmp_11': 42.904184}
2022-05-06 16:19:46 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 43.90633, 'sensor.snmp_9': 43.906187, 'sensor.snmp_10': 43.906154, 'sensor.snmp_11': 43.906121}
2022-05-06 16:19:47 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 44.908836, 'sensor.snmp_9': 44.908693, 'sensor.snmp_10': 44.90866, 'sensor.snmp_11': 44.908627}
2022-05-06 16:19:48 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 45.909739, 'sensor.snmp_9': 45.909596, 'sensor.snmp_10': 45.909563, 'sensor.snmp_11': 45.90953}
2022-05-06 16:19:49 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 46.911169, 'sensor.snmp_9': 46.911026, 'sensor.snmp_10': 46.910993, 'sensor.snmp_11': 46.91096}
2022-05-06 16:19:50 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 47.912479, 'sensor.snmp_9': 47.912336, 'sensor.snmp_10': 47.912303, 'sensor.snmp_11': 47.91227}
2022-05-06 16:19:51 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 48.913778, 'sensor.snmp_9': 48.913635, 'sensor.snmp_10': 48.913602, 'sensor.snmp_11': 48.913569}
2022-05-06 16:19:52 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 49.914779, 'sensor.snmp_9': 49.914636, 'sensor.snmp_10': 49.914603, 'sensor.snmp_11': 49.91457}
2022-05-06 16:19:53 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 50.915963, 'sensor.snmp_9': 50.91582, 'sensor.snmp_10': 50.915787, 'sensor.snmp_11': 50.915754}
2022-05-06 16:19:53 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-06 16:19:54 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 51.91709, 'sensor.snmp_9': 51.916947, 'sensor.snmp_10': 51.916914, 'sensor.snmp_11': 51.916881}
2022-05-06 16:19:55 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 52.918181, 'sensor.snmp_9': 52.918038, 'sensor.snmp_10': 52.918005, 'sensor.snmp_11': 52.917972}
2022-05-06 16:19:56 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 53.919351, 'sensor.snmp_9': 53.919208, 'sensor.snmp_10': 53.919175, 'sensor.snmp_11': 53.919142}
2022-05-06 16:19:57 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 54.920439, 'sensor.snmp_9': 54.920296, 'sensor.snmp_10': 54.920263, 'sensor.snmp_11': 54.92023}
2022-05-06 16:19:58 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 55.921801, 'sensor.snmp_9': 55.921658, 'sensor.snmp_10': 55.921625, 'sensor.snmp_11': 55.921592}
2022-05-06 16:19:59 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 56.923444, 'sensor.snmp_9': 56.923301, 'sensor.snmp_10': 56.923268, 'sensor.snmp_11': 56.923235}
2022-05-06 16:20:00 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 57.924607, 'sensor.snmp_9': 57.924464, 'sensor.snmp_10': 57.924431, 'sensor.snmp_11': 57.924398}
2022-05-06 16:20:01 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 58.926943, 'sensor.snmp_9': 58.9268, 'sensor.snmp_10': 58.926767, 'sensor.snmp_11': 58.926734}
2022-05-06 16:20:02 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: sensor.snmp_5, sensor.snmp_9, sensor.snmp_10, sensor.snmp_11
2022-05-06 16:20:02 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: {'sensor.snmp_5': 59.928185, 'sensor.snmp_9': 59.928042, 'sensor.snmp_10': 59.928009, 'sensor.snmp_11': 59.927976}
2022-05-06 16:20:02 ERROR (MainThread) [homeassistant.components.sensor] Setup of platform snmp is taking longer than 60 seconds. Startup will proceed without waiting any longer.
2022-05-06 16:20:02 ERROR (MainThread) [homeassistant.components.sensor] Setup of platform snmp is taking longer than 60 seconds. Startup will proceed without waiting any longer.
2022-05-06 16:20:02 ERROR (MainThread) [homeassistant.components.sensor] Setup of platform snmp is taking longer than 60 seconds. Startup will proceed without waiting any longer.
2022-05-06 16:20:02 ERROR (MainThread) [homeassistant.components.sensor] Setup of platform snmp is taking longer than 60 seconds. Startup will proceed without waiting any longer.
2022-05-06 16:20:03 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-06 16:20:13 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-06 16:20:23 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-06 16:20:33 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-06 16:20:43 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-06 16:20:53 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-06 16:21:02 DEBUG (MainThread) [homeassistant.core] Waited 60 seconds for task: <Task pending name='Task-5633' coro=<SnmpSensor.async_update() running at /usr/src/homeassistant/homeassistant/components/snmp/sensor.py:180> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7f054ed14b80>()]> cb=[<TaskWakeupMethWrapper object at 0x7f054c93bac0>()]>
2022-05-06 16:21:03 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-06 16:21:13 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-06 16:21:23 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-06 16:21:33 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-06 16:21:43 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-06 16:21:53 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-06 16:22:02 DEBUG (MainThread) [homeassistant.core] Waited 120 seconds for task: <Task pending name='Task-5633' coro=<SnmpSensor.async_update() running at /usr/src/homeassistant/homeassistant/components/snmp/sensor.py:180> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7f054ed14b80>()]> cb=[<TaskWakeupMethWrapper object at 0x7f054c93bac0>()]>
2022-05-06 16:22:03 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-06 16:22:13 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10

@jeremysherriff
Copy link

Assuming you used grep to filter, try adding -C 2 to the grep command to add 2 lines of "context" before and after every match - it might expose some additional errors, especially when it comes to python exceptions.

Your log will be quite large with that additional context, so consider pastebin or trimming your log entries to just things that look interesting, rather than dozens of the same messages repeated.

@claymen
Copy link

claymen commented May 6, 2022

Assuming you used grep to filter, try adding -C 2 to the grep command to add 2 lines of "context" before and after every match - it might expose some additional errors, especially when it comes to python exceptions.

Your log will be quite large with that additional context, so consider pastebin or trimming your log entries to just things that look interesting, rather than dozens of the same messages repeated.

Nah just a simple snmp filter on the log output from portainer as I was remote, and mainly enabling debug on everything as above with the snmp component didn't really seem to show anything additional. Having a look with -C2 and full debug is still very very noisy given all the other devices (lots of MQTT, and UPNP being picked up on).

@jeremysherriff
Copy link

Understood.

I find it weird that there are no significant error messages - feels like maybe the debug log level isn't respected by pysnmp/pysnmplib given that there's no messages recorded from that source component.

@claymen
Copy link

claymen commented May 6, 2022

I find it weird that there are no significant error messages - feels like maybe the debug log level isn't respected by pysnmp/pysnmplib given that there's no messages recorded from that source component.

Yeah that's the same point I reached, it seemed weird that it didn't respect the debug, or didn't really give me much more that made sense. If anyone can come up with another way to pull more detailed logs of the SNMP component, happy to grab more info.

@supersebbo
Copy link

Having given it 24 hours it does seem to be intermittent. Can't rule out something on the network side at the moment. Will keep monitoring.

@claymen
Copy link

claymen commented May 6, 2022

Having given it 24 hours it does seem to be intermittent. Can't rule out something on the network side at the moment. Will keep monitoring.

It's definitely intermittent, but hasn't improved giving it time overnight. It also seems to change which SNMP sensors are working/broken every restart. So it may be something to do with the number of SNMP sensors, and why it worked during testing?
image

@lzzsalvo
Copy link
Author

lzzsalvo commented May 7, 2022

I just installed Core version 2022.5.2 and the problem is still present.

@lord-drinkalot
Copy link

lord-drinkalot commented May 7, 2022

I too have the same issues. SNMP Integration Startuptime is always somewhere beetween 200 and 600 Seconds and a lot of warnings with the polling.

2022-05-07 10:51:04 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-07 10:51:14 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-07 10:51:21 WARNING (MainThread) [homeassistant.components.switch] Updating snmp switch took longer than the scheduled update interval 0:00:30
2022-05-07 10:51:24 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-07 10:51:34 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-07 10:51:44 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-07 10:51:51 WARNING (MainThread) [homeassistant.components.switch] Updating snmp switch took longer than the scheduled update interval 0:00:30
2022-05-07 10:51:54 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-07 10:52:04 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-07 10:52:14 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-07 10:52:21 WARNING (MainThread) [homeassistant.components.switch] Updating snmp switch took longer than the scheduled update interval 0:00:30
2022-05-07 10:52:24 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-07 10:52:34 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-07 10:52:44 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-07 10:52:51 WARNING (MainThread) [homeassistant.components.switch] Updating snmp switch took longer than the scheduled update interval 0:00:30

edit:
Additionally, for me not just sensors with that behaviour, also SNMP Switches:
image

@galak
Copy link
Contributor

galak commented May 7, 2022

Seeing this as well with Core 2022.5.2

@shuixinxing
Copy link

Core 2022.5.2, these error logs are output at startup

2022-05-08 10:59:39 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/pysnmp/carrier/asyncio/dispatch.py", line 56, in handle_timeout
yield asyncio.From(asyncio.sleep(self.getTimerResolution()))
AttributeError: module 'asyncio' has no attribute 'From'
2022-05-08 10:59:58 WARNING (MainThread) [homeassistant.components.sensor] Setup of sensor platform snmp is taking over 10 seconds
2022-05-08 11:00:56 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: switch.snmp
2022-05-08 11:08:07 WARNING (MainThread) [homeassistant.components.switch] Timed out adding entities for domain switch with platform s nmp after 500s

@WillCodeForCats
Copy link
Contributor

SNMP also broken here in core 2022.5.2; nothing beyond this in logs even with debug set for pysnmp and snmp component.

2022-05-07 23:39:16 WARNING (MainThread) [homeassistant.components.sensor] Setup of sensor platform snmp is taking over 10 seconds.
2022-05-07 23:39:16 WARNING (MainThread) [homeassistant.components.sensor] Setup of sensor platform snmp is taking over 10 seconds.
2022-05-07 23:39:16 WARNING (MainThread) [homeassistant.components.sensor] Setup of sensor platform snmp is taking over 10 seconds.
2022-05-07 23:40:03 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: sensor.snmp_9, sensor.snmp_10, sensor.snmp_11
2022-05-07 23:40:06 ERROR (MainThread) [homeassistant.components.sensor] Setup of platform snmp is taking longer than 60 seconds. Startup will proceed without waiting any longer.
2022-05-07 23:40:06 ERROR (MainThread) [homeassistant.components.sensor] Setup of platform snmp is taking longer than 60 seconds. Startup will proceed without waiting any longer.
2022-05-07 23:40:06 ERROR (MainThread) [homeassistant.components.sensor] Setup of platform snmp is taking longer than 60 seconds. Startup will proceed without waiting any longer.

Worked fine before, now doesn't. No config changes between versions.

@WillCodeForCats
Copy link
Contributor

Just to see what would happen, I started removing SNMP sensors and it magically started working when I had only 8 SNMP sensors configured. Adding a 9th caused it to break again. So the magic number seems to be no more than 8 SNMP sensors. 9 sensors breaks it.

@WillCodeForCats
Copy link
Contributor

@claymen

Can you try removing all but 8 of your SNMP sensors and see if you get the same results I had?

@jeremysherriff
Copy link

Might be a race condition rather than a (hard) limit, so dependant on what other integrations are installed and the performance of the hardware running HA, people's experiences may vary from that magic #8. Just something to keep in mind.

I've been putting off upgrading to 2022.5.x until this got sorted but as I only have 2 SNMP sensors it now sounds like I'm unlikely to be affected.

@claymen
Copy link

claymen commented May 8, 2022

@claymen

Can you try removing all but 8 of your SNMP sensors and see if you get the same results I had?

For me it seemed to be 10, once I went past 9 it seemed to get unhappy again and you'd see delays on startup. This aligns with what I was seeing earlier, that sometimes after restarting the container I'd be missing a random set of SNMP sensors, then another restart and it would be a different set that were missing. At least this gets my energy monitors back for now, the other data is nice to have, but still a regression over 2022.4.x

@AndreFjeld
Copy link

AndreFjeld commented May 8, 2022

Having the same issue.

Running: Home Assistant Core 2022.5.2

Getting flooded in the log with:
2022-05-08 11:08:42 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-08 11:08:47 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:30
2022-05-08 11:08:52 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-08 11:09:02 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-08 11:09:12 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-08 11:09:17 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:30
2022-05-08 11:09:22 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-08 11:09:32 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-08 11:09:42 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10
2022-05-08 11:09:47 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:30
2022-05-08 11:09:52 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:10

Sometimes sensors dissapear when rebooting and after a few hours running, sensors stops updating.
image

Reboots gets the sensors back to updating and then freezes after another few hours again.
The sensor history above is my router uptime, and it gets updates usally every minute, but as you se above. It stops regulary.

Seems like the updated SNMP integration are overloading it self. I have around 13 sensors, and they where running fine on Hassio Core 2022.4.7. Now they fail constantly.

@bieniu
Copy link
Member

bieniu commented May 8, 2022

I think I fixed the problem. Please test this as a custom component.

If you're using brother integration you should remove it during snmp testing.

@AndreFjeld
Copy link

Running your fix as a custom component fixed the Log flooding.
Will let i run for a few hours and se that its stable before I confirm that its working.

@jansemrad
Copy link

I was testing the fix for 17 hours on about 30 sensors and everything seems to be OK.

@lzzsalvo
Copy link
Author

lzzsalvo commented May 9, 2022

Hi,
I'm testing your fix on HA Core 2022.5.3 with 78 sensors. At the moment everything seems ok. Thanks

@AbeltjeNL
Copy link

AbeltjeNL commented May 11, 2022

@bieniu, your fix (custom_component) seems to be working on my side.

This fix definitely fixes the issues on my side. Nice work!

@lzzsalvo
Copy link
Author

Hi @AbeltjeNL ,
for the fix we must thank @bieniu . I only noticed the issue and reported it here.
Thanks to you for the positive feedback

@AbeltjeNL
Copy link

Hi @AbeltjeNL ,

for the fix we must thank @bieniu . I only noticed the issue and reported it here.

Thanks to you for the positive feedback

Wauw, that's awkward. Changed it, thanks!

@AbeltjeNL
Copy link

AbeltjeNL commented May 11, 2022

@bieniu, i was to optimistic:
[homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:01:00>

First occurred: 21:17:02 (52 occurrences) Last logged: 22:08:03

@claymen
Copy link

claymen commented May 12, 2022

@bieniu, i was to optimistic: [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:01:00>

First occurred: 21:17:02 (52 occurrences) Last logged: 22:08:03

How many SNMP sensors/switches do you have configured?

@bameijer
Copy link

bameijer commented May 12, 2022

Same problem here. I've a total of 53 snmp sensors (on 3 devices), running HA on a i3-6100T CPU @ 3.20GHz and no Brother integration.
Also tried the "accept_errors: true" and the "scan_interval: 60" but it didn't help.
Average Core CPU usage is below 5%. (currently 1.2%)

On 2022.4.7 it is all working fine, but with the 2022.5.x versions I get the same errors as mentioned above.

@bieniu
Copy link
Member

bieniu commented May 12, 2022

Those who still have warnings with the custom component, can you check the pysnmplib/pysnmp version?

pip list | grep pysnmp

And uninstall old pysnmp, pysmi, pyasn1 packages and restart HA?

pip uninstall pysnmp pysmi pyasn1

I think this is only possible if you're using HA on core or supervised installation.

@claymen
Copy link

claymen commented May 12, 2022

This is what it looks like inside the container
image

Technically you can run the uninstall
image

But boy is it unhappy

ModuleNotFoundError: No module named 'pysnmp'
2022-05-12 16:01:12 ERROR (MainThread) [homeassistant.config] Platform error: sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config.py", line 877, in async_process_component_config
    platform = p_integration.get_platform(domain)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 603, in get_platform
    cache[full_name] = self._import_platform(platform_name)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 620, in _import_platform
    return importlib.import_module(f"{self.pkg_path}.{platform_name}")
  File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/config/custom_components/snmp/sensor.py", line 7, in <module>
    import pysnmp.hlapi.asyncio as hlapi
ModuleNotFoundError: No module named 'pysnmp'
2022-05-12 16:01:12 ERROR (MainThread) [homeassistant.config] Platform error: sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config.py", line 877, in async_process_component_config
    platform = p_integration.get_platform(domain)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 603, in get_platform
    cache[full_name] = self._import_platform(platform_name)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 620, in _import_platform
    return importlib.import_module(f"{self.pkg_path}.{platform_name}")
  File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/config/custom_components/snmp/sensor.py", line 7, in <module>
    import pysnmp.hlapi.asyncio as hlapi
ModuleNotFoundError: No module named 'pysnmp'
2022-05-12 16:01:12 ERROR (MainThread) [homeassistant.config] Platform error: sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config.py", line 877, in async_process_component_config
    platform = p_integration.get_platform(domain)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 603, in get_platform
    cache[full_name] = self._import_platform(platform_name)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 620, in _import_platform
    return importlib.import_module(f"{self.pkg_path}.{platform_name}")
  File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/config/custom_components/snmp/sensor.py", line 7, in <module>
    import pysnmp.hlapi.asyncio as hlapi
ModuleNotFoundError: No module named 'pysnmp'
2022-05-12 16:01:12 ERROR (MainThread) [homeassistant.config] Platform error: sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config.py", line 877, in async_process_component_config
    platform = p_integration.get_platform(domain)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 603, in get_platform
    cache[full_name] = self._import_platform(platform_name)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 620, in _import_platform
    return importlib.import_module(f"{self.pkg_path}.{platform_name}")
  File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/config/custom_components/snmp/sensor.py", line 7, in <module>
    import pysnmp.hlapi.asyncio as hlapi
ModuleNotFoundError: No module named 'pysnmp'
2022-05-12 16:01:12 ERROR (MainThread) [homeassistant.config] Platform error: sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config.py", line 877, in async_process_component_config
    platform = p_integration.get_platform(domain)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 603, in get_platform
    cache[full_name] = self._import_platform(platform_name)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 620, in _import_platform
    return importlib.import_module(f"{self.pkg_path}.{platform_name}")
  File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/config/custom_components/snmp/sensor.py", line 7, in <module>
    import pysnmp.hlapi.asyncio as hlapi
ModuleNotFoundError: No module named 'pysnmp'

@lzzsalvo
Copy link
Author

Those who still have warnings with the custom component, can you check the pysnmplib/pysnmp version?

pip list | grep pysnmp

And uninstall old pysnmp, pysmi, pyasn1 packages and restart HA?

pip uninstall pysnmp pysmi pyasn1

I think this is only possible if you're using HA on core or supervised installation.

Hi everyone,
I have two instances of Home Assistant OS, the first runs on Proxmox and is the one I use every day, the second runs on the Synology NAS as a virtual machine. I run all the tests on the second instance and the fix works correctly. All snmp sensors are read and the integration seems to work. After testing for a day I tried to backup and restore in the first instance but the fix doesn't work. I necessarily restored to version 2022.4.7. I specify that in both instances I had the same versions of Core, OS and Supervisor (see attachment
ds
)

@bieniu
Copy link
Member

bieniu commented May 12, 2022

@claymen Please reinstall pysnmplib and restart HA

pip install --force-reinstall git+https://github.com/bieniu/pysnmp.git@fix-asyncio#pysnmplib==5.0.11

@AndreFjeld
Copy link

Running your fix as a custom component fixed the Log flooding. Will let i run for a few hours and se that its stable before I confirm that its working.

The fix worked for me :)

@claymen
Copy link

claymen commented May 13, 2022

@claymen Please reinstall pysnmplib and restart HA

pip install --force-reinstall git+https://github.com/bieniu/pysnmp.git@fix-asyncio#pysnmplib==5.0.11

Not sure this is going to work inside the container, throws a new set of errors. Am I right in thinking this is all related to simply being container based, as what I am doing isn't really what you should be doing to a container?

image
image

@jcsouthworth
Copy link

I have 12 sensors and 5 switches handled with SNMP. They were extremely unreliable on 2022.5.x. Similar logs to what others posted. I installed the custom component and the problem has not reoccurred. RPi4 running HAOS 7.6. Thanks for the help resolving this issue, at least for a portion of us.

@AbeltjeNL
Copy link

My installation running in VB doesn't like al the above (uninstall, install, reinstall). Sorry, can't test what you are suggesting.

@AbeltjeNL
Copy link

@claymen Please reinstall pysnmplib and restart HA


pip install --force-reinstall git+https://github.com/bieniu/pysnmp.git@fix-asyncio#pysnmplib==5.0.11

Totally missed this. Throws some red lines but does seem to fix the issue on my test machine. Just updated my main instance to 2022.5.4 and ran this line. Will keep you posted with my findings this weekend 👍🏻

@claymen
Copy link

claymen commented May 14, 2022

@claymen Please reinstall pysnmplib and restart HA


pip install --force-reinstall git+https://github.com/bieniu/pysnmp.git@fix-asyncio#pysnmplib==5.0.11

Totally missed this. Throws some red lines but does seem to fix the issue on my test machine. Just updated my main instance to 2022.5.4 and ran this line. Will keep you posted with my findings this weekend 👍🏻

What kind of install are you using though? Are you using a container install, or the HassOS/Supervised install?

@AbeltjeNL
Copy link

AbeltjeNL commented May 14, 2022

@claymen Please reinstall pysnmplib and restart HA

pip install --force-reinstall git+https://github.com/bieniu/pysnmp.git@fix-asyncio#pysnmplib==5.0.11

Totally missed this. Throws some red lines but does seem to fix the issue on my test machine. Just updated my main instance to 2022.5.4 and ran this line. Will keep you posted with my findings this weekend 👍🏻

What kind of install are you using though? Are you using a container install, or the HassOS/Supervised install?

OVA, VirtualBox.

@quadhammer
Copy link

I think I fixed the problem. Please test this as a custom component.

If you're using brother integration you should remove it during snmp testing.

the problem still exists for me using the custom component. This is what it says in the logs:


2022-05-14 17:05:56 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: sensor.snmp_4, sensor.snmp_5, sensor.snmp_11, sensor.snmp_12
2022-05-14 17:06:14 ERROR (MainThread) [homeassistant.components.sensor] Setup of platform snmp is taking longer than 60 seconds. Startup will proceed without waiting any longer.
2022-05-14 17:06:14 ERROR (MainThread) [homeassistant.components.sensor] Setup of platform snmp is taking longer than 60 seconds. Startup will proceed without waiting any longer.
2022-05-14 17:06:14 ERROR (MainThread) [homeassistant.components.sensor] Setup of platform snmp is taking longer than 60 seconds. Startup will proceed without waiting any longer.
2022-05-14 17:06:14 ERROR (MainThread) [homeassistant.components.sensor] Setup of platform snmp is taking longer than 60 seconds. Startup will proceed without waiting any longer.
[cont-finish.d] executing container finish scripts...
[cont-finish.d] done.
[s6-finish] waiting for services.
2022-05-14 17:13:00 ERROR (MainThread) [homeassistant.components.hassio.handler] Client error on /homeassistant/restart request Server disconnected
2022-05-14 17:13:00 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/pysnmp/carrier/asyncio/dispatch.py", line 56, in handle_timeout
    yield asyncio.From(asyncio.sleep(self.getTimerResolution()))
AttributeError: module 'asyncio' has no attribute 'From'
2022-05-14 17:13:00 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/pysnmp/carrier/asyncio/dispatch.py", line 56, in handle_timeout
    yield asyncio.From(asyncio.sleep(self.getTimerResolution()))
AttributeError: module 'asyncio' has no attribute 'From'
2022-05-14 17:13:00 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/pysnmp/carrier/asyncio/dispatch.py", line 56, in handle_timeout
    yield asyncio.From(asyncio.sleep(self.getTimerResolution()))
AttributeError: module 'asyncio' has no attribute 'From'
2022-05-14 17:13:00 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/pysnmp/carrier/asyncio/dispatch.py", line 56, in handle_timeout
    yield asyncio.From(asyncio.sleep(self.getTimerResolution()))
AttributeError: module 'asyncio' has no attribute 'From'
[finish] process exit code 0

@AbeltjeNL
Copy link

No joy:

Logger: homeassistant.components.sensor Source: helpers/entity_platform.py:724 Integration: Sensor (documentation, issues) First occurred: 11:32:18 (14 occurrences) Last logged: 11:45:18 Updating snmp sensor took longer than the scheduled update interval 0:01:00

@bieniu
Copy link
Member

bieniu commented May 14, 2022

AttributeError: module 'asyncio' has no attribute 'From'

This means you're not using pysnmplib with the fix.

@jcsouthworth
Copy link

I have 12 sensors and 5 switches handled with SNMP. They were extremely unreliable on 2022.5.x. Similar logs to what others posted. I installed the custom component and the problem has not reoccurred. RPi4 running HAOS 7.6. Thanks for the help resolving this issue, at least for a portion of us.

Correction - error returned after a couple of days of uptime

@AbeltjeNL
Copy link

@bieniu, is there something else we can test that can possibly fix this issue? :)

@Remboooo
Copy link

pip install --force-reinstall git+https://github.com/bieniu/pysnmp.git@fix-asyncio#pysnmplib==5.0.11

Just wanted to add that if you want to run this inside the HASS docker container, you first need to install alpine-sdk. Otherwise installing the pycryptodomex dependency will fail because it's missing gcc.

docker exec -it home-assistant bash
apk add alpine-sdk
pip install --force-reinstall git+https://github.com/bieniu/pysnmp.git@fix-asyncio#pysnmplib==5.0.11
exit

@ratsputin
Copy link

@claymen Please reinstall pysnmplib and restart HA

pip install --force-reinstall git+https://github.com/bieniu/pysnmp.git@fix-asyncio#pysnmplib==5.0.11

This fixed the issue for me as well. Core 2022.5.4.

@jeremysherriff
Copy link

2022.5.5 just released, which includes a revert to the PR that caused these issues.

@github-actions github-actions bot locked and limited conversation to collaborators Jun 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.