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

Fix statistics graphs not loading with data_rate, electric_current, voltage, information, and unitless units #87202

Merged
merged 2 commits into from
Feb 2, 2023

Conversation

bdraco
Copy link
Member

@bdraco bdraco commented Feb 2, 2023

Proposed change

Add missing converters to the recorder/statistics_during_period API schema

This was resulting in the stats graphs not loading on the frontend

related issue #87137

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

  • 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.

To help with the load of incoming pull requests:

This was resulting in the stats graphs not loading on the frontend
@home-assistant
Copy link

home-assistant bot commented Feb 2, 2023

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!

Code owner commands

Code owners of recorder can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Change the title of the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign recorder Removes the current integration label and assignees on the issue, add the integration domain after the command.

@epenet
Copy link
Contributor

epenet commented Feb 2, 2023

Could we add a test, similar to #87138 ?

@bdraco
Copy link
Member Author

bdraco commented Feb 2, 2023

2023-02-02 18:39:41.159 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140359544572608] Error handling message: extra keys not allowed @ data['units']['unitless']. Got '%' (invalid_format) J. Nick Koston from 108.87.95.24 (Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/connection.py", line 111, in async_handle
    handler(self.hass, self, schema(msg))
  File "/usr/local/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 272, in __call__
    return self._compiled([], data)
  File "/usr/local/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 595, in validate_dict
    return base_validate(path, iteritems(data), out)
  File "/usr/local/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 433, in validate_mapping
    raise er.MultipleInvalid(errors)
voluptuous.error.MultipleInvalid: extra keys not allowed @ data['units']['unitless']

Still seeing an issue

@bdraco
Copy link
Member Author

bdraco commented Feb 2, 2023

Its working now. Will try to find time to add a test later today

@bdraco bdraco marked this pull request as ready for review February 2, 2023 18:45
@bdraco bdraco requested a review from a team as a code owner February 2, 2023 18:45
@epenet
Copy link
Contributor

epenet commented Feb 2, 2023

Could we add a test, similar to #87138 ?

Maybe the test shouldn't be in patch...

@bdraco
Copy link
Member Author

bdraco commented Feb 2, 2023

Could we add a test, similar to #87138 ?

Maybe the test shouldn't be in patch...

Will add it if I get free cycles, if not it can always come later

@epenet
Copy link
Contributor

epenet commented Feb 2, 2023

Could we add a test, similar to #87138 ?

Maybe the test shouldn't be in patch...

Will add it if I get free cycles, if not it can always come later

If not I can do a follow-up tomorrow.
For #87138 it was excluded from patch because power conversion is considered a new feature and would have generated failures in patch

@bdraco
Copy link
Member Author

bdraco commented Feb 2, 2023

Could we add a test, similar to #87138 ?

Maybe the test shouldn't be in patch...

Will add it if I get free cycles, if not it can always come later

If not I can do a follow-up tomorrow.

For #87138 it was excluded from patch because power conversion is considered a new feature and would have generated failures in patch

Makes sense. Let's do the test in a separate PR and get this fixed in 2023.2.x

@balloob balloob merged commit 22698b1 into home-assistant:dev Feb 2, 2023
balloob pushed a commit that referenced this pull request Feb 2, 2023
…oltage, information, and unitless units (#87202)

* Add missing converts to recorder/statistics_during_period API

This was resulting in the stats graphs not loading on the frontend

* its in two places
@balloob balloob mentioned this pull request Feb 2, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Feb 3, 2023
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