[SOLVED] Weatherflow Smart Weather Station binding

HI Bill, any chance to integrate weatherflow weather forecast data?

Hi-

The forecast data isn’t available in the local UDP broadcast data from the SmartWeather hub. The forecast data is available from the weather flow REST service, which is sort of separate from the observation data. I was going to suggest that maybe that be added as a new data source for the Weather binding, but it seems that’s not been updated for use with OpenHAB 3 (seems like a pretty odd thing to get left behind).

As a stop-gap, you could generate an access token and then use the HTTP binding to fetch forecast data…

You can generate a token at https://tempestwx.com → Settings → Data Authorizations.
You’ll also need your numeric station ID, which you can get from the “Sharing Page” under Settings → Public Data.

Then you can generate the URL you need from this page:

https://weatherflow.github.io/Tempest/api/swagger/#!/forecast/getBetterForecast

I’d set the refresh interval to something like 1200 seconds (every 20 minutes) with a timeout of 2000 ms.

Then you can create channels and items that pull bits and pieces of the forecast data every time it’s fetched. The data is JSON, so you can use the JSONPath transform module to do this. For example, here’s a snippet you can use as a state transformation that will get the expected conditions from the first hour of the forecast:

JSONPATH:$.forecast.hourly[0].conditions

Here’s an example I just threw together that creates a thing with the currently forecast condition. Just change your station ID and authorization code:

UID: http:url:WeatherflowForecast
label: Weatherflow Forecast
thingTypeUID: http:url
configuration:
  authMode: BASIC
  ignoreSSLErrors: false
  baseURL: https://swd.weatherflow.com/swd/rest/better_forecast?station_id=0000&token=MYTOKEN
  refresh: 1200
  commandMethod: GET
  contentType: application/json
  timeout: 2000
  bufferSize: 2048
channels:
  - id: ForecastJSON
    channelTypeUID: http:string
    label: JSON
    description: ""
    configuration: {}
  - id: Hourly_Conditions
    channelTypeUID: http:string
    label: Hourly_Conditions
    description: ""
    configuration:
      mode: READONLY
      stateTransformation: JSONPATH:$.forecast.hourly[0].conditions
1 Like

The periodicaly reports…I still see 0 even a lot of lightnings right now in my area

I would verify that your sensor is actually indicating data. If it isn’t, the binding won’t show anything either. You can snoop udp port 50222 to see the data broadcast by your hub.

See this page for details of where to find the lightning strike data:

https://weatherflow.github.io/Tempest/api/udp/v143/

Hoi Bill, any hint how to install it? Any disatvantages or problems I might face with OH2 when installing this “new rules engine”?

Cheers and thanks for the help!

Have a look at this document. This is how I installed it when I set my openhab2 install.

You don’t have to use the new rules engine, it’s a module that just sits along side the existing rules engine. I haven’t had any problems having it enabled myself.

1 Like

Thanks very much Bill, this works!
I will try now to map the other forecast.
The only thing that i miss still very much is method for -live- wind direction and spee data, to be able to make 360deg compass/wind rose, that would look similiar like in the WF app.

You should be able to use the “rapid wind event” trigger to create a rule that updates some item when the hub broadcasts the update. I don’t have the exact code to do it, but here’s an example that sends a notification when the momentary wind exceeds a threshold:

https://git.sr.ht/~hww3/org.openhab.binding.weatherflowsmartweather/tree/master/item/src/main/resources/rules/readme.md

You’d probably just need to modify this rule to update your desired wind speed and direction items (note that the sky/tempest doesn’t have momentary wind, as that’s not sent from the observation data). A quick search of the community website has lots of examples of how to do that in a rule. Maybe the long term solution is to add new items for that, but the downside would be a lot of extra data if you’re persisting that, such as for graphing purposes.

Bill

1 Like

A quick update:

I found a typo in the current version of the binding that would prevent the rule from triggering. I’ve fixed that and tested that it works now. I also added an example that updates an item with the wind speed every time a rapid wind event is received. You can do the same with the wind direction, it’s in the field called “windDirection”.

Bill

1 Like

Hi Bill,

I’ve been having an issue that may be self inflicted. While my Tempest reports rain (and so does the binding), the accumulation never rises above 0.0 in. It could be that I have set the wrong item type to the channel, but I would think that even in that case, I would still see what the channel thinks the current accumulation is, and I would also expect there to be a message in the logs about a failed conversion. The interesting thing is that I see rain accumulation data hit the logs in openhab, so I’m wondering if there is a disconnect between the reception, and storing/reporting of the data in the binding.

I also have no information (null) for all of the weatherflow hub channels, but that is less of a concern to me personally. Finally, I have also noticed that the lightning strike count will go up, but it seems to zero itself out pretty quickly (I think today it was gone within an hour). This may be why others are not seeing their strikes go up.

If you have any advice or thoughts, I’d be happy to try whatever you suggest. I’d also be happy to guinea pig any code. I’m hoping to get to the point where I can help debug, but my Tempest is on a separate VLAN from my dev machine so I still need to get the networking set up before I can be any use there.

Thanks!

Hi all,
So have had this binding installed for about a week or so, and it seems to work great. But I saw today, that my log spits out this twice every minute. Haven’t seen them before, which is strange.

