Using REST integration to check disk temperature using FreeNAS api v2.0

Howdy! Spent some time figuring out how to utilize the new(er) FreeNASs API v2.0 using REST integration in Home Assistant. My goal is to post disk temperatures on my HA dashboard so I can access them easily using the Home Assistant Android App. Below is the code. I plan in the future to try to normalize drive temperature by changing case fan speeds using an automation or script. That’s a future goal though.

in configuration.yaml

sensor:
  - platform: rest
    method: POST
    resource: http://192.168.x.x/api/v2.0/disk/temperatures
    payload: '{"names":["da1", "da2", "da3", "da4"],"powermode":"NEVER"}'
    username: !secret fn_user
    password: !secret fn_pass
    authentication: basic
    name: disk temp
    json_attributes:
      - da1
      - da2
      - da3
      - da4
  - platform: template
    sensors:
      disk1:
        unit_of_measurement: 'C°'
        value_template: '{{ states.sensor.disk_temp.attributes["da1"] }}'
      disk2:
        unit_of_measurement: 'C°'
        value_template: '{{ states.sensor.disk_temp.attributes["da2"] }}'
      disk3:
        unit_of_measurement: 'C°'
        value_template: '{{ states.sensor.disk_temp.attributes["da3"] }}'
      disk4:
        unit_of_measurement: 'C°'
        value_template: '{{ states.sensor.disk_temp.attributes["da4"] }}'
1 Like

This is awesome! Thanks!

1 Like