Added MQTT support

One last think, are you planning to publish the individual measurements or a single json message with all the measurements?

Thanks
Renato

you can set to send custom data
e.g via custom tags, i.e you can set to send what ever you like
in the setup (you should have seen that)
otherwise the default is it sends the clientraw.txt file contents

No Brian, my question was:

“…otherwise the default is it sends the clientraw.txt file contents”

In this case, are you sending the content of the clientraw.txt as a single message or as a collection of messages, one for each measurement?

Example:

Southampton/WeatherDisplay/clientraw = “12345 1.4 2.6 277 15.8 42 1010.7 0.0 11.4 254.5 0.00 0.00 21.3 47 100.0 0 0.0 0 0 0.0 -54.4 255.0 -65.0 -67.8 -100.0 -100.0 -100 -100 -100 15 29 57 N3KJE-3:29:57_PM 0 100 10 4 0.00 0.00 100 100 100 100 100 15.8 14.5 16.3 4.2 0 Sunny/Dry -0.3 2 2 1 1 0 0 2 1 1 1 0 1 1 2 2 3 3 3 3 3 10.0 2.9 5315.8 4/10/2019 15.3 2.8 16.3 4.2 2.2 3 0 2 0 2 3 0 3 1 2 15.9 15.5 15.4 15.6 15.4 15.4 15.6 15.6 15.7 15.8 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 16.3 4.2 15.8 6.1 0 — — 316 0 0 -100.0 -100.0 22 -100 -100 -100 -100 733.0 22.4 20.0 21.5 1011.0 1006.3 10 2:43_PM 2:43_PM 23.5 3.1 6.9 1.9 4 2019 0.0 -1 -1 -1 290 294 236 263 302 305 304 267 92 277 0.0 255.0 1.6 10.0 40.18528 75.02556 0.0 91 40 0.0 5:49_AM 0.0 0.0 0.0 0.0 0.0 0.0 25.2 2:06_PM 5:49_AM 312 !!C10.37S93!!”

or as

Southampton/WeatherDisplay/ID_code = “12345”
Southampton/WeatherDisplay/Average_windspeed = “1.4”
Southampton/WeatherDisplay/Gust = “2.6”

Thanks
Renato

the former
would take a lot of message sends to send all that data

any application at the receiving end can digest out the data it needs, yes?
(e.g I was thinking this is a way to get data to a client version of WD or the WDliveapp )

nothing is as easy as it looks huh

have added ability to set port number and the QoS setting

Brian

Thanks for the quick turnaround. Unfortunately I will not be able to test it since my mosquitto uses authentication (username/pass).

Thanks
Renato

I forgot to add that
will do that now
stand by

done that now, download again…

Brian, it works.

3 questions

  1. Here is the message I see:
    bH9IkmPF7Lhvh5kgPLk5NhZ!12345 0.5 0.0 344 8.7 54 1017.1 0.0 11.4 254.5 0.00 0.00 20.9 47 100.0 13 0.0 0 0 0.0 -54.4 255.0 -65.0 -67.8 -100.0 -100.0 -100 -100 -100 22 49 16 N3KJE-10:49:16_PM 0 0 10 4 0.00 0.00 100 100 100 100 100 8.7 6.5 16.3 4.2 13 Night_time/Dry/Cloudy_with_clear_patches_ 1.5 1 1 2 2 2 2 1 1 1 1 1 0 0 0 0 0 0 0 0 0 10.0 -0.1 3625.5 4/10/2019 15.3 2.8 16.3 4.2 0.0 0 1 0 1 0 1 1 0 1 0 9.9 9.8 9.7 9.5 9.4 9.3 9.2 9.0 8.8 8.7 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 16.3 4.2 8.7 6.0 0 — — 308 0 0 -100.0 -100.0 0 -100 -100 -100 -100 0.0 22.4 20.0 7.4 1017.1 1006.3 7 9:49_PM 2:43_PM 23.5 3.1 6.9 -0.6 2 2019 0.0 -1 1 -1 199 92 67 87 89 73 214 215 252 344 0.0 255.0 0.3 5.2 40.18528 75.02556 0.0 91 38 0.0 5:49_AM 0.0 0.0 0.0 0.0 0.0 0.0 35.1 2:06_PM 5:49_AM 308 !!C10.37S94!!

I noticed that the message starts with a unique identifier and not !12345. Is that by design?

  1. Messages are published every 1 min. If I wanted to publish at the 2.5 sec interval supported by the Davis station, how would I do that?

  2. The windows task manager shows 2 instance of crowndmqtt.exe running at all times. Is this by design? Should it just be one?

Thanks again for adding this great new feature.

Renato

I could make it where you can set the identifier (clientID) (which is followed by a !)

re udpate rate, yes,i could make it where you set the update rate
there should be just the one running…maybe one has got stuck…kill it off?

download a new zip again
where I have added ability to set the clientID and the update rate (seconds)

Brian

Excellent job. Works as advertised.

May I make a suggestion? Perhaps the MQTT page most logical access should be from the “Control Panel” along with the other publications. My 2c.

Thanks again
Renato

maybe
but it is for the more advanced users, hence why its in the advanced setup

Brian

some new feedback. My MQTT server became unavailable earlier in the day. Later this evening I started the Task Manager on the machine running WD and noticed that there were hundreds of cronwdmqtt.exe processes running!

Are you starting a new process every time? Also, you may want to consider adding exception handling logic.

Renato

1 Like

i do have exception handling logic in place
the program should be closing after the data is sent
(and yes then a new one is spawned)
but what I could do is add a time out → close

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

Brian

would it make more sense to have the connection only be established at startup and leave it connected?

For example, I have built about a dozen IOT devices using ESP8266 which publish to an MQTT server every sec. I establish a connection as the ESP boots up. The only time I re-estaglish the connection is if the connection dies (i.e. wifi becomes unavailable, mqtt pod crashes etc) at which point, I try to reconnect every 5 mins.

I am not trying to tell you how to code, just a suggestion.

Renato

i was not really envisaging people wanting to send data frequently, that was all
otherwise yes I would do it that way, and still could yet
anyway , make sure to use this new update and see how that goes

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