[solved] Meteoblue weather binding - return units (mm or inches, degree or farenheit, kmh or mph)?

Dear all,

I have successfully added the meteoblue binding on my new OH2.5 installation and are able to receive the anticipated values using my personal API key (non commercial, Basic package)

The installation is following the documentation having a .things, .items and the .sitemap file

I do want to use degree celcius, mililiter and kmh as units and as far as I can see the METOBlue API documentation does allow to get this type of units. I do however see no option to configure the binding to force this behaviour.

See below items extract. Of course I can change the .items text for example from mph to kmh… but i gues this does not really help…

My question is: What are the return units and is there a way to force/configure it to be mm, celsius degree or kmh ?

the MeteoBlue API Documentation is talking about optional setting you can parse in the URL:
• “&asl=279” altitude, can be selected by customer, otherwise API uses elevation model
• “&tz=Europe%2Fzurich” time zone
• “&name=Basel” location name, label your forecast, has no effect on data
• “&temperature=C” temperature unit
• “&windspeed=ms-1” wind speed unit
• “&winddirection=degree” wind direction unit
• “&precipitationamount=mm” precipitation amount unit
• “&timeformat=Y-M-D” time format
• “&format=JSON” output format
• “&forecast_days=3” number of forecast days (0 – 7 days)
• “&history_days=1” number of historical days (0 – 4 days)

Perhaps we need to change the binding to cast the url more dynamically ?

Many thanks for an answer

Number:Temperature  todayTempL          "Low Temp [%.2f °C]"                <temperature>   (weatherDay0)  {channel="meteoblue:weather:metBridge:CasaKunz:forecastToday#minTemperature"}
Number:Temperature  todayTempH          "High Temp [%.2f °C]"               <temperature>   (weatherDay0)  {channel="meteoblue:weather:metBridge:CasaKunz:forecastToday#maxTemperature"}
Number:Length       todayPrec           "Total Prec. [%.2f in]"             <rain>          (weatherDay0)  {channel="meteoblue:weather:metBridge:CasaKunz:forecastToday#precipitation"}
Number:Length       todayRain           "Rainfall [%.2f in]"                <rain>          (weatherDay0)  {channel="meteoblue:weather:metBridge:CasaKunz:forecastToday#convectivePrecipitation"}
Number:Speed        todayWindSpL        "Low Wind Speed [%.2f mph]"         <wind>          (weatherDay0)  {channel="meteoblue:weather:metBridge:CasaKunz:forecastToday#minWindSpeed"}

`

If this is an official binding you should submit an issue on GitHub where the developer can review and handle it. They may not be here in this user based forum.

Did you try? The idea of these types (called Unitiy of Measure (UOM) Like Number:Speed) is that they automatically convert to the type as specified in the item. You need to give the right unit. See this list:

1 Like

To put it another way, you don’t really care if temperature data is supplied and/or stored in °C, °F or K.
So long as you can select the unit you want at point of use or display.

Edit - one place where this approach goes wrong is with Persistence. Current OH persistence is essentially UoM blind, and just stores numbers. In this case, you cannot select the unit you want at retrieval (e.g. graphs) and indeed you have to hope the stored data was in the same units you are using now.
You have to enforce the units you want before persisting.

Hey… hilbrand

youre the man… I did not know that OpenHAB is capable of doing automatic unit conversion… I always thought that the °C is just the “text” you want to have displayed right to the value…

So I can confirm it is working. I do have changed the items to :
[%.2f °C] for converting the Fahrenheit to degree Celsius, 2 digit
[%.1f mm] for converting the inches in to milliliter, 1 digit
[%.2f kmh] for converting the mph to Kilometer per hour, 2 digit

As on the question from rossko57 I assume the persistence stores it the same way you setup the item. I will find out one day when I start to play around with persistence…

Thanks Again for pushing me in the right direction. Probably worth mentioning this in the add-on description.

1 Like

It is already in the documentation.

I know /saw…

I meant to add a cross reference on the MeteoBlue add-on page MeteoBlueAddOnPage to link to the UnitOfMeasurement Page with an explanation "You can change measurement units by changing to the anticipated conversion value, see UnitofMeasurement page or so…

Strangely when I Press the edit in GitHUB page on the MeteoBlue Page I get a 404 error not found. I am happy to change but I am not a developer. Do you know why this is not working ?

1 Like

They reorganized GitHub for 2.5.x & OH3.
This link should work for 2.5.x, I think.

Every binding that uses e.g. Number:Temperature should not explain it.
That’s a general Item property.

1 Like

Might be all clear for you as experts, however I tell you as non developer you struggle here.

When I was doing my items config back in OH v1.8 , v2.2 and now v.2.5 I always looked at this like
doing an Excel concatenating strings function. Assume a Cell Y33 contains the value 22,87564
And the everything in the [ ] is about formatting only. A formula of =TEXT(Y33,“0.0”) & “°C” is needed to get to a “22,9 °C” string…

So as in the OH items configuration I thought a [%.2f °C] will give me just a decimal with 2 digits and appends a °C text .

Means I learned a lot about OH configuration today :slight_smile:

Just submitted my first in live ever fork and pull github request. I hope I did it all right.

Here is my proposal of the new readme.md additions:

Having your channels display the values in the anticipated unit (mph or kmh , degrees or fahrenheit, …) you need to cast the items accordingly using the available OpenHAB “Units Of Measurement” option. Have a look t the OpenHAB documentation, concepts section, UnitsOfMeasurement chapter for details.

1 Like