Create new MQTT notify plugin#2624
Conversation
Alpha level coding of MQTT notification plugin
liiight
left a comment
There was a problem hiding this comment.
Thanks for this! A few changed requested
liiight
left a comment
There was a problem hiding this comment.
Please install pre-commit as we use it for a bunch of auto style and import order formatting
ianstalk
left a comment
There was a problem hiding this comment.
Cool idea, and the code looks pretty good too!
|
@liiight - Sorry I disappeared for so long. Figured I should finally clean this up and merge to project. I think I've addressed all the requests, let me know if there's other issues/suggestions you want me to address. |
just couple cleanups, welcome back :) |
numericOverflow
left a comment
There was a problem hiding this comment.
Comments have been addressed with a couple additional commits
|
@paranoidi - requested changes made |
|
@paranoidi LGTM |
| publish_info, | ||
| ) | ||
| except Exception as e: | ||
| raise PluginWarning(f'Error publishing to MQTT broker: {e}') |
There was a problem hiding this comment.
Should probably use log.exception .. this catches everything unknown and with this we don't get proper tracebacks.
Yeah, just one thing about error logging caught my eye. Other than that. Seems good! @numericOverflow thanks! |
|
Looking forward for this plugin |
| tls_version: ['tlsv1.2', 'tlsv1.1', 'tlsv1'] | ||
| ] | ||
| [qos: [0,1,2] ] | ||
| [retain: True/False] |
There was a problem hiding this comment.
We use yes/no in yaml as it is more natural language.
| 'client_cert': {'type': 'string'}, | ||
| 'client_key': {'type': 'string'}, | ||
| 'validate_broker_cert': {'type': 'boolean', 'default': True}, | ||
| 'tls_version': {'type': 'string', 'enum': ['tlsv1.2', 'tlsv1.1', 'tlsv1', '']}, |
| logger.debug('TLS secure cert mode enabled. Broker cert will be validated') | ||
|
|
||
| # Handle user/pass authentication | ||
| if config.get('username'): |
There was a problem hiding this comment.
When checking key presence in dict the pythonic way is if "username" in config:, same applies to few other places in the code.
|
This PR is stale because it has been open 150 days with no activity. Remove stale label or comment or this will be closed in 60 days. |
|
This PR is stale because it has been open 150 days with no activity. Remove stale label or comment or this will be closed in 60 days. |
|
not stale, TODO eventually |
|
This PR is stale because it has been open 150 days with no activity. Remove stale label or comment or this will be closed in 60 days. |
|
Let's merge this in, it's been pending too long. |
|
Awesome job, sorry it took so long to merge this |
|
Maybe I spoke too soon, it doesn't seem to work. @numericOverflow Issue #3533 Can you help a bit with that? |
Motivation for changes:
Enable notification to an MQTT broker, because a plugin didn't exist yet to do so
Detailed changes:
Addressed issues:
None
Implemented feature requests:
None, just my own needs so contribute to code base
Config usage if relevant (new plugin or updated schema):
Log and/or tests output (preferably both):
Test config (redacted servers)
Log file output (redacted servers a bit)
To Do: