[Support] Electric Brain Unraid API


303 posts in this topic Last Reply

Recommended Posts

Probably a HomeAssistant problem.
I get the MQTT messages at my HA when starting unraid-api and when anything changes (start/stop a docker)

so, the MQTT bit is working!
but
MQTT auto discovery on HA does not work - I have no unraid entities listed in HA

any ideas?

Link to post
  • Replies 302
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

Overview: Support for Docker image unraid-api in the electricbrain repo. Docker Hub: https://hub.docker.com/r/electricbrainuk/unraidapi Github/ Docs: https://github.com/ElectricBrainUK/Unrai

Hey, As for default image I don't see why not, I'll look into it. I currently have no plans to provide a https end point so I would recommend using a proxy for now. I will also look at

@ElectricBrainUK Thank you for your response. Firing Users Scripts would be more than enough.    @Jokerigno For instance firing a script that unbinds a usb device from a running vm

Posted Images

15 hours ago, oldfart said:

Probably a HomeAssistant problem.
I get the MQTT messages at my HA when starting unraid-api and when anything changes (start/stop a docker)

so, the MQTT bit is working!
but
MQTT auto discovery on HA does not work - I have no unraid entities listed in HA

any ideas?

Do you have auto discovery enabled in your home assistant mqtt config? And do you have it configured to the same base topic that the unraid api broadcasts on?

Link to post

auto discovery is enabled by default - so yes.

still messing with config file, could use an example if possible

 

so far I got messages in HA:  one example - 

Message 51 received on homeassistant/tower/unifivideo at 23:24:

{ "id": "01bf4d6e-9ed7-39d0-2d3b-af595f3d5398",

"status": "started",

"coreCount": "2",

"ram": "4096M",

"primaryGPU": "VNC:5900",

"name": "unifivideo",

"mac": "52:54:00:38:64:fc" }

QoS: 0 - Retain: false

 

my config.yaml:
mqtt:
  discovery: true
  discovery_prefix: homeassistant/tower

Edited by oldfart
Link to post
17 hours ago, oldfart said:

auto discovery is enabled by default - so yes.

still messing with config file, could use an example if possible

 

so far I got messages in HA:  one example - 

Message 51 received on homeassistant/tower/unifivideo at 23:24:

{ "id": "01bf4d6e-9ed7-39d0-2d3b-af595f3d5398",

"status": "started",

"coreCount": "2",

"ram": "4096M",

"primaryGPU": "VNC:5900",

"name": "unifivideo",

"mac": "52:54:00:38:64:fc" }

QoS: 0 - Retain: false

 

my config.yaml:
mqtt:
  discovery: true
  discovery_prefix: homeassistant/tower

That's correct except the discovery prefix should just be homeassistant (without /tower)

Link to post
2 minutes ago, Jokerigno said:

Hi,

 

it is "normal" that even if I removed this docker (because it cause cpu peak) I still can see a process unraid-api consuming 10% of my cpu?

No that is not normal but killing the process or rebooting your server should fix

Link to post
42 minutes ago, ElectricBrainUK said:

No that is not normal but killing the process or rebooting your server should fix

I rebooted but it's still there.

 

If you remember me I'm the say guy who noticed that there's a warning message in HA.

 

Quote

21-04-19 13:17:34 WARNING (MainThread) [supervisor.addons.validate] Add-on config 'startup' with 'before' is deprecated. Please report this to the maintainer of Unraid API

 

I think there are spare pieces in my config and I would like to delete them and start all over. Can you suggest me how to remove all traces in HA and Unraid?

Edited by Jokerigno
Link to post
8 hours ago, Jokerigno said:

I rebooted but it's still there.

 

If you remember me I'm the say guy who noticed that there's a warning message in HA.

 

 

I think there are spare pieces in my config and I would like to delete them and start all over. Can you suggest me how to remove all traces in HA and Unraid?

In unraid with the docker removed and the app data config deleted you should be fine. For HA I'm less familiar but removing the docker and then all data in the share as well as any references in the config should work fine.

 

