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.
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.
What do you think of using more descriptive names here in the glances-api package already instead of doing the translation in Home Assistant?
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.
I assume that adding the unit of measurement to a sensor name could be problematic as I'm frankly not sure if the return value could depend on the system's settings (Celsius vs. Fahrenheit, etc.).
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.
The Home Assistant interface will need to display a unit anyways so I figured the closer to the source we resolve the ambiguity, the better.
I based myself on the comments in this part of the glances codebase to be sure about the units:
https://github.com/nicolargo/glances/blob/develop/glances/plugins/gpu/model.py#L278
A bit further up in that same file, I see a mention of Fahrenheit conversion but that seems to be only for the GUI, not the API
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.
API HOST 61208/api/3/gpu
[{"key":"gpu_id","gpu_id":0,"name":"Tesla P4","mem":26.248677571614582,"proc":0,"temperature":42,"fan_speed":null}]