Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New widget type: double-button with visible state #1013

Open
denilsonsa opened this issue Oct 6, 2020 · 6 comments
Open

New widget type: double-button with visible state #1013

denilsonsa opened this issue Oct 6, 2020 · 6 comments
Labels
enhancement New feature or request widget

Comments

@denilsonsa
Copy link

Is your feature request related to a problem? Please describe.

I want to be able to do some actions very quickly:

  • Turn a light on or off.
  • Make a light dimmer or brighter.
  • Change the volume of a media player
  • etc.

The current way to do those actions is:

  1. Open the Home Assistant app.
  2. Wait for the splash screen to go away (the one with the white background; which kind hurts my eyes as everything else is dark on my device, but that's a different issue).
  3. Wait for the Lovelace webview to load.
  4. Navigate to the input I need (either a different sidebar item, and/or a different tab, and/or scroll down to the card).
  5. Finally, interact with the input.

Describe the solution you'd like

If you notice, most actions have a duality: turn on/off, change the volume up/down, dim the light darker/lighter, make the white balance colder/warmer, roll the blinds up/down...

Thus, I propose a new widget type that contains two buttons, and an optional visible state. Look at this ASCII Art mockup with a few examples (slightly broken because unicode/emoji characters are not the same width as other characters):

.-------.   .-------.   .-------.   .-----.
|   ⇧   |   |   ⏽   |   |   🔆   |   |  🔊  |
| Blind |   | Swtch |   |  Lamp |   | 42% |
|   ⇩   |   |   ⭘   |   |   🔅   |   |  🔉  |
'-------'   '-------'   '-------'   '-----'

The widget can have either two or three interactive areas:

  • The top half (or top third) will call a service (e.g. light.turn_on).
  • The bottom half (or bottom third) will call another service (bonus points for automatically suggesting the complementary service in the UI).
  • The middle third can update the visible state upon touch. That way, the user can refresh the visible state manually (similar to the current template widget).
    • This state should be automatically updated a couple of seconds after the service was called if the other thirds were tapped.
    • If this state is static (i.e. a literal string), then the middle third could be ignored, and thus the interactive area could be changed to halves instead of thirds. This can be helpful if the user prefers a very compact-size widget.

Bonus idea: I know some widgets have scrolling support (e.g. the calendar widget from your phone calendar). Thus, it's possible to detect up/down swipes in a widget. Then, instead of just tapping (which is a binary action), we could have some analog-ish interaction. The user could swipe up/down and then the amount of brightness/volume changed would be proportional to the length of the swipe. This could be implemented by repeatedly calling the up/down services for each "Y" amount of finger movement. In other words, it would behave similarly as an incremental encoder.

Describe alternatives you've considered, if any

My alternative, so far, is to have many widgets. Look at this screenshot:

image

And the same widgets, after I rotate my device to landscape orientation:

image

There are four button widgets, plus one template widget in the middle. Five widgets in total. Their paddings were removed (a feature of the Nova Launcher), and they were resized to the minimum "usable" size. There are many issues with my current solution:

  • Too many widgets (4+1).
  • Button widgets can't have dynamic (template-based) label, forcing me to use a template widget.
  • Template widgets can't have any interaction, forcing me to use button widgets.
  • Tapping on buttons doesn't update the template; I have to remember to tap the template as well.
  • Button widgets can't have an empty label (i.e., if the label is an empty string, there is a wasted "empty" space reserved for the label).
  • The label for up/down actions is duplicated (because button widgets must have a label).

Additional context

Somewhat related issues:

Further refactoring idea

If we take a step back, this widget that I'm suggesting is a superset of the current widgets. Thus, we could imagine a future where we have only one very flexible widget type, and that type contains multiple pieces:

  • If it contains only one "button" piece, then it emulates the current button widget.
  • If it contains only one "template" piece, then it emulates the current template widget.
  • If it contains a button piece, followed by a template piece, followed by another button piece; then it emulates the ASCII-Art mockup I described above.
  • This also means we could have a 3-button widget: [volume up, mute, volume down] or [previous, play/pause, next] or [brighter, toggle, darker]
  • This also means the user could have some arbitrary presets: set brightness to [100%, 75%, 50%, 25%, 1%]

So, this new flexible widget idea would be one widget to rule them all. Or almost. And I understand it takes quite some work to make it usable (specially building the UI, I know UIs are surprisingly time-consuming to build).

@KBerstene
Copy link
Contributor

@denilsonsa Check out the PR I have open. The only thing I think I don't have that you have suggested here is a 3-button widget, though I have already created a media player widget that would cover your previous/playpause/next use case.

@stale
Copy link

stale bot commented Mar 11, 2021

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Mar 11, 2021
@kongo09
Copy link

kongo09 commented Apr 2, 2021

I would suggest a more generic approach to widgets, rather than hard wiring individual designs.

#1193 (comment)

@stale stale bot removed the stale label Apr 2, 2021
@stale
Copy link

stale bot commented Jan 8, 2022

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jan 8, 2022
@denilsonsa
Copy link
Author

Dear stale bot… There was the PR #1077 which got very close to solving this, but wasn't finished due to concerns during the code review. And we have a similar issue/suggestion #1193 that was also marked stale and then unmarked as stale.

@stale stale bot removed the stale label Jan 9, 2022
@Mincka
Copy link
Contributor

Mincka commented Jan 18, 2022

Thanks to the latest update with websockets support and instant status update, this kind of feature, or even more simple ideas like #402 would make even more sense. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request widget
Projects
None yet
Development

No branches or pull requests

5 participants