mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Upgrade pysnmp to 4.3.3 (#5757)
This commit is contained in:
parent
573fc651dc
commit
91bebca0b6
@ -17,24 +17,24 @@ from homeassistant.components.device_tracker import (
|
|||||||
from homeassistant.const import CONF_HOST
|
from homeassistant.const import CONF_HOST
|
||||||
from homeassistant.util import Throttle
|
from homeassistant.util import Throttle
|
||||||
|
|
||||||
# Return cached results if last scan was less then this time ago.
|
|
||||||
MIN_TIME_BETWEEN_SCANS = timedelta(seconds=10)
|
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
REQUIREMENTS = ['pysnmp==4.3.2']
|
|
||||||
|
|
||||||
CONF_COMMUNITY = "community"
|
REQUIREMENTS = ['pysnmp==4.3.3']
|
||||||
CONF_AUTHKEY = "authkey"
|
|
||||||
CONF_PRIVKEY = "privkey"
|
|
||||||
CONF_BASEOID = "baseoid"
|
|
||||||
|
|
||||||
DEFAULT_COMMUNITY = "public"
|
CONF_COMMUNITY = 'community'
|
||||||
|
CONF_AUTHKEY = 'authkey'
|
||||||
|
CONF_PRIVKEY = 'privkey'
|
||||||
|
CONF_BASEOID = 'baseoid'
|
||||||
|
|
||||||
|
DEFAULT_COMMUNITY = 'public'
|
||||||
|
|
||||||
|
MIN_TIME_BETWEEN_SCANS = timedelta(seconds=10)
|
||||||
|
|
||||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
||||||
vol.Required(CONF_HOST): cv.string,
|
vol.Required(CONF_HOST): cv.string,
|
||||||
vol.Optional(CONF_COMMUNITY, default=DEFAULT_COMMUNITY): cv.string,
|
vol.Optional(CONF_COMMUNITY, default=DEFAULT_COMMUNITY): cv.string,
|
||||||
vol.Inclusive(CONF_AUTHKEY, "keys"): cv.string,
|
vol.Inclusive(CONF_AUTHKEY, 'keys'): cv.string,
|
||||||
vol.Inclusive(CONF_PRIVKEY, "keys"): cv.string,
|
vol.Inclusive(CONF_PRIVKEY, 'keys'): cv.string,
|
||||||
vol.Required(CONF_BASEOID): cv.string
|
vol.Required(CONF_BASEOID): cv.string
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -119,14 +119,14 @@ class SnmpScanner(DeviceScanner):
|
|||||||
return
|
return
|
||||||
# pylint: disable=no-member
|
# pylint: disable=no-member
|
||||||
if errstatus:
|
if errstatus:
|
||||||
_LOGGER.error('SNMP error: %s at %s', errstatus.prettyPrint(),
|
_LOGGER.error("SNMP error: %s at %s", errstatus.prettyPrint(),
|
||||||
errindex and restable[int(errindex) - 1][0] or '?')
|
errindex and restable[int(errindex) - 1][0] or '?')
|
||||||
return
|
return
|
||||||
|
|
||||||
for resrow in restable:
|
for resrow in restable:
|
||||||
for _, val in resrow:
|
for _, val in resrow:
|
||||||
mac = binascii.hexlify(val.asOctets()).decode('utf-8')
|
mac = binascii.hexlify(val.asOctets()).decode('utf-8')
|
||||||
_LOGGER.debug('Found mac %s', mac)
|
_LOGGER.debug("Found MAC %s", mac)
|
||||||
mac = ':'.join([mac[i:i+2] for i in range(0, len(mac), 2)])
|
mac = ':'.join([mac[i:i+2] for i in range(0, len(mac), 2)])
|
||||||
devices.append({'mac': mac})
|
devices.append({'mac': mac})
|
||||||
return devices
|
return devices
|
||||||
|
@ -16,7 +16,7 @@ from homeassistant.const import (
|
|||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.util import Throttle
|
from homeassistant.util import Throttle
|
||||||
|
|
||||||
REQUIREMENTS = ['pysnmp==4.3.2']
|
REQUIREMENTS = ['pysnmp==4.3.3']
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
"""Setup the SNMP sensor."""
|
"""Set up the SNMP sensor."""
|
||||||
from pysnmp.hlapi import (getCmd, CommunityData, SnmpEngine,
|
from pysnmp.hlapi import (getCmd, CommunityData, SnmpEngine,
|
||||||
UdpTransportTarget, ContextData, ObjectType,
|
UdpTransportTarget, ContextData, ObjectType,
|
||||||
ObjectIdentity)
|
ObjectIdentity)
|
||||||
@ -61,7 +61,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
ObjectType(ObjectIdentity(baseoid))))
|
ObjectType(ObjectIdentity(baseoid))))
|
||||||
|
|
||||||
if errindication:
|
if errindication:
|
||||||
_LOGGER.error('Please check the details in the configuration file')
|
_LOGGER.error("Please check the details in the configuration file")
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
data = SnmpData(host, port, community, baseoid)
|
data = SnmpData(host, port, community, baseoid)
|
||||||
@ -128,7 +128,7 @@ class SnmpData(object):
|
|||||||
if errindication:
|
if errindication:
|
||||||
_LOGGER.error("SNMP error: %s", errindication)
|
_LOGGER.error("SNMP error: %s", errindication)
|
||||||
elif errstatus:
|
elif errstatus:
|
||||||
_LOGGER.error('SNMP error: %s at %s', errstatus.prettyPrint(),
|
_LOGGER.error("SNMP error: %s at %s", errstatus.prettyPrint(),
|
||||||
errindex and restable[-1][int(errindex) - 1] or '?')
|
errindex and restable[-1][int(errindex) - 1] or '?')
|
||||||
else:
|
else:
|
||||||
for resrow in restable:
|
for resrow in restable:
|
||||||
|
@ -505,7 +505,7 @@ pysma==0.1.3
|
|||||||
|
|
||||||
# homeassistant.components.device_tracker.snmp
|
# homeassistant.components.device_tracker.snmp
|
||||||
# homeassistant.components.sensor.snmp
|
# homeassistant.components.sensor.snmp
|
||||||
pysnmp==4.3.2
|
pysnmp==4.3.3
|
||||||
|
|
||||||
# homeassistant.components.digital_ocean
|
# homeassistant.components.digital_ocean
|
||||||
python-digitalocean==1.10.1
|
python-digitalocean==1.10.1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user