home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.51k stars 30.71k forks source link

SNMP switches stopped working in HA 0.101.0 #28371

Closed hruzipet closed 5 years ago

hruzipet commented 5 years ago

Home Assistant release with the issue: 0.101.0

Last working Home Assistant release (if known): 0.100.3

Operating environment (Hass.io/Docker/Windows/etc.): Ubuntu/Docker

Component/platform: snmp

Description of problem: SNMP switches stopped working after upgrade to 0.101.0

AttributeError: 'str' object has no attribute 'getTagSet'

Problem-relevant switch.yaml entries and (fill out even if it seems unimportant):

- platform: snmp
  name: Valve_boiler
  host: 192.168.10.134
  community: private
  baseoid: 1.3.6.1.4.1.19865.1.2.1.1.0
  payload_on: 1
  payload_off: 0

Traceback (if applicable):

  File "/usr/src/homeassistant/homeassistant/components/snmp/switch.py", line 193, in async_turn_on
    await self._set(self._command_payload_on)
  File "/usr/src/homeassistant/homeassistant/components/snmp/switch.py", line 236, in _set
    *self._request_args, ObjectType(ObjectIdentity(self._commandoid), value)
  File "/usr/local/lib/python3.7/asyncio/coroutines.py", line 120, in coro
    res = func(*args, **kw)
  File "/usr/local/lib/python3.7/site-packages/pysnmp/hlapi/asyncio/cmdgen.py", line 267, in setCmd
    (options.get('lookupMib', True), future)
  File "/usr/local/lib/python3.7/site-packages/pysnmp/entity/rfc3413/cmdgen.py", line 249, in sendVarBinds
    v2c.apiPDU.setVarBinds(reqPDU, varBinds)
  File "/usr/local/lib/python3.7/site-packages/pysnmp/proto/api/v1.py", line 132, in setVarBinds
    varBindList.getComponentByPosition(idx), varBind
  File "/usr/local/lib/python3.7/site-packages/pysnmp/proto/api/v1.py", line 42, in setOIDVal
    varBind.setComponentByPosition(1).getComponentByPosition(1).setComponentByType(val.getTagSet(), val, verifyConstraints=False, matchTags=False, matchConstraints=False, innerFlag=True)
AttributeError: 'str' object has no attribute 'getTagSet'
rfpronk commented 5 years ago

Exactly the same here. Might be caused by home-assistant/pull/27422

rfpronk commented 5 years ago

I reverted home-assistant/pull/27422 on my local installation and everything worked again. Perhaps this weekend I've got time to fix it properly so the goal of that PR is maintained while keeping integers working as well.

daveyrb commented 5 years ago

I have the same issue. I have rolled back to 0.100.3 and it's working again