Skip to content

Instantly share code, notes, and snippets.

@YongHuax
Last active February 10, 2018 19:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save YongHuax/e734377624810d4a7119d42626f39e72 to your computer and use it in GitHub Desktop.
Save YongHuax/e734377624810d4a7119d42626f39e72 to your computer and use it in GitHub Desktop.
Test for LG01-P to Mqtt
#!/bin/sh
#The following code demonstrates a basic command using mosquitto client to connect to public broker hivemq using port 1883
# publish to topic yhtest with message "ok"
#it is possible to copy and paste the following line of code to Dragino Linux cli to run command .
mosquitto_pub -h broker.hivemq.com -p 1883 -t yhtest -m "ok"
# 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 another example of the mosquitto_pub command
# publish to topic yhtest2 with message "testing " to mosquitto broker
#mosquitto_pub -h test.mosquitto.org -p 1883 -t yhtest2 -m "ok"
# to check aforementioned code using mosquitto cli , copy the following line of code
#mosquitto_sub -h test.mosquitto.org -p 1883 -t yhtest 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment