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 ozw dimming transition #38850

Merged
merged 2 commits into from
Aug 14, 2020
Merged

Fix ozw dimming transition #38850

merged 2 commits into from
Aug 14, 2020

Conversation

firstof9
Copy link
Contributor

Proposed change

The light component sends the transition as a float, we instead need a int.

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)
  • 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 # n/a
  • This PR is related to issue: n/a
  • Link to documentation pull request: n/a

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.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

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

@firstof9
Copy link
Contributor Author

Unrelated check failed

Copy link
Contributor

@stshontikidis stshontikidis left a comment

Choose a reason for hiding this comment

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

might be worth hardening the test transition value type to catch future changes from sending float.

https://github.com/home-assistant/core/blob/dev/tests/components/ozw/test_light.py#L34

>>> x = {'a': 0.0}
>>> y = {'a': 0}
>>> assert x == y  # false positive
>>> assert isinstance(x['a'], int)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AssertionError

@firstof9
Copy link
Contributor Author

Previous version of ozw values get converted to int already. I just forgot to int the fix for the new transition time.

@stshontikidis
Copy link
Contributor

stshontikidis commented Aug 13, 2020

got it, actually added the assert I thought we were missing and you are right... tests still pass so that wont catch it. The instance version is less than the conditional so dropping into the if block that has the int

@cgarwood cgarwood added this to the 0.114.1 milestone Aug 13, 2020
@MartinHjelmare MartinHjelmare changed the title Dimming transition fix for ozw Fix ozw dimming transition Aug 13, 2020
@MartinHjelmare
Copy link
Member

Change the light test to send a float as the transition instead of an integer. The sent value should still be an integer.

@cgarwood cgarwood merged commit 5c9f29c into home-assistant:dev Aug 14, 2020
@firstof9 firstof9 deleted the ozw-light-fix branch August 14, 2020 16:03
balloob added a commit that referenced this pull request Aug 15, 2020
* Handle float from light component

* Test with float

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
@balloob balloob mentioned this pull request Aug 15, 2020
weissm pushed a commit to weissm/core that referenced this pull request Aug 28, 2020
* Handle float from light component

* Test with float

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
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.

6 participants