Support SNMPv3 and asyncio in snmp sensor#14753
Support SNMPv3 and asyncio in snmp sensor#14753fabaff merged 4 commits intohome-assistant:devfrom mtdcr:snmpv3-asyncio-sensor
Conversation
| authProtocol=auth_protocols[authproto] if authkey | ||
| else usmNoAuthProtocol, | ||
| provProtocol=priv_protocols[privproto] if privkey | ||
| else usmNoPrivProtocol, |
There was a problem hiding this comment.
continuation line unaligned for hanging indent
| authKey=authkey or None, | ||
| privKey=privkey or None, | ||
| authProtocol=auth_protocols[authproto] if authkey | ||
| else usmNoAuthProtocol, |
There was a problem hiding this comment.
continuation line unaligned for hanging indent
|
TOXENV=pylint fails on Travis CI: I'd say that's not true. And it doesn't occur when I run the tests locally. |
|
I managed to reproduce the warning locally and successively replaced the code in question with functionally equivalent code accepted by pylint. |
|
We have adopted PEP 492, please update accordingly, eg: to
|
| vol.Optional(CONF_AUTH_KEY): cv.string, | ||
| vol.Optional(CONF_AUTH_PROTOCOL, default=DEFAULT_AUTH_PROTOCOL): | ||
| vol.In(AUTH_PROTOCOLS), | ||
| vol.Optional(CONF_PRIV_KEY): cv.string, |
|
@dgomes: I've updated my branch. |
| UsmUserData( | ||
| username, | ||
| authKey=authkey or None, | ||
| privKey=privkey or None, |
There was a problem hiding this comment.
This replaces en empty string with None, which makes a difference in UsmUserData. Are you implying that authkey=="" is guaranteed not to appear in this codepath?
|
Use on top: |
|
@pvizeli: Thanks for your suggestions! I've updated my branch. |
| vol.Optional(CONF_USERNAME): cv.string, | ||
| vol.Optional(CONF_AUTH_KEY): cv.string, | ||
| vol.Optional(CONF_AUTH_PROTOCOL, default=DEFAULT_AUTH_PROTOCOL): | ||
| vol.In(MAP_AUTH_PROTOCOLS.keys()), |
There was a problem hiding this comment.
.keys() is not needed, it's the default.
| vol.In(MAP_AUTH_PROTOCOLS.keys()), | ||
| vol.Optional(CONF_PRIV_KEY): cv.string, | ||
| vol.Optional(CONF_PRIV_PROTOCOL, default=DEFAULT_PRIV_PROTOCOL): | ||
| vol.In(MAP_PRIV_PROTOCOLS.keys()), |
|
Any progress on this PR? |
|
I rebased this branch on dev again and removed keys(), even though using keys() was suggested to use before. Contributing to this project is fun, really. |
* Update sensor.snmp.markdown Depends on home-assistant/core#14753 * ✏️ Minor tweaks * Minor changes
Instantiate pysnmp objects once during setup and reuse them. Requires asyncio, because SnmpEngine objects can't be shared between threads. This speeds up repeated queries significantly and simplifies support for different authentication types.
Related to #6973 and #11370.
For SNMPv3, the following new options were modified or added:
Changed to accept version '3'.
<string><string><none|hmac-md5|hmac-sha|hmac128-sha224|hmac192-sha256|hmac256-sha384|hmac384-sha512><string><none|des|3des-ede|aes-cfb-128|aes-cfb-192|aes-cfb-256>Note:
none.none.none.none.Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#5484
Checklist:
tox.If user exposed functionality or configuration variables are added/changed:
No new files or dependencies were introduced.