home-assistant / android

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

WearOS shortcuts tile displays incorrect cover icon #4369

Closed Madj42 closed 2 weeks ago

Madj42 commented 2 weeks ago

Home Assistant Android app version(s): 2024.4.3-full Android version(s): AP31.240322.027 Device model(s): Pixel 8 Pro and Pixel Watch 2 Home Assistant version: 2024.5.0b1 Last working Home Assistant release (if known): N/A Description of problem, include YAML if issue is related to notifications: When adding a cover that displays the garage door icon in the main android app, the phone displays it as a window icon. Adding the device to the shortcuts tab displays the window icon.

Companion App Logs:

Screenshot or video of problem: Screenshot_20240429-001710 screenshot-2024-04-29-00-16-41

Additional information:

dshokouhi commented 2 weeks ago

what is the device class of the entity? can you check in the states tab?

Madj42 commented 2 weeks ago

Device class is garage.

dshokouhi commented 2 weeks ago

Thanks for confirming.

I think I see the issue and it may not be an easy one to fix. We generally rely on the device to show the icon attribute however in some cases it may not.

https://github.com/home-assistant/android/blob/master/wear/src/main/java/io/homeassistant/companion/android/views/ChooseEntityView.kt#L146

We do handle the cover device class case

https://github.com/home-assistant/android/blob/master/common/src/main/java/io/homeassistant/companion/android/common/data/integration/Entity.kt#L517

However we dont have all the data saved for shortcut entities as tiles cannot be kept up to date and you wont see icons updating like a device class does. In this case we are hitting the default icon of window open.

https://github.com/home-assistant/android/blob/master/common/src/main/java/io/homeassistant/companion/android/common/data/integration/Entity.kt#L552

I am not sure it makes sense for us to try and save an icon in this case as it will never be correct representation. Can you try setting the icon manually? That will correct the issue.

Madj42 commented 2 weeks ago

Thanks for the update. I didn't want to set the icon manually as I'd lose out on having the icon update automatically based on the cover status. Setting the icon indeed fixes it. I ended up creating a template cover with the icon set. Thank you for the explanation and looking into it.