And that would be port 8082 right?
you forward 5001 to 5001 on RPI and 8082 to 8082 on RPI
the 8082 you only need to forward if you want to access it from outside your network.
When I do that, all the errors are backā¦
2017-10-08 15:33:46 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform traccar
Traceback (most recent call last):
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/requests/packages/urllib3/connection.py", line 141, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/requests/packages/urllib3/util/connection.py", line 83, in create_connection
raise err
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/requests/packages/urllib3/util/connection.py", line 73, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 356, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/lib/python3.4/http/client.py", line 1090, in request
self._send_request(method, url, body, headers)
File "/usr/lib/python3.4/http/client.py", line 1128, in _send_request
self.endheaders(body)
File "/usr/lib/python3.4/http/client.py", line 1086, in endheaders
self._send_output(message_body)
File "/usr/lib/python3.4/http/client.py", line 924, in _send_output
self.send(msg)
File "/usr/lib/python3.4/http/client.py", line 859, in send
self.connect()
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/requests/packages/urllib3/connection.py", line 166, in connect
conn = self._new_conn()
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/requests/packages/urllib3/connection.py", line 150, in _new_conn
self, "Failed to establish a new connection: %s" % e)
requests.packages.urllib3.exceptions.NewConnectionError: <requests.packages.urllib3.connection.HTTPConnection object at 0x6cd69530>: Failed to establish a new connection: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/requests/adapters.py", line 438, in send
timeout=timeout
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 649, in urlopen
_stacktrace=sys.exc_info()[2])
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/requests/packages/urllib3/util/retry.py", line 388, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
requests.packages.urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='<redacted>.duckdns.org', port=5002): Max retries exceeded with url: /api/devices (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x6cd69530>: Failed to establish a new connection: [Errno 111] Connection refused',))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/device_tracker/__init__.py", line 160, in async_setup_platform
disc_info)
File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
yield self # This tells Task to wait for completion.
File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
value = future.result()
File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
raise self._exception
File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
result = self.fn(*self.args, **self.kwargs)
File "/home/homeassistant/.homeassistant/custom_components/device_tracker/traccar.py", line 28, in setup_scanner
TraccarDeviceScanner(hass, config, see)
File "/home/homeassistant/.homeassistant/custom_components/device_tracker/traccar.py", line 41, in __init__
self._update_info()
File "/home/homeassistant/.homeassistant/custom_components/device_tracker/traccar.py", line 48, in _update_info
self._devices = requests.get(self._host + '/api/devices', auth=(self._username, self._password),headers = ({'Accept': 'application/json'}))
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/requests/api.py", line 72, in get
return request('get', url, params=params, **kwargs)
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/requests/api.py", line 58, in request
return session.request(method=method, url=url, **kwargs)
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/requests/sessions.py", line 518, in request
resp = self.send(prep, **send_kwargs)
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/requests/sessions.py", line 639, in send
r = adapter.send(request, **kwargs)
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/requests/adapters.py", line 502, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='<redacted>duckdns.org', port=5002): Max retries exceeded with url: /api/devices (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x6cd69530>: Failed to establish a new connection: [Errno 111] Connection refused',))
Finally getting some data to my server:
2017-10-08 16:26:14 INFO: [BB8D8E5C] connected
2017-10-08 16:26:15 DEBUG: [BB8D8E5C: 5002 < 62.140.137.115] HEX: 78780d0103528$
2017-10-08 16:26:17 INFO: [FD7EB218] connected
2017-10-08 16:26:18 DEBUG: [BB8D8E5C: 5002 < 62.140.137.115] HEX: 78781f12110a0$
2017-10-08 16:26:21 DEBUG: [BB8D8E5C: 5002 < 62.140.137.115] HEX: 78780a1340050$
2017-10-08 16:26:25 DEBUG: [BB8D8E5C: 5002 < 62.140.137.115] HEX: 78781f12110a0$
2017-10-08 16:26:26 INFO: [2A1D9DA4] disconnected
IP trace confirms this is my Vodafone simcard reporting. Canāt get the HEX deciphered unfortunately, looks like it has been cutoff.
Finally I can see my device ID in the logfile using port 5023:
2017-10-08 16:50:11 INFO: [209AC5D3] id: 352887075416044, time: 1970-01-01 01:$
But now the next obstacle occurs: I canāt add my device
Update: location reporting also works, only I canāt add my device in Traccarā¦
2017-10-08 18:26:02 INFO: [209AC5D3] id: 352887075416044, time: 2017-10-08 18:25:50, lat: 51.96530, lon: 4.61914, speed: 0.0, course: 0.0
Are you using this when adding a new device?
352887075416044
Add it to the second line āidentifierā when adding a device
Hi all:
Thanks to koen01 for this great component!!
My environment is an Ubuntu 16.04 server, with Home Assistant, Traccar and many other pieces of software. My gps device is a Teltonika FM1204 reporting fine to Traccar since first time. After commenting this line
ā# āipā: position_id[āattributesā][āipā],ā
all went ok!!
Iām using a read only Traccar user to retrieve the data from it.
Thank you!!
Update: Well after a lot of failed attempts I discovered my device was reporting itās location fine as from last night. The reason I couldnāt add it was because it was allready been recognized by the Traccar server.
After changing my logon credentials back to my own username and password (instead of admin/admin) I finally see my device in the Traccar instance running on my PI.
@koen01 Iām having problems with āaccuracyā:
2017-10-09 18:58:23 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform traccar
Traceback (most recent call last):
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/device_tracker/__init__.py", line 160, in async_setup_platform
disc_info)
File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
yield self # This tells Task to wait for completion.
File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
value = future.result()
File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
raise self._exception
File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
result = self.fn(*self.args, **self.kwargs)
File "/home/homeassistant/.homeassistant/custom_components/device_tracker/traccar.py", line 28, in setup_scanner
TraccarDeviceScanner(hass, config, see)
File "/home/homeassistant/.homeassistant/custom_components/device_tracker/traccar.py", line 41, in __init__
self._update_info()
File "/home/homeassistant/.homeassistant/custom_components/device_tracker/traccar.py", line 58, in _update_info
_gps_accuracy=position_id['accuracy']
KeyError: 'accuracy'
Is the component expecting to recieve a value that is missing?
Fixed it by commenting out the following two lines:
# _gps_accuracy=position_id['accuracy']
# gps_accuracy=_gps_accuracy,
Apologies @Bob_NL not been around for the last week and just seen you question but looks like you got it working. Be careful with the OBDII version just ended up with a dead car battery after it was left connected and car not used for 3.5 days. I have been intending to make a cable up which uses and OBDII extension and relay which only provides power to the tracker when the ingition is on preventing the car battery drain.
Thanks for the great custom component @koen01, I just started using the traccar android app on my internet-connected head unit in my car. Got it configured, and working (thanks to the comments on this thread).
Iām wondering, how would I use this device_tracker in combination with another device_tracker? The New known_device from traccar is identified by ā11578ā. Normally if 2 device_trackerās had the same name, or MAC addresses matched, it would recognize it as the same device. Iām not sure how to do that, with this. Any idea where this number (11578) comes from? Perhaps it could be set manually in the component, to match the name of another device_tracker? Thoughts?
Is there any way to get the current geofence as an attribute?
I have added battery level by using the example from above in this thread.
'batteryLevel': position_id['attributes']['batteryLevel'],
But i cant see in either xxxx/api/devices och xxxx/api/positions that the current geofence is reported.
Anyone know if you have to manually add something as a attribute in the traccar server?
I havent come around to understand the attributes or computed attributes yet in the documentation.
Is anyone else having problem with the reported speed. I cant get the right speed into home-assistant I suspect that the value i get might be in mph, but in my traccar server i see the speed in kmph. Might be the same problem with gps accuracy the value i get seem a bit high, but it might be imperial?
I also canāt get the address into home-assistant. I guess it might be a problem with swedish charters. As you can see in the screenshot. (there you see the speed, and accuracy that i suspect is imperial to.
As for the reported speed, in the traccar UI, goto cog, account, expand preferences, and set speed to whatever youād like. Should probably also customize the other options thereā¦ Hope that helps.
I allready have km/h and km in the settings for server, account and under user.
I really liked the custom component that @koen01 wrote up, but I didnāt care for how it reported the device to be tracked, to HA. I found it unnecessarily complicated to work with a device named ā12345ā, when all other devices have a name like ācarā. So I made a slight modification to the code (Iām not a developer), to report the name of the device, instead of the ID. So now when the traccar component gets loaded, and the device is created, itās named the same as it is in the traccar UI. In my testing, this change does not affect the functionality at all, just the name in HA.
Please keep in mind, like a lot of things in HA, the name will appear lowercase, and with _ instead of spaces. It can be found here:
https://github.com/xstrex/HAConfig/blob/master/custom_components/device_tracker/traccar.py
i had that at first, but as a device name doesnt have to be unique in traccar i opted to use the device_id, which is unique.