Solution for notifications not arriving at companion app when not connected to server?

Yesterday I missed a notification even though the companion app was connected.
This has happened before as well but there seems to be no consistency, most of the times it works though.
This is on a tablet with the minimal app on WiFi and now running latest version since before yesterday.

  1. Is there a way to check if a mobile device is connected?
  2. Is there something I can check which might cause this?
  3. How to intercept this ‘not arriving notification’?

Thanks for any help!

You can add confirmation to the notification and try again if it failed.

1 Like

Hi Hellis81, thank you for this tip!
I wasn’t aware of this option and have added it now.

I have re-read the docs, did some searches here on the forum but it’s not clear to me were I can find a result if this notification has arrived or not. :blush:

I had already seen that part of the companion docs but still I cannot make anything about it because it’s not clear to me where to look for that result.
By sending a notification with the mobile device on and offline, I didn’t find an event in the logs or the logbook.

This will only work on Android devices, you need to go to the Developer Tools and listen to the event " mobile_app_notification_received" after sending the notification.

You can receive an event when a notification is received on the device. In order to receive this event you will need to set confirmation: true as a parameter in your notification service call.All notification data will be present in the event data for the event typemobile_app_notification_received.

1 Like

Hi randomsnack, I did already set that ‘confirmation: true’ option and now with your explanation I have found it! :+1:
Is it possible to use this as a check from the script or automation to get feedback without having to dig it up yourself?

It’s an event, events are triggers.
So yes you can automate it

Guys, I don’t get it…

It’s possible to receive an event if you set that ‘confirmation: true’ parameter: that part I understand.
I had never used an event as a trigger so didn’t know this was possible but now that Hellis81 pointed this out, I still cannot figure out how to get some kind of automatic solving/notification/… when the companion app is not connected and therefor a notification doesn’t arrive.

Here is a automation example to turn on the light when notification is received

alias: ZZZZZZZZ event trigger test
description: ""
trigger:
  - platform: event
    event_type: mobile_app_notification_received
condition: []
action:
  - service: light.turn_on
    data: {}
    target:
      entity_id: light.desk_light
mode: single

And what if the notification is not received, is there a way to make that noticed?

It only return true if notification is received, with the automation if the light doesn’t turn on, the message was not received.

Okay, that’s obvious.

If the companion app is not connected you will not know if a notification was not sent.

Here the boolean will stay off if it has not been received.

description: ""
mode: single
trigger: []
condition: []
action:
  - service: input_boolean.turn_off
    data: {}
    target:
      entity_id: input_boolean.notification
  - service: notify.mobile_app
    data:
      message: Test
  - wait_for_trigger:
      - platform: event
        event_type: mobile_app_notification_received
    timeout:
      hours: 0
      minutes: 0
      seconds: 20
      milliseconds: 0
    continue_on_timeout: false
  - service: input_boolean.turn_on
    data: {}
    target:
      entity_id: input_boolean.notification
1 Like