I’d also be interested in monitoring Temperatures, warnings and drive settings etc… on my Unraid server on a different computer/over the network through Home Assistant (Hassio) - could be really useful (for me).
I don’t have hass.io, so i’m not sure how to do a plugin, or if this helps at all, but i’ll post this anyway as it seems relevant.
i created a small python script to read the /var/local/emhttp/disks.ini file on Unraid for disk status, and then use a command_line sensor in the hass configuration:
Unraid.py (note: you will probably need to make a symbolic link and/or a mount point to /var/local/emhttp)
import configparser, json
numErrors = 0
config = configparser.ConfigParser()
config.read("/mnt/sage/disks.ini")
for s in config.sections():
e = config[s]['numErrors'].replace('"','')
numErrors += int(e)
if not config[s]['status'].startswith('"DISK_NP'):
if config[s]['status'] != '"DISK_OK"':
result = {"result":"{}:{}".format(s,config[s]['status'])}
else:
result = {"result":"Ok"}
result['numErrors'] = numErrors
print(json.dumps(result))
configuration.yaml:
- platform: command_line
command: '~/homeassistant/bin/python /home/pi/.homeassistant/unraid.py'
name: Unraid Disk Status
value_template: '{{ value_json.result }}'
json_attributes:
- numErrors
this will create sensor.unraid_disk_status, the state of which should be “Ok” if all the disks are “DISK_OK”, otherwise the state should be whatever the last failed disk status is marked as. (although i haven’t tested this because my array hasn’t failed yet < fingers-crossed >). The sensor will have also have an attribute called numErrors that will show how many errors were collected for the whole array.
i think this could be a model for other data points in disks.ini and the other ini files in that directory that contain more unraid state information, ie: var.ini, cpuload.ini, …
not a custom component, just a python script run as a command_line sensor. Because the disks.ini file is accessed through a mount point, the only place the IP is coded is in /etc/fstab where the mount point gets created upon reboot.