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

Battery attribute & accuracy filter #24277

Merged
merged 5 commits into from
Jun 17, 2019
Merged

Battery attribute & accuracy filter #24277

merged 5 commits into from
Jun 17, 2019

Conversation

GoNzCiD
Copy link
Contributor

@GoNzCiD GoNzCiD commented Jun 3, 2019

Breaking Change:

  • battery_level attribute changes to battery.
    Since a device_tracker component contains a standart attribute for battery level, that we can use with see service, update with async_see method, we should use it for maintain component criteria and not create a new attribute for the same pourpose with a different name.
    To solve this breaking change, only need to replace the battery_level attribute with battery in all templates than use the battery attribute of any traccar device_tracker.

Description:

  • Battery attribute is sent into see method instead of an additional paremeter.
  • Added an accuracy filter option to exclude positions if accuracy is higher than specified.
  • Added a skip accuracy filter option to avoid filter certain positions by accuracy if any of the specified attributes are present in the message, ie throw an alarm but accuracy is too high.
  • Extract constants to const.py file.

Pull request in home-assistant.io with documentation (if applicable): home-assistant/home-assistant.io#9347

Example entry for configuration.yaml (if applicable):

device_tracker:
  - platform: traccar
    ...
    max_accuracy: 100
    skip_accuracy_filter_on:
      - alarm
    ...

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.

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 (example).
  • New dependencies have been added to requirements in the manifest (example).
  • New dependencies are only imported inside functions that use them (example).
  • New or updated dependencies have been added to requirements_all.txt by running script/gen_requirements_all.py.
  • New files were added to .coveragerc.

Note: From #2329 [Outdated]

@ghost
Copy link

ghost commented Jun 3, 2019

Hey there @ludeeus, mind taking a look at this pull request as its been labeled with a integration (traccar) you are listed as a codeowner for? Thanks!

This is a automatic comment generated by codeowners-mention to help ensure issues and pull requests are seen by the right people.

GoNzCiD and others added 4 commits June 3, 2019 22:18
Co-Authored-By: Otto Winter <otto@otto-winter.com>
Co-Authored-By: Otto Winter <otto@otto-winter.com>
Use [] syntax for keys that are in the validated data.

Co-Authored-By: Otto Winter <otto@otto-winter.com>
Copy link
Member

@OttoWinter OttoWinter left a comment

Choose a reason for hiding this comment

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

Code LGTM, waiting for comment from @ludeeus as code owner.

@ludeeus ludeeus merged commit ddeb6b6 into home-assistant:dev Jun 17, 2019
@balloob balloob mentioned this pull request Jun 26, 2019
alandtse pushed a commit to alandtse/home-assistant that referenced this pull request Oct 12, 2019
* Extract const to a const file, Add battery as tracker attribute, add accuracy filter option

* Update homeassistant/components/traccar/device_tracker.py

Co-Authored-By: Otto Winter <otto@otto-winter.com>

* Update homeassistant/components/traccar/device_tracker.py

Co-Authored-By: Otto Winter <otto@otto-winter.com>

* Update homeassistant/components/traccar/device_tracker.py

Use [] syntax for keys that are in the validated data.

Co-Authored-By: Otto Winter <otto@otto-winter.com>

* Fix indentation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants