Color Bands Gauge Widget [3.1.0.0;6.0.0.0)

A generic numerical gauge with an optional LCD, in a “classic” style.

Most colors can be changed and up to 9 color bands can be defined.

Screenshots



Changelog

Version 1.1

  • Added click action

Version 1.0

  • initial release

Resources

https://github.com/Nadahar/openhab-widgets/releases/download/r5/colorbands-gauge.yaml

That is great. Thanks.
I will use that for my water tank percentage.

You can change the colors - red is probably wrong when the tank is full…

You can also reduce the “ticks” so that the “small lines” doesn’t indicate each 6.66. And for such a long title, you might want to reduce the font size a tad. If you add unit metadata to your Item, it will also show %.

Could the default “Action” be made available for this widget? So that when you click on the item, that you can define what it needs to do (such as go to the analyze page of the item)

The truth is that I don’t know if that’s possible with a widget. Have you seen any other widgets that do this? If so, let me know which, so I can see how they have done it.

The problem is, that just letting you choose the Action isn’t very useful. The different actions have different parameters, so you must somehow dynamically create/enable other parameters depending on which action has been chosen. I have some vague memory that there might be some clever way to do this, but I just cannot remember the details, or if it’s in fact true.

@JustinG Sorry to bother you again, and it might not be up your alley, but do you have any hints or knowledge about his? @rlkoshak You have also done a lot of gymnastics with the parameters, so maybe you have some hint for me about where to look?

This is a built-in feature. You don’t define a parameter, but instead a parameter group (with no other parameters assigned to it) and give that parameter group context: action. Then, on the component that should have the specified action, you don’t set any of the action properties, you just set actionPropsParameterGroup to the name of the action parameter group you just defined. All the different actions and their related inputs will be dynamically produced in the property dialog and passed on to the component.

You can see an example here:

The widget has been updated, it should be possible to configure an action if you reinstall the widget now.

@JustinG One again, thanks a lot :+1:

Thank you very much Nadahar!

I’ve reinstalled the widget and configured the action and it’s working. Thanks again!

Ravi, thanks for this great widget. Here my use case for PV battery monitoring:

@Nadahar : have special problem today. Have a unit °min (energy integral) which is not part of openHAB’s UoM.

Could you help me with a special variant of your widget which probably adds °min as text instead of taking it from the item state?

I’m sorry, I’m quite sick and unable to test/work on anything. That said, I’m sure there are others like @JustinG that can guide you in what you need to modify to achieve that.

Oh, i am sorry about that and wish you the very best. :crossed_fingers:

@Nadahar feel better soon!

@dk8pn In the widget code, there are several instances where the widget expressions include:

items[props.item].state.split(' ')[1]

These are all the places where the widget extracts the unit from the item state. To simply get your custom unit just replace each of those instances with

'°min'

If you are looking to make this more flexible, you could add a new property following the same format as any of the other properties (I would recommend using one of the ones with groupName: appearance as a template). Then you would need to replace the expression above with props.NAME_OF_YOUR_PROP and then you could set the unit using the configuration properties of the widget.

Many thanks for guiding me. Your hints did the job :grinning_face: .