Home assistant addon : Scrutiny (SMART dashboard)

Sorry no idea…

1 Like

Thanks but this doesn’t work still. I think you’re referencing the wrong part of the api? It’s not under smart_results it’s in the first part of device.device_status

{
  "data": {
    "device": {
      "CreatedAt": "2024-07-11T21:54:54.025602638+01:00",
      "UpdatedAt": "2024-07-13T09:05:59.067375742+01:00",
      "DeletedAt": null,
      "wwn": "0x5000c5000daedee6",
      "device_name": "sdf",
      "device_uuid": "",
      "device_serial_id": "ata-ST31000340AS_9QJ1X0NR",
      "device_label": "",
      "manufacturer": "",
      "model_name": "ST31000340AS",
      "interface_type": "",
      "interface_speed": "",
      "serial_number": "9QJ1X0NR",
      "firmware": "SD15",
      "rotational_speed": 7200,
      "capacity": 1000204886016,
      "form_factor": "",
      "smart_support": false,
      "device_protocol": "ATA",
      "device_type": "sat",
      "label": "",
      "host_id": "home_assistant",
      "device_status": 2
    },
    "smart_results": [
      {
        "date": "2024-07-13T08:05:58Z",
        "device_wwn": "0x5000c5000daedee6",
        "device_protocol": "ATA",
        "temp": 39,
        "power_on_hours": 54962,
        "power_cycle_count": 2025,
        "attrs": {
...
        },
        "Status": 0

Hehe you are right it should like be {{ "on" if value_json.data.device[0].device_status in [1, 2] else "off" }} I’m not at my computer so did not test it

Thanks for your persistence, but it’s still not working.
This is the full rest sensor config, I changed the " for ’ in your example:

rest:
  - verify_ssl: false
    scan_interval: 60
    resource: http://db21ed7f-scrutiny-fa:8086/api/device/0x5000c5000daedee6/details
    binary_sensor:
      - name: "HDD - NAS4 SMART Status"
        value_template: "{{ 'on' if value_json.data.device[0].device_status in [1, 2] else 'off' }}"
        device_class: problem
        unique_id: HDD NAS4 SMART Status

I get the following in the log:

  • Template variable error: ‘value_json’ is undefined when rendering ‘{{ ‘on’ if value_json.data.device[0].device_status in [1, 2] else ‘off’ }}’

Just curious, I have an nvme drive(Samsung 970 evo) that scrutiny says has failed test. It has 520 media errors.
I replaced this drive with a brand new drive (Samsung 980 pro) and scrutiny says it has still failed with 520 media errors… (even though the drive name had changed in the report)
Any ideas what’s going on / how to refresh the report?

Hello
Should this add-on work without additional configuration?
I’m getting pretty empty UI view

Found in scrutiny logs:

time="2024-08-17T15:31:16+02:00" level=info msg="Executing command: smartctl --scan --json" type=metrics
time="2024-08-17T15:31:16+02:00" level=info msg="Executing command: smartctl --info --json --device sat /dev/sda" type=metrics
time="2024-08-17T15:31:16+02:00" level=error msg="Could not retrieve device information for sda: exit status 2" type=metrics

After entering the docker:

 smartctl --info --json --device sat /dev/sda
{
  "json_format_version": [
    1,
    0
  ],
  "smartctl": {
    "version": [
      7,
      3
    ],
    "svn_revision": "5338",
    "platform_info": "aarch64-linux-5.10.17-v8",
    "build_info": "(local build)",
    "argv": [
      "smartctl",
      "--info",
      "--json",
      "--device",
      "sat",
      "/dev/sda"
    ],
    "messages": [
      {
        "string": "Smartctl open device: /dev/sda [SAT] failed: Operation not permitted",
        "severity": "error"
      }
    ],
    "exit_status": 2
  },
  "local_time": {
    "time_t": 1723902705,
    "asctime": "Sat Aug 17 15:51:45 2024 CEST"
  }
}

Any idea why operation is not permitted? I tried both: normal and full-access versions of the add-on.

There is something weird going on with the ports in the addon. Ingress wasn’t defined. But if I do, it doesn’t save? I changed to the host IP and the template worked when I changed it to:

rest:
  - verify_ssl: false
    scan_interval: 60
    resource: http://my.local.host.ip:8086/api/device/aa235110163/details
    binary_sensor:
      - name: "SSD - System SMART Status"
        value_template: "{{ 'on' if value_json.data.device.device_status in [1, 2] else 'off' }}"
        device_class: problem
        unique_id: SSD System SMART Status
  - verify_ssl: false

Hi, if you use ingress and disable the external port the API is likely exposed through the ingress url based on the homeassistant port. Anyway most important thing is that it works :slight_smile:

Hi, not all ssd support smart as I as surpsied to learn ; does yours? The add-on should have in theory max permissions, and I guess you tried also the full access version

I’m using Kingston SSDNow V300. It seems it does support S.M.A.R.T.
CrystalDiskInfo confirms that
And yes, I’ve tried both version of Scrutiny.

I’m still on old HA OS (7.6). Could that be the reason?

Thank you so much for getting the addon dev to include this feature.

1 Like

I recently found that the addon is not working anymore in a remote installation
The plugin is NOT running and if I try to start it the whole system becomes unresponsive (I’m using tailscale for remote access) and I can only remotely reboot the raspberry using a WiFi power socket

image

when I set it up for the first time I had to disable Protection mode in order to have it running

and this is the most recent log I can find

could this be related to some update of HA?
please help me understanding the issue and how to solve it
thanks in advance for any assistance :grinning:

LOG

2024/10/08 13:33:00 Found Smart Device (0x5f8db4c2134023bd) Attributes (11)
2024/10/08 13:33:00 Found Smart Device (0x5f8db4c2134023bd) Attributes (11)
time="2024-10-08T13:33:00+02:00" level=info msg="172.30.32.1 - db21ed7f-scrutiny-fa [08/Oct/2024:13:33:00 +0200] \"GET /api/device/0x5f8db4c2134023bd/details\" 200 327181 \"\" \"HomeAssistant/2024.10.1 httpx/0.27.2 Python/3.12\" (926ms)" clientIP=172.30.32.1 hostname=db21ed7f-scrutiny-fa latency=926 method=GET path=/api/device/0x5f8db4c2134023bd/details referer= respLength=327181 statusCode=200 type=web userAgent="HomeAssistant/2024.10.1 httpx/0.27.2 Python/3.12"
time="2024-10-08T13:33:03+02:00" level=info msg="Checking Influxdb & Sqlite health" type=web
time="2024-10-08T13:33:03+02:00" level=info msg="127.0.0.1 - db21ed7f-scrutiny-fa [08/Oct/2024:13:33:03 +0200] \"GET /api/health\" 200 16 \"\" \"curl/7.88.1\" (4ms)" clientIP=127.0.0.1 hostname=db21ed7f-scrutiny-fa latency=4 method=GET path=/api/health referer= respLength=16 statusCode=200 type=web userAgent=curl/7.88.1

configuration.yaml

rest:
  - verify_ssl: false
    scan_interval: 60
    resource: http://homeassistant:8086/api/device/0x5f8db4c2134023bd/details
    sensor:
      - name: "SSD0 - WWN"
        value_template: "{{ value_json.data.smart_results[0].device_wwn }}"
      - name: "SSD0 - Last Update"
        value_template: "{{ value_json.data.smart_results[0].date }}"
        device_class: timestamp
      - name: "SSD0 - Temperature"
        value_template: "{{ value_json.data.smart_results[0].temp }}"
        device_class: temperature
        unit_of_measurement: "°C"
        state_class: measurement
      - name: "SSD0 - Power Cycles"
        value_template: "{{ value_json.data.smart_results[0].power_cycle_count }}"
      - name: "SSD0 - Power Hours"
        value_template: "{{ value_json.data.smart_results[0].power_on_hours }}"
      - name: "SSD0 - SSD Wear Leveling Count"
        value_template: '{{ value_json.data.smart_results[0].attrs["173"].raw_value }}'
      - name: "SSD0 - Life Left"
        value_template: '{{ value_json.data.smart_results[0].attrs["231"].raw_value }}'
    binary_sensor:
      - name: "SSD0 - SMART Status"
        value_template: "{{ bool(value_json.data.smart_results[0].Status) }}"
        device_class: problem

The update function is not working for me. I have set to “hourly” but it never does.
I am using the collector spoke option since I have a docker hub running on another server within the same local network.
I am running Full Access scrutiny addon.

please see this Home assistant addon : Scrutiny (SMART dashboard) - #117 by Tismo

I heard from several non-related addons similar elements. I think something is messed up in HA itself since a recent version, but this happened on such different addons (qbittorrent ; *arr addons ; this one) that the only common point is HA itself …

There was indeed an issue upstream with Scrutiny itself which gave this issue, then was solved and the issue went away. As my own code didn’t change and it was working before perhaps it’s again the upstream app ?

1 Like

The custom update variables are working great. so Thank you for that.
I do have this TZ issue though, I can’t figure out how to solve it

Blockquote
Error : /etc/cont-init.d/01-configuration.sh exiting 2
sed: can’t read /etc/cont-init.d/10-timezone: No such file or directory

1 Like

Hi, just pushed a new version that should solve that

1 Like

Fixed. Thank you Alex

1 Like