home-assistant / iOS

:iphone: Home Assistant for Apple platforms
https://companion.home-assistant.io
Other
1.59k stars 311 forks source link

Push location update has stopped #194

Closed jjpeet closed 5 years ago

jjpeet commented 5 years ago

Hi @robbiet480 and @blackgold9 I notice that forcing a location update (used to work well) has recently stopped in the last few beta versions. I would have reported sooner but there were a few new phones in my household which I need to ensure weren't causing the issue.

I've been using this automation successfully for those in my household on the beta version of the app (prior to it not working);

- alias: Request Location
  trigger:
  action:
    service: notify.NOTIFIER_All
    data:
      message: "request_location_update"

Thx JP

los7702 commented 5 years ago

Using apple store version 1.50 it is only in background push doesn’t work. When the app is active, the request is working.

robbiet480 commented 5 years ago

I've just double checked that this is working in 1.5.1 and 2.0 and both appear fine. Are you still experiencing this issue?

jjpeet commented 5 years ago

Hi @robbiet480 I am running 1.5.1. I use an automation below to request location updates via button on the interface.

It doesn’t matter whether the app is in the foreground or not, nothing seems to happen when I run the automation.

Running 1.5.1.

- alias: Request Location
  trigger:
  action:
    service: notify.notifier_all
    data:
      message: "request_location_update"

Thx JP

robbiet480 commented 5 years ago

@jjpeet How are you confirming that nothing is happening? Are you monitoring your Home Assistant logs? Is there anything relevant in the event log?

robbiet480 commented 5 years ago

@jjpeet Also, can you enable the "Pushed Location Request Notifications" setting and see if you get notified of a request?

jjpeet commented 5 years ago

Hi @robbiet480 I’ve yet to sit down in from of my desktop to search the logs, but I did just turn on pushed location notification and I’m not getting notified.
I’ll try and get to the logs today - sorry for delay! Thx JP

jjpeet commented 5 years ago

Hi @robbiet480 In debug mode, I get this when I run the script. I'm not sure whether the second log entry relates, but it does appear after the first one regularly...

2019-02-22 16:23:39 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection.1853528112] Sending {'id': 2, 'type': 'event', 'event': {'event_type': 'call_service', 'data': {'domain': 'automation', 'service': 'turn_on', 'service_data': {'entity_id': 'automation.request_location'}}, 'origin': 'LOCAL', 'time_fired': datetime.datetime(2019, 2, 22, 6, 23, 39, 527028, tzinfo=<UTC>), 'context': {'id': '99613fc9f1864ec3a2aca595c41fe78c', 'user_id': None}}}

2019-02-22 16:25:43 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection.1841716144] Sending {'id': 16, 'type': 'result', 'success': True, 'result': None}

Does that tell you anything? Thx JP

robbiet480 commented 5 years ago

@jjpeet If you aren't seeing a line right around there that looks like:

[homeassistant.components.ios.notify] iOS push notification rate limits for robbies_iphone_xs_max_beta: 1 sent, 150 allowed, 0 errors, resets in 17:31:32

then a push notification isn't being sent.

I'm on Discord right now if you have some time to do one on one debugging with me.

jjpeet commented 5 years ago

Hi @robbiet480 Sorry didn't get back to you - end of a long week.

I just checked logs and confirmed it wasn't running; so I changed how I was triggering it (did it manually from the Automation more-info panel) and it worked.

So I've changed my Lovelance config - it was a Glance card toggling the automation (which now I realise was a dumb move). Now it's a service-call, which calls a script, and the script triggers the automation. For some reason I can't actually call automation.trigger directly from Lovelace call-service either, so a script came the rescue.

Thanks for you help - it was my bad after all - sorry for being a time waster :)

JP

robbiet480 commented 5 years ago

@jjpeet Glad to hear it!

Swiftnesses commented 5 years ago

@robbiet480 I'm noticing my locations are not updating now I'm using the V2.0 app.

I send the request_location_update via notify.mobile_app_lina_s_iphone service, is this correct?

robbiet480 commented 5 years ago

@Swiftnesses it is. In the most recent beta build released in the last hour I've added notifications if updating location ends in a error. Can you please update to that build, enable all location notifications and let me know if you still are having issues. You can also hop on Discord and give me part of your push token so I can check the server side logs to ensure that your syntax is all correct. (Yes, that is the notify target to use. As long as you are receiving normal notifications then you can receive the request_location_update one too.

Swiftnesses commented 5 years ago

@robbiet480 I just opened the app to check things and noticed that once it was opened, the push update fired correctly... It's an XR, so I'm not sure why it stopped working (the app had been idle for a day or so, but...).

robbiet480 commented 5 years ago

@Swiftnesses you need to ensure that Background Refresh is turned on in the iOS Settings app. Find Home Assistant Beta in there and make sure the switch is on.

Swiftnesses commented 5 years ago

@robbiet480 It is on, I also checked it before opening the app to check things - I'll keep an eye on it and see if it fails to update again... Thanks for the great app :)