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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Vizio fix to avoid KeyError #32163

Merged
merged 3 commits into from Feb 25, 2020
Merged

Conversation

@raman325
Copy link
Contributor

raman325 commented Feb 25, 2020

Proposed change

In #32151 I fixed a bug that occurred when the config entry data dictionary did not have volume_step. @MartinHjelmare identified that the change I made was redundant in that I was falling back to the DEFAULT_VOLUME_STEP when checking the config, but that is unnecessary because config validation already guarantees that the volume_step parameter is in the config dictionary, so this change fixes that. As part of looking into this, I also realized that I did not set volume_step in the data dictionary on initialization, which means that the second import (e.g. on a restart) would always set it. I have updated the logic to always ensure it is included in the config entry data.

This should go out with 0.106 along with the other linked PR

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

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
raman325 added 2 commits Feb 25, 2020
@project-bot project-bot bot added this to Needs review in Dev Feb 25, 2020
@project-bot project-bot bot moved this from Needs review to By Code Owner in Dev Feb 25, 2020
@raman325 raman325 changed the title Vizio bugfix fix Vizio bugfix fix for PR #32151 to avoid KeyError Feb 25, 2020
@MartinHjelmare MartinHjelmare changed the title Vizio bugfix fix for PR #32151 to avoid KeyError Improve Vizio fix to avoid KeyError Feb 25, 2020
@MartinHjelmare MartinHjelmare added this to the 0.106.0 milestone Feb 25, 2020
@codecov

This comment has been minimized.

Copy link

codecov bot commented Feb 25, 2020

Codecov Report

Merging #32163 into dev will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev   #32163      +/-   ##
==========================================
- Coverage   94.74%   94.73%   -0.01%     
==========================================
  Files         768      768              
  Lines       55629    55619      -10     
==========================================
- Hits        52703    52693      -10     
  Misses       2926     2926
Impacted Files Coverage 螖
homeassistant/components/vizio/media_player.py 100% <100%> (酶) 猬嗭笍
homeassistant/components/vizio/config_flow.py 100% <100%> (酶) 猬嗭笍
homeassistant/components/twitch/sensor.py 96.7% <0%> (-0.04%) 猬囷笍
homeassistant/components/darksky/sensor.py 96.81% <0%> (酶) 猬嗭笍
homeassistant/components/withings/const.py 100% <0%> (酶) 猬嗭笍
...eassistant/components/homekit_controller/sensor.py 100% <0%> (酶) 猬嗭笍
homeassistant/components/geonetnz_volcano/const.py 100% <0%> (酶) 猬嗭笍
homeassistant/components/awair/sensor.py 95.09% <0%> (酶) 猬嗭笍
homeassistant/components/smartthings/sensor.py 100% <0%> (酶) 猬嗭笍
homeassistant/components/google_assistant/trait.py 97.19% <0%> (酶) 猬嗭笍
... and 11 more

Continue to review full report at Codecov.

Legend - Click here to learn more
螖 = absolute <relative> (impact), 酶 = not affected, ? = missing data
Powered by Codecov. Last update c98f501...7b5f166. Read the comment docs.

Copy link
Member

MartinHjelmare left a comment

Looks good!

Dev automation moved this from By Code Owner to Reviewer approved Feb 25, 2020
@balloob balloob merged commit 4236d62 into home-assistant:dev Feb 25, 2020
10 checks passed
10 checks passed
CI Build #20200225.21 succeeded
Details
CI (FullCheck Mypy) FullCheck Mypy succeeded
Details
CI (FullCheck Pylint) FullCheck Pylint succeeded
Details
CI (Overview CheckFormat) Overview CheckFormat succeeded
Details
CI (Overview Lint) Overview Lint succeeded
Details
CI (Overview Validate) Overview Validate succeeded
Details
CI (Tests PyTest Python37) Tests PyTest Python37 succeeded
Details
cla-bot Everyone involved has signed the CLA
codecov/patch 100% of diff hit (target 94.74%)
Details
codecov/project Absolute coverage decreased by -<.01% but relative coverage increased by +5.25% compared to c98f501
Details
Dev automation moved this from Reviewer approved to Done Feb 25, 2020
@raman325 raman325 deleted the raman325:vizio_bug_fix branch Feb 25, 2020
balloob added a commit that referenced this pull request Feb 25, 2020
* dont set default volume_step on import check

* ensure config entry data['volume_step'] is set

* consolidate entry update during entry setup
@lock lock bot locked and limited conversation to collaborators Feb 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Dev
  
Done
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can鈥檛 perform that action at this time.