You managed to know which data you get?
After some searching on the traccar forum i found out that the speed that is output via the api is in KNOTS.
So to be able to get it as kmph i have to multiply the speed with 1.852
Im going to search some more if the “accuracy” and “total distance” values allso is put out in any other format to.
According to the author of traccar the other api values is reported in meters.
How do i change the “polling intervall”?
I guess this code is the one controlling the polling
track_utc_time_change(self.hass, self._update_info,
second=range(0, 60, 30))
I guess that this code means that it’s polling every 30 sec?
I don’t understand your question. Everything is working fine now after all :). I did decide to use one of the demo servers in the end since hosting my own server led to a lot of RP crashes.
Which data you can track/read?
@anon35356645 Here you go:
{"status":64,"ignition":false,"charge":false,"blocked":false,"battery":5,"rssi":4,"alarm":"vibration","distance":0.0,"totalDistance":214848.34,"motion":false},"deviceId":11544,"type":null,"protocol":"gt06","serverTime":null,"deviceTime":"2017-10-18T14:46:23.426+0000","fixTime":"2017-10-18T14:45:47.000+0000","outdated":true,"valid":true,"latitude":xx.xxxxxxxx,"longitude":xx.xxxxxx,"altitude":0.0,"speed":0.0,"course":0.0,"address":null,"accuracy":0.0,"network":null}]
Unfortunately not my remaining fuel level which I was really hoping for.
I have the same looking OBD tracker and im pretty sure that the only pins in the obd connector that is used is the +12v and ground. Or does your “ignition” show anything else then “false” ever?
Mine reports the same values if i unplug the OBD from the car. (it have a built in battery, and the device starts up as soon as you insert the simcard bay into it.)
I found others yhat have problem with this device since it never goes into “sleepmode”, it keeps sending positions as long as there is power and dataplan.
Im going to connect mine to a obd power dongle and connect it to the ignition, because if i keep it in the cars obd connection the car battery will go out if it is standing unused for a longer period. (and the dataplan will suffer a lot by sending the same location with the same interval standing still longer periods as if driving.)
Found this online from china ($1) each
Going to use that instead and connect the +12v and ground on ignition to make the tracker only power on when car is running (might have to open the tracker and disable the internal battery to save the dataplan)
What is the data which are useful, I mean some real life usage
Well, at the moment not so much actually
I was really hoping to extract the fuel level so I can make an automation which checks my fuel level and commute time and use that in a notification.
"You have to leave in 'X' minutes, commute time to work is 'Y' minutes and you'll have to refuel your car first which will cost you 'Z'.
Did anyone manage to extract fuel levels and if yes, which device are you using?
I did not try it yet, I will and report back.
Please keep up posted on the progress!
Home Assistant 0.56.2, Synology, Docker. Traccar is running on local PC in a virtual box. I can use Traccar locally, get API results using web (Chrome), from HA using weblinks but getting this error from HA and devices are not loaded/updated.
Any suggestions or ideas greatly appreciated.
2017-10-29 14:02:48 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform traccar
Traceback (most recent call last):
File “/usr/src/app/homeassistant/components/device_tracker/init.py”, line 155, in async_setup_platform
disc_info)
File “/usr/local/lib/python3.6/asyncio/futures.py”, line 332, in iter
yield self # This tells Task to wait for completion.
File “/usr/local/lib/python3.6/asyncio/tasks.py”, line 250, in _wakeup
future.result()
File “/usr/local/lib/python3.6/asyncio/futures.py”, line 245, in result
raise self._exception
File “/usr/local/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/config/custom_components/device_tracker/traccar.py”, line 28, in setup_scanner
TraccarDeviceScanner(hass, config, see)
File “/config/custom_components/device_tracker/traccar.py”, line 41, in init
self._update_info()
File “/config/custom_components/device_tracker/traccar.py”, line 61, in _update_info
‘ip’: position_id[‘attributes’][‘ip’],
KeyError: ‘ip’
try this updated version:
Thank you, that worked.
Anybody used the Sinocastel devices? I got a IDD-213L and i do mange to get it ‘online’ as in that it has internet (it has wifi too, so i checked it with that) but it fails to logon to any server (even official ones) perhaps somebody has some knowledge.
SOLVED
When I try to use the batterylevel I receive the following error code, any ideas? And it only does the one update when Hass is first started.
'batteryLevel': position_id['attributes']['batteryLevel'],
2017-10-30 16:45:33 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform traccar
Traceback (most recent call last):
File “/usr/src/app/homeassistant/components/device_tracker/init.py”, line 155, in async_setup_platform
disc_info)
File “/usr/local/lib/python3.6/asyncio/futures.py”, line 332, in iter
yield self # This tells Task to wait for completion.
File “/usr/local/lib/python3.6/asyncio/tasks.py”, line 250, in _wakeup
future.result()
File “/usr/local/lib/python3.6/asyncio/futures.py”, line 245, in result
raise self._exception
File “/usr/local/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/config/custom_components/device_tracker/traccar.py”, line 28, in setup_scanner
TraccarDeviceScanner(hass, config, see)
File “/config/custom_components/device_tracker/traccar.py”, line 41, in init
self._update_info()
File “/config/custom_components/device_tracker/traccar.py”, line 62, in _update_info
‘batteryLevel’: position_id[‘attributes’][‘batteryLevel’],
KeyError: ‘batteryLevel’
The solution for this batterylevel was:
One device only reported battery so I needed to add the computed attribute of ‘batteryLevel’ to the device in traccar.
REQUEST’s
Local time instead of UTC time as pulled from the API. (Servertime, Device time is local, as is Traccar Time)
The pull from API gets the address from Traccar, (nominatim) if I click on the device I can see the address but just sitting there in a group tab there is no address, just a not home zone.
device_tracker.keelin_1 not_home
source_type: gps
latitude: 42.32161055555556
longitude: -72.42045444444445
gps_accuracy: 0
totalDistance: 1622871.75
protocol: eelink
speed: 0
address: Crown Crescent, City, Ontario, CA
status: online
lastUpdate: 2017-10-30T22:40:58.728+0000
friendly_name: keelin 1
Hello gentleman, I would have one question, my traccar use geocoding and addresses are with special characters, in UTF-8, in the traccar UI I can see address correctly, however HASS is showing bad characters, like this
would be possible to transcode somehow address from api to UTF-8 ? or is there some setting I can modify ?
big thank you
Having trouble with traccar sensor, can you help any?:
Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/homeassistant/components/device_tracker/init.py”, line 169, in async_setup_platform
disc_info)
File “/usr/lib/python3.6/asyncio/futures.py”, line 332, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.6/asyncio/tasks.py”, line 250, in _wakeup
future.result()
File “/usr/lib/python3.6/asyncio/futures.py”, line 245, in result
raise self._exception
File “/usr/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/config/custom_components/device_tracker/traccar.py”, line 28, in setup_scanner
TraccarDeviceScanner(hass, config, see)
File “/config/custom_components/device_tracker/traccar.py”, line 41, in init
self._update_info()
File “/config/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 “/usr/lib/python3.6/site-packages/requests/api.py”, line 72, in get
return request(‘get’, url, params=params, **kwargs)
File “/usr/lib/python3.6/site-packages/requests/api.py”, line 58, in request
return session.request(method=method, url=url, **kwargs)
File “/usr/lib/python3.6/site-packages/requests/sessions.py”, line 508, in request
resp = self.send(prep, **send_kwargs)
File “/usr/lib/python3.6/site-packages/requests/sessions.py”, line 612, in send
adapter = self.get_adapter(url=request.url)
File “/usr/lib/python3.6/site-packages/requests/sessions.py”, line 703, in get_adapter
raise InvalidSchema(“No connection adapters were found for ‘%s’” % url)
requests.exceptions.InvalidSchema: No connection adapters were found for ‘192.168.113.55:80/api/devices’
Post your config. The URL/ip seems wrong
Did you include http://. ?