Api update intervals

What are the chances of changing the update interval output from 1 minute to less .

Whilst I finally got the websocket running nicely but only active if the browser is open , really want to move away from being dependent on a browser via device or computer to be Used and automating other functions without third party software or computer.

Or add a function to the firmware hub to generate an api output a url address using exactly the same method as the GET protocol used for Wunderground upload this s I used with firmware file hack on a ambient ws1001 a couple years ago which basically dumped a json output to a file every 10seconds without any third party software or computer the device did all the work just like a hub.

Food for thought ? It would make the hub a versatile self sufficient device.

You don’t need a browser to establish a web socket connection. Any device can be used to establish a web socket connection. You can use a Pi or any device that can be programmed for a network use.

I don’t see how changing the report interval has any bearing on the end result.


1 Like

Interesting Gary are you not aware the api only delivers at 1 minute intervals .so wind data is only display and updated every minute unless I’m totally missing something please explain .

Sorry I should be clearer I do not want tio use any third party device or software the hub can be efficient enough to do all this without a middle man and additional hardware,software .

I did with the ambient hardware so I see no reason why it can’t be done.

So show me how the websocket is triggered without a browser for using with a web template not an application.


I am aware that API data is only one minute.

Are you not aware that Web Socket and UDP delivers wind data every three seconds?

First, you need to accept that a browser as an application. To use a web socket you need a client which in your case, is the browser. If you are using a PC you can use one of many JavaScript clients.

You can also use Python or PHP or even .Net.


1 Like

For those with other hardware will be used to seeing intervals at rates less than 10 seconds so I don’t think the 1 minute interval is sufficient for wind data …

I totally get the websocket and udp but both are dependent on either software or browser . I have it all working in websocket no problem which is fine when the browser is open .

Now the real trick and magic is to get the hub to send data to an alternative destination whilst still delivering to the weatherflow server.

One way I’ve done that is use dd-wrt router and redirect but not everyone is going to have that to hand or want to risk bricking there router.so I will continue to strive for a non third party solution and have the hub do all the work.


The Hub does all the work but you absolutely must have some device to receive the data.

You may get the data directly from the Hub via UDP


You may get the data from the WeatherFlow servers via web socket.


1 Like

what you are dreaming of is basically including some kinda weather display soft (like the on I run on pi) where you can decide where to send your data and have some config panel to add your credentials …

Don’t think it is hard to recode the hub module to do so but … is there enough ram/cpu in there to handle the extra load for this process ?

If they can integrate it, yeah, no need for udp intercept in most cases …

And regarding hacking your router, why not use a little pi zero with weather display ? Less bricking danger :smirk:… you might create an image with os + WD and configs so it auto starts, little GUI for the configs and/or terminal details explained. A little kit cost around 25 USD with case, sink and power supply … that’s not to expensive …

Think we are going round in circles Gary … I have the websocket running …

I sent you a script two days ago via email did you not get it…?

Redirect data from hub to another IP address hence the dd-wrt method .


I have the file, Brian. I’ll have a look at it this weekend.

The Hub sends data via UDP so why do you need to redirect it?

1 Like

sending it to other services without the need of third party hardware/software ?

I’m getting confused here and I think you may be over complicating what you want to do.

1 Like

I believe he wants to run his scripts on a web site and not have the need for any other hardware (computer, pi, etc) to send data to the web site. And then from there, populate a database on the website so historical data can be displayed.

That’s super easy. That’s what I’m doing with TomCat and JavaScript.

1 Like

Spot on hankster … I dont use a computer for sending or storing data , I use a stand-alone meteobridge connected to router or the weatherflow hub connected to router no third party software or computer .in the past I hacked a file on the ambient ws1001 to send direct an alternative ip address or url no longer have that hardware but again it was a non computer solution.just console connected to a router with a ups .

Don’t misunderstand it’s a personal preference and I see thousands of users successfully using software like weather display,Cumulus and so on reliably but the meteobridge and the weatherflow hub are low powered and connected to a home ups which will run for aprox two days on its own. Istanbul is a place electric just disappears randomly weekly or daily so hence one of my my preferences for no computer as a source for distributing data.

What are you using to collect and store the data?

1 Like

https://weather34.com meteobridge ->mysql updated at 10 second intervals its all automated

meteobridge sends data to server every 10 seconds and its stored on locally with a simple GET request script

the template has a function built into meteobridge so just tick the appropriate box and enter your server url and job done. see screenshot self automated https://weather34.com/homeweatherstation/mb34.html


1 Like

Okay. You have a website that subscribes to a web socket. Is that correct?

1 Like

no websocket ,it uses a GET request capture data is sent to the url and dumped into mysql and text file simultaneously the simple explode the text file

$file_live = file_get_contents(‘MBrealtimeupload.txt’);
$meteobridgeapi = explode(" ", $file_live);

thats it then simply assign

$temp = $meteobridgeapi[2];
$barometer = $meteobridgeapi[10];
$raintoday = $meteobridgeapi[9];
$uv = $weatherflow['uv'];
$windgust = $meteobridgeapi[6];
$windspeed = $meteobridgeapi[5];
$solar = $weatherflow['solar'];
$dewpoint = $meteobridgeapi[4];
$rainrate = $meteobridgeapi[8];
$direction =$meteobridgeapi[7]; 

for mysql

mysqli_query($conn,“INSERT INTO weather34station(time,outsideTemp,barometer,raintoday,UV,windgustmph,windSpeed,radiation,dewpoint,rainrate,direction,date,lightning)
VALUES(’$updated’, ‘$temp’, ‘$barometer’,’$raintoday’,’$uv’,’$windgust’,’$windspeed’,’$solar’,’$dewpoint’,’$rainrate’,’$direction’,’$date’,’$lightning’)”);}
else if (mysqli_connect_errno()) {
printf(“Connect failed: %s\n”, mysqli_connect_error());

all this is in the same file so each time the meteobridge pings the url file all this happens every ten seconds.

for weather flow data I only insert the uv/solar into the template and mysql

$file1 = ‘…/jsondata/weatherflow.txt’;
$url = $file1;
$content = file_get_contents($url);
$json = json_decode($content, true);
foreach($json[‘obs’] as $item)
//foreach($json[‘station_units’] as $item2)
$weatherflow[‘solar’] = $item[‘solar_radiation’];
$weatherflow[‘uv’] = $item[‘uv’];

hope that helps bottom line its all automated no hands or manually doing things last reboot of meteobridge was October for a firmware upgrade and if erroneous(bad) data is received or sent the mysql ignores it with some basic php IF{} code .

Confused :slight_smile:

I understand now. That’s a long way to go a short distance.

With WeatherFlow I use a web socket to receive data. Then parse the JSON string and store it.

I have a watcher that is set for 60 seconds so if no data is received it reconnects to the web socket.

1 Like

Show us some live examples I’m curious of seeing the websocket function and how it stores to MySQL I’m trying to really understand the websocket and how to make use of it so the end user really benefits and only has to add there device ID via simple setup screen. I really don’t want to use it the end user has to start modifying code whilst most will probably have no issue with that but there will be some who are not familiar with editing of code.

Not sure it’s a long way to go has that is doing multiple things every 10 seconds reliably . That one single file is doing multiple tasks , like truncate at end of day ,append to monthly and yearly MySQL ,captures data from weatherflow api, meteobridge simultaneously ,polling air quality index ,polling kinder,sflux,a index values for aurora data and not one bit of JavaScript in there so very little cpu overhead on the server .

If there is an easier way I’m always willing to learn and share …


1 Like