Skip to content
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

Add feature "dynamic topic targets" #169

merged 2 commits into from Feb 16, 2016


Copy link

@amotl amotl commented Feb 14, 2016

Dear Jan-Piet and Ben,

first things first: Thanks for sharing this great project!

We tried to enhance mqttwarn to add functionality we need for our Hiveeyes bee monitoring project. The feature was implemented as generic as possible to provide added value to the mqttwarn infrastructure in general. Kudos go to @einsiedlerkrebs for conceiving it and making this possible.

A short overview over the changes made:

Please get back to us if you have further questions or suggestions.

With kind regards,

- Interpolate transformation data values into topic targets
- Improve overall robustness and address mqtt-tools#27
Copy link

We also updated the appropriate Wiki page. Unfortunately GitHub can not issue pull requests to Wikis, so we link to a PR issued to a clone: hiveeyes/mqttwarn-wiki#1


Copy link

jpmens commented Feb 15, 2016

This basically looks very good, however it crashes mqttwarn if I publish a non-JSON payload to your example.

2016-02-15 11:50:49,750 DEBUG [mqttwarn] Section [topic-targets-dynamic] matches message on test/topic-targets-dynamic. Processing...
2016-02-15 11:50:49,750 WARNING [mqttwarn] Cannot decode JSON object, payload=blub: No JSON object could be decoded
Traceback (most recent call last):
  File "./", line 970, in <module>
  File "./", line 930, in connect
  File "/usr/local/lib/python2.7/site-packages/paho/mqtt/", line 1212, in loop_forever
    rc = self.loop(timeout, max_packets)
  File "/usr/local/lib/python2.7/site-packages/paho/mqtt/", line 792, in loop
    rc = self.loop_read(max_packets)
  File "/usr/local/lib/python2.7/site-packages/paho/mqtt/", line 1043, in loop_read
    rc = self._packet_read()
  File "/usr/local/lib/python2.7/site-packages/paho/mqtt/", line 1425, in _packet_read
    rc = self._packet_handle()
  File "/usr/local/lib/python2.7/site-packages/paho/mqtt/", line 1881, in _packet_handle
    return self._handle_publish()
  File "/usr/local/lib/python2.7/site-packages/paho/mqtt/", line 2009, in _handle_publish
  File "/usr/local/lib/python2.7/site-packages/paho/mqtt/", line 2165, in _handle_on_message
    self.on_message(self, self._userdata, message)
  File "./", line 532, in on_message
    send_to_targets(section, topic, payload)
  File "./", line 586, in send_to_targets
    targetlist = [t.format(**data) for t in targetlist]
KeyError: u'loglevel'

Could you address that please?

Copy link

jpmens commented Feb 15, 2016

@einsiedlerkrebs Thanks for the documentation which I have "merged" ;-)

Copy link
Member Author

amotl commented Feb 15, 2016

Sorry for missing that detail, would have been easy to catch, but it was late. :-) Will have a look and send a fix tonight.

@jpmens jpmens merged commit 4170e52 into mqtt-tools:master Feb 16, 2016
Copy link

jpmens commented Feb 16, 2016

Nur Döner macht schöner! Merged, Danke!

@amotl amotl deleted the wip/topic-targets-dynamic branch February 16, 2016 07:39
Copy link
Member Author

amotl commented Feb 16, 2016

Thanks a bunch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

3 participants