Integrate TrueNAS CORE statistics with Home Assistant for effortless monitoring
Disclosure: This post contains affiliate links. If you click through and make a purchase, I will earn a commission, at no additional cost to you. Read my full disclosure here.
In a digital world where multitasking has become second nature, we yearn for streamlined solutions to effortlessly monitor and manage our systems. With that in mind, we will delve into integrating TrueNAS CORE statistics and messages into Home Assistant, building upon the previous guide on enabling remote starting and shutting down of a TrueNAS CORE machine. Our tool of choice? The TrueNAS CORE API.
While the TrueNAS CORE dashboard has blossomed into a valuable visual hub for critical data, the Home Assistant Dashboard typically takes centre stage on our desktops. So, why not import and display TrueNAS CORE data into the Home Assistant Dashboard for easy access? This guide will walk you through setting up a sensor that provides a report of essential information, which can then be used for notifications or push alerts to keep you informed of your system's health.
Setting the stage with RESTful sensors
In our pursuit of integrating TrueNAS CORE data into Home Assistant, we will utilize RESTful sensors—no RESTful commands needed, as we aren't executing any system commands. To enable specific variables in the RESTful integration, simply add or remove them under the json_attributes in the configuration provided below.
status The current status of the volume
vol_guid The volume’s Globally Unique Identifier
name The volume’s name
used_pct The percentage of used storage
used_si The amount of storage currently used
is_decrypted Whether the volume is decrypted or not
Our trusty secrets.yaml file will once again be used to reference the username and password, as explained in our previous guide.
Opting for template sensors
The code provided creates a new entity with desired attributes. However, it falls short in terms of practicality, as it doesn't allow you to display individual information in your Home Assistant Dashboard or easily use the values in automations. To remedy this, create a template sensor for each individual value.
Unleashing the power of TrueNAS CORE and Home Assistant
With a few lines of code and some tinkering, you can now seamlessly integrate TrueNAS CORE statistics and system information into your Home Assistant setup. This fusion unlocks a world of possibilities for automations, scripts, and notifications. Effortlessly monitor your system's performance and address potential issues, leaving you with peace of mind to focus on life's more important matters.
An example of how you can display TrueNAS CORE information in Home Assistant
2 thoughts on “Integrate TrueNAS CORE statistics with Home Assistant for effortless monitoring”
Heads up, seems you have a typo in the volume status template. Missing the sensor in “states.sensor.freenas…..”. Great blog though, love it!
Heads up, seems you have a typo in the volume status template. Missing the sensor in “states.sensor.freenas…..”. Great blog though, love it!
Thanks for that! Have updated the post. And also thanks for your praise!