core: External traccar server not connecting
The problem
Trying to connect to an external traccar server with the documented lines in configuration.yaml, but connection fails:
Logger: homeassistant.components.device_tracker
Source: components/device_tracker/legacy.py:307
Integration: Device tracker (documentation, issues)
First occurred: 9:10:15 PM (1 occurrences)
Last logged: 9:10:15 PM
Error setting up platform legacy traccar
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/device_tracker/legacy.py", line 307, in async_setup_legacy
setup = await self.platform.async_setup_scanner(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/traccar/device_tracker.py", line 202, in async_setup_scanner
return await scanner.async_init()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/traccar/device_tracker.py", line 238, in async_init
await self._api.get_server()
File "/usr/local/lib/python3.12/site-packages/pytraccar/client.py", line 92, in get_server
response: ServerModel = await self._call_api("server")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pytraccar/client.py", line 78, in _call_api
raise TraccarResponseException(f"{response.status}: {response.reason}")
pytraccar.exceptions.TraccarResponseException: 400: Bad Request
What am I doing wrong? Should note that I can connect to this server via the web and the Traccar phone app no problem.
What version of Home Assistant Core has the issue?
core-2024.2.0.dev20240117
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant OS
Integration causing the issue
traccar
Link to integration documentation on our website
https://www.home-assistant.io/integrations/traccar/
Diagnostics information
No response
Example YAML snippet
device_tracker:
- platform: traccar
host: traccar.my.domain
port: 8082
username: user
password: password
event: ["all_events"]
Anything in the logs that might be useful for us?
Logger: homeassistant.components.device_tracker
Source: components/device_tracker/legacy.py:307
Integration: Device tracker (documentation, issues)
First occurred: 9:14:24 PM (1 occurrences)
Last logged: 9:14:24 PM
Error setting up platform legacy traccar
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/device_tracker/legacy.py", line 307, in async_setup_legacy
setup = await self.platform.async_setup_scanner(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/traccar/device_tracker.py", line 202, in async_setup_scanner
return await scanner.async_init()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/traccar/device_tracker.py", line 238, in async_init
await self._api.get_server()
File "/usr/local/lib/python3.12/site-packages/pytraccar/client.py", line 92, in get_server
response: ServerModel = await self._call_api("server")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pytraccar/client.py", line 78, in _call_api
raise TraccarResponseException(f"{response.status}: {response.reason}")
pytraccar.exceptions.TraccarResponseException: 400: Bad Request
Additional information
Running 5.11 of traccar server.
About this issue
- Original URL
- State: closed
- Created 5 months ago
- Comments: 16 (7 by maintainers)
It is the server throwing a 401 (Unauthorized) status code for one (or more) of the API calls. Until this is resolved there will be no entities, as all these 3 are needed for the device representation.
https://www.home-assistant.io/integrations/logger/ you use the
loggerintegration to change that.