org.openhab.ui.habpanel icon indicating copy to clipboard operation
org.openhab.ui.habpanel copied to clipboard

Added a new widget: Symbol

Open hypetsch opened this issue 7 years ago • 7 comments

The purpose of the 'symbol' widget is to visualize the current state of an item (in my case e.g. the level at which my CWL is currently operating). The basic idea: Transform the state value of an item into a graphical visualization. Therefore it is possible to configure an unlimited number of rules. Each rule consists of

  • an unlimited number of conditions
  • and style settings like
    • Icon
    • Icon Rotation
    • Icon Animation
    • Background Color
    • Background Animation

Here is a sample screenshot: image

When the selected item state changes, the configured rules are processed from top to bottom until all conditions of a rule match. If so, the configured style properties are applied to the widget. Additionally to the state of an item, conditions can currently also check current date and time.

Some additional notes:

  • To be able to dynamically change a configured icon, I also had to modify the icon widget.
  • In the current version of the symbol widget the rotation of an icon can be specified in degrees. I think it could make sense to add this as a generic feature for all icons?
  • Some possible enhancements that came into my mind and could be added in the future:
    • Add a configurable command (for each rule) which is sent when clicking.
    • Add more animations.
    • Add more operands for conditions.
    • Add more operators for conditions.
    • Add an optional text for each rule which is shown along with the icon (or instead of the symbol).
    • Show a preview of the configured style in the settings dialog.

I would appreciate your feedback and hope you can find some time to have a look at my first 'real' angular experience :).

hypetsch avatar Oct 15 '17 19:10 hypetsch

Thanks for your work! Really appreciated! I intend to have it make its way into the HABPanel environment eventually, but need some time to review how it works and (since it could be a new built-in widget) make sure it doesn't confuse new users and really warrant a new addition to the codebase vs. a plug-in. I'll keep you posted! ;)

ghys avatar Oct 15 '17 23:10 ghys

I tried it and it's a good start, some early design notes - I haven't reviewed the code in detail:

  1. I'm wondering if your rules system could be added as an optional feature to the dummy widget instead of duplicating the same fundamental purpose (displaying a item's state read-only) in a new widget. Also "Symbol" is maybe a little vague -- you could argue that "dummy" is even worse and you would be right ;) but we have to keep it for retro-compatibility. This would also solve the lack of layout options in your widget (textual display mostly).

  2. In the current version of the symbol widget the rotation of an icon can be specified in degrees. I think it could make sense to add this as a generic feature for all icons?

actually to be honest, I don't see many use cases where rotating icons is really useful (the same goes for the spinning animation which btw is available for backgrounds too and looks really silly 😲 ). The only one I could eventually understand is the icon of a fan but still, this is very anecdotal. Adding options that clutter up the dialog boxes and will almost never be used is rarely a good idea. Maybe you could elaborate why you needed that?

  1. If no rules match the widget remains empty (and there's an error in the console). Again adding the rules to the dummy widget would solve that.

Cheers!

ghys avatar Oct 17 '17 17:10 ghys

Thanks for your feedback. I have little time at the moment but i'll try to reply asap.

hypetsch avatar Oct 22 '17 20:10 hypetsch

@hypetsch are you still interested in refactoring your Symbol widget into the Dummy widget as suggested? If not please make sure you allow maintainers to commit to your PR branch, so that I can help you with that (probably not before next year). Thanks!

ghys avatar Dec 27 '17 11:12 ghys

Hi, yes I am still interested in it, but unfortunately do still not have time for it, sorry. Permission should be ok, so you should be able to refactor if you like. I think the dummy widget would be a good way to go. Honestly I didn't have a look at it when implementing the Symbol Widget - because of its name :-). Just one note: I understand that it cannot be renamed in the code for backward compatibility reasons, but wouldn't it be possible to just change the name used in the UI? Thanks for your work and have a happy new year.

hypetsch avatar Dec 27 '17 19:12 hypetsch

Just one note: I understand that it cannot be renamed in the code for backward compatibility reasons, but wouldn't it be possible to just change the name used in the UI?

That is a possibility, but maybe it's better if the id matches the name. "dummy" could remain an alias to ensure existing dashboards continue working after it's renamed to "value" or whatever name we end up with.

Cheers!

ghys avatar Dec 28 '17 19:12 ghys

When will be this available?

8666 avatar May 02 '19 09:05 8666