Categories
Uncategorized

Debugging/your/MQTT help!

Starting mosquitto from the command line, you can use the ‘-v’ (or ‘–verbose’) option for showing verbose messages…this will override the logtype option in the config file. So first step, when something is not going right, start the MQTT server manually with mosquitto -v and watch what the server does while you debug the problem.

If you don’t have direct access to the Broker/Server, you can also check out MQTTBox http://workswithweb.com/mqttbox.html, works on most platforms…great tip from David B., thank you.

Create a new MQTT Client, with some unique MQTT Client Name (MeBox will work), select the protocol you are using in your application, and enter the hostname or IP address for the Host. Enter Username and Password, if used, and check or uncheck all the other boxes that are application to your setup. Then click Save and selecting the “MeBox” client in the list, will allow you to add Publishers to Publish to a Topic, or Subscribers to Subscribe to one or more Topics, with the wildcards (Single Level ‘+’ and Multilevel ‘#’) , as usual.

Very easy to monitor and interact with the MQTT Server: a Published message has a “Publish again” arrow, avoiding quite a but of typing.; restarting MQTTBox will automatically connect (if the option was selected), but you will need to click the Subscribe button in each Subscriber window.

Categories
Uncategorized

Uploading/code/to/ESP8266/with mqTrainsIO.ino.bin

Monitoring the verbose output in the debug window in the Arduino 1.8.12 IDE, we see:

C:\Users\name\AppData\Local\Arduino15\packages\esp8266\tools\python3\3.7.2-post1/python3 C:\Users\name\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.0/tools/upload.py --chip esp8266 --port COM4 --baud 115200 --before default_reset --after hard_reset write_flash 0x0 mqTrainsIO.ino.bin
esptool.py v2.8
Serial port COM4
Connecting......_

Enable verbose output with Settings (Ctrl+Comma). File -> Preferences -> Show verbose output during: [ x ] compilation [ x ] upload

Categories
Uncategorized

Setting/up/MQTT/Broker mosquitto

Download:
https://mosquitto.org/
https://mosquitto.org/download/

Windows:
mosquitto-1.6.12a-install-windows-x64.exe (example)

Select Files and Service

To start the service, Computer Management (right-click on My Computer, Manage) -> Services and Applications->Services->Mosquitto Broker->right click->Start

(You can also set the service to Automatic in right click on the service->Properties->Startup type)

If not run as a service, you can start it with
C:\”Program Files”\mosquitto\mosquitto.exe -v -c “C:\Program Files\mosquitto\mosquitto.conf”

To test, run:
C:\Program Files\mosquitto\mosquitto_sub -h localhost -v -t “TxNamib/#”

If the service is not running or accessible, the error wil show:
Error: No connection could be made because the target machine actively refused it.

Else, you will only see a message if it was “retained”, or you publish something to TxNamib now
C:\”Program Files”\mosquitto\mosquitto_pub -h localhost -t “TxNamib/servo.2003/03” -r -m “CLOSED”
or
C:\”Program Files”\mosquitto\mosquitto_pub -h localhost -t “TxNamib/servo.2003/03” -r -m “THROWN”

Ubuntu and Raspberry Pi (3, 4, 400 and Zero W):
sudo apt-get install mosquitto

or

snap install mosquitto

Older versions of Ubuntu:
sudo apt-add-repository ppa:mosquitto-dev/mosquitto-ppa
sudo apt-get update

Categories
Uncategorized

We/are/live TRUE

Welcome to the mqTrains WordPress site. This is our first post!