iOS Notifications

Just setup the notification component and I am not having immediate success - I have a couple of questions.

notify:
  - name: iOSApp
    platform: ios
    target: '<TOKEN FROM SETTINGS>'

What should the token be here? I don’t see anything called token in the App itself as I expected?

Also, for now I am not defining any Push Categories - will basic notification still work? I am currently testing with the dev tools like this:

The logs show the call going through with no errors, but I get nothing from the App on the phone - I guess because the token is incorrect(I just put in the device name).

Any hints?

I had this same problem… the token is in the app settings by the push section… it is a really long code.

As for Push Categories, they are currently necessary even if you are not using actionable messages, but I was told a change was coming that would only require that for actionable messages. The bare minimum for me is the following to get the messages working:

ios:
  health_check: true
  push_categories:
    - name: Generic
      identifier: 'GENERIC'

Then testing in the dev tools, use this JSON:

{
  "message":"Hello",
  "data":
  {
    "push":
    {
      "category":"GENERIC"
    }
  }
}

I used GENERIC as the identifier for me sending regular messages without actions

1 Like

Thanks - that is very helpful :slight_smile:

When I was talking to @robbiet480 about whether or not the Push Categories were necessary for sending regular messages, and he asked me if I was on iOS 9 or iOS 10, but since I have not yet upgraded to iOS 10, I told him I was still on iOS 9, so he said, “yeah, you will still need it”, so I am not sure if that means that if you are on iOS 10 it may go through with just {“message”:“Hello”} once you have the token in the configuration.yaml without needing to add any categories to the configuration, but I can not say for sure, but if I remember correctly, you mentioned in another post that you were on iOS 10 now? If so, you should give it a try with just the message and see what happens.

There’s a bug in the iOS 10 code for registering the push categories. If you use the default configuration that I put in the Gist it will crash your app every time you launch the app. It will be fixed soon.

OK cool, I’ll hang off on the notification piece - but the Presence seems to be vastly improved from the last version I looked at -:slight_smile:

Ahh, so I assume the Push Categories will be required no matter what, on regular messages and actionable messages. Thats fine for me, I just have the GENERIC category for non-actionable messages.

But for now, is it correct that iOS 10 users can not use any push notifications until the next app update? If so, I’ll hold off on upgrading my devices to iOS 10

I haven’t set up any push categories and notifications are working just fine for me. My notification platform setup looks like this:

notify:
 - platform: ios
   name: iOSApp
   target: TOKEN

And my config entry is only this:

ios:

Then I call the notify.iosapp service with the payload

{
"message": "Test"
}

and it delivers through the app just fine.

hmm, that is strange… @robbiet480, when I told you I was not wanting to use actionable messages but just plain messages without buttons and whether or not I needed to have the Push Categories anyway, I thought you told me that I still needed Push Categories. Did I misunderstand? I’ll have to test in the developer tools.

UPDATE: Wow, it works… thats so much easier.

Fix for this coming up now. Please go get the updated version of the gist.

Changes:

  • The health check has been removed (you can implement this on your own with automations)
  • The default value for push_categories is now [] so you no longer need to specify categories.
  • Updated the configuration.yaml to add the new iOS 10 text input keys and mark the parameters dictionary as iOS 9 only.
  • Added a new file showing example automations to use the new notification enhancements (map and attachment support)

Build is uploading now with a bunch of fixes, push being some of the biggest. Attachments now support images, video and audio.

1 Like

I must be missing something obvious here …

I am opening the App on IOS, clicking on the bottom right menu for “more” then selecting settings on the bottom. Under that screen I see setup info such as the URL and password, my Device ID and all of the zones I have created in HA. I do not see a “push” section, or anything marked as a token …

What am I doing wrong?

Have you granted the app permission for notifications?

I haven’t done anything special - however I checked and it doesn’t seem to even have an entry in the notifications section.

I tried the reinstallation advice in this thread and I now see the ID.

Still no luck - I have the target set correctly (I copy and pasted it to make doubly sure). My ios config is simply:

ios:

My notify section is:

notify:
  - platform: ios
    name: iOSApp
    target: '<TOKEN>'

And I am using the dev tools to call notify/iosapp with the following data:

{"message": "Hello"}

I see the service calls going through in the log an no errors are repored:

Sep 16 09:41:48 Pegasus hass[6760]: INFO:homeassistant.components.http:Serving /api/services/notify/iosapp to 192.168.1.154 (auth: True)
Sep 16 09:41:48 Pegasus hass[6760]: INFO:homeassistant.core:Bus:Handling <Event call_service[L]: domain=notify, service_data=message=Hello, service=iosapp, service_call_id=140290165100784-9>
Sep 16 09:41:51 Pegasus hass[6760]: INFO:homeassistant.core:Bus:Handling <Event service_executed[L]: service_call_id=140290165100784-9>

But nothing from the App. I checked and it does now have an entry in the notifications options page in iOS and everything is enabled.

I am running the latest - 1.0(41).

@robbiet480 - do you have any other suggestions?

My suggestion is to message me on Gitter so we can debug this 1-on-1 :slight_smile:

That was indeed a great suggestion - thanks for getting me up and running so quickly.

For anyone interested in the outcome, my config was OK, Robbie identified a server side issue and fixed it.

2 Likes