Thanks to Jhonny Monclair This will allow you to see actual status of dump1090, ADSBx mlat client, and other feeders( FA, FR24, OPENSKY, PLANEFINDER, RADARBOX) on your mobile devices. Tested only on Android devices. Configuration and installation contains two parts: Raspberry and Smartphone. Let's see first what you need to do on Raspberry. Create new file named "mqtt-json.sh" in your home folder Code: nano /home/pi/mqtt-json.sh Paste code below into file, dump version will be detected automatically Code: #!/bin/sh # # Configuration variables # RPINAME=`uname -n` # For a list of free public servers, check https://github.com/mqtt/mqtt.github.io/wiki/public_brokers # MQTT broker MQTTHOST="iot.eclipse.org" # Change this to become something unique, so that you get your own topic path # MQTTPREFIX="yourname" # Descriptive topic, can be any string # TOPIC="ads-b" ########################## # script ########################## tty -s if [ $? = 1 ]; then sleep 30 fi nowold=0 messagesold=0 if pgrep -f /usr/bin/dump1090-mutability > /dev/null; then VER="dump1090" else VER="dump1090-fa" fi while true do if pgrep dump1090 > /dev/null; then NOW=`wget -q -O - "localhost/$VER/data/aircraft.json" | jq '.now' | awk '{print int($0)}'` MESSAGES=`wget -q -O - "localhost/$VER/data/aircraft.json" | jq '.messages'` nowdelta=`expr $NOW - $nowold` messagesdelta=`expr $MESSAGES - $messagesold` RATE=`echo "$messagesdelta $nowdelta /p" | dc` AC_POS=`wget -q -O - "localhost/$VER/data/aircraft.json" | jq '[.aircraft[] | select(.seen_pos)] | length'` AC_TOT=`wget -q -O - "localhost/$VER/data/aircraft.json" | jq '[.aircraft[] | select(.seen < 60)] | length'` DUMP=`echo "Aircraft:$AC_TOT\nPosition:$AC_POS\nMsg/s:$RATE"` #echo $DUMP nowold=$NOW messagesold=$MESSAGES SCAT="off" if pgrep socat > /dev/null; then SCAT="run" fi MLAT="off" if pgrep mlat-client > /dev/null; then CONN=`ss -r -t state established | grep "adsbexchange.com:31090" | wc -l` if [ "$CONN" -gt 0 ]; then MLAT="run\nconnected" else MLAT="run\nstand-by" fi fi ADSBX=`echo "Socat:$SCAT\nMlat:$MLAT"` FR24="0" if pgrep fr24feed > /dev/null; then FR24="1" fi FA="0" if pgrep -f /usr/bin/piaware > /dev/null; then if pgrep -f /usr/lib/piaware/helpers/faup1090 > /dev/null; then if pgrep -f /usr/lib/piaware/helpers/fa-mlat-client > /dev/null; then FA="1" fi fi fi PF="0" if pgrep pfclient > /dev/null; then PF="1" fi RBOX="0" if pgrep rbfeeder > /dev/null; then RBOX="1" fi OSKY="0" if pgrep openskyd-dump1090 > /dev/null; then OSKY="1" fi /usr/bin/mosquitto_pub -h $MQTTHOST -t "$MQTTPREFIX/$RPINAME/$TOPIC" -m "{ \"dump\" : \"$DUMP\", \"adsbx\" : \"$ADSBX\", \"fr24\" : \"$FR24\", \"fa\" : \"$FA\", \"pf\" : \"$PF\", \"rbox\" : \"$RBOX\", \"osky\" : \"$OSKY\" }" fi sleep 5 done Replace username in MQTTPREFIX="yourname" parameter, it has to be unique If you use FA image install dc Code: sudo apt-get install dc Before run script install mosquitto client Code: sudo apt-get install jq mosquitto mosquitto-clients Make file executable: Code: sudo chmod +x /home/pi/mqtt-json.sh cd into your home directory and run the script: Code: ./mqtt-json.sh If everything is ok, you shouldn't see any output or error. Stop execution (Ctrl-C) and re-run the script, this time in background: Code: ./mqtt-json.sh & In order to run the script at boot, you have to add a line in crontab Code: sudo crontab -e Select nano as editor (option 2) Paste code below at the end of file Code: @reboot /home/pi/mqtt-json.sh & Save and exit. That's all what you have to do on your Pi. Next step - mobile device configuration in next post.
Ok, time to install a new app on your Android device. https://play.google.com/store/apps/details?id=net.routix.mqttdash&hl=it Run the app and add a new connection ("+" on the upper right corner) Fill the following fields: Name (can be any string useful to remind you what you're watching, eg. ADS-B) Address (the server name, iot.eclipse.org) Port (default to 1883, leave it as it is) Tile Size (as for now choose Small, this setting is a compromise between readability and number of info fitting just in a page, you can change it at any moment) Save the set (floppy on the upper right corner). Tap and open the connection. Now you have to configure what info you want to read. Let's create an entry for Dump1090 ("+" on the right upper corner). Choose Text and fill following fields: Name (can be any string, example, myPi-Dump1090) Topic (this is a path made of the variables you've been previously setting on raspberry, MQTTPREFIX/name-of-your-pi/ads-b (example: ABC-123456/my-pi1/ads-b). Pay attention to not insert spaces. Extract from JSON path ($.dump) uncheck Enable Publishing Main Text Size (Small) Save the set (floppy on the upper right corner). Now you should see actual status of dump1090 Press this tile and select clone. Press cloned tile and select Edit Modify Extract from JSON path ($.adsbx) Save the set (floppy on the upper right corner). Now you should see mlat client and socat status Let's create a further entry for FA feeder ("+" on the right upper corner). Choose Switch/button and fill following fields: Name (can be any string, example, myPi-FA) Topic (example: ABC-123456/my-pi1/ads-b). Extract from JSON path ($.fa) uncheck Enable Publishing On (leave 1) Off (leave 0) Choose icons to show for the two different conditions (can leave default if you like) Choose color of icons for status "on" and "off" (can leave default if you like) Save the set (floppy on the upper right corner). You can add further feeders, if you like. Clone tile, you only need to change the content identifier in field "Extract from JSON path" Adsbexchange = $.adsbx FlightAware = $.fa Flightradar24 = $.fr24 PlaneFinder = $.pf RadarBox = $.rbox OpenSky = $.osky
For Apple users: try https://itunes.apple.com/us/app/mqtt-buddy/id1252991874?mt=8 If it will work please post your configuration.
Magnificent! A nice initiative and very clear explanation! Look up the name of your Rpi in advance = the name behind [email protected] in your ssh. Thanks MDA,(and Jhonny Monclair of course). Joop.