@@ -23,9 +23,8 @@ I've written an introductory post, explaining [what mqttwarn can be used for](ht
2323 + [ Custom functions] ( #custom-functions )
2424 + [ Templates] ( #templates )
2525 * [ Periodic tasks] ( #periodic-tasks )
26- * [ Running with Docker] ( #running-with-docker )
27- + [ Run the Image] ( #run-the-image )
28- + [ Build the image] ( #build-the-image )
26+ * [ Running with Docker] ( #docker )
27+ * [ Loading external services] ( #loading-external-services )
2928 * [ Examples] ( #examples )
3029 + [ Low battery notifications] ( #low-battery-notifications )
3130 + [ Producing JSON] ( #producing-json )
@@ -3404,6 +3403,55 @@ pinger = 10.5; now=true
34043403In order to run `mqttwarn` on Docker, please follow up at [DOCKER.md](DOCKER.md).
34053404
34063405
3406+ ## Loading external services
3407+
3408+ In order to bring in custom emitter machinery to `mqttwarn` in form of service
3409+ plugins, there are two options.
3410+
3411+
3412+ ### Service plugin from package
3413+
3414+ This configuration snippet outlines how to load a custom plugin from a Python
3415+ module referenced in "dotted" notation.
3416+
3417+ ```ini
3418+ [defaults]
3419+ ; name the service providers you will be using.
3420+ launch = log, file, tests.acme.foobar
3421+
3422+ [test/plugin-module]
3423+ ; echo ' {" name" : " temperature" , " value" : 42.42}' | mosquitto_pub -h localhost -t test/plugin-module -l
3424+ targets = tests.acme.foobar:default
3425+ format = {name}: {value}
3426+
3427+ [config:tests.acme.foobar]
3428+ targets = {
3429+ ' default' : [ ' default' ],
3430+ }
3431+ ```
3432+
3433+ ### Service plugin from file
3434+
3435+ This configuration snippet outlines how to load a custom plugin from a Python
3436+ file referenced by file name.
3437+
3438+ ```ini
3439+ [defaults]
3440+ ; name the service providers you will be using.
3441+ launch = log, file, tests/acme/foobar.py
3442+
3443+ [test/plugin-file]
3444+ ; echo ' {" name" : " temperature" , " value" : 42.42}' | mosquitto_pub -h localhost -t test/plugin-file -l
3445+ targets = tests/acme/foobar.py:default
3446+ format = {name}: {value}
3447+
3448+ [config:tests/acme/foobar.py]
3449+ targets = {
3450+ ' default' : [ ' default' ],
3451+ }
3452+ ```
3453+
3454+
34073455## Examples ##
34083456
34093457This section contains some examples of how `mqttwarn` can be used with some more complex configurations.
0 commit comments