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

Add Traccar server integration #109002

Merged
merged 4 commits into from Jan 31, 2024
Merged

Add Traccar server integration #109002

merged 4 commits into from Jan 31, 2024

Conversation

ludeeus
Copy link
Member

@ludeeus ludeeus commented Jan 28, 2024

Proposed change

The current traccar integration handles both connections from the client, and connections to the server.
This PR adds a new integration to handle the server part.

This is the first PR in a series that will eventually move all the handling of server communication out of the current integration but with the rules for making PRs, that has to be split.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

Comment on lines +52 to +53
hass.data.setdefault(DOMAIN, {})
hass.data[DOMAIN][entry.entry_id] = coordinator
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
hass.data.setdefault(DOMAIN, {})
hass.data[DOMAIN][entry.entry_id] = coordinator
hass.data.setdefault(DOMAIN, {})[entry.entry_id] = coordinator

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

homeassistant/components/traccar_server/coordinator.py Outdated Show resolved Hide resolved
Comment on lines +28 to +30
"skip_accuracy_filter_for": "Position skip filter for attributes",
"custom_attributes": "Custom attributes",
"events": "Events"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it maybe be nice to add data_description fields to explain a bit more what something is?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +142 to +143
result = await hass.config_entries.options.async_init(config_entry.entry_id)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
result = await hass.config_entries.options.async_init(config_entry.entry_id)
result = await hass.config_entries.options.async_init(config_entry.entry_id)
assert result["type"] == FlowResultType.FORM

Copy link
Member Author

@ludeeus ludeeus Jan 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is implied, the rest of this test would fail if it is not a form.

Comment on lines +172 to +173
assert await hass.config_entries.async_setup(config_entry.entry_id)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you have to necessarily setup the entry to check for already_configured.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not, but it does not hurt.

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
@ludeeus ludeeus merged commit 640463c into dev Jan 31, 2024
53 checks passed
@ludeeus ludeeus deleted the traccar_server branch January 31, 2024 13:50
# This goes against two of the HA core guidelines:
# 1. Event names should be prefixed with the domain name of the integration
# 2. This should be event entities
# However, to not break it for those who currently use the "old" integration, this is kept as is.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please break long comments around max 88 characters per line.

@github-actions github-actions bot locked and limited conversation to collaborators Feb 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants