cloudy cloudy

Author Topic: added MQTT support  (Read 3492 times)

0 Members and 1 Guest are viewing this topic.

Online Weather Display

  • Posts: 86,945
  • Davis VP2
  • New Zealand
  • OS/Browser:
  • Win NT 10.0
  • Chrome 73.0.3683.103
    • Weather Display
Re: added MQTT support
« Reply #45 on: April 16, 2019, 04:24:04 AM »
my bad
try again a new .zip update
the new setting was only being saved if you clicked on test send

Offline renatohtpc

  • Posts: 87
  • Southampton, PA
  • OS/Browser:
  • Mac OS X 10.14
  • Firefox 60.0
    • N3KJE
Re: added MQTT support
« Reply #46 on: April 16, 2019, 04:35:27 AM »
Brian

I am still not seeing the field names as part of the message. Just the values (and not a key/value combo).

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

Online Weather Display

  • Posts: 86,945
  • Davis VP2
  • New Zealand
  • OS/Browser:
  • Win NT 10.0
  • Chrome 73.0.3683.103
    • Weather Display
Re: added MQTT support
« Reply #47 on: April 16, 2019, 05:42:50 AM »

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 #48 on: April 16, 2019, 06:22:55 AM »
Thanks Renato - good to see a fellow ham!!

I'll follow these instructions when I'm home from work and report back - cheers!

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 #49 on: April 16, 2019, 07:47:11 AM »
Hi Renato,

I'm having trouble configuring WD for mqtt - I'm not sure if I've configured it correctly or I've got Node-Red wrong?

Server - I'm using the IP address of the PC that's running WD - is that correct? 192.168.1.75
Port 1883
Client ID I left blank but I tried 99 with no luck
QoS - At most once
Topic is Gerringong/WD/
blank username password
update rate 60 or 10 made no difference

When cron WD MQTT ver 1.6 starts - opening teh windo shows blank in Received and Status and Message to send says:

This action requires a connected state (C:\Users\Brian\Documents\tmssoftware\TMS MQTT\TMS.MQTT.Client.pas, line 518)

I configured Node-Red using your script and matched the same settings for Topic - QOS 0 - Server 192.168.1.75 and port 1883 - blamk Client ID and user/password blank.

After deploying and restarting flows it says connecting  with nothing else.

Any clues? Thanks
« Last Edit: April 16, 2019, 07:55:28 AM by vk2him »

Offline renatohtpc

  • Posts: 87
  • Southampton, PA
  • OS/Browser:
  • Mac OS X 10.14
  • Firefox 60.0
    • N3KJE
Re: added MQTT support
« Reply #50 on: April 16, 2019, 11:06:24 AM »
Brian

Yes, now it works.


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

Offline renatohtpc

  • Posts: 87
  • Southampton, PA
  • OS/Browser:
  • Mac OS X 10.14
  • Firefox 60.0
    • N3KJE
Re: added MQTT support
« Reply #51 on: April 16, 2019, 11:25:57 AM »
vk2him

First I would download mqtt-spy. This utility allows you to connect to the mqtt server and validate that mosquitto is properly configured and up and running.

You can find it here https://github.com/eclipse/paho.mqtt-spy/wiki/Downloads

Once started go to Connections -> Manage connections to create a new one for your environment.  With a new connection created, click on "Control Panel". You should now see a button for your server appear in the middle section. Click on it. If it turns green then it means that your mqtt server is up and running.

Next check your WD setting:

I am attaching a screenshot of my setup. Please noe:

1) I am using a non-standard port (i.e. 30925 rather than the default1883)
2) make sure that the "send customclientraw is NOT checked since the version of teh dashboard I shared with you was created using clientraw.

Let me know if this works for you.



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 #52 on: April 16, 2019, 11:02:06 PM »
Thanks for the help Renato - I think I see my problem. I'm assuming your ip address 192.168.1.50 you have setup in WD is your mqtt server?

I didn't realise I needed a mqtt server - I have a Solar/Power meter that directly outputs mqtt and I've been able to connect and receive data using Node-Red running on my Synology directly connected to the solar meter without needing a mqtt server. I (wrongly) assumed WD was also able to also directly connect without a mqtt server.

So now I'll investigate mqtt servers - it may be better to run the mqqt server on my Synology than on the Windows10 laptop that WD is currently running.
I'll try again tonight
Regards
Ian

