[BUG] Failed to send event notification on cleared
Home Assistant Android version: 2021.3.1-full
Android version: 11 / 10
Phone model: Samsung Note 20 Ultra / Samsung S8
Home Assistant version: core-2021.3.4
Last working Home Assistant release (if known): This message has always displayed on both devices
Description of problem: When dismissing a notification from Home Assistant, get the message flash up failed to send event notification on cleared event This does not appear to occur all the time, but only seems to be when HA hasn't been opened on the phone for a while, or when it isnt in the recent apps list.
Last night tested actionable notifications, and got a message that said: Failed to Notify HA of picked option Again same circumstances as above.
Traceback (if applicable, to get the logs you may refer to: https://companion.home-assistant.io/docs/troubleshooting/faqs/#android-crash-logs):
Screenshot of problem: Cannot provide, disapears too quickly
Additional information:
This has occured ever since installing and running notifications months ago, so has persisted between app versions and HA versions.
This error occurs when the app is unable to send back the event to HA, are there any HA error logs? ~~You said you tested actionable notifications...did the event fire in home assistant?~~ I suspect the issue is related to your HA instance either not being online or not accepting the event. Either way we need the device logs too. We need more info.
Edit: does the app have proper permissions to run in the background without interference? Its a samsung device so you may need to dig on the settings too. https://dontkillmyapp.com/samsung
Re-read the issue, this is related to devices that are not permitted to run in the background. Our app needs to have full access all the time otherwise things will fail. Closing because the error messages are there for when things are not setup properly. Make sure all permissions are granted and that you check the samsung link above. You may need to hunt down what setting to change so the app can run free in the background.
In both instances the app is allowed to run in the background, it has has access, as per the documentation, and running through the setup in the app itself. Have added the app, along with a number of other apps to the list to stop battery saving etc.
If it wasn't running, it wouldnt receive the notifications in the first place, which it does.
Even double checking the above, issue persists. Clearly a bug.
so teh app only prompts you through standard android practices...Samsung is known for going beyond that so you will need to check the link above for additional steps for Samsung devices. Your device may wake up when it receives the notification but its not staying awake to send the event. Lets look at the logs before we re-open this.
Attached are logs from the beta app I've just updated too (and yes occurs in this as well). Had to use this as phone is not rooted, and Android Studio just does not start on my machine. Hopefully this captures the successful notification and failed.
These errors look to be related to your security certificate, did it expire or something?
java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
and it shows up for every call (location/sensors/notifications), notifications being received are not the same here
Nope, perfectly valid certificate, browsers have no issues with it. It doesnt expire until June.

The config says I have a different internal IP, so I've just updated that to match the external domain, and given it another go, but issue persists on both devices.
Here's a full log example where we update the device registration in HA on full start, all of the errors including the ones in mentioned in this ticket have the exact same error.
04-06 09:25:26.426 31769 31769 E LaunchPresenter: Issue updating Registration
04-06 09:25:26.426 31769 31769 E LaunchPresenter: io.homeassistant.companion.android.common.data.integration.IntegrationException: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
04-06 09:25:26.426 31769 31769 E LaunchPresenter: at io.homeassistant.companion.android.common.data.integration.impl.IntegrationRepositoryImpl.updateRegistration(IntegrationRepositoryImpl.kt:117)
04-06 09:25:26.426 31769 31769 E LaunchPresenter: at io.homeassistant.companion.android.common.data.integration.impl.IntegrationRepositoryImpl$updateRegistration$1.invokeSuspend(Unknown Source:12)
04-06 09:25:26.426 31769 31769 E LaunchPresenter: at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
04-06 09:25:26.426 31769 31769 E LaunchPresenter: at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
04-06 09:25:26.426 31769 31769 E LaunchPresenter: at android.os.Handler.handleCallback(Handler.java:938)
04-06 09:25:26.426 31769 31769 E LaunchPresenter: at android.os.Handler.dispatchMessage(Handler.java:99)
04-06 09:25:26.426 31769 31769 E LaunchPresenter: at android.os.Looper.loop(Looper.java:246)
04-06 09:25:26.426 31769 31769 E LaunchPresenter: at android.app.ActivityThread.main(ActivityThread.java:8506)
04-06 09:25:26.426 31769 31769 E LaunchPresenter: at java.lang.reflect.Method.invoke(Native Method)
04-06 09:25:26.426 31769 31769 E LaunchPresenter: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
04-06 09:25:26.426 31769 31769 E LaunchPresenter: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
Is there anything else you can tell us about the certificate? It doesn't appear to be self assigned but something else seems to be amiss.
https://developer.android.com/training/articles/security-ssl.html#CommonProblems
For the app we require a valid SSL cert like the ones issued by Lets Encrypt for example which is what many of us use.
The SSL errors need to be solved as the app will not bypass them.
It is showing as valid when using different browsers, it is a pretty standard PostiveSSL certificate for a single domain. Is a once yearly renewal due to not being able to do longer than this now.
Valid is good but what about the other things described in the link by Google? When it comes to SSL errors these are all to be solved by the user and not the app as we will not be bypassing these errors. My guess is the error might have something to do with the CA, either unknown or missing.
Was a valid root, however Android appears to not like having to download the intermediate certificates itself, unlike browsers apparently. Hard thing to check for without being able to see those logs and know what they mean. Be pretty good if the app could give a more detailed error in situations like this, or even have an SSL checker.
So I've bundled everything together now and it all works and the issue no longer exists.
Thanks for your help there.
Having the same issue. On 2 devices of Android 10. My SSL certificate is valid, as it was created with LetsEncrypt as i always do, all browsers report a valid cert and i logon HA companion without issues. Its just this toast notification clearance that never gets sent back to the HA server for some reason.
Using NGINX separately from HA as a reverse proxy to handle my HA instance.
Is it possible there could be a different issue here?
i repeat there is no issue with my SSL certificate
So I've bundled everything together now and it all works and the issue no longer exists.
What do you mean you have bundled everything together? If you mean you instead used NGINX as an HA addon. then that is not a solution to this problem. What about people who use NGINX as a reverse proxy? Otherwise please explain your solution. Appreciate it.
So I've bundled everything together now and it all works and the issue no longer exists.
What do you mean you have bundled everything together? Please explain your solution. appreciate it.
I merged the domain certificate, and CA certs into a single certificate file so that it was one complete chain. Some reason this was causing the error, although no browser ever complained, seems to be only within the Android app. Likely because it already knows the chain. Issue resolved.
LetsEncrypt provide a certificate, then a CA cert, so might be a case again, that you need to chain these.