py-SMART icon indicating copy to clipboard operation
py-SMART copied to clipboard

Feature request: add to Device a method that returns a dictionary of SMART attributes

Open f18m opened this issue 11 months ago • 0 comments

Hi @ralequi , In this comment: https://github.com/truenas/py-SMART/issues/86#issuecomment-2068801498 you mentioned that it should already be possible to access the properties of the Device class as a dictionary via dict. However using e.g.

sudo python3 -c 'import pySMART, pprint; pprint.pprint(pySMART.Device("/dev/sda").__dict__)'

I noticed that the Device class dictionary does not contain any "temperature" key, just an empty "temperatures" (plural) key. Instead the output of

sudo python3 -c 'import pySMART, pprint; pprint.pprint(pySMART.Device("/dev/sda").__getstate__())'

does include the "temperature" attribute (populated with valid data). However using a non-documented getstate() function from 3rd party programs does not seem a stable/solid solution.

Thus my question is: would you consider adding to Device() class a method that returns all SMART attributes as a dictionary? I think this would simplify usage from other utilities. Thanks!

f18m avatar Jan 27 '25 15:01 f18m