Gpslogger component not working after update

Hi guys,

I’ve recently upgraded my HASS.IO install from 0.60.1 to 0.65.4 and just noticed that gpslogger has stopped working for both myself and my partner.
I’m confident that the app end on the phone is still working, but when I go to the address that the app posts to I’m geeted with

500 Internal Server Error
Server got itself in trouble

From the homeassistant.log

2018-03-15 19:31:26 INFO (MainThread) [homeassistant.components.http.view] Serving /api/gpslogger to 192.168.1.1 (auth: True)
2018-03-15 19:31:26 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/aiohttp/web_protocol.py", line 381, in start
    resp = await self._request_handler(request)
  File "/usr/lib/python3.6/site-packages/aiohttp/web_app.py", line 310, in _handle
    resp = await handler(request)
  File "/usr/lib/python3.6/site-packages/aiohttp/web_middlewares.py", line 88, in impl
    return await handler(request)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/http/static.py", line 68, in staticresource_middleware
    return await handler(request)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/http/real_ip.py", line 27, in real_ip_middleware
    return await handler(request)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/http/ban.py", line 68, in ban_middleware
    return await handler(request)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/http/auth.py", line 52, in auth_middleware
    return await handler(request)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/http/view.py", line 100, in handle
    result = await result
  File "/config/custom_components/device_tracker/gpslogger.py", line 41, in get
    res = yield from self._handle(request.app['hass'], request.GET)
AttributeError: 'Request' object has no attribute 'GET'
2018-03-15 19:31:26 INFO (MainThread) [homeassistant.core] Bus:Handling <Event system_log_event[L]: timestamp=1521102686.3717344, level=ERROR, message=Error handling request, exception=Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/aiohttp/web_protocol.py", line 381, in start
    resp = await self._request_handler(request)
  File "/usr/lib/python3.6/site-packages/aiohttp/web_app.py", line 310, in _handle
    resp = await handler(request)
  File "/usr/lib/python3.6/site-packages/aiohttp/web_middlewares.py", line 88, in impl
    return await handler(request)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/http/static.py", line 68, in staticresource_middleware
    return await handler(request)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/http/real_ip.py", line 27, in real_ip_middleware
    return await handler(request)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/http/ban.py", line 68, in ban_middleware
    return await handler(request)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/http/auth.py", line 52, in auth_middleware
    return await handler(request)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/http/view.py", line 100, in handle
    result = await result
  File "/config/custom_components/device_tracker/gpslogger.py", line 41, in get
    res = yield from self._handle(request.app['hass'], request.GET)
AttributeError: 'Request' object has no attribute 'GET'
, source=custom_components/device_tracker/gpslogger.py>

Anyone else having problems ?

Is anyone running GPSLogger on HASSIO ? Is it still working ??

OK, so for anyone reading along, after MUCH stuffing around including backing up, fresh installs, mucking around with known_devices etc etc etc…

Three problems :

  1. When I initially set up gpslogger months ago, I did so by adding a file in the custom_components folder.
    I have no idea why, or if this was even normal for this component back then.
    Anyway, deleting the custom_components folder solved the 500 Internal Server Error problem :slight_smile:
  2. I could see that HA was now accepting data via the api for gpslogger, but my sensors were still not updating. Looking through known_devices I could see new familiar looking entries. Long story short, the serial number which used to be reported as logger_### was now just ####.
    I can only assume this was due to an update of the GPSLogger App, or Android itself.
    After a quick rejig of known_devices I thought I’d be good to go. Not quite :expressionless:
  3. I was now getting strange errors from any sensors that referenced the new device_tracker name. This is an old issue where for some reason HA doesn’t like entities that start with a number. The solution here was to change the %SER in the GPSLogger web request to ‘WhatEverYouWantToCallYourDevice’.
    Once this was pushed to known_devices and after another rejig, then updates to sensor names in the sensors.yaml, finally, after a couple of weeks of stuffing around, IT WORKS !!!

Thanks for reading, and I hope one day, this helps someone out.
( even if its just me in 12 months time when the same thing happens and I cant remember how I fixed it :joy::sweat_smile:

2 Likes

im on 0.73 , and still receive 500 internal server error.
i have included the component as indicated on the docs , included the api password at the end of the URL ,
tried everything i thought was worth to try , and still same problem .

so i think this may have other causes not yet discovered .

I sadly have the same problem. Changed the device name, added password in both the URL and the configuration but still get 500.

After 3 days of banging my head, I FINALLY got this working!
With configurations as convoluted as this, there is always a high probability of a typo! Suggestion to devs: Simplify configurations - customization for individual tastes IS NOT always a good thing! Especially if your users cannot get the application to function.

Here’s my painful path:

Follow install instructions CAREFULLY on Home Assistant site:

On the Android app install, under Logging Details, tap Log to custom URL
As shown in the instructions, paste the following code into the URL area.

https://YOUR.DNS.HOSTNAME:PORT/api/gpslogger?latitude=%LAT&longitude=%LON&device=%SER&accuracy=%ACC&battery=%BATT&speed=%SPD&direction=%DIR&altitude=%ALT&provider=%PROV&activity=%ACT&api_password=your_api_password

Modify your host… (I use duckdns, so mine looks like https://my_host.duckdns.org)

IMPORTANT: You must add your Home Assistant API password onto the end of this URL!
This is not shown in the Home Assistant instructions.

I DID NOT change anything else under Log to custom URL (such as Authorization: Bearer LLAT)

Be SURE to double & triple check your Host URL! This seems to be the primary source of errors.

I had missed the % sign before ALT in the URL, and I was getting a ValueError: could not convert string to float: ‘ALT’

Hope this helps!

I believe the API password is deprecated, hence the use of tokens in the instructions.

Home Assistant version 0.85.0
GPSLogger version 99

Using LLAT appended to HTTP Headers and NO password appended to URL(per instructions):

home-assistant.log Details:

2019-01-14 22:03:07 WARNING (MainThread) [homeassistant.components.http.ban] Login attempt or request with invalid authentication from 192.168.1.1

GPSLogger Android app Log View error:

Unexpected response code Response{protocol=http/1.1, code=401, message=Unauthorized, url=https://… etc.
The important elements are “code=401” and “message=Unauthorized”

Using “Authorization: Bearer eyJ0eXAiOiJKV…” (LLAT) replacing “Content-Type: application/x-www.form-urlencoded” in HTTP Headers and NO password appended to URL:

GPSLogger Log View errors:

22:51 error while executing job com.mendhak.gpslogger.loggers.customurl.CustomUrlJob@4d967dd
22:51 Could not send to custom URL

Using (deprecated) password appended to URL, and NO LLAT appended to HTTP Headers:

No errors in GPSLogger Android app or home-assistant.log
Device is immediately populated in known-devices.yaml

My conclusion: An update, either in HA or GPSLogger app, has broken something.

Did you ever get GPS logger working correctly. I tried a new install following the GPSlogger documentation on HA .964 and get error " component.gpslogger.config.abort.not_internet_accessible’: ‘Your Home Assistant instance needs to be accessible from the internet to receive messages from GPSLogger.’, ‘component.gpslogger.config.abort.one_instance_allowed’: ‘Only a single instance is necessary.’, ‘component.gpslogger.config.create_entry.default’: 'To send events to Home Assistant, you will need to setup the webhook feature in GPSLogger.\n\nFill in the following info:\n\n- URL: {webhook_url}\n- Method: POST"
I have no problems logging into my HA from either my network (internal or external) at my Https://xxxx.duckdns.org:8123.

Any ideas on what to try?