New plugin weatherflow

Post Reply
davidefa
Expert
Expert
Posts: 862
Joined: Tue Jan 12, 2021 8:03 am
Location: Italy
Station model: WH2650
Software: WH2650 (direct upload)
Contact:

New plugin weatherflow

Post by davidefa » Sat Aug 28, 2021 5:06 pm

Added a plugin to receive data from the weatherflow weather station ( via their online service )

- configure the plugin inserting 'access token' and 'station id' ( available via tempestwx.com )
- copy the script weatherflowUpdate.php to load/crons and setup a CRON job ( if not already created ) to execute load/cron.php?password=xxx ( I think 1 minute is ok for the cron job )
only the following fields are converted in the corresponding meteotemplate filed:

Code: Select all

["timestamp"]                      ["U"]
["air_temperature"]                ["T"]
["sea_level_pressure"]             ["P"]
["relative_humidity"]              ["H"]
["precip_accum_local_day"]         ["R"]
["precip_accum_last_1hr"]          ["RR"]
["wind_avg"]                       ["W"]
["wind_direction"]                 ["B"] 
["wind_gust"]                      ["G"]
["solar_radiation"]                ["S"]
["uv"]                             ["UV"]
["lightning_strike_last_epoch"]    ["LT"]
["lightning_strike_last_distance"] ["LD"]
["lightning_strike_count"]         ["L"] 
If the last option 'Add All Fields' is set to yes all watherflow fields will be added to the meteotemplateLive.txt ( even those that have no corresponding field in meteotemplate ), to be used by blocks that retrieve the 'current condition' from meteotemplateLive.txt.



weatherflow3.png
weatherflow3.png (366.86 KiB) Viewed 3831 times
Attachments
weatherflow_0.3.zip
(4.85 KiB) Downloaded 78 times
Last edited by davidefa on Mon Oct 11, 2021 6:51 am, edited 1 time in total.
Image

User avatar
Daali
Advisor
Advisor
Posts: 56
Joined: Mon Jul 26, 2021 8:06 pm
Location: Georgia, US
Station model: Ecowitt GW1002
Software: Meteobridge, FOSHKplugin
Contact:

Re: New plugin weatherflow

Post by Daali » Sat Aug 28, 2021 7:13 pm

Great Work davidefa!
https://www.jeffersonweather.com
GW1000 gateway
WS68 Anemometer
WH40 Rain Gauge
WH32 Temp/Hum
WH57 Lightning
WH41 PM2.5 Air Quality
WH45 PM2.5/10/Co2 Air Quality
WN34S Soil temperature
WH31SM Soil Moisture

snow
Observer
Observer
Posts: 10
Joined: Sat Oct 07, 2017 11:33 am
Station model: Davis Vantage Pro 2
Software: Weather Display

Re: New plugin weatherflow

Post by snow » Mon Aug 30, 2021 6:25 am

Excelent work davidefa, thank you very much!

Julius
Advisor
Advisor
Posts: 89
Joined: Fri Sep 24, 2021 10:41 pm
Station model: Barani MeteoHelix
Software: meteobridge

Re: New plugin weatherflow

Post by Julius » Mon Oct 04, 2021 12:30 pm

Wow, this makes the entire flow with the meteobridge I have at home obsolete, for tempest data at least.
I will now have to consider putting the meteotemplate site on the remote server I own, instead of proxying to my LAN server.

Perhaps a Lightning data Block would be possible from this? Since that data is actually NOT obtained from the WF Tempest or its hub alone, but requires post-processing by weatherflow's servers, so as long as that is the source, the data is already there.

This also makes it interesting to merge/add this data as secondary or third sensors. I currently have T, RH, Pressure, Solar and wind from barani devices, but I would like to add all the tempest data as secondaries or thirds. There's also a homemade sensor-suite for T and H I want to add. And, my girlfriend has a netatmo weather station suite I would like to add as a source, so I could actually graph 3 or 4 together and compare. Anyway, lots of ideas. Thanks Davide!
Image

davidefa
Expert
Expert
Posts: 862
Joined: Tue Jan 12, 2021 8:03 am
Location: Italy
Station model: WH2650
Software: WH2650 (direct upload)
Contact:

Re: New plugin weatherflow

Post by davidefa » Sat Oct 09, 2021 8:49 pm

Julius wrote: Mon Oct 04, 2021 12:30 pm Perhaps a Lightning data Block would be possible from this? Since that data is actually NOT obtained from the WF Tempest or its hub alone, but requires post-processing by weatherflow's servers, so as long as that is the source, the data is already there.
Sorry, not sure to understand correctly what you say.
All data are retrieved from the weatherflow server via their api ( not from the hub directly ).
And yes, several of these data are processed by their servers ( at least temperature, rain, lightning ).
Lightning data is already available and is converted to LT,LD, and L meteotemplate fields.
Raffaello Di Martino wrote a block to show lightning data.


