Android: Entity state widget shows N/A when brightness is selected for attribute

Created on 3 Aug 2020  路  9Comments  路  Source: home-assistant/android

Home Assistant Android version:
2.0.0-2-gd747afd-237-full
Android version:
10
Phone model:
Pixel 4 XL
Home Assistant version:
0.113.3
Last working Home Assistant release (if known):
N/A
Description of problem:

I just setup the new entity state widget and I noticed that when I selected brightness as an attribute to display along with my zwave light status the widget shows as N/A. If I change the attribute to say the Friendly Name it will display correctly, despite needing a missing space :)

Traceback (if applicable):


Screenshot of problem:

Here is what I see when I select brightness as an attribute
image

This is the widget data I used for the above screenshot
image

Here is an example of it working with the friendly name
image

Additional information:

bug widget

All 9 comments

Maybe @colincachia can take a look?

Maybe @colincachia can take a look?

Sure, I can have a look.

@dshokouhi would you mind pasting the value of the brightness attribute for your selected entity from the HA Developer Tools?

@colincachia sure its for my zwave light switches. Keep in mind that brightness is only displayed when the entity is turned on.

Here is the attribute:
brightness: 255

For my test as you can see in the 2 screenshots up above that the light was on so the attribute should be visible.

Edit: I also tested it against another zwave light switch with a different brightness level with the same N/A result

brightness: 103

@colincachia sure its for my zwave light switches. Keep in mind that brightness is only displayed when the entity is turned on.

Here is the attribute:
brightness: 255

For my test as you can see in the 2 screenshots up above that the light was on so the attribute should be visible.

Edit: I also tested it against another zwave light switch with a different brightness level with the same N/A result

brightness: 103

Tapping on the widget should also update the value displayed. Can you confirm that in a scenario where the switch is on (i.e. brightness value should be present), tapping the widget updates the value correctly?

If that is the case I can simply default to something else than "N/A"

Tapping on the widget should also update the value displayed.

Good to know will update my PR with that tidbit! Otherwise it updates every 30 minutes right?

Can you confirm that in a scenario where the switch is on (i.e. brightness value should be present), tapping the widget updates the value correctly?

Unfortunately for me when I tap on the widget the value stays as N/A even with the light on

image

Keep in mind also that even the widget label of test is missing as well

Here is a side by side comparison of when I select brightness or friendly_name:

image

Thanks for the info, will come up with a fix later on 馃檪

@colincachia so I noticed that when my light turned off the widget updated on its own but the app was killed.

image

When I launch the app, turn on the light and tap on the widget I see the following error which means I need to start the app again.

image

Here is the fatal error I encountered when I grab the latest logcat

--------- beginning of crash
08-03 15:52:23.840 11125 11125 E AndroidRuntime: FATAL EXCEPTION: main
08-03 15:52:23.840 11125 11125 E AndroidRuntime: Process: io.homeassistant.companion.android, PID: 11125
08-03 15:52:23.840 11125 11125 E AndroidRuntime: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
08-03 15:52:23.840 11125 11125 E AndroidRuntime:        at io.homeassistant.companion.android.widgets.StaticWidget.resolveTextToShow(StaticWidget.kt:110)
08-03 15:52:23.840 11125 11125 E AndroidRuntime:        at io.homeassistant.companion.android.widgets.StaticWidget$resolveTextToShow$1.invokeSuspend(Unknown Source:12)
08-03 15:52:23.840 11125 11125 E AndroidRuntime:        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
08-03 15:52:23.840 11125 11125 E AndroidRuntime:        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
08-03 15:52:23.840 11125 11125 E AndroidRuntime:        at android.os.Handler.handleCallback(Handler.java:883)
08-03 15:52:23.840 11125 11125 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:100)
08-03 15:52:23.840 11125 11125 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:214)
08-03 15:52:23.840 11125 11125 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:7356)
08-03 15:52:23.840 11125 11125 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
08-03 15:52:23.840 11125 11125 E AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
08-03 15:52:23.840 11125 11125 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

Let me know if you need anything else pulled but I think this should be helpful to start :)

Edit: Here is where it got killed

