Home Assistant Android version:
1.7.2-137 (137)
Android version:
10
Phone model:
Pixel 4 XL
Home Assistant version:
0.105.5
Last working Home Assistant release (if known):
N/A
Description of problem:
After updating to build 137 I can see several of the new notification enhancements. When I attempt to use uri in my actions nothing happens. Neither a normal URL, which was previously working (https://www.google.com/) or even a lovelace view /lovelace/settings load anything. The notification is just dismissed. When I use clickAction the lovelace view loads as expected. The relative camera URL is also working for image.
Example:
service: notify.mobile_app
message: test
data:
actions:
- action: test
title: test
uri: /lovelace/settings
I have also tried
uri: https://www.google.com
Traceback (if applicable):
N/A
Screenshot of problem:
No screenshot as the notification just dismisses without any action occurring.
Additional information:
The action event still get sent when the action is selected so seems to just be a URL loading issue.
In order for the uri handling to happen you need to set the action to URI
Example:
service: notify.mobile_app
message: test
data:
actions:
- action: URI
title: test
uri: /lovelace/settings
Thanks for confirming @JBassett will update the docs PR
Still not fully clear how this is supposed to work for me either. This doesn't change the view for me once I click on the notification:
{
"message": "Camera snapshot",
"data": {
"sticky": true,
"color": "red",
"ttl": 0,
"priority": "high",
"image": "http://some.image",
"actions": {
"uri": "/lovelace/cameras"
}
}
}
Should the above work or do I have a typo somewhere in the JSON?
@recklessnl you are missing the action and title, look at the example up above.
@dshokouhi Still doesn't work. This is what I currently have:
{
"message": "Camera snaphot",
"data": {
"sticky": true,
"color": "orange",
"ttl": 0,
"priority": "high",
"image": "http://some.url/image.jpg",
"actions": {
"action": "URI",
"title": "View camera",
"uri": "/lovelace/cameras"
}
}
}
When I click on the image, I get taken to the Android app, but it's never switching to the cameras page for me.
@recklessnl your JSON is not correctly formatted as the actions need to be in a list format. You probably got an error in your logs about this too.
Use this instead:
{
"message": "Camera snaphot",
"data": {
"sticky": true,
"color": "orange",
"ttl": 0,
"priority": "high",
"image": "http://some.url/image.jpg",
"actions": [
{
"action": "URI",
"title": "View camera",
"uri": "/lovelace/cameras"
}
]
}
}
What @dshokouhi said is correct. That will create a button in the notification. If you want clicking on the notification to go to the /lovelace/cameras view you need a click action, not actions:
{
"message": "Camera snaphot",
"data": {
"sticky": true,
"color": "orange",
"ttl": 0,
"priority": "high",
"image": "http://some.url/image.jpg",
"clickAction": "/lovelace/cameras"
}
}
It still just doesn't work unfortunately. I see the button now correctly, but when I click it it does absolutely nothing.
Current code:
{
"message": "Camera snapshot",
"data": {
"sticky": true,
"color": "orange",
"ttl": 0,
"priority": "high",
"image": "http://some.url/image.jpg",
"actions": [
{
"action": "URI",
"title": "View Cameras",
"uri": "/lovelace/cameras"
}
]
}
}
@recklessnl Does the example @JBassett provided using clickAction work? If not try to first Force Close the application and reopen it and try again. If that fails try to start fresh with the app: https://companion.home-assistant.io/docs/troubleshooting/faqs/#starting-fresh-with-the-android-app
clickAction doesn't work either unfortunately. I just started from scratch again and it still didn't work. Not sure what's going on. I can access the camera page fine by url, so /lovelace/cameras should work...
I just tried it and it was working when the application was fully closed and the notification was clicked but I did notice it failed to load the correct page when the application was already open.
Well that could be why then. I have my app open in the background most of the time.
I reopened and edited the title to better describe the usecase.
Interesting I just tested having the app open, receiving the notification and clicking on it and I was taken to the appropriate tab and/or URL. It also works when I swipe home, receive notification and click on it. So for me both cases are working.
@recklessnl so you cleared data in the app and performed the other steps outlined in the link?
Yes. Seems @JBassett has the issue as well.
@recklessnl when you tested the feature I mentioned in this issue were you also on build 1.7.2-137? I see in #473 you mentioned an older build (128) but I am not sure if this is the same device used here. Just an FYI this specific feature is in build 1.7.2-136 and on. You would need to be on the beta builds and not the production builds to see this feature. That may explain why its not entirely working for you yet.
I do see an issue where sometimes I am also taken to the app instead of the exact view when the action was selected but its not fully reproducible on my end.
@dshokouhi Good catch - I wasn't aware that the current version I'm on doesn't fully support that yet. However, from the looks of the other comments here, it doesn't seem fully 100% working yet - but it would explain why it never works for me.
The other issue that I created (#473) is separate from this one however.