Running in background on android maybe broken?

I have been messing around with different android feature and have got mixed results. I have a guess that there is an issue with background processes but its just a guess.

I have attempted to enable device controls, widgets and use it with android auto. All three of those at one time or another were working.

For example, the widgets will work when I first set them up. I have one entity state widget and one service call (button). But then about 30 minutes later If i attempt to use either widget, I get an error “Unable to make service call” If I attempt to use android auto in that first 30 minutes when the widgets are working, everything works fine. But once the widgets stop working, android auto is no longer working as well.

The app itself has never stopped working, if i launch the app and attempt to do anything, it works fine regardless if the widgets/controls/AA are working or not

So it seems like all the functions specifically for Android are the ones not working properly. all the ones that are supposed to work even when the HA app is closed.

I have given the app permission to run in the background, it has unrestricted data access, even if data saver is on. I have tried this with both the stable and beta versions of the app

Settings > companion app > troubleshooting > show and share logs

look at the errors when everything fails to see whats happening. There is probably something else in relation like things not working when not at home etc…

ok so it was all working fine for a week, which it has done before. But today is back to giving me issues. Here is the log that shows an error when I attempted to use one of the wdigets. Looks like somethig with my ssl cert? doing some googling and poking around. it looks like possibly android doesnt like the CA for my SSL cert?

