Log an error if modbus Cover is not initialized correctly#48829
Log an error if modbus Cover is not initialized correctly#48829MartinHjelmare merged 3 commits intohome-assistant:devfrom Lutemi:feature/cover-improve-error-handling
Conversation
|
Hey there @adamchengtkc, @janiversen, mind taking a look at this pull request as its been labeled with an integration ( |
|
@MartinHjelmare thanks for the review! I'll update the code here, as you suggested, and I'll do the same also in PR #42120 and #48558. This small PR was ported from my work there to maintain consistency with the components. |
|
@vzahradnik if you want, you can look in #49053 test_modbus.py I already changed mock(_logger) -> caplog |
|
@MartinHjelmare I updated the code as you requested. Please take a look at your convenience. Thanks! |
|
adding a flag expectFail is a good idea, please add it. |
Already did as a POC as I waited for your response. Please check the code. |
|
Looks good to me, thanks for not duplicating code. |
|
OK, let's wait for the test results. If they'll pass, this PR should address all issues pointed by @MartinHjelmare |
Proposed change
This PR adds an error message to the log, if user tries to initialize
Coverin an unsupported way, i.e., the
discovery_infodictionary isNone.Type of change
Additional information
Checklist
black --fast homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all..coveragerc.The integration reached or maintains the following Integration Quality Scale:
To help with the load of incoming pull requests: