URL Notification Link

I am trying to send a URL link to my phone through the HA app. When I use the following in the services developer tool, it works as expected:

{
	"title": "Test URL",
	"message": "waze://?favorite=work"
}

I would prefer it to not show the full website address, so I tried changing to:

{
	"title": "Test URL",
	"message": "Navigate",
	"data": {
		"url": "waze://?favorite=work"
	}
}

I have also tried:

{
	"title": "Test URL",
	"message": "Navigate",
	"data": {
		"attachment": {
			"url": "waze://?favorite=work",
		}
	}
}

When I do that, I get the notification, but I am not able to click on the text to go to the URL. Does anyone know if this is possible?

Great feature request, will be out in the next version :slight_smile:

EDIT: BTW, the reason itā€™s not working is because attachment is expected to be an image, audio or video file. You will need to tweak the format slightly to open URLs.

1 Like

Awesome! Love the app you have built and glad to see you keep improving it. Figured it was looking for some type of file association with the attachment, but wanted to try all the possible combinations before posting.

Looking forward to the next release!

This has been included in the forthcoming 1.1.1 which I just submitted to Apple. It should be released tomorrow. Thanks for the feature request!

3 Likes

Perfect! Thanks for getting it implemented so fast.

has this been implemented yet? i still cannot get this to workā€¦

Yes, it is working for me. How do you have the notification setup? Below is my notification to open waze and start navigating if there is heavy traffic.

action:
  service: notify.ios_michael_iphone
  data:
    title: "Work Detour"
    message: "Navigate using detour?"
    data:
      url: waze://?favorite=work
1 Like

Just curious in the trigger for that automation @shire210

The trigger is set to send the notification if I leave my house between 6:30-7:00 on a weekday if ā€œalternate routeā€ is turned on. For the alternate route sensor, I have a google travel time sensor set up and compare the distance listed in that sensor to the usual commute distance. If those two numbers are different, it turns ā€œalternate routeā€ ON.

trigger:
  platform: state
  entity_id: input_boolean.ios_home
  to: 'off'
condition:
  condition: and
  conditions:
    - condition: time
      after: '06:30:00'
      before: '07:00:00'
      weekday:
        - mon
        - tue
        - wed
        - thu
    - condition: state
      entity_id: binary_sensor.alternate_route
      state: 'on'
action:
  service: notify.ios_michael_iphone
  data:
    title: "Work Detour"
    message: "Navigate using detour?"
    data:
      url: waze://?favorite=work

i wrote it as:
action:
service: notify.ios_phone
data:
title: ā€˜New Version of Home Assistant Available!ā€™
message: ā€˜Check the release notes here.ā€™
data:
attachment:
url: https://www.home-assistant.io/blog/

well iā€™m not sure why that didnā€™t copy correctlyā€¦

action:
  service: notify.ios_scotts_iphone
  data:
    title: 'New Version of Home Assistant Available!'
    message: 'Check the release notes here.'
    data:
      attachment:
        url: https://www.home-assistant.io/blog/

Do regular notifications work (ones without links)? I would try removing the ā€œattachmentā€ portion and using double quotes.

action:
  service: notify.ios_scotts_iphone
  data:
    title: "New Version of Home Assistant Available!"
    message: "Check the release notes here."
    data:
      url: https://www.home-assistant.io/blog/

I just tested it by going to the ā€œServicesā€ section under developer tools. Under ā€œServiceā€ select notify.ios_scotts_iphone and under service data, I used the following:

{"title":"'New Version of Home Assistant Available!'","message":"Check the release notes here.","data":{"url":"https://www.home-assistant.io/blog/"}}
1 Like

ok. i got that workingā€¦ is there any way to do that with an actionable notification? so i have set up options for ā€˜updateā€™, ā€˜read release notesā€™, ā€˜stop reminding meā€™, and ā€˜remind me laterā€™. i would like it to just open the release notes when i click that option, but instead from what i can tell it would just have to send another notification to do so

I believe you are correct. I am not aware of any way to do that without having it send a new notification.

Is this still working for you? I am trying to set up the exact same automation but canā€™t get the URL to pass either using Google, Waze or Apple maps. The notification just ignores it.

Yes, it is still working perfectly for me. Not sure why it wouldnā€™t be working for you. If you can post your code, I can take a look at it and see if everything was set up correctly there. If you are getting the notification on your phone, you can just paste the ā€œActionā€ piece.

Hereā€™s the code in question. Iā€™ve not gotten as far as building out the automation with triggers/conditions (at present Iā€™ve just set it to go at a time of day, and am triggering it via automation.trigger to test it). Iā€™ve commented out the other services Iā€™ve tried to implement, none of these are working. iOS simply shows the title/message and no map.

Iā€™ve tried using data: attachment: and that has no change.

action:
  - service: notify.ios_matt
    data:
      title: 'Commute Update'
      message: 'Here's an update for you...'
      data:
        #url: waze://?favorite=work
        url: http://maps.apple.com/?saddr=Cupertino&daddr=San+Francisco
        #url: 'comgooglemaps://?saddr=Cupertino&daddr=San+Francisco&directionsmode=driving'

Okay. I pasted that into an automation and it worked perfectly. What happens when you click on the notification? Does it take you into the Home Assistant app or does it do nothing at all?

Ahhh ok - Iā€™d not followed it through HA previously as Iā€™d assumed it would direct me straight to Waze/Google/Apple etc. I can click the notification and it takes me into HA and then I can click again for directions. Problem solved - the error was the user!

Glad you got it sorted out. If you click on the settings button (Gear in bottom right) in the HA app, scroll down to ā€œNotification Settingsā€, you can turn off ā€œConfirm before opening URLā€. If you do that, when you click on the notification, it will open HA and then switch right over to the correct app. It skips you having to click again to get the directions.