Core: GPSLogger webhook returns 422, required key not provided

Created on 24 Jan 2019  路  20Comments  路  Source: home-assistant/core

Home Assistant release with the issue:

Last working Home Assistant release (if known):

Operating environment (Hass.io/Docker/Windows/etc.):
Docker

Component/platform:
GPSLogger Webhook

Description of problem:
The URL https://URL/api/webhook/ID?latitude=%LAT&longitude=%LON&device=myname_smartphone&accuracy=%ACC&battery=%BATT&speed=%SPD&direction=%DIR&altitude=%ALT&provider=%PROV&activity=%ACT

Returns 422, required key not provided.

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):


Traceback (if applicable):


Additional information:

Most helpful comment

Ok got it working with the following settings:

  • URL: https://URL/api/webhook/ID
  • HTTP Body: latitude=%LAT&longitude=%LON&device=clifford_gpslogger&accuracy=%ACC&battery=%BATT&speed=%SPD&direction=%DIR&altitude=%ALT&provider=%PROV&activity=%ACT
  • HTTP Headers: Content-Type: application/x-www-form-urlencoded
  • HTTP Method: POST

All 20 comments

Home Assistant release with the issue:
0.86.1
Last working Home Assistant release (if known):
0.85.1
Operating environment (Hass.io/Docker/Windows/etc.):
RaspberryPI / Archlinux / pip install

Component/platform:
GPSLogger Webhook

Description of problem:
The URL https://URL/api/webhook/ID?latitude=%LAT&longitude=%LON&device=clifford_gpslogger&accuracy=%ACC&battery=%BATT&speed=%SPD&direction=%DIR&altitude=%ALT&provider=%PROV&activity=%ACT

Returns 422, required key not provided.

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

logger:
  default: debug
device_tracker:
  - platform: gpslogger

Traceback (if applicable):
Without original gpslogger access token:

2019-01-24 10:16:18 INFO (MainThread) [homeassistant.components.http.view] Serving /api/webhook/<<ID>> to <<IP>> (auth: False)

With original gpslogger access token:

2019-01-24 10:17:56 INFO (MainThread) [homeassistant.components.http.view] Serving /api/webhook/<<ID>> to <<IP>> (auth: True)

Additional information:
I am also seeing this in the log file:

2019-01-24 08:58:09 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection.281471290604736] Received {'type': 'config/entity_registry/get', 'entity_id': 'device_tracker.clifford_gpslogger', 'id': 14}
2019-01-24 08:58:09 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection.281471290604736] Sending {'id': 14, 'type': 'result', 'success': False, 'error': {'code': 'not_found', 'message': 'Entity not found'}}

GPSLogger Version: 99
Updated on Dec 13, 2018

GPSLogger V99 does not have the "POST" checkbox, but does have "HTTP Body / HTTP Method"

I have set HTTP Method to POST and for HTTP Body have tried both multiline and seperated by & versions of the parameters

Investigating, I wonder if GPSLogger changed something with how they post data.

My custom URL screen looks like this: https://gpslogger.app/images/17.png

My custom URL screen looks like this: https://gpslogger.app/images/17.png

At the very least, we'll need to update the docs.

Ok got it working with the following settings:

  • URL: https://URL/api/webhook/ID
  • HTTP Body: latitude=%LAT&longitude=%LON&device=clifford_gpslogger&accuracy=%ACC&battery=%BATT&speed=%SPD&direction=%DIR&altitude=%ALT&provider=%PROV&activity=%ACT
  • HTTP Headers: Content-Type: application/x-www-form-urlencoded
  • HTTP Method: POST

Confirmed @phdelodder's fix works for me as well. Looks like we do just need to a docs update and no code is needed.

@phdelodder do you want to update the docs?

@rohankapoorcom I can do it tonight at the earliest. I see if I can create a pull request.

Sounds good, I would do it, but about to head to bed (since there is no code change required). Feel free to tag me to review the docs update.

@rohankapoorcom / @phdelodder This worked for me as well, I will start updating the docs now :)

Hi, I have the same settings in my gpslogger app but I can't make the integration work for some reason. It did worked fine for 0.85.x

the warning i'm getting is:
"Received message for unregistered webhook WEBHOOK_ID"

how can i "register" the webhook? how will homeassistant know that this webhook is the gpslogger one?

Thanks!

The webhook is a new feature in version 0.86

Yes I understand it's a breaking change, but can't make gpslogger work properly. The docs aren't very clear regarding the "WEBHOOK_ID".

To create a webhook ID, you need to go to Configuration -> Integrations -> add gpslogger

At that point you will get your webhook ID.

sh** i totally missed that part in the documentation, sorry for bothering you!

i have done all as stated in documentation, but im getting error:

Unexpected code Response{protocol=http/1.1, code=422, message=Unprocessable Entity, url=https://xx.xx.xx/api/webhook/xxxx}

Hi! I'm also trying to integrate GPSLogger with HA, but the problem is that I don't see GPSlogger component in integrations.
image
Anybody knows why?

Hi! I'm also trying to integrate GPSLogger with HA, but the problem is that I don't see GPSlogger component in integrations.
image
Anybody knows why?

search below Webhook GPSLooger

Thanks, I found it under "Konfiguracja Geofancy Webhook" (which is not the best translation in polish).

Was this page helpful?
0 / 5 - 0 ratings