lightning.png
lightning.png (27.35 KiB) Viewed 3717 times
Image

Julius
Advisor
Advisor
Posts: 89
Joined: Fri Sep 24, 2021 10:41 pm
Station model: Barani MeteoHelix
Software: meteobridge

Re: New plugin weatherflow

Post by Julius » Sun Oct 10, 2021 10:38 pm

davidefa wrote: Sat Aug 28, 2021 5:06 pm - copy the script weatherflowUpdate.php to load/crons and setup a CRON job ( if not already created ) to execute load/cron.php?password=xxx ( I think i minute is ok for the cron job )
This is new to me, and I can't see anything about it in the wiki. So does your plugin require mtwebroot/load/cron.php to be run? And if so, where do I set that password you've entered here?
Image

davidefa
Expert
Expert
Posts: 862
Joined: Tue Jan 12, 2021 8:03 am
Location: Italy
Station model: WH2650
Software: WH2650 (direct upload)
Contact:

Re: New plugin weatherflow

Post by davidefa » Mon Oct 11, 2021 10:38 am

Yes the plugin require a cron job.
1) copy the script weatherflowUpdate.php to load/crons
2) create a cron job to execute load/cron.php?password=xxx ( insert your update password )

When you create a cron job you have to specify the complete command to execute.
For example something like this ( but this depends on your system ):
wget http://www.yoursite.com/template/load/c ... ssword=xxx

