Wetbulb Temperature User Defined Plugin Weatherstation

This section covers the Meteobridge PRO, NANO SD and Raspberry Pi units exclusively

Moderator: Mattk

Post Reply
User avatar
AlaskaWX
Junior Boarder
Junior Boarder
Posts: 33
Joined: Thu Apr 05, 2012 7:46 pm

Wetbulb Temperature User Defined Plugin Weatherstation

Post by AlaskaWX »

I've worked up a Meteobridge compatible "AWK script" version of my wetbulb temperature calculation plugin weather station. I've made the code pubiically available on github at:

https://github.com/TrimbleSoftware/mbwbpi

See the github README.md file for more information on how it works and how to install it.

For those of you that are interested in snow forecasting or snow making this can be an interesting addition to your weather station data.

Feel free to give it a try and see how it works for you.
Davis VP2 with IIS and Leaf/Soil + numerous user defined plugin weather stations

User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 6631
Joined: Mon Oct 01, 2007 10:51 pm

Re: Wetbulb Temperature User Defined Plugin Weatherstation

Post by admin »

Interesting! Thanks for sharing!

User avatar
AlaskaWX
Junior Boarder
Junior Boarder
Posts: 33
Joined: Thu Apr 05, 2012 7:46 pm

Re: Wetbulb Temperature User Defined Plugin Weatherstation

Post by AlaskaWX »

Just commited an update to github. Added an optional snowmaking rank output on data1 sensor. This will be of interest to Meteobridge users that are interested in snowmaking. :mrgreen:
Davis VP2 with IIS and Leaf/Soil + numerous user defined plugin weather stations

azchrisf
Senior Boarder
Senior Boarder
Posts: 40
Joined: Thu Aug 17, 2017 5:30 am

Re: Wetbulb Temperature User Defined Plugin Weatherstation

Post by azchrisf »

I've installed it on my station and it doesn''t seem to work.
This is all I get in the log:

logger (02.02.2021 10:33:53): connect station 2 (User-defined via Plug-in).
logger (02.02.2021 10:33:53): station 2 (User-defined), unexpected 0 bytes.
logger (02.02.2021 10:33:53): disconnect station 2 (User-defined): response without data

User avatar
AlaskaWX
Junior Boarder
Junior Boarder
Posts: 33
Joined: Thu Apr 05, 2012 7:46 pm

Re: Wetbulb Temperature User Defined Plugin Weatherstation

Post by AlaskaWX »

azchrisf wrote:
Tue Feb 02, 2021 7:34 pm
I've installed it on my station and it doesn''t seem to work.
This is all I get in the log:

logger (02.02.2021 10:33:53): connect station 2 (User-defined via Plug-in).
logger (02.02.2021 10:33:53): station 2 (User-defined), unexpected 0 bytes.
logger (02.02.2021 10:33:53): disconnect station 2 (User-defined): response without data
Are you using a Meteobridge deice with a "scripts" folder?

The files mbwbpi.plugin (the awk script) and mbwbpi (config file) both have to go into the scripts folder. When setting up the user defined plugin weather station after selecting script:mbwbp from the Select Plugin dropdown list, be sure to click the "Reload Plugin" button before clicking Save.

MB outputs a superflous error, but it still works on my MB:

Code: Select all

