Plug In for Government Weather Feeds

Done :slight_smile:

Hi,

You can get the observation json data with an URL like http://www.bom.gov.au/fwo/IDQ60801/IDQ60801.94566.json.

Where the IDQ60801 and 94566 values indicate the weather station. To find those go to http://www.bom.gov.au/index.php, select you province at the right top, then under observations, XXX Latest observations. Search for the station you want to use and click that for these two identifiers. You can also scroll down and get the json link.

Cheers Rene

We’re working on exactly that in private chat. We’ll publish the solution when @zedrally gets it working on his end.

I tried with Finnish Meteorology Institute (FMI) data, works ok.

Here is the recipe:

  1. Go to Havaintoasemat - Ilmatieteen laitos and select your weather station. Copy FMISID number.

  2. Form url by https://ilmatieteenlaitos.fi/observation-data?station=XXXXXX where XXXXXX is the FMISID. When accessing the URL following data is available in JSON:

status
stationId
generated
latestObservationTime
timeZoneId
Precipitation1h	[…]
WindDirection	[…]
t2m	[…]
SnowDepth	[…]
Humidity	[…]
DewPoint	[…]
WindSpeedMS	[…]
Visibility	[…]
WindGust	[…]
Pressure	[…]
TotalCloudCover	[…]
SnowDepth06	[…]
MinimumTemperature	[…]
rrday	[…]
MaximumTemperature	[…]

Note that the ones with […] are arrays. t2m is temperature and rrday is amount of precipitation

  1. Set the url in SiteSensor and get your selection of data from response. For example latest values:
last(response.t2m).[2]
last(response.SnowDepth).[2]
last(response.Humidity).[2]
last(response.DewPoint).[2]
last(response.WindSpeedMS).[2]
last(response.Visibility).[2]
last(response.WindGust).[2]
last(response.Pressure).[2]
1 Like

My FMI SiteSensor failed and reason was tracked to too long response:

SiteSensor: WARNING: Response was truncated to limit of 65536 bytes; 186148 total bytes received in “/tmp/Q_SiteSensor_160.txt”

SiteSensor release notes warn about too long response and possibility to crash your Vera. @rigpapa:Which size is still safe to use (I am using Edge)?

I would try to use a query that uses a smaller response, if there is one. This is the best approach, hands down.

If that’s not possible, you can set the MaxResponseSize parameter up a little higher than the actual response length.

Unfortunately it seems there is no possibility to shorten the response. JSON from FMI is also somehow “not supported”, they provide their open data nowadays in XML instead.
Anyway, good to know the limitations. This is not in any way critical to my system, I’ll just delete the sensor for now to get rid off tripped messages.

Not sure what is happening here but until now SS was working perfectly as per Patricks original Recipe, something has changed today and the feed is not working…
Vera now can’t find the device, log as follows.

10:08:13: SiteSensor: Requesting JSON data
10:08:13: SiteSensor: "GET" "http://reg.bom.gov.au/fwo/IDV60901/IDV60901.94870.json", headers={  }
10:08:13: SiteSensor: WARNING: Response was truncated to limit of 65536 bytes; 136380 total bytes received in "/tmp/Q_SiteSensor_625.txt"
10:08:13: SiteSensor: WARNING: the response from this site is quite large! (65536 bytes)
10:08:13: SiteSensor: Unable to decode JSON response, "unterminated string at line 2789, column 5" (dev 625)

edit: Might be good time for a HASS PI.

Just set MaxResponseSize to 150000 or so and you should be good. I think I’ve already mentioned this recently in thread.

I think that may have been in the Site Sensor discussion., I didn’t follow it as at the time the feed was still working Thanks for the prompt on publishing the recipe, I totally overlooked it so here it is for anyone else who might be interested in Australian Weather.
This one is based on readings from Moorabbin Airport, for other areas refer to the BOM Weather site and substitute IDV60901/IDV60901.94870.json for the area you need.

"name": "BOM Weather Sensor",
"author": "Black Cat",
"description": "Australian BoM Weather feed.
 http://www.bom.gov.au/index.php" for your area feed,
