Generating derived weather calculations with the Weather Calculations Binding

Hi Bill,
What (Rothfusz) equation you are using for the Heat Index for temperatures < 80F. Your previous script did not use the proposed formula of Steadman’s. But your value look good.

Hi-

The heat index equations (which are actually approximations of the original manually calculated heat index tables) are defined only for temps above 80F. Below 80F, the heat index is the ambient temperature in F. I don’t have the references at hand, but the equation is sourced from NOAA/NWS.

Hello all-

I’ve prepared a test version of the Weather Calculations binding for OpenHAB 3.0. I haven’t had much time to test this, but the changes required were fairly minimal, so I am hopeful that problems getting this running will be minimal. Please feel free to give this a try and let me know if you run into any problems!

Bill

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

@hww3 hello I get no values displayed.

here is my config.

UID: weathercalculations:weathercalculations:tempest
label: Weathercalculation Tempest
thingTypeUID: weathercalculations:weathercalculations
configuration:
  temperatureItem: weatherflowsmartweather:tempest:HB-00026268:ST-00023138:temperature
  altitude: 6
  windSpeedItem: weatherflowsmartweather:tempest:HB-00026268:ST-00023138:wind_avg
  stationAltitude: 324
  pressureItem: weatherflowsmartweather:tempest:HB-00026268:ST-00023138:pressure
  rainFallItem: weatherflowsmartweather:tempest:HB-00026268:ST-00023138:rain_accumulated
  humidityItem: weatherflowsmartweather:tempest:HB-00026268:ST-00023138:humidity

Anything wrong?

In the LOG I see only

2021-02-08 19:24:40.352 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'weathercalculations:weathercalculations:tempest' changed from UNINITIALIZED (DISABLED) to INITIALIZING

2021-02-08 19:24:40.367 [INFO ] [s.handler.WeatherCalculationsHandler] - Scheduling bucket tipper 16519632ms from now.

2021-02-08 19:24:40.375 [INFO ] [s.handler.WeatherCalculationsHandler] - Added items to event filter: [weatherflowsmartweather:tempest:HB-00026268:ST-00023138:humidity, weatherflowsmartweather:tempest:HB-00026268:ST-00023138:pressure, weatherflowsmartweather:tempest:HB-00026268:ST-00023138:rain_accumulated, weatherflowsmartweather:tempest:HB-00026268:ST-00023138:temperature, weatherflowsmartweather:tempest:HB-00026268:ST-00023138:wind_avg]

2021-02-08 19:24:40.378 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'weathercalculations:weathercalculations:tempest' changed from INITIALIZING to ONLINE

Loglevel ist set to INFO

org.openhab.binding.weathercalculations            │ INFO

I should start out by saying that if you’re using configuration files, the problem is likely that you are specifying the item name incorrectly (and thus WeatherCalculations isn’t seeing the item changes it needs to in order to operate).

My testing environment is a fresh install of OH 3.0.1, to which I’ve added the SmartWeather and WeatherCalculations bindings. I’ve configured everything exclusively through the UI, allowing OH to discover the SmartWeather devices. The configuration of the WeatherCalculations thing looks like this (taken from the “code” tab):

UID: weathercalculations:weathercalculations:64f8868079
label: Weather Calculations Thing
thingTypeUID: weathercalculations:weathercalculations
configuration:
  temperatureItem: SmartWeatherAir_Temperature
  altitude: 314
  stationAltitude: 2
  pressureItem: SmartWeatherAir_Temperature
  humidityItem: SmartWeatherAir_RelativeHumidity
location: Outdoors

My logging is set to INFO, and I see the following as weather reports arrive:

16:27:37.700 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'SmartWeatherAir_ReportEpoch' changed from 2021-02-09T16:26:35.000+0000 to 2021-02-09T16:27:35.000+0000
16:27:37.702 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'SmartWeatherAir_Pressure' changed from 29.05455606386509756117727797287257 inHg to 29.05160306497660634280537256805777 inHg
16:27:37.703 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'SmartWeatherAir_Temperature' changed from 27.14 °F to 27.014 °F
16:27:37.703 [INFO ] [ns.handler.WeatherCalculationsHandler] - Receive Update: Item 'SmartWeatherAir_Temperature' changed from 27.14 °F to 27.014 °F, SmartWeatherAir_Temperature, ItemStateChangedEvent
16:27:37.706 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'WeatherCalculations_Humidex' changed from -5.7 to -5.8
16:27:37.707 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'WeatherCalculations_HeatIndex' changed from 27.14 °F to 26.96 °F

@hww3 it’s running now. youcan’t use the channel name any more need to use the item name directly

Yes, that worked briefly due to the fact that autogenerated (and suggested) item names and channel names were similar. At some point, OpenHAB changed the way it generated item names and this really nice convenience broke. The upside is that item names are now a lot less “mechanical” and easier to understand. The configuration UI (hopefully) prevents confusion by providing a list of suitable items for use as configuration values.

Hello, all-

I’ve prepared a new test version of the Weather Calculations binding. It adds a few new features:

  • Add wind direction to cardinal direction calculation with configurable number of compass points. This calculation also has the nice feature of snapping value to the cardinal nearest the actual measurement on either side, rather than waiting for the direction to pass the cardinal.
  • Add support for high and low temperature values for today and yesterday. The time each high/low occurs is also available.
  • Also schedule tipper for midnight in the OpenHAB configured timezone rather than the timezone of the system. This hopefully should avoid the confusing result of resetting the daily values at midnight UTC if your openhab isn’t configured to be in the UTC timezone.

Download link is available in this post:

As always, please give it a try and let me know if you have any questions, suggestions or problems!

1 Like

@hww3 get this error

[WARN ] [ab.core.internal.events.EventHandler] - Dispatching/filtering event for subscriber 'org.openhab.core.events.EventSubscriber' failed: Rounding necessary

configuration is

UID: weathercalculations:weathercalculations:0764510488
label: Weather Calculations Thing
thingTypeUID: weathercalculations:weathercalculations
configuration:
  temperatureItem: number_weatherflow_temperaturetempest
  altitude: 6
  windSpeedItem: number_weatherflow_windavgtempest
  windDirectionItem: number_weatherflow_winddirectiontempest
  cardinalPoints: 32
  stationAltitude: 324
  pressureItem: number_weatherflow_pressuretempest
  rainFallItem: number_weatherflow_rainaccumulatedtempest
  humidityItem: number_weatherflow_humiditytempest

I had a report of a problem on another user running on a raspberry pi. I don’t have this problem on my platform, but I’ve just uploaded a new version that hopefully fixes the issue. Feel free to give it a try.

Actually, the other user just got back to me on the other thread and indicates the problem is resolved for him.

@hww3 can you recompile the binding? See here openHAB 3.1 Milestone discussion - #181 by wborn 4

Sure thing… use the jar with the “M5-UP” label. This is just a recompile of the existing code, but it’s untested, so YMMV.

https://bitbucket.org/hww3/org.openhab.binding.weathercalculations/downloads/

2 Likes

Hello @hww3 ,

I am getting this error

2021-06-11 04:29:43.347 [WARN ] [ab.core.internal.events.EventHandler] - Dispatching/filtering event for subscriber 'org.openhab.core.events.EventSubscriber' failed: Rounding necessary

java.lang.ArithmeticException: Rounding necessary

	at java.math.BigDecimal.commonNeedIncrement(BigDecimal.java:4621) ~[?:?]

	at java.math.BigDecimal.needIncrement(BigDecimal.java:4677) ~[?:?]

	at java.math.BigDecimal.divideAndRound(BigDecimal.java:4585) ~[?:?]

	at java.math.BigDecimal.setScale(BigDecimal.java:2891) ~[?:?]

	at java.math.BigDecimal.setScale(BigDecimal.java:2951) ~[?:?]

	at org.openhab.binding.weathercalculations.utils.WeatherUtils.getHeadingString(WeatherUtils.java:272) ~[?:?]

	at org.openhab.binding.weathercalculations.handler.WeatherCalculationsHandler.eventReceived(WeatherCalculationsHandler.java:378) ~[?:?]

	at org.openhab.binding.weathercalculations.internal.WeatherCalculationsEventSubscriberImpl.receiveTypedEvent(WeatherCalculationsEventSubscriberImpl.java:77) ~[?:?]

	at org.openhab.binding.weathercalculations.internal.WeatherCalculationsEventSubscriberImpl.receiveTypedEvent(WeatherCalculationsEventSubscriberImpl.java:1) ~[?:?]

	at org.openhab.core.events.AbstractTypedEventSubscriber.receive(AbstractTypedEventSubscriber.java:57) ~[?:?]

	at org.openhab.core.internal.events.EventHandler.lambda$0(EventHandler.java:151) ~[?:?]

	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]

	at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]

	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]

	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]

	at java.lang.Thread.run(Thread.java:834) [?:?]

What platform are you running openhab on? It seems that some are more sensitive to this sort of problem… I’ll try to get an updated version that fixes this problem in the next few days. Stand by.

I am on newest openhabian with oh3.1M5 running

Can you try the version I’ve just uploaded (see above for the link, it’s the “M5-UP” jar). It seems that the version I built previously was missing a change I’d forgotten to commit. This one should have that fix. Please let me know if you still have problems.

Bill

Just a quick note in case anyone stumbles across this thread: I’ve prepared a new version of the binding for openHAB 3.2 and also published it to the new “Marketplace”. If you happen to try either the new version (from the usual download spot) or install directly from the Marketplace, feel free to post your results here!

Bill

1 Like

Monitoring this thread, and thank you very much for the update.
Looks good, no errors and binding is initializing correctly.

1 Like

Hi Bill,

I realized your binding is still maintained and has a great UI. Any chances you could contribute it to OpenHab? It has a lot of cool calculations built-in.

PS: Just realized it is in the marketplace - I need to figure out how that works :slight_smile:

Erik.

Hi-

I am actively working on this binding, so if you find any problems, please don’t hesitate to let me know. I’ve opted at the moment to not submit this for inclusion to the official release. That’s primarily because the effort required to do that would be pretty significant and would prevent me from fixing problems and enhancing this binding. If anyone is interested in helping out with that, I would certainly not object, of course. In the mean time, I’ve published the latest version in the “marketplace”. Do drop me a line if you run into any problems…

Best-

Bill