1.0.0-alpha.6 • Published 3 years ago
ezrun-mqtt v1.0.0-alpha.6
ezrun-mqtt
ezrun-mqtt for ezrun plugin
Tag details
| Tags | Description |
|---|---|
| ezrun-mqtt | Declare a mqtt connector |
| ezrun-mqtt'pub | Publish a message to topics in mqtt |
| ezrun-mqtt'quit | Stop subscribed. Only used in "ezrun-mqtt'sub" |
| ezrun-mqtt'sub | Subscribe topics in mqtt |
ezrun-mqtt
Declare a mqtt connector
Example:
- ezrun-mqtt:
title: "[mqtt] localhost"
uri: mqtt://user:pass@mqtt # Mqtt uri
runs: # When a message is received then it will runs them
- echo: Mqtt is connectedPublish a message to topics
- ezrun-mqtt:
title: "[mqtt] localhost"
uri: mqtt://user:pass@mqtt # Mqtt uri
runs: # When a message is received then it will runs them
- ezrun-mqtt'pub:
title: Publish a message
topics:
- test
data:
msg: Hello worldezrun-mqtt'pub
Publish a message to topics in mqtt
Example:
Publish a message to mqtt
- ezrun-mqtt'pub:
title: "[mqtt] localhost"
uri: mqtt://user:pass@mqtt
topic: topic1
topics:
- topic2
- topic3
pubOpts:
qos?: 0 | 1 | 2
data:
name: thanhReuse mqtt connection to publish multiple times
- ezrun-mqtt:
title: "[mqtt] localhost"
uri: mqtt://user:pass@mqtt
runs:
- ezrun-mqtt'pub:
topics:
- topic1
pubOpts:
qos?: 0 | 1 | 2
data:
name: thanh
- ...
# Other elementsezrun-mqtt'quit
Stop subscribed. Only used in "ezrun-mqtt'sub"
Example:
- ezrun-mqtt'sub:
uri: redis://redis:6379
topics: # Topics which is subscribed
- topic1
runs: # When a message is received then it will runs them
- ezrun-mqtt'stop: # Stop subscribedezrun-mqtt'sub
Subscribe topics in mqtt
Example:
- ezrun-mqtt'sub:
title: "[mqtt] localhost"
uri: mqtt://user:pass@mqtt
topic: topic1
topics: # topics which is subscribed
- topic1
- topic2
runs: # When a message is received then it will runs them
- ${this.parentState} # - Received data in a topic
- ${this.parentState.topicName} # - Topic name
- ${this.parentState.topicData} # - Received message which is cast to object
- ${this.parentState.topicMsg} # - Received message which is text
- ...
# Other elementsUsed in global mqtt
- ezrun-mqtt:
title: Global MQTT
uri: mqtt://user:pass@mqtt
runs:
- ezrun-mqtt'sub:
title: "[mqtt] localhost"
topic: topic1
topics: # topics which is subscribed
- topic1
- topic2
runs: # When a message is received then it will runs them
- ${this.parentState} # - Received data in a topic
- ${this.parentState.topicName} # - Topic name
- ${this.parentState.topicData} # - Received message which is cast to object
- ${this.parentState.topicMsg} # - Received message which is text
- ...
# Other elementsHave fun :)
1.0.0-alpha.7
3 years ago
1.0.0-alpha.6
3 years ago
1.0.0-alpha.5
3 years ago
1.0.0-alpha.4
3 years ago
1.0.0-alpha.3
3 years ago
1.0.0-alpha.8
3 years ago
1.0.0-alpha.2
3 years ago
1.0.0-alpha.1
3 years ago
1.0.0-alpha.0
3 years ago
0.0.0-alpha.0
3 years ago