Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tools:mqtt_as [2020/08/18 08:29] – [test.py] darron | tools:mqtt_as [2020/08/18 23:41] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 7: | Line 7: | ||
==ESP32== | ==ESP32== | ||
- | boot.py is the MicroPython startup. The others, the MQTT demo. | + | boot.py is the MicroPython startup. The others |
< | < | ||
Line 18: | Line 18: | ||
==Shell== | ==Shell== | ||
- | Scripts | + | These scripts |
< | < | ||
Line 27: | Line 27: | ||
===boot.py=== | ===boot.py=== | ||
- | The ESP32 startup file. | + | The ESP32 startup file which run our test after a short boot delay. |
< | < | ||
Line 84: | Line 84: | ||
===config.py=== | ===config.py=== | ||
- | mqtt_as configuration as found in distribution directory with mosquitto | + | mqtt_as configuration as found in distribution directory with mosquitto |
changes. | changes. | ||
- | Configure MQTT server, ssid and password. | + | Configure MQTT broker, ssid and password. |
< | < | ||
Line 129: | Line 129: | ||
===mqtt_as.py=== | ===mqtt_as.py=== | ||
- | mqtt_as excecutable. | + | mqtt_as excecutable. This is the main logic which maintains a Wifi connection and publishes and subscribes to topics. |
< | < | ||
Line 214: | Line 214: | ||
==script== | ==script== | ||
+ | |||
+ | Subscribe to the topic named ' | ||
< | < | ||
#! /bin/bash | #! /bin/bash | ||
- | while : | + | mosquitto_sub -h 192.168.0.13 -t result |
- | do | + | |
- | | + | |
- | sleep 5 | + | |
- | done | + | |
</ | </ | ||
==Shell output== | ==Shell output== | ||
+ | |||
+ | Running status for the result topic. | ||
< | < | ||
Line 234: | Line 234: | ||
==script== | ==script== | ||
+ | |||
+ | Publish two messages to the topic named ' | ||
< | < | ||
Line 248: | Line 250: | ||
==ESP32 output== | ==ESP32 output== | ||
+ | |||
+ | Show running status on the ESP32 and incoming subscription topics. | ||
< | < |