home-assistant / android

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

Entity field not proposed when trying to create a widget for a switch #4700

Closed brenard closed 1 month ago

brenard commented 1 month ago

Home Assistant Android app version(s): 2024.9.5-full (from play store)

Android version(s): 14

Device model(s): Redmi Note 13 Pro+ 5G

Home Assistant version: 2024.10.1

Last working Home Assistant release (if known): I don't known

Description of problem, include YAML if issue is related to notifications:

When trying to create a widget for a switch entity, after selecting switch.toggle in the Action field, the Entity ID field is not displayed and I can't create my widget. Same problem for switch.turn_on and switch.turn_off actions, but no problem with light.toggle for instance.

Companion App Logs:

Screenshot or video of problem:

Screenshot_2024-10-06-08-55-58-676_io homeassistant companion android

Additional information:

dshokouhi commented 1 month ago

Do you have actual switch entities to control? Can you tell us now about them like what integration they come from? I am unable to reproduce, the issue may lie in the entities or integration providing them so we need more information to continue.

Screenshot_20241006-091658.png

brenard commented 1 month ago

Do you have actual switch entities to control? Can you tell us now about them like what integration they come from?

Yes, a lot from many different integrations (MQTT, ESPHome, Frigate, ZHA,...).

I am unable to reproduce, the issue may lie in the entities or integration providing them so we need more information to continue. I'm reproduce the same bug on a Samsung S23 ultra (Android 14 with same version of Android Companion App and same server).

What I could provide to you to help to understand this bug?

dshokouhi commented 1 month ago

What I could provide to you to help to understand this bug?

the companion app logs that were not included in the bug would be a great place to start please.

settings > companion app > troubleshooting > show and share logs

please reproduce the issue and grab the logs so we can see, you can mask GPS and your URLs in the logs

jpelgrom commented 1 month ago

To clarify: does it suggest switch.toggle while typing the action? Or do you have to manually type the action and doesn't it suggest anything at all?

brenard commented 1 month ago

To clarify: does it suggest switch.toggle while typing the action? Or do you have to manually type the action and doesn't it suggest anything at all?

I started to tip and switch.toggle (and turn on/off) is proposed.

I attach logs: homeassistant_companion_log_9-6-2024_21-9-34.txt

dshokouhi commented 1 month ago

interesting, i dont see an error around entity retrieval but sometihng did complain about an empty string. Do you see the same issue if you create a entity state widget? What about in device controls do you see your switches in there? I would expect both of those features also wont show the switches in question.

brenard commented 1 month ago

interesting, i dont see an error around entity retrieval but sometihng did complain about an empty string. Do you see the same issue if you create a entity state widget? What about in device controls do you see your switches in there? I would expect both of those features also wont show the switches in question.

When trying to create an entity status widget, all my switches are proposed and can select any of them without problem. With this type of widget, I also can control my switches when I chose toggle as action.

Screenshot_2024-10-07-01-56-13-945_io homeassistant companion android

This problem seem only appear when a I try to create a action button widget.

brenard commented 1 month ago

Furthermore, on the Samsung S23, I already have action button widgets previously created that control some of my switches without problem, but I can't create new ones.

jpelgrom commented 1 month ago

Can you open Developer tools > Actions and search for the switch toggle action there, and see if the 'Targets' show up? It is sounding like your server isn't telling us that there should be an input for a target which is weird, but this should make it more obvious whether it is an app issue or not. The screen should look like:

image

Dev note: https://github.com/home-assistant/android/blob/master/app/src/main/java/io/homeassistant/companion/android/widgets/button/ButtonWidgetConfigureActivity.kt#L134 -> https://github.com/home-assistant/android/blob/master/app/src/main/java/io/homeassistant/companion/android/widgets/button/ButtonWidgetConfigureActivity.kt#L158-L160

brenard commented 1 month ago

Can you open Developer tools > Actions and search for the switch toggle action there, and see if the 'Targets' show up? It is sounding like your server isn't telling us that there should be an input for a target which is weird, but this should make it more obvious whether it is an app issue or not. The screen should look like:

You are correct, from the HA UI, I also don't have the corresponding interface that loads for the 'switch.toggle' action :

Capture d’écran du 2024-10-09 09-21-52

I checked the HA logs and I don't see any messages when I select the 'switch.toggle' action in the interface. Do you have any ideas on what I can do to understand what's happening on the HA side?

jpelgrom commented 1 month ago

I've been looking at core (server) issues to see if this is known, but I don't see any reports or reason for it to happen currently. @dshokouhi any ideas, have you seen this before?

When fixed on the server, the app should start showing the field again.

dshokouhi commented 1 month ago

Personally i have not seen it, at first i thought maybe a custom integration is causing but we have code in place for that but could be possible something funky on the server end? A good place to start would be disable custom integrations just to rule that out.

brenard commented 1 month ago

Personally i have not seen it, at first i thought maybe a custom integration is causing but we have code in place for that but could be possible something funky on the server end? A good place to start would be disable custom integrations just to rule that out.

Indeed, you were right: by disabling a few custom integrations and restarting Home Assistant, the Action tab in the dev tools was functional again, and as a result, I was able to create widgets with the Android app. Strangely enough, after progressively reactivating all my custom integrations, the bug did not reappear...

dshokouhi commented 1 month ago

thanks for confirming @brenard which custom integrations did you end up disabling and re-enabling? maybe that will help hte next person or to pinpoint an issue in HA core :)

brenard commented 1 month ago

Unfortunately, I was unable to pinpoint any particular integration as the cause, since once I reactivated them all, the problem disappeared. The only integration that stood out was the Android TV remote integration, which had been in error for quite some time before I deactivated it. After reactivating it, it was still in error (as expected), but it was clearly not the cause since my problem had disappeared, and I ended up deleting it (as it was useless to me). Therefore, it is difficult to specifically blame it. I would have liked to provide more clues to understand my problem and to those who might encounter it, but unfortunately, apart from suggesting a mass deactivation of integrations, a restart of HA, and then a gradual reactivation of the integrations, I didn't do anything else 🤗