Unraid API - Connect and control Unraid servers through Home Assistant via MQTT

hi,

I found this message in my supervisor logs, but I don’t have any addon for Unraid API (just a container in unraid server that is off right now). Can some one please give me a hint?

21-04-05 13:03:57 WARNING (MainThread) [supervisor.addons.validate] Add-on config ‘startup’ with ‘before’ is deprecated. Please report this to the maintainer of Unraid API

Thank you

Hi, that is unusual, have you ever had the add-on installed? It shouldn’t matter anyway it’s just something I need to change when I look at getting the add-on working again

Yes I tried once. Maybe some parts are still in my config somewhere? At the moment I don’t have the addon installed wo that’s a weird message. I raised this question because if you look at my username I already wrote you on Unraid Forum asking your support because the container is no longer usable in 6.9.1 cause when it’s running CPU are all 100% all the time. So I was wondering if this warning can be somehow related. I guess no based on your answer. Looking forward to use this tool again!

Perhaps, very odd! I appreciate you letting me know though thanks!

I have pushed a partial fix for 6.9.1 but as we discussed on the unraid forum it doesn’t seem to have fully remedied the situation, but rest assured I haven’t forgotten and am working with some other members of the community to release a completely revamped tool with all the same functionality but better performance and UI - give it another week or two though as I can only work on it in my spare time

3 Likes

Hey, I don’t suppose your issue could be related to this? https://github.com/ElectricBrainUK/UnraidAPI/issues/33

Hi, I might be missing something silly but I’ve got everything set up but I’d like to pull the disk space used into my config but I cant see it as a sensor? Do I need to add it in the sensor yaml?

Hey, yeah so it should show up under server details right? You have to manually configure a sensor if you want to use that data in automations (in your sensors.yaml like you said)

There are set details here: Home Assistant Integration · ElectricBrainUK/UnraidAPI Wiki · GitHub

And more specifically here: MQTT Sensor - Home Assistant

Try it yourself and let me know how you get on, happy to help if you get stuck

Thanks, I’ve got it although the sensor data seems to swap between the disk space used and this?
Content-Type" content="text/html; charset=utf-8">

That is interesting, let me check that

This is my sensor.yaml if that helps…

  sensors: 
    server_diskspace:
      value_template: "{{state_attr('binary_sensor.unraidserv_server', 'diskSpace') }}"
      friendly_name: 'Unraid Disk Space'

Mother of god this solved my issue!

1 Like

I’ve installed the Unraid-API container on my unraid server, but it doesn’t seem to pull any info whatsoever, apart from the IP address and name of the server after I log into the application using my unraid credentials.

This is what is shown after I login with the credentials (it does show “connected”):

Anyone had a similar issue?
Any tips or anything I may have missed?

Thanks!

Hey, it looks like your IP is correct and it can find the server but is failing for some reason to authenticate with it. It could be:

  • because your server can only be accessed over Https and you didn’t tick the Https box
  • you entered the wrong password
  • your unraid API can’t access unraid due to network config (docker bridge or DNS settings on unraid and the docker)
    It could also be something else but those are my initial thoughts, check the unraid server logs and the logs of the unraid API for more details

Thanks for creating the integration. Things started working when I added my (custom) port to the IP address field: 192.168.###.###:####
I had moved unraid to different port.

1 Like

Hi @ElectricBrain
I’m getting errors in my log like this:

  • emplate variable warning: ‘dict object’ has no attribute ‘parityCheckRunning’ when rendering ‘{{ value_json.parityCheckRunning }}’
  • Template variable warning: ‘dict object’ has no attribute ‘moverRunning’ when rendering ‘{{ value_json.moverRunning }}’
  • Template variable warning: ‘dict object’ has no attribute ‘arrayStatus’ when rendering ‘{{ value_json.arrayStatus }}’

Any idea?
I dont see any json config

Hey @skank the json it is referring to is the one sent in the MQTT payload, is this in the logs on the home assistant side?

hi @ElectricBrain
Yes this is in the home assistant logs

How did you configure glance, i install on unraid glance with docker container and then on home assistant through integration but i do not get any sensor, i know that are communicating because when i stop the container is reflecting on home assistant

@ElectricBrain I’m getting these in my logs as well. Not sure exactly when it started but I get this error by the thousand daily. I posted in your Discord where a few other seem to have this issue as well but no one seems to have any suggestions. Please assist if possible. Below are my notes from the discord post:

  1. I’ve been getting the same errors as well. I’ve used mqtt explorer to view the incoming data on my broker and there are times when it’s missing partial json info that then lead to the errors in the HA logs. See example: (edited)

  2. [6:50 PM]

Image

  1. [6:52 PM]

I got these same errors on 6.9.x before moving to Unraid 6.10.x btw

  1. [6:53 PM]

Oh… and the json above is from the “/homeassistant/tower” topic…where tower is the name of the server (edited)

June 5, 2022

Cpt Trip Today at 10:51 AM

Really hoping someone has suggestions on this as it has been flooding my logs with thousands of errors daily for some time now. It’s not breaking anything but still far from ideal. (edited)

  1. [10:54 AM]

I dont know the details about how the container creates and publishes the messages to mqtt but I see there is a servers.json file being stored in the docker volume and this seems to contain all the data. There is a “serverdetails” portion that also seems to contain the info that is published to the homeassistant/servername topic and I’ve checked this file with every refresh. It seems to always have the complete data but for some reason, it sometimes send the partial data outlined above. Hopefully this info can help track down this issue.

1 Like

So, I have developed a problem with data gathering in Home Assistant. Bear in mind that this had been working fine, not sure if the latest HA updates or Unraid API updates broke it.
I get all of the switches for my dockers and the capacity of my array, but I have lost the data for [sensor.unraid_array_protection] and [sensor.unraid_array_status] both have become unknown in HA. Both of these sensors do populate for a split second from time to time, and then revert almost instantly to unknown in developer tools in HA. I should add that I am on 6.11.5 Unraid Plus and 2023.1.7 of HA.

The part that leads me to believe that this may be an Unraid side issues is that the API connection to my server, after login, only shows my server dockers it now does not list VMs, Utils and server status. I am still seeing the MQTT traffic from Unraid that includes the cpu type, mobo model, memory size, disk space , unraid version

It appears that from time to time the MQTT data from Uraid is correct.

And that sometimes it is truncated.

I have rebooted both systems, refreshed the login on the API in Unraid, but have not reinstalled the Unraid API container on Unraid yet.