NOTE
In the meteotemplate 'philosophy' you only need 1 cron job. This cron job will execute all scripts present in load/crons directory ( even other scripts you'll add later, for example to manage your webcam )

P.S:
For your cron job you can use even online services like this one: https://cron-job.org/en/
The free plan ( 5 minutes min ) can be used for testing, super simple to setup ( not super accurate timinig )
A 'local' cron job is preferred.
Image

Julius
Advisor
Advisor
Posts: 89
Joined: Fri Sep 24, 2021 10:41 pm
Station model: Barani MeteoHelix
Software: meteobridge

Re: New plugin weatherflow

Post by Julius » Mon Oct 11, 2021 12:14 pm

Thanks, I know about cron, but I wasn't sure about the password. So it is the "update" password set under Meteotemplate Settings.
For me that would be this in crontab;

Code: Select all

*/2 * * * * root /usr/bin/php -f /var/www/html/mt/load/cron.php?password=myMTupdatepass
Image

davidefa
Expert
Expert
Posts: 862
Joined: Tue Jan 12, 2021 8:03 am
Location: Italy
Station model: WH2650
Software: WH2650 (direct upload)
Contact:

Re: New plugin weatherflow

Post by davidefa » Mon Oct 11, 2021 1:55 pm

Ok
Image

Julius
Advisor
Advisor
Posts: 89
Joined: Fri Sep 24, 2021 10:41 pm
Station model: Barani MeteoHelix
Software: meteobridge

Re: New plugin weatherflow

Post by Julius » Tue Oct 12, 2021 10:03 am

davidefa wrote: Sat Oct 09, 2021 8:49 pm Lightning data is already available and is converted to LT,LD, and L meteotemplate fields.
Strangely, my meteotemplate live file does not have L, LT or LD entries, while both my meteobridge pro and your plugin should add those, right?
Raffaello Di Martino wrote a block to show lightning data.
The README file included there says:

Code: Select all

The Meteotemplate doesn't have the L, LD, LT, fields in the database and in the api.php so
there are more files to update.
You find them in the Meteotemplate directory of my github:

"api.php" and all the "update/" directory.
The files inside the update directory must be in the directory of Meteotemplate
with the same name "update"

https://github.com/iz0qwm/ecowitt_http_gateway/tree/master/Meteotemplate

NOT the "plugins/ecowitt", you don't need it if you don't use the Ecowitt plugin.

I don't know if Meteobridge sends the lightning data to meteotemplate so please check this
before installing this plugin if you have such hardware.
So, this requires quite a bit of updating of core MeteoTemplate files (which are hard to even download by the way), this should not be needed, Jachym does not recommend doing it like this;
"from my understanding, if it works the same way as my other plugins written for some specific station models, then api.php should not be replaced. The way "my" plugins work is that they receive data, convert it to a format acceptable for the universal api.php script and send the data to the api.php, which does the rest of the processing.
So no, I would not replace api.php, i would install this as a regular plugin. It is just the CRON job URL which is then not the api.php, but the plugin URL."
Image

davidefa
Expert
Expert
Posts: 862
Joined: Tue Jan 12, 2021 8:03 am
Location: Italy
Station model: WH2650
Software: WH2650 (direct upload)
Contact:

Re: New plugin weatherflow

Post by davidefa » Tue Oct 12, 2021 11:51 am

Please add a link to your site ( need to check the cache directory ).
- are you updating the meteotemplate database via meteobridge and the weatherflow plugin ( at the same time )? This should be done with caution ( it has some side effect )
- I think meteobridge does not automatically send lightning data, but you have to configure it to do so ( there is a thread on wxforum )

If you only want to use the lightning block you don't need any api.php or update/apiSetup.php change ( as the block uses the meteotemplateLive.txt data ).
These changes are only needed to save lightning data in the database ( currently there is no block/plugin that uses the lightning data saved in the db... but this may change ; - )

If you need this database mod you can find it included in this 'extension' ( simply extract in the root directory )
Image

Julius
Advisor
Advisor
Posts: 89
Joined: Fri Sep 24, 2021 10:41 pm
Station model: Barani MeteoHelix
Software: meteobridge

Re: New plugin weatherflow

Post by Julius » Tue Oct 19, 2021 1:57 pm

davidefa wrote: Tue Oct 12, 2021 11:51 am Please add a link to your site ( need to check the cache directory ).
It's currently in a testing-stage, which is why I'm not posting it (yet). So please don't publish this link.
- are you updating the meteotemplate database via meteobridge and the weatherflow plugin ( at the same time )? This should be done with caution ( it has some side effect )
- I think meteobridge does not automatically send lightning data, but you have to configure it to do so ( there is a thread on wxforum )
Phew, yes, it seems like I would have to customize the meteobridge output. Frankly, at this stage I'm not sure I really have a need for the meteobridge anymore. Unless I suddenly come in possession of Davis equipment, but I'm not expecting that anytime soon...
If you only want to use the lightning block you don't need any api.php or update/apiSetup.php change ( as the block uses the meteotemplateLive.txt data ).
These changes are only needed to save lightning data in the database ( currently there is no block/plugin that uses the lightning data saved in the db... but this may change ; - )
If you need this database mod you can find it included in this 'extension' ( simply extract in the root directory )
I'm surprised all this (still) isn't just done by a few clicks in meteotemplate config. Why would you not allow all possible existing station outputs in your db and in your api.php ? It's not like that's a lot of heavy data, we're talking a few strings of text, which can always be compressed down to 1% of its size later on.
Image

davidefa
Expert
Expert
Posts: 862
Joined: Tue Jan 12, 2021 8:03 am
Location: Italy
Station model: WH2650
Software: WH2650 (direct upload)
Contact:

Re: New plugin weatherflow

Post by davidefa » Wed Oct 20, 2021 8:30 pm

Julius wrote: Tue Oct 19, 2021 1:57 pm I'm surprised all this (still) isn't just done by a few clicks in meteotemplate config. Why would you not allow all possible existing station outputs in your db and in your api.php ? It's not like that's a lot of heavy data, we're talking a few strings of text, which can always be compressed down to 1% of its size later on.
Regarding api.php you can pass any 'field' to it. All these will be reflected in meteotemplateLive.txt ( which is generally used by blocks that use instantaneous values ).
Regarding the database you can save only 'well known' sensors to it ( the complete list is available in the wiki ). If you want to extend the database with other sensors ( not included in the previous list) you have to extend a few scripts ( like I did ). But this is generally not required, but it can be done.

NOTE
The author of meteotemplate is Jachyim ( kudos to him ), I'm only a regular user of meteotemplate

P.S.
What I like more in meteotemplate is that if I miss something... then it is not that difficult to add it ( at least I can try ; - ).
Image

Julius
Advisor
Advisor
Posts: 89
Joined: Fri Sep 24, 2021 10:41 pm
Station model: Barani MeteoHelix
Software: meteobridge

Re: New plugin weatherflow

Post by Julius » Fri Aug 12, 2022 9:09 pm

Ola Davide,

By now I have the netatmo plugin and the tempest plugin from this thread running with cron, but the tempest data does not seem to get through into the api. When I check the apiViewer (over here) I don't see any of the tempest sensors getting through. Any idea why? The cron works, as it does for netatmo as well.

Note that I have 2 tempest devices using 1 Station-ID, check here.
For now I only want the tempest/weatherflow sensors to add UV/solar and rain data to get into MeteoTemplate db, actually. Is there an easy way to do that? Can I just comment out the sensors I don't want to see in /w/mt/load/crons/weatherflowUpdate.php ?
Also, what makes this a strange setup is that I have 2 tempest devices under 1 Station ID at weatherflow, but from one tempest, the pressure sensor is broken, and from the other the wind/anemo and rain sensors need to be disabled. I have not found a way to disable them as such at weatherflow. And also haven't been able to do this using the MeteoBridge Pro. It keeps adding back all sensors and mappings.
And another thing, one of the tempest T and RH sensors shows Grass Temp/Humidity values, the other one shows 'normal' T and RH, but I can't find a way to map them as such.

So sorry I didn't go for ecowitt! So much better in their design and usability..
Image

davidefa
Expert
Expert
Posts: 862
Joined: Tue Jan 12, 2021 8:03 am
Location: Italy
Station model: WH2650
Software: WH2650 (direct upload)
Contact:

Re: New plugin weatherflow

Post by davidefa » Fri Aug 12, 2022 10:52 pm

I developed the plugin ( modified an existing one ) having access to a 'standard' tempest weather station.
In your case this is not enough, but I could extend the plugin ( as I already have done for DavisWLL and ecowittNet plugins ) letting the user select the sensor to import and the mapping to the meteotemplate 'database fields' ( in this way the plugin can support more complex installation, as is your case, and also weather stations/sensors that will be introduced in the next future).
To do this I need your credentials ( access token and station id, once everything is ok you can regenerate a new token from the control panel, if I'm not wrong )
Image

Julius
Advisor
Advisor
Posts: 89
Joined: Fri Sep 24, 2021 10:41 pm
Station model: Barani MeteoHelix
Software: meteobridge

Re: New plugin weatherflow

Post by Julius » Sat Aug 13, 2022 1:12 am

davidefa wrote: Fri Aug 12, 2022 10:52 pm I developed the plugin ( modified an existing one ) having access to a 'standard' tempest weather station.
In your case this is not enough, but I could extend the plugin ( as I already have done for DavisWLL and ecowittNet plugins ) letting the user select the sensor to import and the mapping to the meteotemplate 'database fields' ( in this way the plugin can support more complex installation, as is your case, and also weather stations/sensors that will be introduced in the next future).
To do this I need your credentials ( access token and station id, once everything is ok you can regenerate a new token from the control panel, if I'm not wrong )
That would be an amazing feature for all weatherflow owners I guess! I will send you an access token and station ID a.s.a.p. via Private message, OK? And I will be able to test out the result onsite whenever you ask me to.
Image

davidefa
Expert
Expert
Posts: 862
Joined: Tue Jan 12, 2021 8:03 am
Location: Italy
Station model: WH2650
Software: WH2650 (direct upload)
Contact:

Re: New plugin weatherflow

Post by davidefa » Mon Aug 15, 2022 9:15 pm

Preliminary release of an 'extended version' of the plugin: weatherflowNet
- it supports multiple weatherflow stations of different type ( tempest, air and sky )
- let you define which sensors to import ( and the mapping to the meteotemplate fields )

Installation:
- extract the compressed archive in the plugin folder
- copy the updateWeatherflowNet.php script in the load/crons folder ( and set a cron job, if not already set, to execute the load/cron.php script as described in the wiki )
- execute the plugin setup via the meteotemplate control panel

Setup:
1) first time you execute the setup insert your access token, click the 'save' button and reload the page
2) you have now access to all your 'stations' and relative 'sensors'
3) now you have to set the 3 parameters:
- MT Field ( field name as used by meteotemplate T,H,P,W,G,B... see meteotemplate wiki, you can use also other field names, all will be imported in the meteotemplatreLive.txt file )
- Conversion ( unit of measure conversion from the weatherflow format to the format used in the meteotemplate api see the wiki )
- Enabled ( enable all sensor you want to pass to meteotemplate )