For others that come across the issue with cpu usage that jokeringo and I have discussed here there is a solution: https://github.com/ElectricBrainUK/UnraidAPI/issues/33

Link to post
  • 3 weeks later...

Hi everyone i have a question regarding this application.

Is there any way to make the web UI only be reachable over HTTPS and having authentication or is this not supported yet?

 

Link to post
On 5/7/2021 at 2:31 PM, Driveman said:

Hi everyone i have a question regarding this application.

Is there any way to make the web UI only be reachable over HTTPS and having authentication or is this not supported yet?

 

Hey, currently HTTPS is not supported, you can force it to authenticate more requests by setting the KeyStorage variable to secure

Link to post
  • 2 weeks later...
Posted (edited)
13 minutes ago, svh1985 said:

Is there a way to secure the webui and api? Currently everyone on the lan can stop and start the array. Thanks!

Hey, it should prompt you for a username and password if you set the keystorage variable to secure, however you will also have to authenticate rest requests. Otherwise you could put the UI behind some other reverse proxy or something that adds auth

Edited by ElectricBrainUK
Link to post
  • 2 weeks later...

I've suddenly started noticing these errors:

 

Get VM Details for ip: 192.168.1.66 Failed
Request failed with status code 503

 

There's nothing else I can see in the logs. When I access the WebUI, I can log in and the details for the VM momentarily appear before disappearing (and VM/docker sections are empty).

 

Also, just to confirm, do I need to have the Unraid API running on both the homeassistant VM and Unraid?

Link to post
On 5/30/2021 at 9:35 AM, paulmorabi said:

I've suddenly started noticing these errors:

 


Get VM Details for ip: 192.168.1.66 Failed
Request failed with status code 503

 

There's nothing else I can see in the logs. When I access the WebUI, I can log in and the details for the VM momentarily appear before disappearing (and VM/docker sections are empty).

 

Also, just to confirm, do I need to have the Unraid API running on both the homeassistant VM and Unraid?

Hey,

That is odd, 503 suggests it cannot authenticate or is being blocked, try re entering your server details in the ui as sometimes they expire especially if you have the config location set to secure. If you have changed the network config to have its own ip on br0.1 etc then it will not work and will throw this error though this may not be the case.

 

You do not need the unraid api on both, the unraid one works more reliably so I would suggest using only that.

Link to post
15 minutes ago, ElectricBrainUK said:

Hey,

That is odd, 503 suggests it cannot authenticate or is being blocked, try re entering your server details in the ui as sometimes they expire especially if you have the config location set to secure. If you have changed the network config to have its own ip on br0.1 etc then it will not work and will throw this error though this may not be the case.

 

You do not need the unraid api on both, the unraid one works more reliably so I would suggest using only that.

 

Thanks for replying. Yes, something is very odd and this is after months of there being no issues. The only thing that changed is I moved my Home Assistant to a different VM and restored from backup. Even then, it seemed to work afterwards but die later.

 

I've tried with one container, alternatively on the HA VM and the Unraid box and each gives the same result, albeit, slighttly different behavior:

 

* On the Unraid box, after logging in, it does not show a second pop up window to log in again. It loads the details of the VM but only very partiually, no containers, vm's or anything.

* On the HA VM, the container asks me to login again after the first auth and then does similar to above, only displaying a few details.

 

Then the logs begin filling with 503 errors.

 

 

 

 

 

Link to post
2 minutes ago, paulmorabi said:

 

Thanks for replying. Yes, something is very odd and this is after months of there being no issues. The only thing that changed is I moved my Home Assistant to a different VM and restored from backup. Even then, it seemed to work afterwards but die later.

 

I've tried with one container, alternatively on the HA VM and the Unraid box and each gives the same result, albeit, slighttly different behavior:

 

* On the Unraid box, after logging in, it does not show a second pop up window to log in again. It loads the details of the VM but only very partiually, no containers, vm's or anything.

* On the HA VM, the container asks me to login again after the first auth and then does similar to above, only displaying a few details.

 

