Generating derived weather calculations with the Weather Calculations Binding

Hi Bill,
The entries int the dropdown were not correct, after adding them manually instead it worked

Hello Bill,

I just tried your binding (because I wanted to get the apparent/feels-like temperature), but it seems that especially there (and for heatindex, too, which I think is the same when youā€™re above 80F) I do get some calculation errors.

Now I live in the US (imperial units) but for this binding I implemented a temperature reading in C. Currently we have outside:
temperature1 (Type=NumberItem, State=80.0 Ā°F)
temperature1c (Type=NumberItem, State=26.7 Ā°C)

The dew point (calculated from temperature and humidity) agrees with what I calculated by hand, but for some reason, I get:

feelslike1 (Type=NumberItem, State=68.00 Ā°F)
heatindex (Type=NumberItem, State=68.00 Ā°F)

whereas the apparent temperature/feels like should be around 82F or so. So Iā€™m not sure if thatā€™s a conversion error somewhere, but I doubt it as the dew point agrees.

Any ideas?

Hi-

Your timing is perfectā€¦ A few days ago I noticed that some of the values were odd but havenā€™t had a moment to look into the situation. The binding should properly adjust regardless of the measurement system, and I know this was working correctly in the past.

I think the problem lies in the heat index calculation: ā€œfeels likeā€ is the wind chill temperature below a certain point (10 degrees C) and the heat index above a certain temperature (26.6667 degrees C).

Iā€™ll take a closer look in the morning and hopefully have an answer for you.

Bill

Thanks.
In the meantime I wrote myself a shell script calculating windchill (below 50F/10C) and heatindex (above 80F/26.6) with the correct (empirical) factors in it. I can provide you with those, if you want.
BTW, between 50F and 80F the apparent temperature is equal to the real temperature.

So if youā€™d want to lighten your binding, skip on heatindex and windchill and only use apparent temperature, which is then calculated according to the rules above.

Hi-

The problem was a typo in the conversion of the heat index value from Fahrenheit back to Celcius, which was added when OpenHAB gained UoM support. I did also take a few moments to tidy the calculation up for easier reading.

The algorithm for HI is taken from the following document:
https://www.wpc.ncep.noaa.gov/html/heatindex_equation.shtml

The ā€œapparent temperatureā€ algorithm used is just as you describe.

Iā€™ve placed a new version with the correct conversion factor here:

http://bill.welliver.org/dist/openhab/org.openhab.binding.weathercalculations-2.5.4-SNAPSHOT.jar

Do let me know if you run into any problems.

Thanks, Iā€™ll have a look.
And yes, thatā€™s where I took the formula from, too. I added an if-clause to only use windchill, measured temperature or heatindex as appropriate for the ā€œapparent temperatureā€.
Out of curiosity, do you apply the adjustment additions/subtractions they use there?

Hmm, doesnā€™t look so good. I deleted and re-added the weather calculations thing after copying over the file, but cannot define source items and get:

21:16:30.578 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'weathercalculations:weathercalculations:65141fee' changed from INITIALIZING to UNINITIALIZED (HANDLER_INITIALIZING_ERROR)
21:16:30.577 [ERROR] [.core.thing.internal.ThingManagerImpl] - Exception occurred while initializing handler of thing 'weathercalculations:weathercalculations:65141fee': null java.lang.NullPointerException: null

I do apply all of the adjustments described in that document. Below 40F the algorithm simply returns the temperature. The reason for that is that the HI is an interesting value below 80F, but itā€™s unclear where that tapers off. The ā€œapparent temperatureā€ (ie, ā€œfeelslikeā€) calculation exists for folks who donā€™t want to think about it, but in case anyone cares to fiddle with the values, I provide all of the components separately.

Okā€¦ I didnā€™t really change anything that should prevent startup, and I did an uninstall/reinstall/restart and things are okay here. Do you have any backtrace information surrounding that failure? Perhaps a restart of openhab would either solve the problem or generate a more complete errorā€¦ Iā€™ve seen this sort of behavior with other bindings.

Iā€™ll attempt an install on a fresh copy of openhab tomorrow just in case there is a problem with the binding somewhere.

Iā€™m certainly aware that all of these derived metrics are purely empirical and also subjective. I even think that heatindex and windchill are calculated differently in other parts of the world.

Iā€™ll do a reboot tonight and see if it comes up properly after that.

No, still getting the same error with the 2.5.4 version.

Ok, thatā€™s not encouragingā€¦ I will set up a clean install and see if I can reproduce the problem. If you can give me a few days, I should be able to come up with a solution.

Bill

No rush :wink:

Iā€™ve prepared a new release of the Weather Calculations binding. This fixes a few problems when using PaperUI to configure the binding, and also adds cumulative rainfall totals for the day. Thatā€™s useful for use with weather stations that report increments of rain (ie, 0.01 units of rain just fell).

Please feel free to download it and let me know how things work out!

https://bitbucket.org/hww3/org.openhab.binding.weathercalculations/downloads/org.openhab.binding.weathercalculations-2.5.11-SNAPSHOT.jar

1 Like

Would there be a way to run the 2.5.11 binding on OH 2.4 because 2.5.11 requires Import-Package: org.joda.time; version="[2.9.0,3.0.0)" and my other addons are not ready for upgrading to OH 2.5.

Unfortunately, the build system changed between 2.4 and 2.5, so it would be some work to get a 2.4 build. However, you might be able to install a jodatime bundle on 2.4:

bundle:install https://search.maven.org/remotecontent?filepath=joda-time/joda-time/2.10.8/joda-time-2.10.8.jar

bundle:list |grep Joda

Hi Bill. Thank you. Version 2.5.11 is up and running on OH 2.4. HeatIndex and dewPioint are accurate. But Feel_Temperature and Windchill still seems to be off (both -7C and should be approx 7.2C).

Are you saying the numbers are off by 14C or 0.2C? I suspect youā€™re seeing a difference due to variations in the model as well as those caused by unit conversions and display conversions. Weā€™re using the North American/UK model for wind chill (which is the component of ā€œFeels Likeā€ below about 10C), and exclusive of various rounding variations, has produced reasonably accurate values in my tests. The first place to go looking might be the raw item value (items list | grep Chill).

See line ~169 for details of the algorithm used:

Let me know if you have any questions or thoughts!

Hi Bill, It is not te rounding. Numbers are way off or inverted. Your WindChill calculation seem to be correct but my OH dispays an invalled value (calculation 7,9C bud displayed -8,0C). I do not understand why. Your FeelsLike is in this case (T= 9,5C < 10C) the same ( FeelsLike = WindChill and displayed -8,0C) and conform your model. In case of T=11,7 (>10C and < 26C) the WindChill=FeelsLike=T and those values are displayed correctly (11,7C). In case T=12,4 (>50F) and windspeed 2,7m/s (<3mph) the calculated WindChild is 11,6 but OH displays -5C.

2.7 m/s = 6 mph