Error (Station #1): Download of plugin script failed: No such file or directory
MB screen should look like this:
mb ss.png
mb ss.png (59.92 KiB) Viewed 336 times
If you can connect to your Meteobridge device using an ssh session as a test, see if you can execute the plugin directly from the command line like this:

Code: Select all


awk -f /tmp/mnt/data/scripts/mbwbpi.plugin

if awk can run the script it will output a few entries into the MB logfile at /tmp/log/meteobridge.log:

Code: Select all

mbwbpi (02.02.2021 12:52:22): wetbulb temp plugin weather station (version 1.1b) started.
mbwbpi (02.02.2021 12:52:22): polling interval 60 seconds.
mbwbpi (02.02.2021 12:52:22): mb logger command line: wget -q -O - http://localhost/public/template.cgi?template=[th0temp-act]%09[th0hum-act]%09[thb0press-act]&contenttype=text/plain;charset=iso-8859-1
mbwbpi (02.02.2021 12:52:22): inital sleep 38 seconds.
and then start outputting data to stdout (the ssh console) like this:

Code: Select all

t0 85
data0 0
data1 0
t0 65
data0 0
data1 0
Davis VP2 with IIS and Leaf/Soil + numerous user defined plugin weather stations

azchrisf
Senior Boarder
Senior Boarder
Posts: 40
Joined: Thu Aug 17, 2017 5:30 am

Re: Wetbulb Temperature User Defined Plugin Weatherstation

Post by azchrisf »

Yes I have a Pro Red.
Here is the output from the ssh console:
awk: /tmp/mnt/data/scripts/mbwbpi.plugin:83: Unexpected token

Thank you for posting that, once it output the line number I looked and it looks like you did not close your if-else statement with braces. Fixed that and testing now. Seems to work good at this point once that was fixed, may want to update your github code.

I congratulate you on a very useful plugin! Unfortunanetly, it serves no use for me because I'm in Phoenix. But one thing I would implore you to do - that is write more plugins. You have a talent sir!

User avatar
AlaskaWX
Junior Boarder
Junior Boarder
Posts: 33
Joined: Thu Apr 05, 2012 7:46 pm

Re: Wetbulb Temperature User Defined Plugin Weatherstation

Post by AlaskaWX »

azchrisf wrote:
Wed Feb 03, 2021 3:56 am
Yes I have a Pro Red.
Here is the output from the ssh console:
awk: /tmp/mnt/data/scripts/mbwbpi.plugin:83: Unexpected token

Thank you for posting that, once it output the line number I looked and it looks like you did not close your if-else statement with braces. Fixed that and testing now. Seems to work good at this point once that was fixed, may want to update your github code.
...
The single line following an if condition shouldn't have to be grouped with braces: http://www.math.utah.edu/docs/info/gawk_10.html#SEC99

I wonder if the problem was caused by CRLF vs LF in the awk script file? Did you copy (or edit) it from Windows to the MB Pro Red Samba share? I don't know how the BusyBox awk treats CRLF instead of LF in awk code read in from a file. I edit files on Linux and use scp to copy files back and forth so extra CRLFs aren't added.

I'm using the same exact code as in the git-hub repository and of course I don't see the parsing problem you saw.

Can you paste a code snippet of what you added to get it working? I'll see if it should be added to the git-hub repository.
azchrisf wrote:
Wed Feb 03, 2021 3:56 am
...
I congratulate you on a very useful plugin! Unfortunanetly, it serves no use for me because I'm in Phoenix.
...
I see that it snowed last week in the Tuson area so maybe snow forecasting may end up being usful in Phoenix someday... :roll: :mrgreen:
azchrisf wrote:
Wed Feb 03, 2021 3:56 am
...
But one thing I would implore you to do - that is write more plugins. You have a talent sir!
I've been in software development for over 40 years. Writing plugin weather station code is a fun and entertaining exercise. There has to be a need to fulfill in writing plugin code. If there is a need, a solution can be found. Necessity is the mother of invention when it comes to plugins! :!:
Davis VP2 with IIS and Leaf/Soil + numerous user defined plugin weather stations

azchrisf
Senior Boarder
Senior Boarder
Posts: 40
Joined: Thu Aug 17, 2017 5:30 am

Re: Wetbulb Temperature User Defined Plugin Weatherstation

Post by azchrisf »

I copied the files directly out of the archive to the MB, and I use Ultraedit which preserves whichever line ending format that is used.
You did not enclose your if with the { and }, it may have to do with it branching to an "else" that caused the problem? Dunno.
if(Ediff == 0.0)
break
else
{
if(Ediff < 0.0)
{
I added it/changed it to this:
if(Ediff == 0.0) {
break
} else {
if(Ediff < 0.0)
{
Not sure why it runs fine on yours and not mine...Hope this helps.

Post Reply