Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration doesn't seem to be working anymore #2

Open
Sjorsa1 opened this issue Jul 12, 2020 · 1 comment
Open

Integration doesn't seem to be working anymore #2

Sjorsa1 opened this issue Jul 12, 2020 · 1 comment

Comments

@Sjorsa1
Copy link

Sjorsa1 commented Jul 12, 2020

I get the following errors when starting up homeassistant with this integration:

2020-07-12 16:12:52 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform legacy
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/device_tracker/setup.py", line 76, in async_setup_legacy
discovery_info,
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/phonetrack/device_tracker.py", line 33, in setup_scanner
PhoneTrackDeviceTracker(hass, config, see)
File "/config/custom_components/phonetrack/device_tracker.py", line 50, in __init__
self._update_info()
File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 239, in wrapper
result = method(*args, **kwargs)
File "/config/custom_components/phonetrack/device_tracker.py", line 61, in _update_info
data = data[self.token]
TypeError: list indices must be integers or slices, not str```

Is there anything I can do to fix this?
@Sjorsa1 Sjorsa1 closed this as completed Aug 18, 2020
@Sjorsa1 Sjorsa1 reopened this Aug 18, 2020
scottwallacesh added a commit to scottwallacesh/homeassistant-phonetrack that referenced this issue Apr 20, 2023
scottwallacesh added a commit to scottwallacesh/homeassistant-phonetrack that referenced this issue Apr 20, 2023
scottwallacesh added a commit to scottwallacesh/homeassistant-phonetrack that referenced this issue Apr 20, 2023
scottwallacesh added a commit to scottwallacesh/homeassistant-phonetrack that referenced this issue Apr 20, 2023
@jonas-w
Copy link

jonas-w commented Sep 24, 2023

@Sjorsa1 and maybe others that see this issue. This error occurs when your token is wrong as the phonetrack API returns an empty list [] when the token does not exist.
You can test this yourself by navigating to the url https://<nextcloud-domain>/index.php/apps/phonetrack/api/getlastpositions/<your token> and it should return a json object like (I replaced all values of mine with 0):

{
  "<token>": {
    "<device_name>": {
      "useragent": "PhoneTrack/0.0",
      "lat": 0.0,
      "lon": 0.0,
      "timestamp": 0,
      "batterylevel": 0,
      "satellites": 0,
      "accuracy": 0,
      "altitude": 0,
      "speed": 0.0,
      "bearing": 0.0
    }
  }
}

j1nx added a commit that referenced this issue Feb 13, 2024
Check configuration items exist.  Fixes, #2.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants