Relevant links:
https://developer.yr.no/doc/
All the data usage appears to be free of charge.
https://developer.yr.no/doc/License/
Weather warning icons:
Relevant links:
https://developer.yr.no/doc/
All the data usage appears to be free of charge.
https://developer.yr.no/doc/License/
Weather warning icons:
Just to mention a alternative:
I am using “metno-locationforecast” in the HabApp python venv for that.
The HabAbb way is a bit involving, but very powerful and flexible.
A met.no binding would be great.
I agree!
I hope that it will be created.
A option is to use a image like this, that is updated every ten minutes:
Any news on that?
Does anyone use the actual json api with http binding and can share the jsonpath values?
I did something similar with the json data from the Australian weather data:
You could do the same and make your own.
I didn’t make a binding I just used an item and made a widget that got the information from the json file.
I use it every day.
Here is the widget code:
uid: BOM-widget-with-temps
tags: []
props:
parameters: []
parameterGroups: []
timestamp: Mar 26, 2021, 11:17:01 AM
component: oh-list
config:
style:
min-width: 250px
--f7-list-item-after-font-size: 12px
--f7-list-item-after-font-weight: bold
--f7-list-item-after-text-color: var(--f7-text-color)
slots:
default:
- component: oh-repeater
config:
sourceType: range
rangeStart: 0
rangeStop: 6
for: index
fragment: true
slots:
default:
- component: oh-list-item
config:
title: =dayjs(JSON.parse(items.BOMdata.state).data[loop.index_idx].date).format('dddd
MMM D')
footer: =JSON.parse(items.BOMdata.state).data[loop.index_idx].extended_text
after: =(JSON.parse(items.BOMdata.state).data[loop.index_idx].temp_min == null)
? " Min --- " + " Max " +
JSON.parse(items.BOMdata.state).data[loop.index_idx].temp_max
:"Min " +
JSON.parse(items.BOMdata.state).data[loop.index_idx].temp_min +
" Max " +
JSON.parse(items.BOMdata.state).data[loop.index_idx].temp_max
icon: ="oh:"+JSON.parse(items.BOMdata.state).data[loop.index_idx].icon_descriptor
- component: f7-segmented
slots:
default:
- component: oh-button
config:
text: Refresh BOM data
outline: true
actionRule: 1a2e6bfd0c
action: rule
Here is the rule I run every 2 hours I put the Norwegian URL in there and it does get json :
//because icon names with dashes in them are reserved I replace the dash with underscore
function input(i) {
return i.replace(/-/g,'_');
}
var DATA = actions.HTTP.sendHttpGetRequest("https://api.met.no/weatherapi/locationforecast/2.0/compact?lat=60.10&lon=9.58", 2000);
//var DATA = actions.HTTP.sendHttpGetRequest("https://api.met.no/weatherapi/locationforecast/2.0/compact?lat=60.10&lon=9.58", 2000).replace(/icon_descriptor...\w+/g,input);
//items.getItem("BOMdata").postUpdate(DATA);
console.log("data refreshed " + DATA)
I am running OH 4.2.0 an use ECMAScript 262
I am sure you could modify it get what you want.
I see there is a github for the icons as well, so it will be easier for you to get the icons displayed?
Anyway, just a suggestion.
Looks good so far, although I will have to adjust it for my needs. I especially don’t like the logic in the widget coding, this belongs in the http thing.
I will share my results when ready.
Can you share a screenshot of your widget?
I also have todays weather on my overview page with a webcam image updated every minute using mqtt.
component: oh-image-card
config:
action: popup
actionModal: widget:BOM-widget-with-temps
footer: ="Max " + JSON.parse(items.BOMdata.state).data[0].temp_max + " "
+ JSON.parse(items.BOMdata.state).data[0].extended_text + " "
+ JSON.parse(items.BOMdata.state).data[0].rain.chance + "% chance of
rain " + JSON.parse(items.BOMdata.state).data[0].rain.amount.min + " to
" + JSON.parse(items.BOMdata.state).data[0].rain.amount.max + " mm."+ "
Issued at "
+ dayjs(JSON.parse(items.BOMdata.state).metadata.issue_time).format('HH:mm')
item: Rawmqttdata_Weathercamimage
title: =dayjs(JSON.parse(items.BOMdata.state).data[0].date).format('dddd MMM D')
Did you ever get yours to work or did you go a different route?
I haven’t been able to complete it yet. But I have tested the concept with this HTTP Thing and JSONPATH transformation.
UID: http:url:68bda7b175
label: Wetter Met.no
thingTypeUID: http:url
configuration:
authMode: BASIC
ignoreSSLErrors: false
baseURL: https://api.met.no/weatherapi/locationforecast/2.0/compact?lat=53.70&lon=10.20
delay: 0
stateMethod: GET
refresh: 30
userAgent: <<<YOUR EMAIL ADRESS>>>
commandMethod: GET
timeout: 3000
bufferSize: 2048
channels:
- id: updated
channelTypeUID: http:datetime
label: updated
description: ""
configuration:
stateTransformation: JSONPATH:$.properties.meta.updated_at
- id: 0-temp
channelTypeUID: http:number
label: 0-temp
description: ""
configuration:
stateTransformation: JSONPATH:$.properties.timeseries[0].data.instant.details.air_temperature
- id: 0-hum
channelTypeUID: http:number
label: 0-hum
description: ""
configuration:
stateTransformation: JSONPATH:$.properties.timeseries[0].data.instant.details.air_temperature