Draggon / hassio-hdd-tools

27 stars 13 forks source link

Some code enhancements #4

Closed boesing closed 3 years ago

boesing commented 3 years ago

Hey there,

first of all, thanks for this addon! I've made several changes to the configuration and to the execution to improve compatibility aswell as extensible configuration.

I've tried to keep most of the configuration backwards compatible but the new attributes_property configuration is not BC compatible and thus, attributes are being omitted if not configured.

So what has changed?

  1. Changed smartctl output to JSON by using --json argument
  2. Made sensor name configurable (sensor_name)
  3. Made sensors "Friendly Name" configurable (friendly_name)
  4. Added flag to enable/disable performance check during startup (performance_check)
  5. Added flag to enable/disable debug mode (debug) which passes the smartctl --json output to the output_file
  6. Added configurable JSON property to parse "attributes" from (attributes_property)

So the attributes_property is a property within the JSON output passed to output_file when debug is enabled. In my case, this is nvme_smart_health_information_log. I think, this differs from setup to setup and thus I wanted to have that configurable.

To avoid unnecessary I/O (writes of the output_file), it is now skipped when debug is false.

In case this is being merged, I'll switch back to this addon but for now I am using my fork.

boesing commented 3 years ago

Oh wow that was quick 👍 I was about to create a new CHANGELOG.

I will create a new PR for this. Thanks for merging tho!

Draggon commented 3 years ago

Thanks for update!