Bump brother library, use pysnmp-lextudio with SNMP integration (#105591)

This commit is contained in:
Maciej Bieniek 2023-12-12 22:36:11 +01:00 committed by GitHub
parent d144d6c9ab
commit 77283704a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 69 additions and 118 deletions

View file

@ -3,8 +3,9 @@ from __future__ import annotations
import binascii
import logging
import sys
from pysnmp.entity import config as cfg
from pysnmp.entity.rfc3413.oneliner import cmdgen
import voluptuous as vol
from homeassistant.components.device_tracker import (
@ -14,7 +15,6 @@ from homeassistant.components.device_tracker import (
)
from homeassistant.const import CONF_HOST
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.typing import ConfigType
@ -26,11 +26,6 @@ from .const import (
DEFAULT_COMMUNITY,
)
if sys.version_info < (3, 12):
from pysnmp.entity import config as cfg
from pysnmp.entity.rfc3413.oneliner import cmdgen
_LOGGER = logging.getLogger(__name__)
PLATFORM_SCHEMA = PARENT_PLATFORM_SCHEMA.extend(
@ -46,10 +41,6 @@ PLATFORM_SCHEMA = PARENT_PLATFORM_SCHEMA.extend(
def get_scanner(hass: HomeAssistant, config: ConfigType) -> SnmpScanner | None:
"""Validate the configuration and return an SNMP scanner."""
if sys.version_info >= (3, 12):
raise HomeAssistantError(
"SNMP is not supported on Python 3.12. Please use Python 3.11."
)
scanner = SnmpScanner(config[DOMAIN])
return scanner if scanner.success_init else None