Closed mdz closed 3 years ago
Haven't had a chance to validate but I'm guessing we might need a wake lock to keep the system from killing us before we can call home.
Can confirm - after update where widgets are more customisable - they take 10x longer to execute (about 10 seconds to do anything). And if I don't wait, it will spin forever, and I can't do anything with it. It should at least fail, and reset itself!
If the system kills the process before it can actually send the request (which it should do instantly over local network), maybe let's make it trigger a foreground service 🤔
I can confirm this happened on my S8 and now also on my S20. It seems to be independent from the Andorid version.
I'm getting this on my pixel2 android 11
Moto X4, Android 9, calling in
Pixel 2XL, Android 11 - same issue - widget randomly locks up with spinning icon
If it takes to long, and you don't wait, this happens. I press the button widget, then open an app. Then it keeps spinning forever. It would be helpful if there is a timeout of 60 seconds for example. Or even 5 minutes would help.
I tried to update the widget form the app settings, but that doesn't reset the state. Only rebooting seems to work for me
I have the same issue on a Samsung S9+. Any word on a fix yet?
I've found a fix: https://github.com/outadoc/home-slide-android/
I wonder if we need to set a callTimeout
as it seems it may just hang at times for whatever reason
https://square.github.io/okhttp/4.x/okhttp/okhttp3/-ok-http-client/-builder/call-timeout/
By default it seems to suggest it will never give up which might be what we see here?
I have the same problem, when I turn my screen off before the action is completed, it spins forever, but the action is still executed. I can fix it by force-stopping the launcher.
If anyone is able to reliably reproduce this issue can you please try the debug APK here? https://github.com/home-assistant/android/actions/runs/428721951
it can install side by side the production version and you can rename the device name to anything to easily delete once done testing.
If you still see the issue please use Logcat Reader from the play store and grant the special ADB permissions and get us the logs. I have added a couple logs around when we send the service call and when it was successful so that should help show us where this issue resides.
I can still reproduce the problem. Note that for me the button action is always completed, it's just that the widget is stuck in a weird state. The logs show a completed HTTP request:
12-18 09:27:48.485 12504 12504 D ButtonWidget: Broadcast received:
12-18 09:27:48.485 12504 12504 D ButtonWidget: Broadcast action: io.homeassistant.companion.android.widgets.button.ButtonWidget.CALL_SERVICE
12-18 09:27:48.485 12504 12504 D ButtonWidget: AppWidgetId: 29
12-18 09:27:48.490 12504 12504 D ButtonWidget: Calling widget service
12-18 09:27:49.946 12504 12504 D ButtonWidget: Service Call Data loaded:
12-18 09:27:49.946 12504 12504 D ButtonWidget: domain: scene
12-18 09:27:49.946 12504 12504 D ButtonWidget: service: turn_on
12-18 09:27:49.946 12504 12504 D ButtonWidget: service_data: {"entity_id":["scene.test_scene"]}
12-18 09:27:49.948 12504 12504 D ButtonWidget: Sending service call to Home Assistant
12-18 09:27:49.961 12504 19834 I okhttp.OkHttpClient: --> POST <redacted>
12-18 09:27:49.961 12504 19834 I okhttp.OkHttpClient: Content-Type: application/json; charset=UTF-8
12-18 09:27:49.961 12504 19834 I okhttp.OkHttpClient: Content-Length: 130
12-18 09:27:49.962 12504 19834 I okhttp.OkHttpClient: {"type":"call_service","data":{"domain":"scene","service":"turn_on","service_data":{"entity_id":["scene.test_scene"]}}}
12-18 09:27:49.962 12504 19834 I okhttp.OkHttpClient: --> END POST (130-byte body)
12-18 09:27:50.119 12504 19834 I okhttp.OkHttpClient: <-- 200 <redacted> (155ms)
12-18 09:27:50.120 12504 19834 I okhttp.OkHttpClient: server: nginx
12-18 09:27:50.120 12504 19834 I okhttp.OkHttpClient: date: Fri, 18 Dec 2020 08:27:50 GMT
12-18 09:27:50.120 12504 19834 I okhttp.OkHttpClient: content-type: application/json; charset=utf-8
12-18 09:27:50.120 12504 19834 I okhttp.OkHttpClient: content-length: 2
12-18 09:27:50.121 12504 19834 I okhttp.OkHttpClient: strict-transport-security: max-age=31536000; includeSubDomains; preload
12-18 09:27:50.123 12504 19834 I okhttp.OkHttpClient: {}
12-18 09:27:50.124 12504 19834 I okhttp.OkHttpClient: <-- END HTTP (2-byte body)
12-18 09:27:50.127 12504 12504 D ButtonWidget: Service call sent successfully
@Nauxuron are there any logs after that? There are no additional calls being made outside of the app. After the service call is successful we just use Androids API to update the widget. If this doesnt happen all the time then there might be a crash log or error associated with it. Can you always reproduce it if you turn off the screen while the widget is attempting to perform the action?
I think I see the issue. Just to clarify...the service call for all users is always successful right? I think we can work on resetting the widget state when the screen turns back on if that is the case. It would be a similar screen on update like the other widgets have.
The service call always succeeds for me as well
On Fri, Dec 18, 2020, 08:27 Daniel Shokouhi notifications@github.com wrote:
I think I see the issue. Just to clarify...the service call for all users is always successful right? I think we can work on resetting the widget state when the screen turns back on if that is the case. It would be a similar screen on update like the other widgets have.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/home-assistant/android/issues/653#issuecomment-748188699, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADKVL63RHQUGM2NN3DKF4LSVN7ILANCNFSM4ORAU2VA .
@Nauxuron are there any logs after that? There are no additional calls being made outside of the app. After the service call is successful we just use Androids API to update the widget. If this doesnt happen all the time then there might be a crash log or error associated with it.
The only lines I could find that may be related are these:
12-18 19:30:46.933 32543 32543 D Launcher: onStart# hashcode: 203177046
12-18 19:30:46.934 32543 32543 D LauncherAppWidgetHost: setListenIfResumed# listenIfResumed: true, flag: 2
12-18 19:30:46.937 32543 32543 D LauncherAppWidgetHostView: updateAppWidget: io.homeassistant.companion.android.minimal.debug
12-18 19:30:46.937 32543 32543 D LauncherAppWidgetHost: startListening# flag: 7
This is after I turn the screen back on again.
Can you always reproduce it if you turn off the screen while the widget is attempting to perform the action?
Yes, I can always reproduce it, and the service call is always succesful.
Just for completeness' sake, I can no longer reproduce the issue with the debug APK from that PR, so it seems to be fixed.
For me still stuck all the time when I click on it on android 12 and latest HA (2024.5.5)
Can confirm issue still present on 2024.7
Home Assistant Android version: 1.10.0-183
Android version: 10
Phone model: Pixel 2
Home Assistant version: 0.110.4
Last working Home Assistant release (if known): N/A, this has always happened for me (several months since I set it up)
Description of problem:
I have several widgets on my home screen which I use to trigger scripts. They mostly work fine (displaying a green check mark when the action is complete), but sometimes, after the script is finished executing, the widget continues to spin indefinitely (>24 hours). Restarting the phone clears the condition.
Screenshot of problem:
Additional information: I wonder if it might be related to screen lock, since I have a habit of explicitly locking my screen with the power button when I'm finished with an action. But I have not investigated this.