cloudy cloudy

Author Topic: added MQTT support  (Read 971 times)

0 Members and 1 Guest are viewing this topic.

Offline Weather Display

  • Posts: 86,484
  • Davis VP2
  • New Zealand
  • OS/Browser:
  • Win NT 10.0
  • Chrome 73.0.3683.86
    • Weather Display
added MQTT support
« on: April 09, 2019, 02:01:48 AM »
to this version
http://www.weather-display.com/downloadfiles/weatherdisplaytest.zip

see under setup, advanced/misc

Offline vk2him

  • Posts: 669
  • Gerringong, NSW, Australia
  • OS/Browser:
  • Mac OS X 10.14.4
  • Chrome 73.0.3683.103
    • The Shack by the Beach
Re: added MQTT support
« Reply #1 on: April 09, 2019, 09:32:12 AM »
Nice - will this allow WD to read MQTT, or does WD publish data via MQTT?

My Solar system outputs MQTT - would be nice if WD could read that and display power generated etc

Offline Weather Display

  • Posts: 86,484
  • Davis VP2
  • New Zealand
  • OS/Browser:
  • Win NT 10.0
  • Chrome 73.0.3683.86
    • Weather Display
Re: added MQTT support
« Reply #2 on: April 09, 2019, 09:43:15 AM »
at this stage its just outputting it (but that output is echoed back so it can read it too)
I was thinking it could be a way to get the data to the WDliveapp or to a client version of WD

Offline vk2him

  • Posts: 669
  • Gerringong, NSW, Australia
  • OS/Browser:
  • Mac OS X 10.14.4
  • Chrome 73.0.3683.103
    • The Shack by the Beach
Re: added MQTT support
« Reply #3 on: April 09, 2019, 09:48:50 AM »
Good idea ... these are the MQTT messages my Solar system produces - it's night time so only power consumed at the moment (674 watts)

Latest MQTT message: /sensor/1ab4d6cd9f2981bfc3a4b40b0e54e47b/gauge, [1554803258,674,"W"]

Offline renatohtpc

  • Posts: 62
  • Southampton, PA
  • OS/Browser:
  • Mac OS X 10.14
  • Firefox 60.0
    • N3KJE
Re: added MQTT support
« Reply #4 on: April 10, 2019, 05:48:31 PM »
Brian

I saw the option under Advanced/Misc Settings.

1) Where do I enter the credentials to connect to a mosquitto server?
2) Can you also enter a port field for those of us who are running mqtt inside a K8 cluster (i.e. using a non standard port other than 1883).

This is a GREAT addition, because now we can expose the data to a variety of devices/targets (i.e use the ESP8266 to build a standalone weather display) in addition to materializing the data in a timeseries database (i.e. InfluxDB).

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

Offline Weather Display

  • Posts: 86,484
  • Davis VP2
  • New Zealand
  • OS/Browser:
  • Win NT 10.0
  • Chrome 73.0.3683.86
    • Weather Display
Re: added MQTT support
« Reply #5 on: April 10, 2019, 06:43:27 PM »
you can set the server address in the setup  different to the default test.mosquitto.org
is that what you mean? (or do you mean to enter a username/password credentials)
I will add where you can set the port

Offline renatohtpc

  • Posts: 62
  • Southampton, PA
  • OS/Browser:
  • Mac OS X 10.14
  • Firefox 60.0
    • N3KJE
Re: added MQTT support
« Reply #6 on: April 10, 2019, 07:01:20 PM »
Thanks Brian. Currently the page only has a "Server" field. What I am saying is that we should have a total of 4 text boxes:
1) Server (already there)
2) port number
3) Username
4) Password

Also, does the component you are currently use support QoS? If so, you may also want to add a 5th text box for that and perhaps have it default to "0". QoS currently only supports these 3 options:

0: The broker/client will deliver the message once, with no confirmation.
1: The broker/client will deliver the message at least once, with confirmation required.
2: The broker/client will deliver the message exactly once by using a four step handshake.

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

Offline Weather Display

  • Posts: 86,484
  • Davis VP2
  • New Zealand
  • OS/Browser:
  • Win NT 10.0
  • Chrome 73.0.3683.86
    • Weather Display
Re: added MQTT support
« Reply #7 on: April 10, 2019, 07:05:19 PM »
yes, there are last will and testiment settings
I can add that option too

I will do this today and let you know

Offline renatohtpc

  • Posts: 62
  • Southampton, PA
  • OS/Browser:
  • Mac OS X 10.14
  • Firefox 60.0
    • N3KJE
Re: added MQTT support
« Reply #8 on: April 10, 2019, 07:10:46 PM »
One last think, are you planning to publish the individual measurements or a single json message with all the measurements?

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

Offline Weather Display

  • Posts: 86,484
  • Davis VP2
  • New Zealand
  • OS/Browser:
  • Win NT 10.0
  • Chrome 73.0.3683.86
    • Weather Display
Re: added MQTT support
« Reply #9 on: April 10, 2019, 07:21:07 PM »
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

Offline renatohtpc

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

Offline Weather Display

  • Posts: 86,484
  • Davis VP2
  • New Zealand
  • OS/Browser:
  • Win NT 10.0
  • Chrome 73.0.3683.86
    • Weather Display
Re: added MQTT support
« Reply #11 on: April 10, 2019, 08:05:09 PM »
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

Offline Weather Display

  • Posts: 86,484
  • Davis VP2
  • New Zealand
  • OS/Browser:
  • Win NT 10.0
  • Chrome 73.0.3683.86
    • Weather Display
Re: added MQTT support
« Reply #12 on: April 10, 2019, 11:29:21 PM »
have added ability to set port number and the QoS setting

Offline renatohtpc

  • Posts: 62
  • Southampton, PA
  • OS/Browser:
  • Mac OS X 10.14
  • Firefox 60.0
    • N3KJE
Re: added MQTT support
« Reply #13 on: April 11, 2019, 01:01:05 AM »
Brian

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

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

Offline Weather Display

  • Posts: 86,484
  • Davis VP2
  • New Zealand
  • OS/Browser:
  • Win NT 10.0
  • Chrome 73.0.3683.86
    • Weather Display
Re: added MQTT support
« Reply #14 on: April 11, 2019, 01:23:04 AM »
I forgot to add that
will do that now
stand by