question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Device controls nullpointerexception for a few domains

See original GitHub issue

Home Assistant Android version: beta-2124-3de19889

Android version: 12 and others

Phone model:

Redmi Note 9 Pro and others

Home Assistant version: unknown

Last working Home Assistant release (if known): unknown

Description of problem:

Looking at sentry we have a few new bugs coming in that all have the same error message, seems like this was introduced in the latest beta (at least according to sentry)

Traceback (if applicable, to get the logs you may refer to: https://companion.home-assistant.io/docs/troubleshooting/faqs/#android-crash-logs):

java.lang.NullPointerException: null cannot be cast to non-null type kotlin.Int
    at java.util.Objects.requireNonNull(Objects.java:245)
    at io.homeassistant.companion.android.controls.VacuumControl$Companion.provideControlFeatures(VacuumControl.kt:30)
    at io.homeassistant.companion.android.controls.HaControl$DefaultImpls.createControl(HaControl.kt:43)
    at io.homeassistant.companion.android.controls.VacuumControl$Companion.createControl(VacuumControl.kt:20)
    at io.homeassistant.companion.android.controls.HaControlsProviderService.sendEntitiesToSubscriber(HaControlsProviderService.kt:216)
    at io.homeassistant.companion.android.controls.HaControlsProviderService.access$sendEntitiesToSubscriber(HaControlsProviderService.kt:28)
    at io.homeassistant.companion.android.controls.HaControlsProviderService$createPublisherFor$1$1$request$1.invokeSuspend(HaControlsProviderService.kt:138)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
    at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:39)
    at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
java.lang.NullPointerException: null cannot be cast to non-null type kotlin.Int
    at java.util.Objects.requireNonNull(Objects.java:245)
    at io.homeassistant.companion.android.controls.CoverControl$Companion.provideControlFeatures(CoverControl.kt:50)
    at io.homeassistant.companion.android.controls.HaControl$DefaultImpls.createControl(HaControl.kt:43)
    at io.homeassistant.companion.android.controls.CoverControl$Companion.createControl(CoverControl.kt:23)
    at io.homeassistant.companion.android.controls.HaControlsProviderService.sendEntitiesToSubscriber(HaControlsProviderService.kt:216)
    at io.homeassistant.companion.android.controls.HaControlsProviderService.access$sendEntitiesToSubscriber(HaControlsProviderService.kt:28)
    at io.homeassistant.companion.android.controls.HaControlsProviderService$createPublisherFor$1$1$request$1.invokeSuspend(HaControlsProviderService.kt:138)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
    at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:39)
    at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
java.lang.NullPointerException: null cannot be cast to non-null type kotlin.Int
    at java.util.Objects.requireNonNull(Objects.java:245)
    at io.homeassistant.companion.android.controls.FanControl$Companion.provideControlFeatures(FanControl.kt:31)
    at io.homeassistant.companion.android.controls.HaControl$DefaultImpls.createControl(HaControl.kt:43)
    at io.homeassistant.companion.android.controls.FanControl$Companion.createControl(FanControl.kt:23)
    at io.homeassistant.companion.android.controls.HaControlsProviderService.sendEntitiesToSubscriber(HaControlsProviderService.kt:216)
    at io.homeassistant.companion.android.controls.HaControlsProviderService.access$sendEntitiesToSubscriber(HaControlsProviderService.kt:28)
    at io.homeassistant.companion.android.controls.HaControlsProviderService$createPublisherFor$1$1$request$1.invokeSuspend(HaControlsProviderService.kt:138)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
    at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:39)
    at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)

Screenshot of problem:

Additional information: CC: @jpelgrom as I believe this may be related to a recent PR?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
dshokouhicommented, Mar 15, 2022

Closing this issue for now, lets revisit if a user comes to us with an issue.

1reaction
jpelgromcommented, Mar 4, 2022

To fix this I would add a null check to the supported features comparisons (for example (entity.attributes["supported_features"] as? Int)?.and(SUPPORT_SET_POSITION) == SUPPORT_SET_POSITION), but given that it is affecting more than a few people and the cause is unclear I’m actually interested in whether the amount grows in the next few days, and if other controls and app versions will start showing this exception as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

NullPointerException on some phones, not others (same API ...
I have an Android app that is getting a NullPointerException on some phones (all 2.3.x) but not on my phone (also 2.3.x) or...
Read more >
Java NullPointerException - Detect, Fix, and Best Practices
NullPointerException is raised in an application when we are trying to do some operation on null where an object is required. Some of...
Read more >
CrossOverDomain problem - null value exceptions every few ...
Hello,. It appears I have a problem with a Crossover Domain. I am getting java Null Pointer Exceptions every few minutes in my...
Read more >
Null pointer exception when locking domains — oracle-tech
So I selected the Domains directory in the Browser and pressed Team>Lock. This gives a null pointer exception: java.lang.
Read more >
"System.NullPointerException: Attempt to de-reference a null ...
I got this error upon trying to deploy a custom controller and test class from sandbox to production: "System.NullPointerException: Attempt ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found