cloudy cloudy

Author Topic: added MQTT support  (Read 3858 times)

0 Members and 1 Guest are viewing this topic.

Offline renatohtpc

  • Posts: 87
  • Southampton, PA
  • OS/Browser:
  • Mac OS X 10.14
  • Firefox 60.0
    • N3KJE
Re: added MQTT support
« Reply #30 on: April 12, 2019, 01:02:03 PM »
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
Thanks
Renato
Davis Vantage Pro 2 - 6163
https://www.n3kje.net/weather/Southampton/

Offline Weather Display

  • Posts: 87,027
  • Davis VP2
  • New Zealand
  • OS/Browser:
  • Win NT 10.0
  • Chrome 73.0.3683.86
    • Weather Display
Re: added MQTT support
« Reply #31 on: April 12, 2019, 07:00:54 PM »
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?

Offline renatohtpc

  • Posts: 87
  • Southampton, PA
  • OS/Browser:
  • Mac OS X 10.14
  • Firefox 60.0
    • N3KJE
Re: added MQTT support
« Reply #32 on: April 12, 2019, 10:17:04 PM »
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
Thanks
Renato
Davis Vantage Pro 2 - 6163
https://www.n3kje.net/weather/Southampton/

Offline Weather Display

  • Posts: 87,027
  • Davis VP2
  • New Zealand
  • OS/Browser:
  • Win NT 10.0
  • Chrome 73.0.3683.86
    • Weather Display
Re: added MQTT support
« Reply #33 on: April 13, 2019, 03:40:07 AM »
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

Offline Weather Display

  • Posts: 87,027
  • Davis VP2
  • New Zealand
  • OS/Browser:
  • Win NT 10.0
  • Chrome 73.0.3683.103
    • Weather Display
Re: added MQTT support
« Reply #34 on: April 13, 2019, 10:48:49 PM »
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

Offline renatohtpc

  • Posts: 87
  • Southampton, PA
  • OS/Browser:
  • Mac OS X 10.14
  • Firefox 60.0
    • N3KJE
Re: added MQTT support
« Reply #35 on: April 14, 2019, 11:42:30 AM »
Brian

deployed the new version. Everything working.

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

Thanks again
Renato.
Thanks
Renato
Davis Vantage Pro 2 - 6163
https://www.n3kje.net/weather/Southampton/

Offline Weather Display

  • Posts: 87,027
  • Davis VP2
  • New Zealand
  • OS/Browser:
  • Win NT 10.0
  • Chrome 73.0.3683.103
    • Weather Display
Re: added MQTT support
« Reply #36 on: April 14, 2019, 06:36:29 PM »
there is now the opportunity for other software developers to use the MQTT message data to add on services?

Offline renatohtpc

  • Posts: 87
  • Southampton, PA
  • OS/Browser:
  • Mac OS X 10.14
  • Firefox 60.0
    • N3KJE
Re: added MQTT support
« Reply #37 on: April 15, 2019, 10:28:18 PM »
Brian

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



Renato
Thanks
Renato
Davis Vantage Pro 2 - 6163
https://www.n3kje.net/weather/Southampton/

Offline Weather Display

  • Posts: 87,027
  • Davis VP2
  • New Zealand
  • OS/Browser:
  • Win NT 10.0
  • Chrome 73.0.3683.103
    • Weather Display
Re: added MQTT support
« Reply #38 on: April 15, 2019, 11:20:52 PM »
kewl
I thought there might be a way to drive a live web site , yes?
so no ftp need to get your data there

Offline renatohtpc

  • Posts: 87
  • Southampton, PA
  • OS/Browser:
  • Mac OS X 10.14
  • Firefox 60.0
    • N3KJE
Re: added MQTT support
« Reply #39 on: April 16, 2019, 01:23:33 AM »
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.

Code: [Select]
[{"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 :)

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
Thanks
Renato
Davis Vantage Pro 2 - 6163
https://www.n3kje.net/weather/Southampton/

Offline Weather Display

  • Posts: 87,027
  • Davis VP2
  • New Zealand
  • OS/Browser:
  • Win NT 10.0
  • Chrome 73.0.3683.103
    • Weather Display
Re: added MQTT support
« Reply #40 on: April 16, 2019, 02:15:28 AM »
yup, i can add option to send customclientraw instead

Offline Weather Display

  • Posts: 87,027
  • Davis VP2
  • New Zealand
  • OS/Browser:
  • Win NT 10.0
  • Chrome 73.0.3683.103
    • Weather Display
Re: added MQTT support
« Reply #41 on: April 16, 2019, 03:27:04 AM »
i have added that option now to the latest .zip update (normal download)

Offline renatohtpc

  • Posts: 87
  • Southampton, PA
  • OS/Browser:
  • Mac OS X 10.14
  • Firefox 60.0
    • N3KJE
Re: added MQTT support
« Reply #42 on: April 16, 2019, 03:50:00 AM »
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
Thanks
Renato
Davis Vantage Pro 2 - 6163
https://www.n3kje.net/weather/Southampton/

Offline vk2him

  • Posts: 674
  • Gerringong, NSW, Australia
  • OS/Browser:
  • Win 7/Srvr 2008R2
  • Chrome 73.0.3683.103
    • The Shack by the Beach
Re: added MQTT support
« Reply #43 on: April 16, 2019, 03:51:17 AM »
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

Offline renatohtpc

  • Posts: 87
  • Southampton, PA
  • OS/Browser:
  • Mac OS X 10.14
  • Firefox 60.0
    • N3KJE
Re: added MQTT support
« Reply #44 on: April 16, 2019, 04:06:40 AM »
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:

Code: [Select]
[{"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}}","min":0,"max":"360","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":1096,"y":318,"wires":[]},{"id":"dc4caa53.e2c0b8","type":"ui_gauge","z":"3184c35f.9c6f6c","name":"","group":"5d2a75f7.ea33cc","order":1,"width":"0","height":"0","gtype":"gage","title":"Outside Temp","label":"C","format":"{{value}}","min":"-40","max":"50","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":1109,"y":417,"wires":[]},{"id":"e959a54f.7adff8","type":"ui_gauge","z":"3184c35f.9c6f6c","name":"","group":"5d2a75f7.ea33cc","order":2,"width":"0","height":"0","gtype":"gage","title":"Outside Hum","label":"%","format":"{{value}} %","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":1101,"y":514,"wires":[]},{"id":"1d404512.0be63b","type":"function","z":"3184c35f.9c6f6c","name":"Metric/Imperial","func":"var tempc = msg.payload;\nif UOM.global == true\n\ntempf = tempc * 9/5 + 32;\ntempf = Math.round(tempf * 10) / 10;\nmsg.payload = tempf;\nreturn msg;","outputs":1,"noerr":7,"x":1108,"y":601,"wires":[[]]},{"id":"a86e04ef.448df8","type":"ui_switch","z":"3184c35f.9c6f6c","name":"UOM","label":"UOM","tooltip":"","group":"5d2a75f7.ea33cc","order":0,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"global","onicon":"","oncolor":"","offvalue":"false","offvalueType":"global","officon":"","offcolor":"","x":1087,"y":658,"wires":[[]]},{"id":"7a840a3e.085984","type":"mqtt-broker","z":"","name":"MQTT on ICP Node0","broker":"192.168.1.50","port":"30925","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"d702a2bb.6772d","type":"ui_group","z":"","name":"Wind","tab":"eb9cf7e0.fcf888","order":1,"disp":true,"width":"6","collapse":false},{"id":"5d2a75f7.ea33cc","type":"ui_group","z":"","name":"Outside","tab":"eb9cf7e0.fcf888","order":2,"disp":true,"width":"6","collapse":false},{"id":"eb9cf7e0.fcf888","type":"ui_tab","z":"","name":"Southampton","icon":"dashboard","order":1,"disabled":false,"hidden":false}]
If you have a blank flow, then you are ok with selecting the option "Import to current flow" else select "New Flow"

4) Double click on the Southampton/WD/ MQTT node and enter your mqtt information (i.e. ip address, login details and topic)

5) Now you should see a red message appear on the top right (to the LT of the hamburger menu) that says "Deploy". Click on that.

6) open a new tab and navigate to http://IP_ADDRESS:1880/ui/#!/0

You should now see the dashboard.


Hope this helps.

Renato
Thanks
Renato
Davis Vantage Pro 2 - 6163
https://www.n3kje.net/weather/Southampton/

 

cumulus