-
-
Notifications
You must be signed in to change notification settings - Fork 28.8k
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
Handle tado update_sensor exceptions #44428
Conversation
ConnectionError exceptions may also occur when connection is reset by peer. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Hey there @michaelarnauts, @bdraco, mind taking a look at this pull request as its been labeled with an integration ( |
@@ -215,7 +215,7 @@ def update_sensor(self, sensor_type, sensor): | |||
else: | |||
_LOGGER.debug("Unknown sensor: %s", sensor_type) | |||
return | |||
except RuntimeError: | |||
except: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my opinion, catching all exceptions broadly is a bad practice.
I think it is better if the upstream package handles the possible exceptions better and would throw specific errors we can handle correctly.
Have you considered contributing an improvement upstream?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my opinion, catching all exceptions broadly is a bad practice.
If you want I can update the PR catching only ConnectionError
.
I think it is better if the upstream package handles the possible exceptions better and would throw specific errors we can handle correctly.
Sure, but that's up to the upstream maintainers.
Have you considered contributing an improvement upstream?
Unfortunately I don't have the time to do that, so I've created an issue upstream.
EDIT: it was easier than I thought, so I created a PR upstream: wmalgadey/PyTado#43
Closing, as this should be fixed upstream: |
ConnectionError exceptions may also occur when connection is reset by peer.
Signed-off-by: Álvaro Fernández Rojas noltari@gmail.com
Proposed change
The current Tado integration floods the Home Assistant log with the following errors:
This happens when tado.getZoneState and tado.getDevices return a "Connection reset by peer" error, which raises an unhandled exception.
With my changes, if this happens, the following will be logged instead:
Type of change
Example entry for
configuration.yaml
: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: