[Support] Electric Brain Unraid API


Recommended Posts

Hey @ElectricBrainUK,

Cheers for the awesome work, got everything up and running both as a container in Unraid first but then switched to hosting inside Home Assistant with the addon as it seems a bit more reliable.

I am having one issue. At this stage, the connection does not seem to persist across server/VM shutdowns, leading to having to sign in (of which it prompts twice?) every time the home assistant server has to reboot. Any way to avoid this?

Thanks again!

Link to comment

Hi guys,

For the first issue I'm unsure what the problem would be unless pi hole is blocking the api somehow, though I doubt that as it doesn't really use domain names. Try reconfiguring the server in the unraid api and failing that checking the logs of both the api and the unraid server itself

 

@Irithor
glad you appreciate, happy it's worked so far. I'm surprised you got the ha app working at all as it has a few problems that I need to sort out! I guess the main thing would be to check the share it is pointing to when it tries to write to config/* and make sure it's properly mapped outside of the docker onto the host somewhere. Not a problem on the unraid docker as the mappings all work but it can be a bit more fiddly in HA! Let me know if you need more help and how you get on. Check here to start with, it should be mapped to a /share folder but it may not be: https://developers.home-assistant.io/docs/add-ons/configuration/

  • Like 1
Link to comment
On 6/10/2021 at 12:04 PM, ElectricBrainUK said:

Hi guys,

For the first issue I'm unsure what the problem would be unless pi hole is blocking the api somehow, though I doubt that as it doesn't really use domain names. Try reconfiguring the server in the unraid api and failing that checking the logs of both the api and the unraid server itself

 

 

Hello,

 

I have solved my own issue and want to supply the info on here in hopes this helps someone else.

I added the 6.9.2 Myservers plugin, now when i try to connect to your ELECTRIC BRAIN UNRAID API i get an error 503.

The solution i came up with was instead of my Unraid IP address i now use the ****************.unraid.net address and the integration fired back up.

 

hope this helps someone moving forward.

  • Like 1
Link to comment
  • 4 weeks later...

I finally found a fix for all people with the 503 error!

Unraid is blocking an IP after to many wrong attempts and if u have entered the wrong credentials more then 3 times u will get blocked from unraid! I was sitting on this for more than 6 hours but now its working. To remove the block u have to delete a file.

Its stored under /var/log/pwfail/ and in this folder there is an file with the internal ip of the docker just delete that over ssh and it should work! Hope it helps! :D

  • Like 2
  • Thanks 1
Link to comment
  • 4 weeks later...
On 8/8/2021 at 1:15 AM, okkies said:

ok, i got some zigbee2mqtt usb sticks forwarded to my Home-assistant VM. 

How do i start. 

what i want to do is, start a userscript. (stopping VM-A, and starting VM-B with a delay) from a zigbee button....
How en where do i start ?

Assuming you have zigbee2mqtt set up with an mqtt broker that is connect to home assistant? If not look into zigbee2mqtt and an mqtt broker

 

Once you have that set up, you want to set up the unraid API adding all of your mqtt broker details in the docker set up, then on the UI adding your unraid server details.

 

There is currently no way to trigger user scripts from the API. So what you would do is create an automation in home assistant that when you press your zigbee button, it turns on VM A and then VM B rather than calling the script.

Link to comment
  • 5 weeks later...

Hi,

first,big thanks for this plugin, i use it with HA.

I configured everything,everything is working but i have one big problem. If i start docker container with this plugin, i get excessive writes on USB drive. I traced it and found that last updated file  is /boot/config/domains.cfg . The content of this file is not changing, with other dockers i dont have this problems. i get maybe 10000 writes/hour, this can destroy boot usb disk in short period of time. For now, i stopped it..  

Link to comment
On 9/9/2021 at 11:58 AM, CRTech said:

Hi,

first,big thanks for this plugin, i use it with HA.

I configured everything,everything is working but i have one big problem. If i start docker container with this plugin, i get excessive writes on USB drive. I traced it and found that last updated file  is /boot/config/domains.cfg . The content of this file is not changing, with other dockers i dont have this problems. i get maybe 10000 writes/hour, this can destroy boot usb disk in short period of time. For now, i stopped it..  

Hi, I'm afraid I've not seen this error before and I don't know what could be causing it. Is there anything in the logs for the unraid api that is suspicious? Or the system logs when the writes are high? Otherwise there is this issue where forcing the api onto a background thread causes it to behave unusually: https://github.com/ElectricBrainUK/UnraidAPI/issues/33

Link to comment

Hi,  in Unraid API log is only this,i dont know if it means something but it shows when i stop this plugin, last message when is running is : Connected to mqtt broker

> [email protected] start
> cross-env NUXT_HOST=0.0.0.0 NODE_ENV=production node server/index.js


WARN mode option is deprecated. You can safely remove it from nuxt.config


READY Server listening on http://0.0.0.0:80

Connected to mqtt broker
Connected to mqtt broker
npm ERR! path /app
npm ERR! command failed

npm ERR! signal SIGTERM
npm ERR! command sh -c cross-env NUXT_HOST=0.0.0.0 NODE_ENV=production node server/index.js

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-09-11T10_42_35_003Z-debug.log

in this file is :

0 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ]
1 info using [email protected]
2 info using [email protected]
3 timing config:load:defaults Completed in 2ms
4 timing config:load:file:/usr/local/lib/node_modules/npm/npmrc Completed in 1ms
5 timing config:load:builtin Completed in 1ms
6 timing config:load:cli Completed in 2ms
7 timing config:load:env Completed in 1ms
8 timing config:load:file:/app/.npmrc Completed in 0ms
9 timing config:load:project Completed in 1ms
10 timing config:load:file:/root/.npmrc Completed in 0ms
11 timing config:load:user Completed in 0ms
12 timing config:load:file:/usr/local/etc/npmrc Completed in 0ms
13 timing config:load:global Completed in 0ms
14 timing config:load:cafile Completed in 0ms
15 timing config:load:validate Completed in 0ms
16 timing config:load:setUserAgent Completed in 0ms
17 timing config:load:setEnvs Completed in 1ms
18 timing config:load Completed in 9ms
19 verbose npm-session 96251fc38a486791
20 timing npm:load Completed in 19ms
21 timing command:run-script Completed in 111880ms
22 timing command:start Completed in 111883ms
23 verbose stack Error: command failed
23 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/index.js
:64:27)
23 verbose stack     at ChildProcess.emit (node:events:378:20)
23 verbose stack     at maybeClose (node:internal/child_process:1067:16)
23 verbose stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
24 verbose pkgid [email protected]
25 verbose cwd /app
26 verbose Linux 5.10.28-Unraid
27 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
28 verbose node v15.8.0
29 verbose npm  v7.5.1
30 error path /app
31 error command failed

thats all,syslog is clean..

Link to comment
On 9/11/2021 at 11:54 AM, CRTech said:

Hi,  in Unraid API log is only this,i dont know if it means something but it shows when i stop this plugin, last message when is running is : Connected to mqtt broker

> [email protected] start
> cross-env NUXT_HOST=0.0.0.0 NODE_ENV=production node server/index.js


WARN mode option is deprecated. You can safely remove it from nuxt.config


READY Server listening on http://0.0.0.0:80

Connected to mqtt broker
Connected to mqtt broker
npm ERR! path /app
npm ERR! command failed

npm ERR! signal SIGTERM
npm ERR! command sh -c cross-env NUXT_HOST=0.0.0.0 NODE_ENV=production node server/index.js

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-09-11T10_42_35_003Z-debug.log

in this file is :

0 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ]
1 info using [email protected]
2 info using [email protected]
3 timing config:load:defaults Completed in 2ms
4 timing config:load:file:/usr/local/lib/node_modules/npm/npmrc Completed in 1ms
5 timing config:load:builtin Completed in 1ms
6 timing config:load:cli Completed in 2ms
7 timing config:load:env Completed in 1ms
8 timing config:load:file:/app/.npmrc Completed in 0ms
9 timing config:load:project Completed in 1ms
10 timing config:load:file:/root/.npmrc Completed in 0ms
11 timing config:load:user Completed in 0ms
12 timing config:load:file:/usr/local/etc/npmrc Completed in 0ms
13 timing config:load:global Completed in 0ms
14 timing config:load:cafile Completed in 0ms
15 timing config:load:validate Completed in 0ms
16 timing config:load:setUserAgent Completed in 0ms
17 timing config:load:setEnvs Completed in 1ms
18 timing config:load Completed in 9ms
19 verbose npm-session 96251fc38a486791
20 timing npm:load Completed in 19ms
21 timing command:run-script Completed in 111880ms
22 timing command:start Completed in 111883ms
23 verbose stack Error: command failed
23 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/index.js
:64:27)
23 verbose stack     at ChildProcess.emit (node:events:378:20)
23 verbose stack     at maybeClose (node:internal/child_process:1067:16)
23 verbose stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
24 verbose pkgid [email protected]
25 verbose cwd /app
26 verbose Linux 5.10.28-Unraid
27 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
28 verbose node v15.8.0
29 verbose npm  v7.5.1
30 error path /app
31 error command failed

thats all,syslog is clean..

That looks relatively normal, do you have any mappings other than /app/config?

Link to comment
Quote

That looks relatively normal, do you have any mappings other than /app/config?

I dont know what you mean exactly, i am not completely familiar with docker and containers. I only configured this container via edit option in unraid, nothing special, app/config path point to /mnt/user/appdata/Unraid-API - default setting. after few days,when i looked on stats i saw this big amount of writes(something arround 280K) then i started to trace where it comes from.. i also tried to uninstall it, delete everything from /mnt/user/appdata/Unraid-API and install one more time, restarted vm manager,docker,whole server - but no luck.. 

Link to comment

One more thing i found now - this behavior starts when i run HA VM and Unraid API docker together. If i start Unraid API after clean reboot of the server without HA VM - no writes to USB, if i then start HA VM,it also start writing to USB. Then i stop HA VM and leave it stopped,stop UA - no writes but if i start UA next time (with HA VM stopped) writing to USB continue... It looks like some network or communication settings persist in Unraid and makes this problem, not UA alone.. 

Link to comment
On 9/13/2021 at 9:40 AM, CRTech said:

One more thing i found now - this behavior starts when i run HA VM and Unraid API docker together. If i start Unraid API after clean reboot of the server without HA VM - no writes to USB, if i then start HA VM,it also start writing to USB. Then i stop HA VM and leave it stopped,stop UA - no writes but if i start UA next time (with HA VM stopped) writing to USB continue... It looks like some network or communication settings persist in Unraid and makes this problem, not UA alone.. 

Okay thanks for letting me know, it is very odd and I've not seen this behavior before but I will try to reproduce it using the details you've provided

Link to comment

Hello. I have the following problem with the unraid-api docker.

Home assistant sees the dockers and unraid-api sees the mqtt (HA) broker.
However, it is impossible to start any docker from Home Assistant, with the following error message contained in the log:

 

 

> [email protected] start
> cross-env NUXT_HOST=0.0.0.0 NODE_ENV=production node server/index.js
WARN mode option is deprecated. You can safely remove it from nuxt.config
Connected to mqtt broker
READY Server listening on http://0.0.0.0:80
Received MQTT Topic: homeassistant/nas/clamav/dockerState and Message: started assigning ID: MQTT-R-ku2txnez
Part of MQTT-R-ku2txnez failed.

 

 

What is the problem?

My Unraid version in 6.10.0-rc1.

Thanks for help

 

 

Link to comment
16 hours ago, giustanca said:

Hello. I have the following problem with the unraid-api docker.

Home assistant sees the dockers and unraid-api sees the mqtt (HA) broker.
However, it is impossible to start any docker from Home Assistant, with the following error message contained in the log:

 

 

> [email protected] start
> cross-env NUXT_HOST=0.0.0.0 NODE_ENV=production node server/index.js
WARN mode option is deprecated. You can safely remove it from nuxt.config
Connected to mqtt broker
READY Server listening on http://0.0.0.0:80
Received MQTT Topic: homeassistant/nas/clamav/dockerState and Message: started assigning ID: MQTT-R-ku2txnez
Part of MQTT-R-ku2txnez failed.

 

 

What is the problem?

My Unraid version in 6.10.0-rc1.

Thanks for help

 

 

Hi, are you able to start and stop that docker from the unraid api ui? What about from the unraid ui as well? Could you share the logs for the former as well

Thanks

Link to comment

How to hide unused container from blowing up my devices list?

I have around 60 docker container, but i only need 2 of them controlled via Home-Assistant.

 

I disabled all containers in the manual settings

 

grafik.thumb.png.f282d5bdc48a5de9902fdc23a5f9b1ef.png

 

But they are shown as MQTT Devices + Entity.

 

grafik.png.c3757238b847506495ce2f2a61ff8c82.png

 

grafik.thumb.png.e71fcf6febc6af11adcc072f7956f634.png

 

 

So how to setup this, that i only see the both container, which are not hidden?

tnxs

Link to comment
15 minutes ago, corgan said:

How to hide unused container from blowing up my devices list?

I have around 60 docker container, but i only need 2 of them controlled via Home-Assistant.

 

I disabled all containers in the manual settings

 

grafik.thumb.png.f282d5bdc48a5de9902fdc23a5f9b1ef.png

 

But they are shown as MQTT Devices + Entity.

 

grafik.png.c3757238b847506495ce2f2a61ff8c82.png

 

grafik.thumb.png.e71fcf6febc6af11adcc072f7956f634.png

 

 

So how to setup this, that i only see the both container, which are not hidden?

tnxs

Hi,

The logs from the unraid api are what I need, the error you have shared is when the request comes via mqtt however when you do it from the unraid apis ui itself the logs will not contain mqtt etc. and may give a better idea of the issue.

 

Once you have hidden a device from that menu you need to delete it from home assistant as it remembers old devices even once they stop sending messages

 

Cheers

Link to comment

Thanks for the quick answer..

I deleted my mqtt/ha test server, removed the unraid-api app and the appdata folder to start fresh.

But after reinstalling the app, the api cant get docker/vm data?

 

Quote

et Dashboard Details for ip: 192.168.2.254 Failed with status code: [object Object]
Request failed with status code 503
Get Main Details for ip: 192.168.2.254 Failed
Request failed with status code 503
Get VM Details for ip: 192.168.2.254 Failed
Request failed with status code 503
Get Main Details for ip: 192.168.2.254 Failed
Request failed with status code 503
Get Dashboard Details for ip: 192.168.2.254 Failed with status code: [object Object]
Request failed with status code 503
Get Main Details for ip: 192.168.2.254 Failed
Request failed with status code 503

 

I checked the login ten times, the login is 100% correct.

Are there new security restrictions in place?

Link to comment
5 minutes ago, corgan said:

Thanks for the quick answer..

I deleted my mqtt/ha test server, removed the unraid-api app and the appdata folder to start fresh.

But after reinstalling the app, the api cant get docker/vm data?

 

 

I checked the login ten times, the login is 100% correct.

Are there new security restrictions in place?

The 503 error means it is failing to authenticate but there could be a lot of different reasons as to why - check your unraid server logs, it might be that because of the restarts etc the server has blocked it for too many requests, may just be worth stopping the docker over night and trying again in the morning. Otherwise there could be new security changes on the new rc but unfortunately I won't be able to check until next week as I'm going on holiday tomorrow. 

 

One thing to check though, what is the network config for the docker itself? Is it just a port on the servers IP? Or have you bridged it its own ip? If it has its own ip it can't communicate with the host

Link to comment

You was right, there was a authentication problem. Now the container can talk to unraid.

Sadly the outcomming is the same.

 

I have hidden nearly all docker container, but get a mqtt switch and an entity for each container.

This was a complete fresh start. Appdata and the broker db was wiped.


App and syslog are fine:

grafik.thumb.png.701910c80c45e361c427578a7bf094bc.png

 

129 MQTT Topics:

 

grafik.thumb.png.9a5d8953e4edad1c461132713b0d1f25.png

 

API manual settings:

 

grafik.thumb.png.52b57839ebcb09aabec44e02d88b8e0d.png

 

what do i miss here?

Link to comment
12 hours ago, corgan said:

You was right, there was a authentication problem. Now the container can talk to unraid.

Sadly the outcomming is the same.

 

I have hidden nearly all docker container, but get a mqtt switch and an entity for each container.

This was a complete fresh start. Appdata and the broker db was wiped.


App and syslog are fine:

grafik.thumb.png.701910c80c45e361c427578a7bf094bc.png

 

129 MQTT Topics:

 

grafik.thumb.png.9a5d8953e4edad1c461132713b0d1f25.png

 

API manual settings:

 

grafik.thumb.png.52b57839ebcb09aabec44e02d88b8e0d.png

 

what do i miss here?

Hmm, everything looks correct - do the mqtt topics continue to be updated? I may have to try and replicate this as the hide function has always worked in the past and I don't really know why it isn't for you sorry

Link to comment

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.