"config": {
    "RequestURL": "http://reg.bom.gov.au/fwo/IDV60901/IDV60901.94870.json",
    "Interval": "600",
    "Timeout": "30",
    "QueryArmed": "0",
    "ResponseType": "json",
    "Trigger": "err",
    "NumExp": "16",
    "FailMasterOnExpressionError": "1",
    "FailChildOnExpressionError": "1",
    "BlankChildOnExpressionError": "0",
    "MaxResponseSize": "150000",
    "Expr1": "response.observations.header[1].refresh_message",
    "Child1": "urn:schemas-micasaverde-com:device:GenericSensor:1",
    "Expr2": "response.observations.data[1].air_temp",
    "Child2": "urn:schemas-micasaverde-com:device:TemperatureSensor:1",
    "Expr3": "response.observations.data[1].dewpt",
    "Child3": "urn:schemas-micasaverde-com:device:HumiditySensor:1",
    "Expr4": "response.observations.data[1].press",
    "Child4": "urn:schemas-micasaverde-com:device:GenericSensor:1",
    "Expr5": "response.observations.data[1].rel_hum",
    "Child5": "urn:schemas-micasaverde-com:device:HumiditySensor:1",
    "Expr6": "response.observations.data[1].wind_spd_kt",
    "Child6": "urn:schemas-micasaverde-com:device:GenericSensor:1",
    "Expr7": "response.observations.data[1].wind_dir",
    "Child7": "urn:schemas-micasaverde-com:device:GenericSensor:1",
    "Expr8": "response.observations.data[1].gust_kt",
    "Child8": "urn:schemas-micasaverde-com:device:GenericSensor:1",
    "Expr9": "response.observations.data[1].apparent_t",
    "Child9": "urn:schemas-micasaverde-com:device:TemperatureSensor:1",
    "Expr10": "response.observations.data[1].cloud",
    "Child10": "urn:schemas-micasaverde-com:device:GenericSensor:1",
    "Expr11": "response.observations.data[1].cloud_oktas",
    "Child11": "urn:schemas-micasaverde-com:device:GenericSensor:1",
    "Expr12": "response.observations.data[1].cloud_base_m",
    "Child12": "urn:schemas-micasaverde-com:device:GenericSensor:1",
    "Expr13": "response.observations.data[1].cloud_type",
    "Child13": "urn:schemas-micasaverde-com:device:GenericSensor:1",
    "Expr14": "response.observations.data[1].weather",
    "Child14": "urn:schemas-micasaverde-com:device:GenericSensor:1",
    "Expr15": "response.observations.data[1].press_msl",
    "Child15": "urn:schemas-micasaverde-com:device:GenericSensor:1"
},
"source": "20095",
"version": "20101.0354"

It’s about two posts above yours in this thread, but we soldier on…

Actually, this isn’t the intended way to publish a recipe. There’s a base64 block shown underneath this presentation that’s the intended portable format. This isn’t loadable as posted, which is why I made the base-64 block–it’s immune to forum formatting and many subtle errors in copy-paste. Can you grab that block and post it for us?

What presentation? I have no idea of what you’re talking about.
Please feel free to edit as you want.

At the bottom of the Recipe tab, after the editing window

=== Ident: BOM Weather version 20102.0415 by Black Cat;
=== BEGIN SITESENSOR RECIPE ===
ewogICAgIm5hbWUiOiAiQk9NIFdlYXRoZXIiLAogICAgImF1dGhvciI6ICJCbGFjayBDYXQiLAog
ICAgImRlc2NyaXB0aW9uIjogIiIsCiAgICAiY29uZmlnIjogewogICAgICAgICJSZXF1ZXN0V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TUiCn0=
=== END SITESENSOR RECIPE ===

Hope it makes sense to someone, it’s all braille to me.

I should point out that using the above would be totally useless unless you live in the SE Suburbs of Melbourne, Australia.
Not sure why you asked for the recipe Patrick as the feed needs to be altered to make it useful for other areas and I don’t see how you can alter the block?
FWIW. I’m not a coder and nothing ever makes sense.

All good questions! To this, the URL is generally the easiest part for people when setting up a SiteSensor. Most people can very quickly find and input the correct URL, but then find the task of looking at the return data and figuring out how to write the expressions a much bigger problem to solve. So the recipes are really more about relieving that aspect of the work. It’s expected, I think, that people will need to customize the URL, as it often involves localizing parameters as you suggest, as well as authorization keys and the like in many cases. That’s why I ask in the recipe instructions that you put “placeholders” in for those things — so others can easily see where and what they need to modify to complete the recipe for their own use.

Once you load a recipe block, it becomes the configuration of your SiteSensor, and that, then, is what someone loading your recipe would modify. The recipe itself doesn’t change once you publish it (unless you publish a newer version).

Many regions have their own local weather services, and other services. You’ve done your neighbors a solid. Thanks for publishing that.

Logistical question:
How does one prevent the sharing of one’s personal API key whilst publishing those base-64 recipe blocks?

So, I’ll reply with a legitimate question, at the risk of coming off a bit salty, but it’s really not that; I’d like to know what, if anything, I can improve in the subject area to make it more clear, because if it’s not working, I need to fix it… the question: Did you read the instructions on the recipe page?

Ah, neat. You were correct to assume I had never read (nor even seen) the “Recipe” page before, and now everything is clear. I see:

“Edit the configuration below to remove any authorization keys or other sensitive data. Do not remove any key/value pairs, but you can leave the value blank (no data between quotes) if you must.”

As usual, you’ve very ably anticipated a potential logistical snag. Thanks!

OK. If it’s not clear enough, I definitely want to fix it, but the effort was made at least. A few days ago, based on other things people were doing, I modified the page anyway to look like this (below), which hopefully leans toward being even more clear. Sometimes (often) things make perfect sense to me, but nobody else, so I need the feedback.