Draggon / hassio-hdd-tools

27 stars 12 forks source link

Add attributes for long term statistic #39

Closed McGiverGim closed 2 years ago

McGiverGim commented 2 years ago

Add attributes to let Home Assistant store the disk temperature for long term usage.

nepozs commented 2 years ago

Is it possible to add to long term statistics other domains? - not only temperature, as some of changing disk parameter are related to drive health and lifetime.

McGiverGim commented 2 years ago

Not with the way it works now. To accomplish that, the addon will need to create several sensors, not only one. The long term statistics work only with the state, not with the attributes.

You can do it by your own creating your sesors, for example:

template:
  - sensor:
      - unique_id: ssd_vida_restante
        unit_of_measurement: "%"
        state_class: measurement
        icon: 'mdi:harddisk-remove'
        state: "{{ state_attr('sensor.hdd_smart', 'unknown_attribute_169') }}"
        attributes:
            friendly_name: "SSD vida restante"            

You need to add the state_class and maybe the device_class: https://developers.home-assistant.io/docs/core/entity/sensor/#long-term-statistics

Another approach is to ask for a feature request allowing the user to select with attributes want to be published as sensors. But I don't know if some developer will have time and interest to do this.

nepozs commented 2 years ago

Thanks a lot.