Wind Gauge Widget [3.1.0.0;6.0.0.0)

A gauge that combines wind direction, speed, gust speed and an optional 3rd wind speed (average, max etc.) into one widget, with a “classic” style. Clicking the widget can optionally open a history chart, at the expense of losing the tooltips.

Screenshots









Changelog

Version 1.2

  • Fixed key case which prevented broke the widget on OH 5.1
  • Prevented display of tooltip for disabled wind speed needles

Version 1.1

  • Added a second “needle style”
  • Added the option to show translatable wind direction abbreviations instead of degrees in the LCD (thanks @crnjan).
  • Added a third wind speed option (thanks @crnjan).
  • Added the option to show a history chart on widget click at the expense of losing tooltips (thanks @crnjan).
  • Made wind speed splits and ticks configurable.
  • Added several visual configuration options like dial and print color and shadow adjustments.
  • Made LCD font size configurable.

Version 1.0

  • Initial release

Resources

https://github.com/Nadahar/openhab-widgets/releases/download/r4/wind-gauge.yaml

15 Likes

Really nice work!

2 Likes

Oh! This is great for my bresser weather station!
Thank you so much!

1 Like

Good widget.
I am using FineOffset weather station and weewx software using mqtt and it the widget works well.
Thanks

1 Like

Thank you very much for the widget!
The widget works fine with my Ecowitt Wittboy weatherstation in a tabbed popup page of my openhab screen. I have adjusted the radius of the first oh-data-series from 72% to 100% to fit an my dark screen background and have added “speed km/h”. You possibly could adjust a text like this on the bottom (between 0 and 40) of your widget … so thats clear what the numbers on the outside mean (without looking into the tooltips).

1 Like

The reason I didn’t add units to the numbers are that I would have to make the widget even smaller, and the smaller it is, the more “fuzzy” the details get. I also assume that most people use the wind speed unit that “they are used to”, for me for examle, wind speed “is” m/s - so I would never expect it to be something else. The text in the widget is editable (where it says “Wind”), so one could add the unit there.

I don’t know if you have discovered the “advanced” button in the widget configuration, but if you click it, you can also adjust all the colors so that it fits better to a dark background.

I thought about a “wind speed text” like this:


… not units by the numbers
I discovered the “show advanced” and adjusted the colors:

  • green: for wind speed and wind direction
  • orange: for guest speed
  • red: 3rd wind speed (todays maximum wind speed)

Tooltips no longer work when I activate “Show Speed Chart”
Thanks again for the widget!

for some reason I keep getting fail to install from the marketplace. marketplace installed the other gauge addons for temperature and barometer just fine. Not sure what Im missing to get it installed

The parser must have become more picky at some point, the same thing happened to me when I tried with 5.1. I found that it was caused by type being written TYPE in one place in the YAML - I have corrected it, and now it installs fine.

OH caches the marketplace add-ons, so you’ll either have to wait 10-15 minutes before trying again, or restart OH. After that, you should get the updated version, which will hopefully work.

that did it. installed without any issues.

thanks

1 Like

Thank you for this great widget.

Here whenever GustSpeed (Rajadas in portuguese) is zero (0) tooltip shows as NaN undefined.

I’ve looked at this, and I think the problem is different than it appears. There is support in the widget for a 3rd wind speed indicator (e.g. max gust last 24 hours etc.), and when it isn’t assigned an Item, its value is “NaN”. The needle itself is hidden when it’s not assigned to an Item, but it stays at “zero” while hidden. It seems that the tooltip for this is still active, and this is what you see. Because the 3rd indicator is defined “on top” of the other two, its tooltip will “win”.

I have managed to hide the tooltip as well, but it still doesn’t make the tooltip from the “gust” appear, it just means that no tooltip will be shown at zero. I don’t know if there’s anything I can do about this, as this functionality is controlled by Apache echarts and I can’t find an option to completely disable a data source conditionally.

1 Like

@JustinG I assume that you don’t have any handy tricks up the sleeve here? I guess this is an echarts issue, not a widget issue, so probably not..?

I have never encountered this issue, and you are right most of this handling is going to out of your control.

I’ve not tried this, but it is possible that you can simulate conditional addition of a tooltip by setting tooltip to an object directly in a widget expression instead of via yaml. So:

tooltip:
  formatter: "=props.directionName ? p=>props.directionName+':
                  <b>'+p.value.toFixed(1)+'°</b>' : NULL"
  valueFormatter: =v=>v.toFixed(1)+'°'

is equivalent to:

tooltip: "={'formatter': props.directionName ? p=>props.directionName+':
                  <b>'+p.value.toFixed(1)+'°</b>' : 'NULL', 'valueFormatter': =v=>v.toFixed(1)+'°'}"

So, in the latter case you could set up a ternary expression of tooltip: =(test) ? {object} : false and then if test is false, tootip tip config should be ignored and therefore not exist in eCharts.

But, echarts provides a “default tooltip” if you don’t specify one. It’s basically the same, just with worse formatting. It did manage to hide it by using show: false, but the problem is that it still “steals the focus” so the tooltip in the layer below isn’t triggered.

Maybe I can alter the z value conditionally, and make it fall behind the others when not used.

I could be misremembering (it’s been a while) but, doesn’t setting silent: true on the data series disable the default tooltip on the series?

Worst-case scenario, you could add display: none to the tooltip’s extra css property.

Thanks. silent: true, if it works, seems like the option I’ve been searching for but couldn’t find. Alternatively, display: none might work, but I’m not sure because echarts actually renders the component to a canvas, so I don’t think they end up as separate elements in HTML. But, maybe their canvas renderer supports it..?

Thank you for your return.
I wasn’t complaining I just meant to warn you about what I found in my setup.
You are completely correct about the reason for the “NaN”.
I hadn’t configured the 3rd indicator or even the 3rd indicator tooltip.
As soon as I made the configuration, the “Nan” information disappeared when gust speed is zero.
Thank you for the excellent widget!

1 Like

This didn’t work, it’s only valid at a “series” level and globally. It doesn’t seem to react to CSS, it’s probably because the whole thing is defined like this:

<canvas data-zr-dom-id="zr_0" width="523" height="375" style="position: absolute; left: 0px; top: 0px; width: 419px; height: 300px; user-select: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); padding: 0px; margin: 0px; border-width: 0px;"></canvas>

I have no idea how they make tooltips/mouseover work within a canvas, but there’s probably some JS magic or similar going on, I can see that the style is being manipulated as I hover over it.