Offline niko

  • syzygy
  • Global Moderator
  • Posts: 28,075
  • Crystal Ball broken! Please post the URL.
  • Northern California, U.S.A.
  • OS/Browser:
  • Win 7/Srvr 2008R2
  • Chrome 73.0.3683.103
Re: added MQTT support
« Reply #53 on: April 16, 2019, 11:11:48 PM »
Might be worth to check out CloudMQTT.com, they have a free option.

Offline renatohtpc

  • Posts: 87
  • Southampton, PA
  • OS/Browser:
  • Mac OS X 10.14
  • Firefox 60.0
    • N3KJE
Re: added MQTT support
« Reply #54 on: April 16, 2019, 11:13:23 PM »
Ian

If this is an option for you, I would probably invest in a Raspberry Pi 3B+ and deploy Mosquitto there.  Later on, you may also want to install there MySQL/MariaDB etc.

Personally I like to "leave the NAS" alone.

My 2c

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 #55 on: April 16, 2019, 11:32:07 PM »
Thanks Renato - I have mariaDb and mysql working successfully on my Synology - it gathers data from my Blitzortung lightning detector:


http://www.theshackbythebeach.com:443/mybo/index.php?bo_page=map

I'll investigate teh options tonight - thansk for the suggestions - cheers

Offline vk2him

  • Posts: 674
  • 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 #56 on: April 18, 2019, 12:22:55 PM »
Hi Renato - It's taken me a few days to do testing etc

Partial success - long story short - for unknown reasons running Node-red on my Synology won't allow me to connect to the Mqtt broker thats also running on the Synology. WD is able to publish to the broker fine and I can subscribe to the broker using a test mqtt.fx app. I can connect from Node-red on the synology to another mqtt device on a different IP and it works fine, I even created some new gauges to display the other mqtt data. I then tried installing Node-red on my windows laptop and I could connect to the Synology broker and display the WD gauges.

So something is broken on the Synology that doesn't allow Node-red to connect - I tried localhost and 127.0.0.1 as well as the IP of the Synology without luck. I even tried a different Node-red docker container and it had the same problem.

I'll keep checking ... thanks anyway
Cheers

Offline renatohtpc

  • Posts: 87
  • Southampton, PA
  • OS/Browser:
  • Mac OS X 10.14
  • Firefox 60.0
    • N3KJE
Re: added MQTT support
« Reply #57 on: April 18, 2019, 01:49:07 PM »
Brian/Ian

Here is an example of the "art of possible" I came across last night.

https://pysselilivet.blogspot.com/2018/09/weatherlink-weather-template_26.html

To implement this, all is needed is to replace the WeatherLink source (i.e. the http request object) with the message coming from WD. Also, some of the Function objects would have to be modified as well to account for available datapoints.

Next
1) Currently working on a NR script that would persist the message in a MySQL database.  Trying to decide if storing the message as a single JSON datatype or individual columns......
2) Persist the data in a timeseries database (i.e. InfluxDB) for later rendering on a dashboard (i.e. Grafana)

Next we could look at replacing the FTP process all together by having a script run on the web server that would subscribe to the message and convert it into a text file to b e stored locally (i.e. pull vs push).

Will keep you posted on the progress

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

Offline renatohtpc

  • Posts: 87
  • Southampton, PA
  • OS/Browser:
  • Mac OS X 10.14
  • Firefox 60.0
    • N3KJE
Re: added MQTT support
« Reply #58 on: April 20, 2019, 05:31:09 AM »
And there you have it.

Data is being persisted in an InfluxDB TimeSeries database and the data is rendered on the Grafana dashboard.


For this to be possible, I had to:
1) Strip the "Client ID" from the message, since its presence would result in an incorrect JSON structure
2) All the values in the customomclientraw file are entered in double quotes. This means that every datatype would be created as strings. I went thru the entire structure of the file and removed the double quotes on those fields that would generate float values (i.e temp, tempTL, tempTH, intemp etc)

3) Brian, I noticed that the 2 values for presstrendval and temptrend should be of type float but they are actually being generated as strings (since values greater than 0 are created with a leading "+" sign). Is this by design?

 

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

Online Weather Display

  • Posts: 86,945
  • Davis VP2
  • New Zealand
  • OS/Browser:
  • Win NT 10.0
  • Chrome 73.0.3683.103
    • Weather Display
Re: added MQTT support
« Reply #59 on: April 20, 2019, 07:19:18 AM »
re your Q 2, is this for the customclientraw, or?

also have you come across the MQTT skin
Belchertown