Then the logs begin filling with 503 errors.

 

 

 

 

 

Okay, I have heard a couple of users report a similar issue, I would suggest not using the HA VM one as that is in alpha and not consistently working at the best of times.

 

For the unraid one, have you tried deleting the server altogether (in the menu on the left under manual config) and then restarting the docker and reconfiguring? This may help otherwise try deleting the config folder and starting from scratch. You could also check the server logs on unraid itself to see if there is any extra details on why it is failing to connect there. 

Link to post
2 hours ago, ElectricBrainUK said:

Okay, I have heard a couple of users report a similar issue, I would suggest not using the HA VM one as that is in alpha and not consistently working at the best of times.

 

For the unraid one, have you tried deleting the server altogether (in the menu on the left under manual config) and then restarting the docker and reconfiguring? This may help otherwise try deleting the config folder and starting from scratch. You could also check the server logs on unraid itself to see if there is any extra details on why it is failing to connect there. 

 

Have removed the add-on from HA completely. I also removed config and container and started again with same results. There is nothing really in the error logs:

 

READY Server listening on http://0.0.0.0:80

Failed to retrieve config file, creating new.


ERROR ENOENT: no such file or directory, open 'config/mqttKeys'


at Object.openSync (node:fs:492:3)
at Proxy.readFileSync (node:fs:393:35)
at default (api/getServers.js:27:36)
at call (node_modules/connect/index.js:239:7)
at next (node_modules/connect/index.js:183:5)
at next (node_modules/connect/index.js:161:14)
at next (node_modules/connect/index.js:161:14)
at SendStream.error (node_modules/serve-static/index.js:121:7)

at SendStream.emit (node:events:378:20)
at SendStream.EventEmitter.emit (node:domain:470:12)


ERROR ENOENT: no such file or directory, open 'config/mqttKeys'


at Object.openSync (node:fs:492:3)
at Proxy.readFileSync (node:fs:393:35)
at default (api/getServers.js:27:36)
at call (node_modules/connect/index.js:239:7)
at next (node_modules/connect/index.js:183:5)
at next (node_modules/connect/index.js:161:14)
at next (node_modules/connect/index.js:161:14)
at SendStream.error (node_modules/serve-static/index.js:121:7)

at SendStream.emit (node:events:378:20)
at SendStream.EventEmitter.emit (node:domain:470:12)


ERROR ENOENT: no such file or directory, open 'config/mqttKeys'


at Object.openSync (node:fs:492:3)
at Proxy.readFileSync (node:fs:393:35)
at default (api/getServers.js:27:36)
at call (node_modules/connect/index.js:239:7)
at next (node_modules/connect/index.js:183:5)
at next (node_modules/connect/index.js:161:14)
at next (node_modules/connect/index.js:161:14)
at SendStream.error (node_modules/serve-static/index.js:121:7)

at SendStream.emit (node:events:378:20)
at SendStream.EventEmitter.emit (node:domain:470:12)

Error: ENOENT: no such file or directory, open 'config/mqttKeys'

at Object.openSync (node:fs:492:3)
at Proxy.readFileSync (node:fs:393:35)
at updateMQTT (/app/mqtt/index.js:272:30)
at Timeout._onTimeout (/app/mqtt/index.js:304:5)
at listOnTimeout (node:internal/timers:556:17)
at processTimers (node:internal/timers:499:7) {
errno: -2,
syscall: 'open',
code: 'ENOENT',
path: 'config/mqttKeys'
}
The secure keys for mqtt may have not been generated, you need to make 1 authenticated request via the API first for this to work

ERROR ENOENT: no such file or directory, open 'config/mqttKeys'


at Object.openSync (node:fs:492:3)
at Proxy.readFileSync (node:fs:393:35)
at default (api/getServers.js:27:36)
at call (node_modules/connect/index.js:239:7)
at next (node_modules/connect/index.js:183:5)
at next (node_modules/connect/index.js:161:14)
at next (node_modules/connect/index.js:161:14)
at SendStream.error (node_modules/serve-static/index.js:121:7)

at SendStream.emit (node:events:378:20)
at SendStream.EventEmitter.emit (node:domain:470:12)


ERROR ENOENT: no such file or directory, open 'config/mqttKeys'


at Object.openSync (node:fs:492:3)
at Proxy.readFileSync (node:fs:393:35)
at default (api/getServers.js:27:36)
at call (node_modules/connect/index.js:239:7)
at next (node_modules/connect/index.js:183:5)
at next (node_modules/connect/index.js:161:14)
at next (node_modules/connect/index.js:161:14)
at SendStream.error (node_modules/serve-static/index.js:121:7)

at SendStream.emit (node:events:378:20)
at SendStream.EventEmitter.emit (node:domain:470:12)

Get Docker Details for ip: 192.168.1.66 Failed

Request failed with status code 503

Get Main Details for ip: 192.168.1.66 Failed

Request failed with status code 503

 

Link to post
Posted (edited)
On 5/18/2021 at 11:18 AM, ElectricBrainUK said:

Hey, it should prompt you for a username and password if you set the keystorage variable to secure, however you will also have to authenticate rest requests. Otherwise you could put the UI behind some other reverse proxy or something that adds auth

Thanks for the awesome container, really useful for Unraid metrics in Grafana. I'm having problems securing the container using the method suggested though, any ideas what i'm doing wrong?

 

I've changing the container variable 'KeyStorage' from config to secure but can still access the api without a username/password prompt, with the following in the logs:

 

Error: ENOENT: no such file or directory, open 'secure/mqttKeys'

 

 

Edited by 1471
Link to post
On 5/31/2021 at 3:12 PM, paulmorabi said:

 

Have removed the add-on from HA completely. I also removed config and container and started again with same results. There is nothing really in the error logs:

 


READY Server listening on http://0.0.0.0:80

Failed to retrieve config file, creating new.


ERROR ENOENT: no such file or directory, open 'config/mqttKeys'


at Object.openSync (node:fs:492:3)
at Proxy.readFileSync (node:fs:393:35)
at default (api/getServers.js:27:36)
at call (node_modules/connect/index.js:239:7)
at next (node_modules/connect/index.js:183:5)
at next (node_modules/connect/index.js:161:14)
at next (node_modules/connect/index.js:161:14)
at SendStream.error (node_modules/serve-static/index.js:121:7)

at SendStream.emit (node:events:378:20)
at SendStream.EventEmitter.emit (node:domain:470:12)


ERROR ENOENT: no such file or directory, open 'config/mqttKeys'


at Object.openSync (node:fs:492:3)
at Proxy.readFileSync (node:fs:393:35)
at default (api/getServers.js:27:36)
at call (node_modules/connect/index.js:239:7)
at next (node_modules/connect/index.js:183:5)
at next (node_modules/connect/index.js:161:14)
at next (node_modules/connect/index.js:161:14)
at SendStream.error (node_modules/serve-static/index.js:121:7)

at SendStream.emit (node:events:378:20)
at SendStream.EventEmitter.emit (node:domain:470:12)


ERROR ENOENT: no such file or directory, open 'config/mqttKeys'


at Object.openSync (node:fs:492:3)
at Proxy.readFileSync (node:fs:393:35)
at default (api/getServers.js:27:36)
at call (node_modules/connect/index.js:239:7)
at next (node_modules/connect/index.js:183:5)
at next (node_modules/connect/index.js:161:14)
at next (node_modules/connect/index.js:161:14)
at SendStream.error (node_modules/serve-static/index.js:121:7)

at SendStream.emit (node:events:378:20)
at SendStream.EventEmitter.emit (node:domain:470:12)

Error: ENOENT: no such file or directory, open 'config/mqttKeys'