14:03:35.549 [WARN ] [eatherflowsmartweather.util.UdpServer] - UdpServer.Listener org.openhab.binding.weatherflowsmartweather.internal.SmartWeatherUDPListenerServiceImpl$1@3357cac6 threw an exception: Task java.util.concurrent.ScheduledThreadPoolExecutor$Schedul
edFutureTask@64b2f18e[Not completed, task = java.util.concurrent.Executors$RunnableAdapter@703bc783[Wrapped task = org.openhab.binding.weatherflowsmartweather.handler.SmartWeatherTempestHandler$1@361e06cc]] rejected from org.openhab.core.internal.common.WrappedS
cheduledExecutorService@49581c3e[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 560]

Maybe they arrived after I updated my server?

oxygen ~ $ java --version
openjdk 11.0.11 2021-04-20
OpenJDK Runtime Environment AdoptOpenJDK-11.0.11+9 (build 11.0.11+9)
OpenJDK 64-Bit Server VM AdoptOpenJDK-11.0.11+9 (build 11.0.11+9, mixed mode)

Anyway, it looks to be a warning, so maybe it is nothing to worry about?

Hi-

The Weatherflow local API reports rainfall increments but not totals; it’s a bit confusing because it looks like the data is provided, but it’s always just zero. To get a useful value, you need to total things up. There are a bunch of ways to do that, but the easiest is probably to use the WeatherCalculations binding that I wrote. It provides a number of “calculated” observations including total rainfall amounts for today and yesterday. If you look back through this thread or do a search, you should find a link to that.

It’s possible that the lightning strike data is similar; to be honest I haven’t really looked at it. One thing you might not be aware of is that there are some custom rule triggers supplied with this binding. These triggers can be used to fire rules when, for example, a lightning strike is reported. I think I’ve got a post further up in the thread that talks about this, and I’ve got an example using the RapidWind trigger here:

https://git.sr.ht/~hww3/org.openhab.binding.weatherflowsmartweather/tree/master/item/src/main/resources/rules/readme.md

I don’t have a good answer for your hub channels having no data; I’m pretty sure my pre-Tempest setup is reporting data and I don’t think the hub changed. Are you getting any data in the logs? I think you should at least be getting log entries showing that the messages are being received.

Hi-

Do you have the full exception in your log files? I think that will be needed to know exactly what’s happening, but I suspect it has to do with the online/offline handler:

Every time a message is received from your tempest, we set a timer a few minutes out that will mark the Tempest unit offline. If a message is received before that (normally they arrive every 30-60 seconds), we remove that timer and set a new one. It’s possible something there is going wrong. I don’t think I get those in my Sky/Air setup, but I’ll look this weekend.

If you’re not seeing any other side effects, it’s probably not a major problem, just that the online/offline indicator might not work properly. Still, I’d like to get it sorted out. If you happen to be able to capture more data from the logs, that’d be helpful!

Bill

So for me, it got worse in other places of OH, same/similar issue, but no longer a warning. I googled, and found other having had the same issue, where a restart of their boxes/VMs cured the problem. While it sounded so-so to me, I also tried this, and it went away(!). I suppose some update made some kind of incompatibility in the java subsystem.
Anyway I have not seen this since the restart so I think we can put this issue to sleep.
Thanks!

Excellent. If the problem surfaces again, just drop me a note!

Thanks, I appreciate the answers! I’ll definitely look into your WeatherCalculations binding.

I think the logging format has changed (I’m running OH3.1), the correct command to suppress the “Rapid Wind” logs like

2021-08-17 11:20:29.307 [INFO ] [openhab.event.RapidWindEvent ] - Rapid Wind at 'RapidWindData{bridgeUID=weatherflowsmartweather:hub:HB-, thingUID=weatherflowsmartweather:tempest:HB-:ST-000, epoch=2021-08-17T09:20:26Z, windDirection=45 °, windSpeed=0.75 m/s}'.

is now:

log:set OFF openhab.event.RapidWindEvent

btw, thanks for your hint!

hi @hww3 Bill,

i’ve created a rule to fire when precipitation starts. but the rule wont fire.
when i change the trigger to rapid wind it will work. i already installed your newest addon file on your git.

in the log file is see:

2021-08-26 19:03:45.163 [INFO ] [nhab.event.PrecipitationStartedEvent] - Precipitation Started at 'PrecipitationStartedData{bridgeUID=weatherflowsmartweather:hub:HB-xxxxxxxx, thingUID=weatherflowsmartweather:tempest:HB-xxxxxxx:ST-xxxxxxx, epoch=2021-08-26T17:03:43Z}'.

is it maybe possible to make a textual rule trigger? all my rules are textual configured…

thanx for your hard work!

It looks like a piece of identifying information was left out of those events, causing them to be ignored by the rule trigger. I’ve posted a new version that works again. Please give it a try and let me know if you still have problems.

Unfortunately, the ability to trigger on these events is only available with the new rules engine. I’m not sure if/how you can specify new rules using text configs (other than saying that there’s a code tab in the UI that allows you to modify the rule configuration textually. There might be some information in the forums elsewhere that covers this topic.

Here’s the link:

https://bitbucket.org/hww3/org.openhab.binding.weatherflowsmartweather/downloads/org.openhab.binding.weatherflowsmartweather-3.1.0-SNAPSHOT-M5-UP.jar

1 Like

thanks! will try, with the weather now it doesn’t take a lot of time waiting… edit: Works!

ah oke, will try to search, for now i have made the action, trigger a rule, there i can point a textual rule…

1 Like