Generating derived weather calculations with the Weather Calculations Binding

Hi Bill! I know this is rather not a weather parameter, but would you mind to add conversion of epoch timestamp to standard Time? (like


I could add that, but I think there is probably a better/easier way (I’m assuming you’ve got an item with an epoch timestamp). The Javascript transformation add-on got support for specifying the transformation in-line last year, which is convenient for simple things like this.

If you’re using item files, I think you can do something like this:

Number  Report_Epoch "[JS(|new Date(parseInt(input)).toString()):%s]" ....

If you’re using the UI, from your item you can do:

Add Metadata → State Description

In the Pattern box, put the following:

JS(|new Date(parseInt(input)).toString()):%s

And the number should be displayed as a readable string. There are a number of different formats supported out of the box; googling “format javascript date object” should give you some tips.

If that isn’t what you had in mind, let me know and I’ll see what I can do.

Thanks Bill. I will try it. Generally I try get weatherflow forecast data by http binding and convert these data into format readible by any existing weather widget.

@hww3 I think there is a little bug.
Seemslike at some point Low Time and High Time Yesterday gets same value.
I think it happends sometime in the night, as sometimes during day these numbers are different.

Just minor issue, but worth to take a look what’s going on.
Otherwise great binding!

DateTime                WC_HighTimeToday        "High Time [%1$tR]"           <time>          (gWeatherCalc)  {channel="weathercalculations:weathercalculations:myWeather:highTimeToday"}
DateTime                WC_HighTimeYesterday    "High Yesterday Time [%1$tR]" <time>          (gWeatherCalc)  {channel="weathercalculations:weathercalculations:myWeather:highTimeYesterday"}
DateTime                WC_LowTimeToday         "Low Time [%1$tR]"            <time>          (gWeatherCalc)  {channel="weathercalculations:weathercalculations:myWeather:lowTimeToday"}
DateTime                WC_LowTimeYesterday     "Low Yesterday [%1$tR]"       <time>          (gWeatherCalc)  {channel="weathercalculations:weathercalculations:myWeather:lowTimeYesterday"}

I’ve been trying to find a way to display the weatherflow forecast data and haven’t come up with a good solution… having to split each piece of data into its own item seems like a terrible approach; treating the forecast json data as a string and pulling each piece out is also pretty frustrating. I’ve been trying to use the weather card widget… I got part of the way but translating things like conditions to images is pretty tedious. wondering if maybe just making a binding to do the transformation would be easier (like the weather calculations)?

what approach have you been taking? it doesn’t seem like there’s an openhab-wide standard or schema for weather forecast data, each source seems to do it’s own thing.

Thanks for pointing this out, I see that same behavior here. It’s probably something simple. I’ll take a look and report back (hopefully!) with a solution.

EDIT: Just took a quick look and can confirm the high time is being used for the low time… probably a copy and paste error. I’ll try to get a new version with a fix out later today.

I’ve prepared a new version of weather calculations that corrects the obvious error in the previous version. I haven’t had a day crossover yet, so I can’t confirm that the problem is solved, but unless I made an even bigger error elsewhere, this should improve the situation. Please give it a try and let me know if it helps!


Hi Bill, I just wanted to do same thing as you did. Currently I download json with http binding and split it into single items. From there I wanted adjust it to whichever widget already was already created for mainui.

Making binding for conversion is a great idea!
Perhaps this binding could evolve into some kind of standard for other weather forecast bindings out there. You would not then worry which weather provider you choose due to data format, just choose the most accurate for you and the binding would do the conversion for you to any available widget. Of course widgets would need to be adjusted to the standard of converter.

Maybe creators of other weather bindings would be interested in help with development? I believe that the most frequently used bindings are openweathermap and weather company bindings.

thnanks, is there a way how to update current binding without need of manually install this fix?


Not quite sure how to answer this; the problem was in the version of the binding jar you installed. To fix it, you’ll need to remove the old one and copy the new one into your addons folder. The change should be detected and the new version will be started in the old one’s place.

dunno, removed 3.2.0 from the marketplace/xxy/ folder, downloaded your’s 3.2.1, restarted OH but seems like nothing changed, both times still the same and I’m not sure how to validate it’s running correct version.

from OH admin, it’s pointing to 3.2.0 i guess, no option to update from UI

Hmm. Is there an option to uninstall the binding from the UI? It shouldn’t remove your things, just the code that it’s running. Then you can drop that jar in your addons/ directory.

So after some more research, I think there’s still a bit of development work going on in the marketplace front… not all of the possible scenarios have been sorted out so unfortunately there will be a bit more legwork for you. Happy to work with you on getting the thing sorted out; just let me know where things stand on your end. If you are able to use the openhab command line tool we should be able to get thing sorted in short order!

I’ll give that some thought over the next few days. I’m playing around with an addition to the openhab core api that allows json data to be dealt with directly. That might allow us to skip the 50 items situation and move right to displaying the data. Still think it would be worth coming up with a standard “schema” for forecast data. Will look around and see if maybe we can come up with a common format so that it would be easy to switch forecast providers…

Will report back when I have some more info!

1 Like

no worries, i know how to use my shell :slight_smile:
so are there any recomended steps, or you just went thru it by yourself? :slight_smile:

Ok, If you can find the bundle id of the old version, you can uninstall it and then install and activate the new one. I think something like this should work:

openhab> bundle:list | grep Calculations
303 │ Active   │  80 │ 3.2.0                 │ openHAB Add-ons :: Bundles :: Weather Calculations Binding
openhab> bundle:uninstall 303
openhab> bundle:install
Bundle ID: 245
openhab> bundle:start 245
openhab> bundle:list 245                                                                                                                
START LEVEL 100 , List Threshold: 50
 ID │ State  │ Lvl │ Version │ Name
245 │ Active │  80 │ 3.2.1   │ openHAB Add-ons :: Bundles :: Weather Calculations Binding
1 Like

allright done it, shows 3.2.1 now
will wait till tmrw if the times will be diferent

thanks! :slight_smile:

Great. Hopefully at some point I will understand how the marketplace works under the covers; I’m glad this “manual procedure” was able to get your version upgraded. I looked quickly at the results I’m getting from the binding and they seem a lot more reasonable. Hopefully you’ll see an improvement as well!

confirming 3.2.1 works great, Thank you!

Yeah, marketplace is somehow half way there, updates of the bindings is something really needed.

Terrific news! Hopefully the shortcomings with the marketplace will get sorted out and future updates will go more smoothly. Hopefully they’re considering having a sort of “testing” channel so that episodes like this will be less of a hassle. Might need to suggest that if it’s not already in the plans.

As always, do reach out if you run into any further difficulties!