retry
retry copied to clipboard
Notification retry not working
System Health details
System Information
| version | core-2024.8.0 |
|---|---|
| installation_type | Home Assistant Container |
| dev | false |
| hassio | false |
| docker | true |
| user | root |
| virtualenv | false |
| python_version | 3.12.4 |
| os_name | Linux |
Checklist
- [X] I have enabled debug logging for my installation.
- [X] I have filled out the issue template to the best of my ability.
- [X] This issue only contains 1 issue (if you have multiple issues, open one issue for each issue).
- [X] This issue is not a duplicate issue of any previous issues..
Describe the issue
My idea was to use the retry service for phone notifications. So for example is my phone is not connected to the internet for some reason, the notification doesn't get lost. I would just receive it a little after my phone connects to the internet again. But this is not working. I get a Task exception was never retrieved when trying to run a notification service within the retry service. Is my idea possible with this retry service?
Reproduction steps
- I created a script with a field called message, which is used in my automations that send messages
- For the message sending part, this is the YAML:
metadata: {}
data:
retries: 999
backoff: 60
service: notify.mobile_app_2109119dg
message: "{{message}}"
data:
message: "{{message}}"
action: retry.action
It works if the phone is connected
Debug logs
Logger: homeassistant
Source: components/mobile_app/notify.py:151
First occurred: 10:31:02 AM (8 occurrences)
Last logged: 11:24:58 AM
Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/mobile_app/push_notification.py", line 56, in handle_push_failed
await fallback_send(data)
File "/usr/src/homeassistant/homeassistant/components/mobile_app/notify.py", line 151, in _async_send_remote_message_target
push_token = app_data[ATTR_PUSH_TOKEN]
~~~~~~~~^^^^^^^^^^^^^^^^^
KeyError: 'push_token'
Diagnostics dump
No response
According to the error, there is a missing ATTR_PUSH_TOKEN. This is notification specific issue, and is unrelated to retry. My suggestion is to use the developer tools and send a regular notification (without retry). Once it's working, you can copy over the relevant parameters.
But the script works if the phone is connected to the internet (meaning it works on the first try). It just issues this error if on the first try it doesn't succeed.
One thing that doesn't seem right is backoff: 60. It should be backoff: "60" - the field is string and not integer. You can also try and remove it entirely, just for making sure it's not the root cause of the issue here.
The other thing that is suspicious is:
Error doing job: Task exception was never retrieved (None)
This means that an exception is not getting properly propagated to the retry integration, which can also explain why there is no additional attempt. I've encountered action (aka service call) which are not propagating exceptions. For example: https://github.com/amitfin/retry/issues/24#issuecomment-1706536433 .
If you share the log file we might be able to understand it better.