NOTE
Those having only 1 tempest weather station may also use the previous version of the plugin ( weatherflow v0.3 ) which have a simplified setup.
Attachments
weatherflowNet_1.0.zip
(8.48 KiB) Downloaded 53 times
Last edited by davidefa on Wed Aug 17, 2022 5:16 pm, edited 6 times in total.
Image

davidefa
Expert
Expert
Posts: 862
Joined: Tue Jan 12, 2021 8:03 am
Location: Italy
Station model: WH2650
Software: WH2650 (direct upload)
Contact:

Re: New plugin weatherflow

Post by davidefa » Mon Aug 15, 2022 9:17 pm

Configuration example:

weatherflownet01.png
weatherflownet01.png (154.6 KiB) Viewed 2166 times
weatherflownet02.png
weatherflownet02.png (127.96 KiB) Viewed 2167 times
weatherflownet03.png
weatherflownet03.png (136.58 KiB) Viewed 2167 times
Image

Julius
Advisor
Advisor
Posts: 89
Joined: Fri Sep 24, 2021 10:41 pm
Station model: Barani MeteoHelix
Software: meteobridge

Re: New plugin weatherflow

Post by Julius » Fri Aug 26, 2022 3:19 pm

Wow, you are my hero Davide! Looks amazing.
I want to try and get the 3 T and 3 RH values below each other, at the top of the stationData plugin, just tinkering the php order should work, but the extra sensors are an extra there, of course.
Image

Post Reply