https://github.com/runnerty/executor-mqtt
Runnerty module: MQTT Publisher
https://github.com/runnerty/executor-mqtt
Last synced: 5 months ago
JSON representation
Runnerty module: MQTT Publisher
- Host: GitHub
- URL: https://github.com/runnerty/executor-mqtt
- Owner: runnerty
- License: mit
- Created: 2020-11-13T18:41:25.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-10-01T06:06:35.000Z (over 1 year ago)
- Last Synced: 2024-11-24T21:12:07.307Z (over 1 year ago)
- Language: JavaScript
- Size: 105 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Smart Processes Management
[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Dependency Status][david-badge]][david-badge-url]
# Executor for [Runnerty]: MQTT
Module MQTT Publisher.
This is a wrapper from the [MQTT.js](https://github.com/mqttjs/MQTT.js)
### Installation:
Through NPM
```bash
npm i @runnerty/executor-mqtt
```
You can also add modules to your project with [runnerty-cli]
```bash
npx runnerty-cli add @runnerty/executor-mqtt
```
This command installs the module in your project, adds example configuration in your `config.json` and creates an example plan of use.
If you have installed [runnerty-cli] globally you can include the module with this command:
```bash
rty add @runnerty/executor-mqtt
```
### Configuration:
Add in [config.json]:
##### Simple:
```json
{
"id": "mqtt_default",
"type": "@runnerty-executor-mqtt",
"hostname": "localhost"
}
```
##### All parameters:
```json
{
"id": "mqtt_default",
"type": "@runnerty-executor-mqtt",
"protocol": "mqtt",
"hostname": "localhost",
"port": 1883,
"username": "guest",
"password": "pass",
"keepalive": 60,
"reschedulePings": true,
"clientId": "mqttjs_@RANDOM(0, 1024, 1024)",
"protocolId": "MQTT",
"protocolVersion": 4,
"clean": true,
"reconnectPeriod": 1000,
"connectTimeout": 30000,
"queueQoSZero": true,
"tlsKeyFile": "./my_cert.key",
"tlsCertFile": "./my_cert.cert",
"tlsCAFile": "./my_cert.ca",
"rejectUnauthorized": false,
"properties": {
"sessionExpiryInterval": 3600,
"receiveMaximum": 1024,
"maximumPacketSize": 32,
"topicAliasMaximum": 32,
"requestResponseInformation": true,
"userProperties": {
"some": "value"
},
"authenticationMethod": "auth_method",
"authPacket": {
"some": "value"
},
"resubscribe": true
}
}
```
### Plan sample:
Add in [plan.json]:
##### Simple:
```json
{
"id": "mqtt_default",
"topic": "MY_TOPIC",
"message": "My message from Runnerty!"
}
```
##### All parameters:
```json
{
"id": "mqtt_default",
"topic": "MY_TOPIC",
"message": "My message from Runnerty!",
"options": {
"qos": 0,
"retain": false,
"dup": false,
"properties": {
"payloadFormatIndicator": true,
"messageExpiryInterval": 60,
"topicAlias": 1,
"responseTopic": "res_topic",
"userProperties": {
"some": "value"
},
"subscriptionIdentifier": 1234,
"contentType": "contenttype_value"
}
}
}
```
More information in MQTT [api reference](https://github.com/mqttjs/MQTT.js/#api)
### Output (Process values):
- `PROCESS_EXEC_ERR_OUTPUT`: Error output message.
[runnerty]: http://www.runnerty.io
[downloads-image]: https://img.shields.io/npm/dm/@runnerty/executor-mqtt.svg
[npm-url]: https://www.npmjs.com/package/@runnerty/executor-mqtt
[npm-image]: https://img.shields.io/npm/v/@runnerty/executor-mqtt.svg
[david-badge]: https://david-dm.org/runnerty/executor-mqtt.svg
[david-badge-url]: https://david-dm.org/runnerty/executor-mqtt
[config.json]: http://docs.runnerty.io/config/
[plan.json]: http://docs.runnerty.io/plan/
[runnerty-cli]: https://www.npmjs.com/package/runnerty-cli