In my endeavour to slowly stepping away from using remote/external big data gather companies (especially) Google I was looking for a replacement of the “Google Location Sharing” device tracker as it only worked once for a small time and since then even with all the updates from HASS it still did not came back to live.
I already migrated my contacts and calendar using Nextcloud on my own server. However during that process I came aware of PhoneTrack-OC;
I was using the Life360 device tracker and that worked great, however the size of the Android APP was rather big and heavy for my wife’s old phone. But most importantly, I rather keep all that GPS based (+historical) data on my own servers (Privacy and Piracy wise)
PhoneTrack works amazingly good and you can use whatever GPS logger suits you best on your phone, however I really, REALLY like the PhonTrack-OC Android APP for this as well. It is very basic, light and just does what it needs to do without even noticing it on the battery life.
Searching on the Internet brought me to a topic from @Phyks here;
So I took his code, converted it to the new layout and adjusted it a bit by looking at the Google Location Sharing tracker.
hi. i’ve added the folder inside the custom_components, added the code in device_tracker. Restart homeassistant and this error come up:
Log Details (ERROR)
Thu Jul 11 2019 17:04:23 GMT+0200 (Ora legale dell’Europa centrale)
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
tracker.see, 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 224, 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
You need the API-URL as selected with the black square. It contains all the info you need, including the TOKEN (No it is not the same token as you use for logging)
Device name is the name as selected in the bottom red square.
Hope this helps.
@hangy Could you post the (anonymized) configuration.yaml section you are using. I suspect something is wrong there.
Super, works a treat.
only issue is it is only showing me one of two devices i added.
my configuration is below, can someone here confirm this is the correct way of defining it:
I created a group within phonetrack and added both my wife’s and own phone to that group. Then used the link and token of that group. That way you can have just both devices within the same devices section of one integration.
@j1nx Thank you so much!
It works perfectly!
I’m wondering why there aren’t any official Nextcloud integrations/components.
I would imagine there’s a large overlap in Homeassistant/Nextcloud users.