Last active
February 10, 2018 20:28
-
-
Save YongHuax/7bcc1ac94f668ace6e6dac6c3dc44575 to your computer and use it in GitHub Desktop.
Shell script for testing mqtt with data sent from ESP32 LoRa to LG01-P
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#The following code demonstrates a sending mqtt messages with data variables | |
# publish to topic yhtest with message data from LoRa | |
#$1 refers to the first data sent from the arduino MCU to the Linux module in the LG01-P ( data sent from ESP32 LoRa ) | |
DATA=$1 | |
HOST=broker.hivemq.com | |
PORT=1883 | |
MSG=yhtest | |
mosquitto_pub -h broker.hivemq.com -p 1883 -t yhtest -m $1 | |
# to check aforementioned code using mosquitto cli , copy the following line of code | |
#mosquitto_sub -h broker.hivemq.com -p 1883 -t yhtest | |
# the following code shows portion of the code subsitied with shell varaibles to make it easier to modify cli command | |
# publish to topic yhtes1 with message data from ESP32 LoRa to mosquitto broker | |
#mosquitto_pub -h $HOST -p $PORT -t $MSG -m "$1" | |
# to check aforementioned code using mosquitto cli , copy the following line of code | |
#mosquitto_sub -h broker.hivemq.com -p 1883 -t yhtest |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment