[SOLVED] Weatherflow Smart Weather Station binding

Amazing work Bill. I’ve tried Calculations binding and it works pretty well!
One issue I have is Heat Index Look:


In this conditions it should be not more than 1.

Also a small thing, in settings there is:
image

I believe it would be better to say “Weather station altitude from sea level (in meters)”
This could also be more cool if the sea level altitude was calculated based on map coordinates.
Thanks for great work.

Regarding “events” channel. This would be good to have some snapshot of the data transmitted through this.
It may be important to have it enabled since I suppose this is the channel of all states which are send immediately from the station without waiting for the closest poll. Am I right? What do you think?
If there is lack of suitable channel type then the only way would be perhaps to decode those data into correct items. Assuming those data are useful among others we already have.

I noticed that I initially had a very strange Heat Index calculation, but then as I was about to investigate, it changed to something more reasonable. That’s one of the calculations that came from the Netatmo code, so it’s possible that there’s something wrong, though with only 2 inputs, it’s hard to imagine what might be wrong. If you’re still getting an error, can you also send me the temp, humidity and the heat index value you’re seeing?

As far as the altitude description is concerned, I agree and will make a change.

My only concern with calculating altitude from coordinates is that the numbers vary quite a bit depending on the data source. Might be worth getting some feedback on that…

Yes, there’s definitely something strange in the Heat Index calculation. With inputs of 2.3 degrees and 82% humidity, I get something over 85.

I’m going to take some time to re-implement that calculation. There is a simpler version that works for a wide range of values. The recommendation from the NWS in the US is to use the simpler equation until it breaks, and then recalculate using the equation with (many more) terms.

I’ll drop a note when it’s working here.

On a side note, we lost power here the other day and I noticed that the Air stopped sending updates until I connected to the hub using my smartphone app. I’m going to do a little more testing and may decide to put a bug report in. I suspect it’s related to the fact that I don’t have my hub connected to the internet…

1 Like

I’ve just added this binding to my server running the 2.2 release and it seems to be working, although I’m seeing these in my log file:

2018-02-01 09:13:20.732 [WARN ] [l.SmartWeatherUDPListenerServiceImpl] - Sending message HubStatusMessage [firmware_version=17, uptime=93677, rssi=-75, timestamp=1517436800, reset_flags=234881026, stack=null, serial_number=HB-00001121] for 3 listeners.
2018-02-01 09:13:20.735 [WARN ] [nternal.SmartWeatherDiscoveryService] - DiscoveryServiceCallback not set. This shouldn’t happen!
2018-02-01 09:13:30.733 [WARN ] [l.SmartWeatherUDPListenerServiceImpl] - Sending message HubStatusMessage [firmware_version=17, uptime=93687, rssi=-74, timestamp=1517436810, reset_flags=234881026, stack=null, serial_number=HB-00001121] for 3 listeners.
2018-02-01 09:13:30.736 [WARN ] [nternal.SmartWeatherDiscoveryService] - DiscoveryServiceCallback not set. This shouldn’t happen!
2018-02-01 09:13:40.734 [WARN ] [l.SmartWeatherUDPListenerServiceImpl] - Sending message HubStatusMessage [firmware_version=17, uptime=93697, rssi=-74, timestamp=1517436820, reset_flags=234881026, stack=null, serial_number=HB-00001121] for 3 listeners.
2018-02-01 09:13:40.739 [WARN ] [nternal.SmartWeatherDiscoveryService] - DiscoveryServiceCallback not set. This shouldn’t happen!

1 Like

I think this is a known problem with OpenHAB 2.2:

1 Like

@hww3 You might want to check out this discussion, as well as this PR. The problem I described above was due to incorrect DS annotations for the discovery services in these two bindings.

Edit: And also this discussion.

Hi Mark,

Thanks for the tip. I looked at my code and it seems to have had the correct annotations already, so I rebuilt the binding jar and the situation (setDiscoveryServiceCallback() not being called) seems to have resolved itself. I don’t see any changes in my code that would (should?) have made a difference so I am just going to assume that there was a bug in the framework that is now fixed.

Just as an aside: Coming from other frameworks, the tooling and behavior of the OSGI framework has required a bit of a learning process. One thing I’ve noticed that the component registration is very specific: if you register a component, the framework only knows it as the type you specified it as, even though it may be a subclass of some other type that the framework also knows about. So, if for example, you have a DiscoveryService, you can’t register it as some subtype because things that go looking for DiscoveryService components won’t find it (even though an object that is a subtype of DiscoveryService is in fact a DiscoveryService).

Bill

For anyone following along, I’ve uploaded a freshly built SmartWeather binding that seems to not have problems with the DiscoveryServiceCallback errors, along with having less verbose logging.

https://bitbucket.org/hww3/org.openhab.binding.weatherflowsmartweather/downloads/org.openhab.binding.weatherflowsmartweather-2.2.0-SNAPSHOT.jar

I’ve also updated the WeatherCalculations binding to hopefully have a more reliable calculation for Heat Index:

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

Please feel free to test it out and let me know if you run into any problems!

Bill

2 Likes

Thanks very much Bill!

Yes, this was a bit of a learning experience for more than you! :wink:

Glad it sorted itself out.

I’ve got this error:

2018-02-04 19:39:48.743 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method ‘EventSubscriber.receive()’ on ‘org.openhab.binding.weathercalculations.internal.WeatherCalculationsEventSubscriberImpl@1ef2dc4’: For input string: "-0,6"
java.lang.NumberFormatException: For input string: "-0,6"
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2043) [?:?]
at sun.misc.FloatingDecimal.parseDouble(FloatingDecimal.java:110) [?:?]
at java.lang.Double.parseDouble(Double.java:538) [?:?]
at org.openhab.binding.weathercalculations.utils.WeatherUtils.getHeatIndex(WeatherUtils.java:65) [263:org.openhab.binding.weathercalculations:2.2.0.201802032322]
at org.openhab.binding.weathercalculations.handler.WeatherCalculationsHandler.eventReceived(WeatherCalculationsHandler.java:148) [263:org.openhab.binding.weathercalculations:2.2.0.201802032322]
at org.openhab.binding.weathercalculations.internal.WeatherCalculationsEventSubscriberImpl.receiveTypedEvent(WeatherCalculationsEventSubscriberImpl.java:71) [263:org.openhab.binding.weathercalculations:2.2.0.201802032322]
at org.openhab.binding.weathercalculations.internal.WeatherCalculationsEventSubscriberImpl.receiveTypedEvent(WeatherCalculationsEventSubscriberImpl.java:1) [263:org.openhab.binding.weathercalculations:2.2.0.201802032322]
at org.eclipse.smarthome.core.events.AbstractTypedEventSubscriber.receive(AbstractTypedEventSubscriber.java:55) [109:org.eclipse.smarthome.core:0.10.0.b1]
at sun.reflect.GeneratedMethodAccessor65.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [109:org.eclipse.smarthome.core:0.10.0.b1]
at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [109:org.eclipse.smarthome.core:0.10.0.b1]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]
2018-02-04 19:39:48.775 [ERROR] [ore.internal.events.OSGiEventManager] - Dispatching/filtering event for subscriber ‘org.eclipse.smarthome.core.events.EventSubscriber’ failed: For input string: "-0,6"
java.lang.NumberFormatException: For input string: "-0,6"
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2043) [?:?]
at sun.misc.FloatingDecimal.parseDouble(FloatingDecimal.java:110) [?:?]
at java.lang.Double.parseDouble(Double.java:538) [?:?]
at org.openhab.binding.weathercalculations.utils.WeatherUtils.getHeatIndex(WeatherUtils.java:65) [263:org.openhab.binding.weathercalculations:2.2.0.201802032322]
at org.openhab.binding.weathercalculations.handler.WeatherCalculationsHandler.eventReceived(WeatherCalculationsHandler.java:148) [263:org.openhab.binding.weathercalculations:2.2.0.201802032322]
at org.openhab.binding.weathercalculations.internal.WeatherCalculationsEventSubscriberImpl.receiveTypedEvent(WeatherCalculationsEventSubscriberImpl.java:71) [263:org.openhab.binding.weathercalculations:2.2.0.201802032322]
at org.openhab.binding.weathercalculations.internal.WeatherCalculationsEventSubscriberImpl.receiveTypedEvent(WeatherCalculationsEventSubscriberImpl.java:1) [263:org.openhab.binding.weathercalculations:2.2.0.201802032322]
at org.eclipse.smarthome.core.events.AbstractTypedEventSubscriber.receive(AbstractTypedEventSubscriber.java:55) [109:org.eclipse.smarthome.core:0.10.0.b1]
at sun.reflect.GeneratedMethodAccessor65.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [109:org.eclipse.smarthome.core:0.10.0.b1]
at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [109:org.eclipse.smarthome.core:0.10.0.b1]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]

I think this may be caused by localization. The code I grabbed from the NWS uses code that can cause problems if your number display format is different than what it expects. I didn’t think too much about it at the time but it’s obvious that is a brittle approach to the problem.

I’ve changed it around so that’s not the case any more. I’ve uploaded a new version if you’d like to try it (I haven’t done much testing of it, obviously…

Yes, I’ve put the newest versions you provided today. It seems that for me this problem still exists. I guesss the issue is about comma vs period?

Yes, I just uploaded a new version that should not be locale specific.

Yes, I’m running newest version and I still have this error:

2018-02-04 20:17:50.050 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method ‘EventSubscriber.receive()’ on ‘org.openhab.binding.weathercalculations.internal.WeatherCalculationsEventSubscriberImpl@128dbe5’: For input string: "-0,8"
java.lang.NumberFormatException: For input string: "-0,8"
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2043) [?:?]
at sun.misc.FloatingDecimal.parseDouble(FloatingDecimal.java:110) [?:?]
at java.lang.Double.parseDouble(Double.java:538) [?:?]
at org.openhab.binding.weathercalculations.utils.WeatherUtils.getHeatIndex(WeatherUtils.java:65) [263:org.openhab.binding.weathercalculations:2.2.0.201802032322]
at org.openhab.binding.weathercalculations.handler.WeatherCalculationsHandler.eventReceived(WeatherCalculationsHandler.java:148) [263:org.openhab.binding.weathercalculations:2.2.0.201802032322]
at org.openhab.binding.weathercalculations.internal.WeatherCalculationsEventSubscriberImpl.receiveTypedEvent(WeatherCalculationsEventSubscriberImpl.java:71) [263:org.openhab.binding.weathercalculations:2.2.0.201802032322]
at org.openhab.binding.weathercalculations.internal.WeatherCalculationsEventSubscriberImpl.receiveTypedEvent(WeatherCalculationsEventSubscriberImpl.java:1) [263:org.openhab.binding.weathercalculations:2.2.0.201802032322]
at org.eclipse.smarthome.core.events.AbstractTypedEventSubscriber.receive(AbstractTypedEventSubscriber.java:55) [109:org.eclipse.smarthome.core:0.10.0.b1]
at sun.reflect.GeneratedMethodAccessor12.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [109:org.eclipse.smarthome.core:0.10.0.b1]
at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [109:org.eclipse.smarthome.core:0.10.0.b1]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]
2018-02-04 20:17:50.105 [ERROR] [ore.internal.events.OSGiEventManager] - Dispatching/filtering event for subscriber ‘org.eclipse.smarthome.core.events.EventSubscriber’ failed: For input string: "-0,8"
java.lang.NumberFormatException: For input string: "-0,8"
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2043) [?:?]
at sun.misc.FloatingDecimal.parseDouble(FloatingDecimal.java:110) [?:?]
at java.lang.Double.parseDouble(Double.java:538) [?:?]
at org.openhab.binding.weathercalculations.utils.WeatherUtils.getHeatIndex(WeatherUtils.java:65) [263:org.openhab.binding.weathercalculations:2.2.0.201802032322]
at org.openhab.binding.weathercalculations.handler.WeatherCalculationsHandler.eventReceived(WeatherCalculationsHandler.java:148) [263:org.openhab.binding.weathercalculations:2.2.0.201802032322]
at org.openhab.binding.weathercalculations.internal.WeatherCalculationsEventSubscriberImpl.receiveTypedEvent(WeatherCalculationsEventSubscriberImpl.java:71) [263:org.openhab.binding.weathercalculations:2.2.0.201802032322]
at org.openhab.binding.weathercalculations.internal.WeatherCalculationsEventSubscriberImpl.receiveTypedEvent(WeatherCalculationsEventSubscriberImpl.java:1) [263:org.openhab.binding.weathercalculations:2.2.0.201802032322]
at org.eclipse.smarthome.core.events.AbstractTypedEventSubscriber.receive(AbstractTypedEventSubscriber.java:55) [109:org.eclipse.smarthome.core:0.10.0.b1]
at sun.reflect.GeneratedMethodAccessor12.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [109:org.eclipse.smarthome.core:0.10.0.b1]
at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [109:org.eclipse.smarthome.core:0.10.0.b1]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]

it sounds like maybe you have a cached version of the module running… can you try downloading the module again (I bumped the version to be sure I uploaded the latest code)?

it should look like this in your bundle:list:

232 | Active | 80 | 2.2.0.201802041930 | WeatherCalculations Binding

I’ve got:

260 │ Active │ 80 │ 2.2.0.201802041713 │ WeatherFlowSmartWeather Binding

263 │ Active │ 80 │ 2.2.0.201802041854 │ WeatherCalculations Binding

I’m also getting this warn:
2018-02-04 21:57:26.401 [ERROR] [ather.model.SmartWeatherDeserializer] - Received unknown SmartWeather message type: hub_status
2018-02-04 21:57:26.406 [WARN ] [atherflowsmartweather.util.UdpServer] - UdpServer.Listener org.openhab.binding.weatherflowsmartweather.internal.SmartWeatherUDPListenerServiceImpl$1@1b88338 threw an exception: null

Hmm. I’m not getting that error, I wonder if there was a change in the message type. I will try looking for hub-status and hub_status; they’re probably the same.

I’ve updated the binding download. Hopefully that error will go away.

I’ve updated bindings. Now I’m getting:

2018-02-05 01:16:06.502 [ERROR] [l.SmartWeatherUDPListenerServiceImpl] - Unable to parse message.
com.google.gson.JsonSyntaxException: java.lang.NumberFormatException: For input string: "BOR,PIN,POR,SFT"
at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:245) [22:com.google.gson:2.7.0]
at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:235) [22:com.google.gson:2.7.0]
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:129) [22:com.google.gson:2.7.0]
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:220) [22:com.google.gson:2.7.0]
at com.google.gson.Gson.fromJson(Gson.java:887) [22:com.google.gson:2.7.0]
at com.google.gson.Gson.fromJson(Gson.java:952) [22:com.google.gson:2.7.0]
at com.google.gson.Gson.fromJson(Gson.java:925) [22:com.google.gson:2.7.0]
at org.openhab.binding.weatherflowsmartweather.model.SmartWeatherDeserializer.deserialize(SmartWeatherDeserializer.java:44) [260:org.openhab.binding.weatherflowsmartweather:2.2.0.201802042152]
at org.openhab.binding.weatherflowsmartweather.model.SmartWeatherDeserializer.deserialize(SmartWeatherDeserializer.java:1) [260:org.openhab.binding.weatherflowsmartweather:2.2.0.201802042152]
at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:69) [22:com.google.gson:2.7.0]
at com.google.gson.Gson.fromJson(Gson.java:887) [22:com.google.gson:2.7.0]
at com.google.gson.Gson.fromJson(Gson.java:852) [22:com.google.gson:2.7.0]
at com.google.gson.Gson.fromJson(Gson.java:801) [22:com.google.gson:2.7.0]
at com.google.gson.Gson.fromJson(Gson.java:773) [22:com.google.gson:2.7.0]
at org.openhab.binding.weatherflowsmartweather.internal.SmartWeatherUDPListenerServiceImpl.processMessage(SmartWeatherUDPListenerServiceImpl.java:63) [260:org.openhab.binding.weatherflowsmartweather:2.2.0.201802042152]
at org.openhab.binding.weatherflowsmartweather.internal.SmartWeatherUDPListenerServiceImpl.access$0(SmartWeatherUDPListenerServiceImpl.java:56) [260:org.openhab.binding.weatherflowsmartweather:2.2.0.201802042152]
at org.openhab.binding.weatherflowsmartweather.internal.SmartWeatherUDPListenerServiceImpl$1.packetReceived(SmartWeatherUDPListenerServiceImpl.java:39) [260:org.openhab.binding.weatherflowsmartweather:2.2.0.201802042152]
at org.openhab.binding.weatherflowsmartweather.util.UdpServer.fireUdpServerPacketReceived(UdpServer.java:544) [260:org.openhab.binding.weatherflowsmartweather:2.2.0.201802042152]
at org.openhab.binding.weatherflowsmartweather.util.UdpServer.runServer(UdpServer.java:357) [260:org.openhab.binding.weatherflowsmartweather:2.2.0.201802042152]
at org.openhab.binding.weatherflowsmartweather.util.UdpServer$1.run(UdpServer.java:219) [260:org.openhab.binding.weatherflowsmartweather:2.2.0.201802042152]
at java.lang.Thread.run(Thread.java:748) [?:?]
Caused by: java.lang.NumberFormatException: For input string: "BOR,PIN,POR,SFT"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) ~[?:?]
at java.lang.Integer.parseInt(Integer.java:580) ~[?:?]
at java.lang.Integer.parseInt(Integer.java:615) ~[?:?]
at com.google.gson.JsonPrimitive.getAsInt(JsonPrimitive.java:260) ~[?:?]
at com.google.gson.internal.bind.JsonTreeReader.nextInt(JsonTreeReader.java:243) ~[?:?]
at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:243) ~[?:?]
… 20 more
2018-02-05 01:16:06.532 [WARN ] [atherflowsmartweather.util.UdpServer] - UdpServer.Listener org.openhab.binding.weatherflowsmartweather.internal.SmartWeatherUDPListenerServiceImpl$1@534f36 threw an exception: null