home-assistant / android

:iphone: Home Assistant Companion for Android
https://companion.home-assistant.io/
Apache License 2.0
2.3k stars 636 forks source link

Wear OS - Add support for multiple Shortcut tiles #2475

Closed kubawolanin closed 1 year ago

kubawolanin commented 2 years ago

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

Describe the solution you'd like

Ability to add shortcuts to Home Assistant entities in my watch is a great feature. Thank you for implementing it! It would be great if we could add multiple tiles with shortcuts. My use case: Shortcuts could be categorized, eg. one tile for lights, second for my car controls etc. ~Not sure if feasible with Android Wear OS.~ Edit: Just checked that Contacts tile (natively available in Samsung Galaxy Watch 4) can be added multiple times.

Describe alternatives you've considered, if any

Additional context

I'm using a Galaxy Watch 4.

dshokouhi commented 2 years ago

I believe we need to define how many tiles we can support in our manifest. How many are you expecting? Just a second one?

https://developer.android.com/training/wearables/tiles#create

kubawolanin commented 2 years ago

Hey @dshokouhi thanks for taking a look at this issue. Not entirely sure how many we would want - maybe 3 is a safe bet? Is there a performance risk when adding more than one?

leroyboerefijn commented 2 years ago

Hey @dshokouhi is your intention to just copy-paste the tile to e.g. tile2? Like we do for quick settings?

I just checked and indeed the Samsung contacts tile can be used multiple times, but as far as I can tell this is a feature that app developers cannot use. By the way, Samsung appears to use more features that we don't have an API for, like animations on the tiles.

dshokouhi commented 2 years ago

Hey @dshokouhi is your intention to just copy-paste the tile to e.g. tile2? Like we do for quick settings?

Yea I was thinking about something similar to quick settings, last time we bumped the total amount it was very simple. The only problem with how quick settings are implemented is that it leads to user confusion on which tile they had setup so we may hit that same issue here if we implement it the same way :)

quack3d commented 2 years ago

Any progress on this? Can you add multiple template tiles as well while you're at it or should that be a separate feature request?

csphoenix1 commented 2 years ago

Hi. Need the same feature to. And also for my girlfriend. Also, thanks for this great app :)

marazmarci commented 1 year ago

I could give this a shot. One thing is sure: we need n number of tiles, let n be any number, that we'll eventually decide.

marazmarci commented 1 year ago

I would only copy-paste manifest entries. The class(es) should be parameterized.

kmalinich commented 1 year ago

I've thought about this so many times. It would be hugely helpful. I personally really only need a second tile. I have 2-3 entities that I'd love to have quick access to on my wrist that I currently cannot, since my current single tile is full. I can't really make decent use of the HA app on WearOS since I have so many entities, the app almost always crashes.

dshokouhi commented 1 year ago

can't really make decent use of the HA app on WearOS since I have so many entities, the app almost always crashes

Try to add your entities to the favorites section then enable show only favorites in the app settings on the watch. Should stop the crashing which is related to a separate issue.

marazmarci commented 1 year ago

Unfortunately, a separate class must be created for every Shortcut Tile, because the <service ...> tag in the manifest only allows unique android:name attributes (which contains the class name).

kmalinich commented 1 year ago

Unfortunately, a separate class must be created for every Shortcut Tile, because the <service ...> tag in the manifest only allows unique android:name attributes (which contains the class name).

Alright, how about HAShortcutTile1, HAShortcutTile2, and HAShortcutTile3? You get the idea.

Or perhaps that will invalidate current HA shortcut tiles..

marazmarci commented 1 year ago

Is it OK if I leave the Show names on shortcuts tile setting global = not settable per Tile?

I don't think users would need it, and I could spare some time.

image

dshokouhi commented 1 year ago

Is it OK if I leave the Show names on shortcuts tile setting global = not settable per Tile?

I think that is fine, a lot of our settings are more global anyways like vibrate and toast notifications :) if users really want it they can request it later too

dshokouhi commented 1 year ago

Alright, how about HAShortcutTile1, HAShortcutTile2, and HAShortcutTile3? You get the idea.

If its anything like Widgets then renaming the existing first tile may cause issues if the user had already added it. I suggest testing once on master and adding the tile, then deploying branch with changes to make sure the tile is still added and functional.

When we did a rename and relocation on widgets it ended up removing widgets from the user home screen so we want to avoid that here :)

marazmarci commented 1 year ago

I just opened a PR (#3697), check it out! 😉