-
-
Notifications
You must be signed in to change notification settings - Fork 29.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
Avoid Exception on Glances missing key #114628
Avoid Exception on Glances missing key #114628
Conversation
Hey there @engrbm87, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
580f043
to
449c422
Compare
Hello @gjohansson-ST , have you had time to look at my answers to your questions ? |
I have also updated the PR description to explain in more detail why this change is useful. |
449c422
to
f6e67d6
Compare
@wittypluck OK! I've marked the PR as draft, please click the "Ready for review" button when you've addressed the comment. |
f6e67d6
to
5ae7d47
Compare
Thank you! I have rebased, made the change and resubmitted for review. |
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.
Thanks @wittypluck 👍
Thank you @gjohansson-ST and @emontnemery ! |
Proposed change
The aim of this PR is to handle gracefully the case where a Glances sensor is removed server side.
In that case, HA should stop updating this sensor and mark it as Unavailable.
Today, the code breaks (exception in logs).
In more detail, there are three cases where Glances data can become unavailable after the inital setup completes correctly:
The PR adds systematic checks that the keys used are present in the data provided by
python-glances-api
. If not, the value is set toNone
.It also updates the logic of
available()
to check forNone
values.Type of change
Additional information
Checklist
ruff format 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
.To help with the load of incoming pull requests: