Local/offline/self-hosted weather forecast?

Yeah, I will manually observe if there is sleet or snow (or none) and add it to the row when the row is created (my NodeRed flow does the check every 15 minutes and then adds a row if the temperature is below 4.1)

Edit: My post limiting code is now:

if (msg.sdata[2] >= 4.1) {
    // too warm, nothing to do - end
    node.status({fill:"red",shape:"ring",text:"Stopped: Too Warm @ " + msg.sdata[2] });
    return null;
}
if (msg.sdata[2] >= 3.1 && msg.sdata[4] < 0.15) {
    // snow probability is low
    node.status({ fill: "red", shape: "ring", text: "Stopped: Snow Probability is " + parseFloat(msg.sdata[4]).toFixed(2) });
    return null;
}
msg.payload = msg.sdata;
node.status({fill: "green", shape: "ring", text: "Passed: " + msg.sdata[2] + "C, " + parseFloat(msg.sdata[4]).toFixed(2) + "%" });

return msg;

So the spreadsheet won’t update if the temperature is over 4.1 OR the temperature is over 3.1 AND the snow probability is < 0.15 (15%)

Just to try and reduce the amount of junk data we will need to wade through later.

On a separate note from Snow Probability, I have Lightning probability.
I don’t get much lightning in my location, so am open to feedback:

I have it setup to take the inputs in Imperial and convert them to metric. If you have metric inputs then just remove the conversions at the top.

// Probability of Lightning
// for testing in Node-Red (Java-Script) all inputs are Imperial
// function in metric since WeatherFlow2MQTT is best done metric

// Most Likely conditions for Lightning
// humidity range 50-70%
// temperature range 20-30C / 68-86F
// sea level pressure range 1010-1020hPa
// local time 2-3pm and 2-3am

var temperature = (msg.temperature - 32) * (5/9)
var relativeHumidity = msg.humidity
var solarRadiation = msg.sr
var windSpeed = msg.wind_speed * 0.44704
var pressure = msg.sea_press * 33.863886666667
var strikes_1m = msg.light_1m
var strikes_1h = msg.light_1h
var strikes_3h = msg.light_3h
var strikes_day = msg.light_day
var dew_point = (msg.dp - 32)*(5/9)
var cloudy = flow.get('cloudy')
var partly_cloudy = flow.get('part_cloud')

let prob = 0;

// temperature, dew point, and relative humidity check
if (temperature > 30) {
    if (relativeHumidity > 50 && dew_point > 15) {
        prob += 30;
    } else if (relativeHumidity > 30 && dew_point > 10) {
        prob += 20;
    }
}

// solar radiation check
if (solarRadiation > 600) {
    prob += 25
} else if (solarRadiation > 400) {
    prob += 10;
}

// wind speed check
if (windSpeed < 15) {
    prob += 15
}

// pressure check
if (pressure < 1000) {
    prob += 25
} else if (pressure < 1010) {
    prob += 10;
}

// lightning detector check
if (strikes_1m > 1 || strikes_1h > 20 || strikes_3h > 50 || strikes_day > 120) {
    prob += 25
} else if (strikes_1m > 0 || strikes_1h > 10 || strikes_3h > 20 || strikes_day > 50) {
    prob += 10;
}

// cloud coverage check
if (cloudy === 'true' || partly_cloudy === 'true') {
    prob += 25;
}

// Combine inputs into one string
msg.inputs = `temperature: ${msg.temperature}F, relative humidity: ${msg.humidity}%, solar radiation: ${msg.sr}, wind speed: ${msg.wind_speed}mph, pressure: ${msg.sea_press}inHg, strikes_1m: ${msg.light_1m}, strikes_1h: ${msg.light_1h}, strikes_3h: ${msg.light_3h}, strikes_day: ${msg.light_day}, dew_point: ${msg.dp}F, cloudy: ${flow.cloudy}, partly_cloudy: ${flow.part_cloud}`;

msg.light = prob
return msg;

I have notes of things to take into account, which I will update.

https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6921276/
Provides observed conditions where snow fell (New York), but it is a start to adding pressure and wind speed in. Wind direction will probably be nearly impossible to implement without creating a massive lookup table for wind direction to snow; which I think would be well outside the scope.

https://www.ncei.noaa.gov/
Has some history of weather, might be useful in the future.

https://tc.copernicus.org/articles/16/1741/2022/tc-16-1741-2022.pdf
Might be some good info here, this states that sea level pressure does have a strong relationship to snowfall but that it is complex…still deciphering.
This paper mentions that 8 components make up over 90% of snow probability…but I can’t find what those components are in the paper.

Some data points:
Lowest recorded pressure for snowfall is 925hPa
Typically, snowfall occurs at pressures between 995-1015 hPa.

Could you add sea level pressure and zambretti # to your google doc?
Wind speed may not be a bad addition also.
The Zambretti number is probably the least useful, but your comment has me thinking about it.

I’ve added Temp in F and hPa.
There is no point in me adding wind speed, because 1) it is massively wrong, the station is probably too low. and 2) The station in in powersave mode, because Winter in the UK. Because of the lack of Wind readings, Zambretti is also not going to much use right now either.

Also -

I think you need to multiply your result by 100 for snow probability.

I will say that your old way of doing it sees to track very well also.

1 Like

Yeah I do, but I’ve left it alone for now - it’s easy enough to see see it as a percentage value, and I’ve colour coded stuff to make it easier to spot stuff lol

The radar shows hours of snow yet

(it’s moving West to East)
and I’m going to have to head to bed. So I won’t be taking any more webcam screencaps lol.
I think the new formula seems to show it’s pretty good - though interestingly right now, the old formula is showing a higher percentage than the new one (because I’m above zero, and have high humidity) - so maybe we can do some sort of hybrid formula?

Andy

For Snow Probability, bottom graph, orange is your old algorithm, blue is the new one. I thought this graph summarized how well they actually track together, at least at higher probabilities. It never snowed at my house for this, but it did snow 20 miles away where I was at the time.

I included the Lightning Probability for show, I’m working on refining it (Orange). Blue on this graph is Fog Probability which is coming from the integration.

Apparent temperature is also a work in progress, it compares air temperature, wind chill (feels like), and a heat index temperature (slightly different from WBGT Wet Bulb Globe Temperature).

Question…

Does anyone have WeeWx setup to intake data from MQTT?

Sorry, late to the conversation. There are several formula in this book:
Predicting Storms

Also I have found the zambretti formula to be fairly accurate for the UK.

I have used the JS script provided here

I’d be very interested in an HA entity that returned the current prediction from this algorithm.

Hi,

did you ever finish the component?

B.

I modified that code (Zambretti) in python. I don’t take into account pressure changes as originally designed but it works fairly well.

If you could share some of those formulas in the book, I would be willing to try some out. I did incorporate a snow prediction formula based off a extensive study of personal weather stations that someone brought to my attention.

Hi,

Sorry for the delay in replying!

The book is available here

Regarding your component, can you point me at a guide to writing them? Do they need to be in Python. or would JS do?

Thanks!

B.

JavaScript will do; I tested all of mine in JS before moving them to Python. I specifically ran everything in Node-Red.

Thanks!

B.

What exactly do you want? I can give you what I have already.

High, sorry for the delay in replying.

Well, by component, I was assuming that it was something integrated into home assistant. Is that the case? If so, I’d certainly like to see what you’ve got. I thought that there might be some guide on how to do it that you followed, and if so, where is it? I’m especially interested in using them in Node Red.

Ta!

B.

I pull mine from UDP via WeatherFlow2MQTT into Home Assistant; the WF2MQTT container does all the work (it is available as an add-on also). But if you want to do it in Node-Red give me a little bit of time and I can pull/update what I have been using for testing.

Hi,

it’s ok, I clearly misunderstood what you were doing. Now I do, so thanks for the explanation!

Thanks!

B.

Wanted to also link to this thread which has a similar goal: Homeassistant 12h local weather forecast. ~94% accurate*

Ideally a generic custom_component would take in all of the sensors and just create a standard weather entity able to be used with any normal weather card, but doesn’t seem to be the case yet.

1 Like