Introduction
This UNRAID plugin is a wrapper for reading the files used by Unraid / emhttpd for displaying various statistics, the files are read from /var/local/emhttp/*.ini and are converted to JSON for easy access by services/applications like Home Assistant
This plugin has no ‘frontend’ and is only accessible directly via http://TOWER/plugins/jsonapi/api.php?file=XXX.ini for example to get the disks.ini file you would do http://TOWER/plugins/jsonapi/api.php?file=disks.ini
currently the following files exist that can be used
- cpuload.ini
- devs.ini
- diskload.ini
- disks.ini
- monitor.ini
- network.ini
- sec.ini
- sec_afp.ini
- sec_nfs.ini
- shares.ini
- users.ini
- var.ini
Usage
Plugins > Install Plugin
https://raw.githubusercontent.com/Cyanlabs/jsonapi-unraid/master/jsonapi.plg
This is designed to be a more “plug and play” method of getting the unraid statistics compared to this Unraid System Monitor integration
Just to clarify, due to limitations afaik in the Unraid plugin system this does require basic auth when accessing the json.
NOTE: please note that this currently is a raw json output, a custom HA component would be the best way to access this data but it is possible without a custom component (HA has a 255 character REST sensor state limit)
- platform: rest
name: Unraid
resource: "http://192.168.1.3/plugins/jsonapi/api.php?file=disks.ini"
username: root
json_attributes:
- disk1
- disk2
password: !secret unraid_password
authentication: basic
value_template: '{{ value_json["disk1"]["status"] }}'
headers:
User-Agent: Home Assistant
Content-Type: application/json
despite it not being able to do more than 255 you can work around it with the attributes, the above code will show something like this
and you can access specific values with like this
My python isn’t great but i believe this is a good starting point - https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/pvoutput/sensor.py
Things like CPU load are easy though
sensor:
- platform: rest
name: Unraid CPU
resource: "http://192.168.1.3:965/plugins/jsonapi/api.php?file=cpuload.ini"
username: root
password: !secret unraid_password
authentication: basic
value_template: '{{ value_json["cpu"]["host"] }}'
headers:
User-Agent: Home Assistant
Content-Type: application/json