-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
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
Support SNMPv3 and asyncio in snmp sensor #14753
Conversation
authProtocol=auth_protocols[authproto] if authkey | ||
else usmNoAuthProtocol, | ||
provProtocol=priv_protocols[privproto] if privkey | ||
else usmNoPrivProtocol, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is that a file, use cv.isfile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it's a string.
@dgomes: I've updated my branch. |
UsmUserData( | ||
username, | ||
authKey=authkey or None, | ||
privKey=privkey or None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need not set to None
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.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()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dito
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* 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.