Unable to send message, not connected: WebSocketRequest(message={type=subscribe_trigger, trigger={platform=state, entity_id=[switch.bedroom_lamp]}}, timeout=30000, eventFlow=kotlinx.coroutines.flow.ReadonlySharedFlow@35cb52e, eventTimeout=0, onEvent=capacity=64,data=[], onResponse=null)
01-23 08:49:09.386  4423  4423 E WebSocketRepository: Unable to subscribe to subscribe_trigger with data {trigger={platform=state, entity_id=[switch.bedroom_lamp]}}
01-23 08:49:09.401  4423 10806 E WebSocketRepository: Websocket: onFailure
01-23 08:49:09.401  4423 10806 E WebSocketRepository: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
01-23 08:49:09.401  4423 10806 E WebSocketRepository: 	at com.android.org.conscrypt.SSLUtils.toSSLHandshakeException(SSLUtils.java:356)
01-23 08:49:09.401  4423 10806 E WebSocketRepository: 	at com.android.org.conscrypt.ConscryptEngine.convertException(ConscryptEngine.java:1134)
01-23 08:49:09.401  4423 10806 E WebSocketRepository: 	at com.android.org.conscrypt.ConscryptEngine.readPlaintextData(ConscryptEngine.java:1089)
01-23 08:49:09.401  4423 10806 E WebSocketRepository: 	at com.android.org.conscrypt.ConscryptEngine.unwrap(ConscryptEngine.java:876)
01-23 08:49:09.401  4423 10806 E WebSocketRepository: 	at com.android.org.conscrypt.ConscryptEngine.unwrap(ConscryptEngine.java:747)
01-23 08:49:09.401  4423 10806 E WebSocketRepository: 	at com.android.org.conscrypt.ConscryptEngine.unwrap(ConscryptEngine.java:712)
01-23 08:49:09.401  4423 10806 E WebSocketRepository: 	at com.android.org.conscrypt.ConscryptEngineSocket$SSLInputStream.processDataFromSocket(ConscryptEngineSocket.java:896)
01-23 08:49:09.401  4423 10806 E WebSocketRepository: 	at com.android.org.conscrypt.ConscryptEngineSocket$SSLInputStream.-$$Nest$mprocessDataFromSocket(Unknown Source:0)
01-23 08:49:09.401  4423 10806 E WebSocketRepository: 	at com.android.org.conscrypt.ConscryptEngineSocket.doHandshake(ConscryptEngineSocket.java:236)
01-23 08:49:09.401  4423 10806 E WebSocketRepository: 	at com.android.org.conscrypt.ConscryptEngineSocket.startHandshake(ConscryptEngineSocket.java:218)
01-23 08:49:09.401  4423 10806 E WebSocketRepository: 	at okhttp3.internal.connection.RealConnection.connectTls(RealConnection.kt:379)
01-23 08:49:09.401  4423 10806 E WebSocketRepository: 	at okhttp3.internal.connection.RealConnection.establishProtocol(RealConnection.kt:337)
01-23 08:49:09.401  4423 10806 E WebSocketRepository: 	at okhttp3.internal.connection.RealConnection.connect(RealConnection.kt:209)
01-23 08:49:09.401  4423 10806 E WebSocketRepository: 	at okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.kt:226)
01-23 08:49:09.401  4423 10806 E WebSocketRepository: 	at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.kt:106)
01-23 08:49:09.401  4423 10806 E WebSocketRepository: 	at okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.kt:74)
01-23 08:49:09.401  4423 10806 E WebSocketRepository: 	at okhttp3.internal.connection.RealCall.initExchange$okhttp(RealCall.kt:255)
01-23 08:49:09.401  4423 10806 E WebSocketRepository: 	at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:32)
01-23 08:49:09.401  4423 10806 E WebSocketRepository: 	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
01-23 08:49:09.401  4423 10806 E WebSocketRepository: 	at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95)
01-23 08:49:09.401  4423 10806 E WebSocketRepository: 	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
01-23 08:49:09.401  4423 10806 E WebSocketRepository: 	at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83)
01-23 08:49:09.401  4423 10806 E WebSocketRepository: 	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
01-23 08:49:09.401  4423 10806 E WebSocketRepository: 	at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76)
01-23 08:49:09.401  4423 10806 E WebSocketRepository: 	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
01-23 08:49:09.401  4423 10806 E WebSocketRepository: 	at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
01-23 08:49:09.401  4423 10806 E WebSocketRepository: 	at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:517)
01-23 08:49:09.401  4423 10806 E WebSocketRepository: 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
01-23 08:49:09.401  4423 10806 E WebSocketRepository: 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
01-23 08:49:09.401  4423 10806 E WebSocketRepository: 	at java.lang.Thread.run(Thread.java:1012)
01-23 08:49:09.401  4423 10806 E WebSocketRepository: Caused by: java.security.cert.CertificateException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
01-23 08:49:09.401  4423 10806 E WebSocketRepository: 	at com.android.org.conscrypt.TrustManagerImpl.checkTrustedRecursive(TrustManagerImpl.java:656)
01-23 08:49:09.401  4423 10806 E WebSocketRepository: 	at com.android.org.conscrypt.TrustManagerImpl.checkTrusted(TrustManagerImpl.java:505)
01-23 08:49:09.401  4423 10806 E WebSocketRepository: 	at com.android.org.conscrypt.TrustManagerImpl.checkTrusted(TrustManagerImpl.java:425)
01-23 08:49:09.401  4423 10806 E WebSocketRepository: 	at com.android.org.conscrypt.TrustManagerImpl.getTrustedChainForServer(TrustManagerImpl.java:353)
01-23 08:49:09.401  4423 10806 E WebSocketRepository: 	at android.security.net.config.NetworkSecurityTrustManager.checkServerTrusted(NetworkSecurityTrustManager.java:94)
01-23 08:49:09.401  4423 10806 E WebSocketRepository: 	at android.security.net.config.RootTrustManager.checkServerTrusted(RootTrustManager.java:90)
01-23 08:49:09.401  4423 10806 E WebSocketRepository: 	at com.android.org.conscrypt.ConscryptEngineSocket$2.checkServerTrusted(ConscryptEngineSocket.java:163)
01-23 08:49:09.401  4423 10806 E WebSocketRepository: 	at com.android.org.conscrypt.Platform.checkServerTrusted(Platform.java:260)
01-23 08:49:09.401  4423 10806 E WebSocketRepository: 	at com.android.org.conscrypt.ConscryptEngine.verifyCertificateChain(ConscryptEngine.java:1638)
01-23 08:49:09.401  4423 10806 E WebSocketRepository: 	at com.android.org.conscrypt.NativeCrypto.ENGINE_SSL_read_direct(Native Method)
01-23 08:49:09.401  4423 10806 E WebSocketRepository: 	at com.android.org.conscrypt.NativeSsl.readDirectByteBuffer(NativeSsl.java:569)
01-23 08:49:09.401  4423 10806 E WebSocketRepository: 	at com.android.org.conscrypt.ConscryptEngine.readPlaintextDataDirect(ConscryptEngine.java:1095)
01-23 08:49:09.401  4423 10806 E WebSocketRepository: 	at com.android.org.conscrypt.ConscryptEngine.readPlaintextData(ConscryptEngine.java:1079)
01-23 08:49:09.401  4423 10806 E WebSocketRepository: 	... 27 more
01-23 08:49:09.401  4423 10806 E WebSocketRepository: Caused by: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
01-23 08:49:09.401  4423 10806 E WebSocketRepository: 	... 40 more

yes not all android devices trust the same CA’s, you can import your CA or regenerate your certificate to see if that solves the issue

the app accepts user imported CAs per

I finally figured out how to import a new CA to my android device so I will see if that helps. My cert expires in 2 weeks apparently so I will be setting up a brand new cert soon anyway. I will report back if it seems to have fixed it or not

and thank you for your help @dshokouhi

1 Like

This is the longest everything has been working without an issue so i think its safe to say this one is fixed

1 Like