npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mqtt-exec2

v2.7.17

Published

Execute shell commands on MQTT messages

Downloads

22

Readme

mqtt-exec2

A MQTT agent that subscribes to a list of MQTT topics and executes a script/command each time a message arrives.

Setup

npm install -g mqtt-exec2

On linux you will need to install node with a version manager to install mqtt-exe with a non-root user.

Usage

exec-mqtt --help

Usage: mqtt-exec [-i] [-u] [-b <broker url>] [-c <config path>] [-l <log path>]

Options:
  --version        Show version number                                 [boolean]
  --install, -i    Install in System Startup
  --uninstall, -u  Uninstall of System Startup
  --broker, -b     MQTT broker url                      [default: "mqtt://mqtt"]
  --config, -c     Path to json config file
  --log, -l        Log to file, let empty to use User config dir
                   (eg: C:\Users\mtbox\.mqtt-exec)
  --help           Show help                                           [boolean]

	Examples:
	  mqtt-exec                                 Use default mqtt broker
	                                            (mqtt://mqtt:1883) and config.json
	                                            file present in user config
	                                            directory, eg:
	                                            C:\Users\mtbox\.mqtt-exec
	                                            No logs to file

	  mqtt-exec -i                              Install at startup, with default
	                                            mqtt broker (mqtt://mqtt:1883) and
	                                            config.json file present in user
	                                            config directory, eg:
	                                            C:\Users\mtbox\.mqtt-exec
	                                            No logs to file

	  mqtt-exec -i -l                           Install at startup, with default
	                                            mqtt broker (mqtt://mqtt:1883) and
	                                            config.json file present in user
	                                            config directory, eg:
	                                            C:\Users\mtbox\.mqtt-exec
	                                            Logs are send to a file in user
	                                            config directory.

	  mqtt-exec -b                              Connect to broker 'mqtt', on port
		mqtt://myname:secretpasswd@mqtt:8883 -c   8883 with config.json parameter      
	  config.json                               file.

	  mqtt-exec -i -c /home/pi/config.json -l   Install at startup, using
	                                            /home/pi/config.json file, log to
	                                            file in user config directory,
	                                            eg: C:\Users\mtbox\.mqtt-exec

	  mqtt-exec -i -c Z:\config.json            Install at startup, using
	                                            Z:\config.json file, no log recorded

	  mqtt-exec -u                              Uninstall from system startup

Configuration

Create a configuration file "config.json" and put it in your user folder (~/.mqtt-exec for linux or %userprofile%\.mqtt-exec for windows).

Windows example

{
  "exec/mypc":	{
    "foobar2000" : "\"K:/Program Files/foobar2000/foobar2000.exe\"",
    "shutdown" : "\"C:/Windows/System32/shutdown.exe\" /s",
    "calc" : "calc"
  }
}

Linux example

{
  "/home/devices/livingroom/light1/value/set":  {
    "true"  : "sudo /home/pi/rcswitch-pi/sendRev B 1 1",
    "false" : "sudo /home/pi/rcswitch-pi/sendRev B 1 0"
  },
  "/home/devices/livingroom/light2/value/set":  {
    "true"  : "sudo /home/pi/rcswitch-pi/sendRev B 2 1",
    "false" : "sudo /home/pi/rcswitch-pi/sendRev B 2 0"
  }
}

Credit

Thank to Dennis Schulte creator of mqtt-exec. It's config.json concept is re-used here.

Licence

Copyright © 2018-present, macro-toolbox.com. Released under the MIT License.