at Object.openSync (node:fs:492:3)
at Proxy.readFileSync (node:fs:393:35)
at updateMQTT (/app/mqtt/index.js:272:30)
at Timeout._onTimeout (/app/mqtt/index.js:304:5)
at listOnTimeout (node:internal/timers:556:17)
at processTimers (node:internal/timers:499:7) {
errno: -2,
syscall: 'open',
code: 'ENOENT',
path: 'config/mqttKeys'
}
The secure keys for mqtt may have not been generated, you need to make 1 authenticated request via the API first for this to work

ERROR ENOENT: no such file or directory, open 'config/mqttKeys'


at Object.openSync (node:fs:492:3)
at Proxy.readFileSync (node:fs:393:35)
at default (api/getServers.js:27:36)
at call (node_modules/connect/index.js:239:7)
at next (node_modules/connect/index.js:183:5)
at next (node_modules/connect/index.js:161:14)
at next (node_modules/connect/index.js:161:14)
at SendStream.error (node_modules/serve-static/index.js:121:7)

at SendStream.emit (node:events:378:20)
at SendStream.EventEmitter.emit (node:domain:470:12)


ERROR ENOENT: no such file or directory, open 'config/mqttKeys'


at Object.openSync (node:fs:492:3)
at Proxy.readFileSync (node:fs:393:35)
at default (api/getServers.js:27:36)
at call (node_modules/connect/index.js:239:7)
at next (node_modules/connect/index.js:183:5)
at next (node_modules/connect/index.js:161:14)
at next (node_modules/connect/index.js:161:14)
at SendStream.error (node_modules/serve-static/index.js:121:7)

at SendStream.emit (node:events:378:20)
at SendStream.EventEmitter.emit (node:domain:470:12)

Get Docker Details for ip: 192.168.1.66 Failed

Request failed with status code 503

Get Main Details for ip: 192.168.1.66 Failed

Request failed with status code 503

 

Those are the logs from unraid api however I mean the ones from unraid itself - there may be something there which explains why the api is failing to connect, did you try reconfiguring the server in the api as well?

Link to post
Posted (edited)
17 hours ago, 1471 said:

Thanks for the awesome container, really useful for Unraid metrics in Grafana. I'm having problems securing the container using the method suggested though, any ideas what i'm doing wrong?

 

I've changing the container variable 'KeyStorage' from config to secure but can still access the api without a username/password prompt, with the following in the logs:

 

Error: ENOENT: no such file or directory, open 'secure/mqttKeys'

 

 

Hey - that is unusual Im guessing the API is sending a cached response probably something I need to fix and not a problem with your config.. Ill look into it - it should mean that you cant perform actions without auth but the bug with the cache means the data about the server is still shared

Edited by ElectricBrainUK
Link to post
Posted (edited)
On 6/2/2021 at 7:52 AM, ElectricBrainUK said:

Hey - that is unusual Im guessing the API is sending a cached response probably something I need to fix and not a problem with your config.. Ill look into it - it should mean that you cant perform actions without auth but the bug with the cache means the data about the server is still shared

 

Thanks for the info.


Yup, setting the variable to 'secure' does then prompt for a password if trying to perform an action which is good.

 

I just need to try and figure out how to authenticate to access the api in Grafana now.

Edited by 1471
Link to post

Hello, Ichjj is faced with a problem again and can't find a solution. I have installed the Unraid API on my main Unraid server. At the beginning I still had the functions that I could control the array etc. there, also the start of the VMs and Docker, but now nothing works anymore. Information is also no longer displayed.
I hope you can help me along with that.

Greetings Maggi 

 

 

Unraid API keine Funktionen.PNG

Link to post
On 6/6/2021 at 4:34 AM, Maggi0r said:

Hello, Ichjj is faced with a problem again and can't find a solution. I have installed the Unraid API on my main Unraid server. At the beginning I still had the functions that I could control the array etc. there, also the start of the VMs and Docker, but now nothing works anymore. Information is also no longer displayed.
I hope you can help me along with that.

Greetings Maggi

Same thing happened to me today been working grate for days now and went to turn on my vm with HA and greyed out.
Go into the Docker image and can see Details but nothing else populates.
Only thing that has changed is I added a PiHole Docker image today.

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.