08-03 15:52:23.844  1390 13285 I DropBoxManagerService: add tag=data_app_crash isTagEnabled=true flags=0x2
08-03 15:52:23.845  1390  1712 W ActivityTaskManager:   Force finishing activity io.homeassistant.companion.android/.webview.WebViewActivity
08-03 15:52:23.850 11125 11125 I Process : Sending signal. PID: 11125 SIG: 9
08-03 15:52:23.859  1390  1426 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.stats.service.DropBoxEntryAddedReceiver
08-03 15:52:23.859  1390  1426 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.chimera.GmsIntentOperationService$PersistentTrustedReceiver
08-03 15:52:23.897   808 13286 E ResolverController: No valid NAT64 prefix (101, <unspecified>/0)
08-03 15:52:23.905   808  1147 E FrameworkListener: read() failed (Connection reset by peer)
08-03 15:52:23.907  1390  1670 W InputDispatcher: channel '81bafea io.homeassistant.companion.android/io.homeassistant.companion.android.webview.WebViewActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
08-03 15:52:23.907  1390  1670 E InputDispatcher: channel '81bafea io.homeassistant.companion.android/io.homeassistant.companion.android.webview.WebViewActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
08-03 15:52:23.919  1390  4961 I DropBoxManagerService: add tag=platform_stats_bookmark isTagEnabled=true flags=0x2
08-03 15:52:23.919 16720 16720 I Zygote  : Process 11426 exited cleanly (0)
08-03 15:52:23.922  1390  1426 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.stats.service.DropBoxEntryAddedReceiver
08-03 15:52:23.922  1390  1426 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.chimera.GmsIntentOperationService$PersistentTrustedReceiver
08-03 15:52:23.952  1390  2379 D ConnectivityService: ConnectivityService NetworkRequestInfo binderDied(NetworkRequest [ LISTEN id=222, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&FOREGROUND Uid: 10342] ], android.os.BinderProxy@522bb91)
08-03 15:52:23.952  1390  4961 I WindowManager: WIN DEATH: Window{81bafea u0 io.homeassistant.companion.android/io.homeassistant.companion.android.webview.WebViewActivity}
08-03 15:52:23.952  1390  4961 W InputDispatcher: Attempted to unregister already unregistered input channel '81bafea io.homeassistant.companion.android/io.homeassistant.companion.android.webview.WebViewActivity (server)'
08-03 15:52:23.952  1390  1408 I ActivityManager: Process io.homeassistant.companion.android (pid 11125) has died: cch CRE
08-03 15:52:23.952  1390  3695 D ConnectivityService: ConnectivityService NetworkRequestInfo binderDied(NetworkRequest [ TRACK_DEFAULT id=221, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED Uid: 10342] ], android.os.BinderProxy@8163af6)
08-03 15:52:23.952  1390  1428 I libprocessgroup: Successfully killed process cgroup uid 10342 pid 11125 in 0ms
08-03 15:52:23.953   809   809 I Zygote  : Process 11125 exited due to signal 9 (Killed)
08-03 15:52:23.954  1390  1720 D ConnectivityService: releasing NetworkRequest [ TRACK_DEFAULT id=221, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED Uid: 10342] ] (release request)
08-03 15:52:23.958   870   870 W lowmemorykiller: Failed to open /proc/11426/oom_score_adj; errno=2: process 11426 might have been killed
08-03 15:52:23.963  1390  1408 I ActivityManager: Killing 11426:com.google.android.webview:sandboxed_process0:org.chromium.content.app.SandboxedProcessService0:0/u0a342i12 (adj 0): isolated not needed
08-03 15:52:23.963  1390  1428 I libprocessgroup: Successfully killed process cgroup uid 99012 pid 11426 in 0ms

It looks like only the attribute is having an issue. Just now I tried to set a static widget for my thermostat with the attribute being the current_temperature and saw the same N/A error. When I create a static widget based on the sensor state which is numeric it seems to be fine.

Fixed in #702

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aleksandrov1995 picture aleksandrov1995  路  4Comments

kmlucy picture kmlucy  路  3Comments

Nik71git picture Nik71git  路  4Comments

simbesh picture simbesh  路  3Comments

andriej picture andriej  路  4Comments