fix crash when HMS error fires before device is registered (X2D)#2019
Open
WrathPak wants to merge 1 commit into
Open
fix crash when HMS error fires before device is registered (X2D)#2019WrathPak wants to merge 1 commit into
WrathPak wants to merge 1 commit into
Conversation
my X2D throws AttributeError: 'NoneType' object has no attribute 'id' in _update_printer_error when it fires an HMS code during the initial connect, before the device is registered in HA. same pattern in _update_print_error. just bail out of those two if hadevice is None.
|
To view this pull requests documentation preview, visit the following URL: docs.page/greghesp/ha-bambulab~2019 Documentation is deployed and generated using docs.page. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ran into this on my X2D. when it throws an HMS code right as HA is connecting,
_update_printer_errorblows up because the device isn't in the registry yet sohadeviceis None:_update_print_errorhas the samehadevice.idpattern so i added a guard there too. if the device lookup comes back None i just log + return and let the next cycle handle it once it's registered. error's gone for me after this.timing thing mostly, my X2D had a pending HMS code (0300_2E00_...) on startup so it hit every reconnect. didn't dig into why the X2D specifically registers later than the error arrives but the None guard seemed like the safe fix regardless of model.
lmk if you'd rather handle it differently but wanted to take a stab at helping :)