Added MQTT support

Brian

I tried the new program, but it does not publish any messages. I replaced the new one with n-1 and messages started showing up.

Renato

my bad
try again

http://www.weather-display.com/downloadfiles/cronwdmqtt.zip

once this runs stable then can work on having it stay logged in and running

Yep, that did it.

Tomorrow morning (my time) I am going to simulate MQTT going offline and will keep an eye on the total number of mqtt processes.

Thanks again
Renato

actually download yet again
as I need to have added a time out
because if no connection then it will not close

Brian

I have downloaded the latest one.

I shut down the pod that MQTT is running in. Immediately, I noticed that WD started 3 new cronwdmqtt processes. Then a forth one started but shorty after was terminated. The creation/termination of a new process kept on going leaving at anytime 3-4 of these processes.

Renato

yeah, that is because the time out is set to 10 seconds

I will now work on leaving it running…if say the frequency to send is less than the default of 60 seconds say?

1 Like

Do you expect the overhead to be significant if you just left it always connected?

Here is another idea…

What if you were to look at the overall app as a collection of “microservices” where the functionality of the main code would be to generate and publishing the data (clientraw). Then each other microservice (i.e. wu upload, mysql upload, ftp etc) would be its own microservice that would subscribe to the message and “take it from there”.

The advantage of this would be

  1. gain granularity of control as to when each process runs
  2. distribute the microservices across multiple os/hw.
  3. facilitate the creation of “3rd party” plugins

Renato

MQTT is a lightweight protocol so should be no overhead and the data sent is not large either

re 2, yes, it does open up lots of possibilities
including getting data to a client version of WD running or the WDliveapp or similar

use a new .zip update
which also has a new cronwdmqtt.exe version (vers 1.4) as well as a new weatherdisplay.exe version
now if you have the update rate less than 60 seconds (default)
then the cronwdmqtt.exe will not exit but keep on running (you can click on the icon to see whats its doing etc in the system tray) and will send the data at the update rate
I have tested and its working

Brian

deployed the new version. Everything working.

Let me know if you would like to brainstorm around the microservices…

Thanks again
Renato.

there is now the opportunity for other software developers to use the MQTT message data to add on services?

Brian

Here is an example of the “art of possible”. Using node-red to subscribe to the message and generate a dashboard.

Renato


kewl
I thought there might be a way to drive a live web site , yes?
so no ftp need to get your data there

Brian

I guess node-red could be used for creating a more detailed webpage. That would indeed eliminate the need for ftp/sftp.

I planning to reach out to one of my colleague at work tomorrow who is the “expert” on node-red.

Meanwhile, if you wish to play with it, you can install NR on a footprint as small as a RPi.

[{"id":"e959a54f.7adff8","type":"ui_gauge","z":"3184c35f.9c6f6c","name":"","group":"d702a2bb.6772d","order":5,"width":"8","height":"8","gtype":"gage","title":"Outside Hum","label":"%","format":"{{value}} %","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":1101,"y":514,"wires":[]},{"id":"d702a2bb.6772d","type":"ui_group","z":"","name":"Weather Display - Southampton","tab":"eb9cf7e0.fcf888","order":1,"disp":true,"width":"28","collapse":false},{"id":"eb9cf7e0.fcf888","type":"ui_tab","name":"Tab 1","icon":"dashboard","order":1}]

One more question/asl, not trying to be a pig :slight_smile:

How difficult would it be to give the option to publish either clientraw or customclientraw.txt. The latter already being in JSON format would lend itself better for loading the data into a database, specifically InfluxDB.

Renato

yup, i can add option to send customclientraw instead

i have added that option now to the latest .zip update (normal download)

Brian

tried the new version…

  1. The option to send customclientraw does not appear to stick. Had to try different combinations between checking and un-checking clientraw and customclientraw to finally have customclientraw and clientraw both stick.

  2. The published message still looks like this:
    Southampton01!12345 4.4 2.6 296 7.2 59 1013.0 2.3 24.6 267.7 0.00 0.00 19.8 51 100.0 1 0.0 0 0 0.3 -54.4 255.0 -65.0 -67.8 -100.0 -100.0 -100 -100 -100 23 43 38 N3KJE-11:43:38_PM 0 0 15 4 0.00 0.00 100 100 100 100 100 5.7 5.0 21.1 7.2 1 Night_time/Dry/Clear_skies 0.7 3 3 3 3 3 6 6 4 3 4 4 3 2 2 3 7 4 3 3 3 17.4 -0.3 3085.0 4/15/2019 27.7 5.0 21.1 4.4 0.0 3 4 4 3 5 1 3 3 1 3 7.8 7.7 7.7 7.7 7.6 7.4 7.4 7.4 7.4 7.2 2.3 2.3 2.3 2.3 2.3 2.3 2.3 2.3 2.3 2.3 21.1 7.2 7.2 11.0 0 — — 297 0 0 -100.0 -100.0 0 -100 -100 -100 -100 0.0 23.8 19.7 4.5 1013.0 992.5 11 11:24_PM 2:59_PM 23.5 3.1 18.9 -0.5 9 2019 0.0 -1 1 -1 297 252 287 290 278 286 300 288 19 296 0.0 255.0 2.4 4.3 40.18528 75.02556 1.3 92 52 2.3 11:35_PM 0.0 0.0 0.0 0.0 0.0 0.0 109.8 2:00_AM 11:42_PM 299 !!C10.37S94!!

i.e. without the field names as opposed to the one WD if FTP’ing which looks like this:

{“date”:“11:48 PM”,“dateFormat”:“m/d/y”,“temp”:“45.0”,“tempTL”:“45.0”,“tempTH”:“70.0”,“intemp”:“67.7”,“dew”:“31.5”,“dewpointTL”:“31.1”,“dewpointTH”:“66.0”,“apptemp”:“41.2”,“apptempTL”:“37.4”,“apptempTH”:“74.3”,“wchill”:“43.9”,“wchillTL”:“39.7”,“heatindex”:“45.0”,“heatindexTH”:“70.0”,“humidex”:“5.0”,“wlatest”:“3.0”,“wspeed”:“3.1”,“wgust”:“10.3”,“wgustTM”:“20.0”,“bearing”:“299”,“avgbearing”:“303”,“press”:“29.916”,“pressTL”:“29.308”,“pressTH”:“29.916”,“pressL”:“28.756”,“pressH”:“30.838”,“rfall”:“0.09”,“rrate”:“0.000”,“rrateTM”:“0.000”,“hum”:“59”,“humTL”:“52”,“humTH”:“92”,“inhum”:“52”,“SensorContactLost”:“0”,“forecast”:“partly cloudy and cooler.”,“tempunit”:“F”,“windunit”:“mph”,“pressunit”:“inHg”,“rainunit”:“in”,“temptrend”:“-1.1”,“TtempTL”:“11:42 PM”,“TtempTH”:“2:00 AM”,“TdewpointTL”:“11:44 PM”,“TdewpointTH”:“3:29 AM”,“TapptempTL”:“11:44 PM”,“TapptempTH”:“2:48 AM”,“TwchillTL”:“2:00 AM”,“TheatindexTH”:“2:00 AM”,“TrrateTM”:“2:30 PM”,“ThourlyrainTH”:“”,“LastRainTipISO”:“4/15/2019 10:34 PM”,“hourlyrainTH”:“0.000”,“ThumTL”:“2:30 PM”,“ThumTH”:“5:08 AM”,“TpressTL”:“3:31 AM”,“TpressTH”:“11:46 PM”,“presstrendval”:"+0.095 ",“Tbeaufort”:“5”,“TwgustTM”:“2:59 PM”,“windTM”:“12.7”,“bearingTM”:“298”,“timeUTC”:“2019,04,16,03,48,26”,“BearingRangeFrom10”:“274”,“BearingRangeTo10”:“19”,“UV”:“0.0”,“UVTH”:“5.1”,“SolarRad”:“0”,“CurrentSolarMax”:“0”,“SolarTM”:“984”,“domwinddir”:“West northwesterly”,“WindRoseData”:[7.0,8.0,3.0,0.0,0.0,0.0,0.0,0.0,0.0,2.0,6.0,9.0,97.0,955.0,181.0,38.0],“windrun”:“68.58”,“version”:“10.37S”,“build”:“94”,“ver”:“10”}

Renato

I’m trying to get a similar dash to Renato’s - I’ve now got Node-RED running fine on my Synology server and I’ve started adding the elements per his dashboard - however I don’t know what to actually enter in each of the split and route boxes etc. Maybe I need to do some reading (a lot) but if Renato could do a quick-start post it would be very much appreciated … Thanks in advance

VK2HIM

Salutations from N3KJE

  1. Go to the ND page. It should be accessible from http://IP_ADDRESS:1880

  2. On the “Hamburger icon” (4 horizontal lines on the top right of the screen) click the option Import → Clipboard

  3. In the “Paste nodes here” block, paste the following code:

[{"id":"3184c35f.9c6f6c","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"bea7e640.b05dd8","type":"mqtt in","z":"3184c35f.9c6f6c","name":"","topic":"Southampton/WD/","qos":"2","broker":"7a840a3e.085984","x":268,"y":109,"wires":[["f7b827d2.c06358"]]},{"id":"f7b827d2.c06358","type":"split","z":"3184c35f.9c6f6c","name":"","splt":" ","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":494,"y":131,"wires":[["de3d28a6.46d508"]]},{"id":"de3d28a6.46d508","type":"switch","z":"3184c35f.9c6f6c","name":"route","property":"parts.index","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"2","vt":"num"},{"t":"eq","v":"3","vt":"num"},{"t":"eq","v":"4","vt":"num"},{"t":"eq","v":"5","vt":"num"}],"checkall":"true","repair":false,"outputs":5,"x":689,"y":539,"wires":[["ac7b2495.072268"],["f67efdc1.922c9"],["3edabef.cfd1642"],["dc4caa53.e2c0b8","1d404512.0be63b"],["e959a54f.7adff8"]]},{"id":"ac7b2495.072268","type":"ui_gauge","z":"3184c35f.9c6f6c","name":"","group":"d702a2bb.6772d","order":1,"width":"0","height":"0","gtype":"gage","title":"Average Wind Speed","label":"Knots","format":"{{value}}","min":0,"max":"50","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":1132.5,"y":133,"wires":[]},{"id":"f67efdc1.922c9","type":"ui_gauge","z":"3184c35f.9c6f6c","name":"","group":"d702a2bb.6772d","order":2,"width":"0","height":"0","gtype":"gage","title":"Wind Gust","label":"Knots","format":"{{value}}","min":0,"max":"50","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":1105,"y":232,"wires":[]},{"id":"3edabef.cfd1642","type":"ui_gauge","z":"3184c35f.9c6f6c","name":"Degrees","group":"d702a2bb.6772d","order":3,"width":"0","height":"0","gtype":"compass","title":"Wind Direction","label":"Degrees","format":"{{value}}

my bad
try again a new .zip update
the new setting was only being saved if you clicked on test send