core icon indicating copy to clipboard operation
core copied to clipboard

Add distance to SensorDeviceClass

Open epenet opened this issue 3 years ago • 1 comments

Proposed change

Add new distance device class Linked to https://github.com/home-assistant/architecture/discussions/607#discussioncomment-3582594

  • [x] Frontend https://github.com/home-assistant/frontend/pull/13831
  • [x] Developer docs: https://github.com/home-assistant/developers.home-assistant/pull/1465
  • [x] User docs: https://github.com/home-assistant/home-assistant.io/pull/24065

Needs:

  • [x] #77952
  • [x] #78578

Type of change

  • [ ] Dependency upgrade
  • [ ] Bugfix (non-breaking change which fixes an issue)
  • [ ] New integration (thank you!)
  • [x] 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

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

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
  • [ ] The code has been formatted using Black (black --fast 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.

The integration reached or maintains the following Integration Quality Scale:

  • [ ] No score or internal
  • [ ] 🥈 Silver
  • [ ] 🥇 Gold
  • [ ] 🏆 Platinum

To help with the load of incoming pull requests:

epenet avatar Sep 07 '22 09:09 epenet

Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration (sensor) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)

Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration (recorder) you are listed as a code owner for? Thanks!

homeassistant avatar Sep 26 '22 06:09 homeassistant

Nice!

bdraco avatar Sep 26 '22 06:09 bdraco

Looks like the test failure is legitimate for this PR

bdraco avatar Sep 26 '22 07:09 bdraco

Might need a pytest.approx?

Full diff:
    {
     'sensor.test': [{'end': '2022-09-26T16:56:05.67[52](https://github.com/home-assistant/core/actions/runs/3129462924/jobs/5078682758#step:10:53)07+00:00',
                      'last_reset': None,
  -                   'max': 393.7 ± 3.9e-04,
  ?                               --------
  +                   'max': 393.700787401[57](https://github.com/home-assistant/core/actions/runs/3129462924/jobs/5078682758#step:10:58)48,
  ?                                ++++ ++++++
  -                   'mean': 393.7 ± 3.9e-04,
  ?                                --------
  +                   'mean': 393.7007874015748,
  ?                                 ++++ ++++++
  -                   'min': 393.7 ± 3.9e-04,
  ?                               --------
  +                   'min': 393.7007874015748,
  ?                                ++++ ++++++
                      'start': '2022-09-26T16:51:05.[67](https://github.com/home-assistant/core/actions/runs/3129462924/jobs/5078682758#step:10:68)5207+00:00',
                      'state': None,
                      'statistic_id': 'sensor.test',
                      'sum': None}],
    }

bdraco avatar Sep 26 '22 17:09 bdraco

Might need a pytest.approx?

Shouldn't have tried to fix on mobile! I've adjusted to use the exact ratio now.

epenet avatar Sep 26 '22 17:09 epenet