[Support] Fork Unraid API-RE


Recommended Posts

32 minutes ago, BoKKeR said:

 

Are you able to wipe the /config folder and start again?

Yes, have done several times, as well as re-installing it.

It re-creates the mqttKeys and servers.json files after I login on the WebGui page.  But still won't post anything to the mqtt broker.

I'm using the bokker/unraidapi-re:6.12-naming repository.

Edited by Cyklone
Link to comment

There is still some problem with 6.12.4? I reupdated back to 6.12.4 some time ago, and now: UI completely unresponsive, it takes ages to load ui pages. When I managed to get to docker page, and shut down this API docker: everything works fine.. maybe need to roll back to 6.12.3, but just let you know, problem still is there.

 

-edit- and yes, after downgrade to 6.12.3 everything seems to be responsive again.

Edited by ByteHeaven
Link to comment

I use HA Companion on android.  I can wake my main and backup servers from a widget, but because there is not a switch for shutdown, I am unable to power off my servers.  I assume that I am going to have to add an ssh command to HA as the power off?

 

Is there a better way?

 

I would also still like to get cpu temp in via the api... is that a roadmap item?  Otherwise works really well.

Link to comment
On 11/23/2023 at 5:47 AM, mattw said:

I use HA Companion on android.  I can wake my main and backup servers from a widget, but because there is not a switch for shutdown, I am unable to power off my servers.  I assume that I am going to have to add an ssh command to HA as the power off?

 

Is there a better way?

 

I would also still like to get cpu temp in via the api... is that a roadmap item?  Otherwise works really well.

 

I just noticed that all are called buttons now instead of switches.

So you should use the service call: button.press i think

 

So then u can turn it off.

Link to comment

@syper @ByteHeaven could you try using the MQTTRefreshRate=60 env variable. Setting the refresh to every 60 seconds or even 120. Instead of the default 20 seconds. Also close the website since I noticed that the web browser has its own 3 second times, each tab would start a new 3s process. I will have to rewrite that...

 

I suspect that when the server/ui becomes slow the unraid-api does not back off and just queues up more tasks ending up slowing down the UI indefinitely. 

 

I would like to rewrite that whole logic but my current fix would require an external redis service. Or implement some sort of logic for exponential backoff https://stackoverflow.com/a/52772266/2515404

 

@skank Does the entity show up as following?  

image.thumb.png.3e519adac57e626db27889a7a02cb0ce.png

 

Link to comment
On 11/25/2023 at 2:23 PM, BoKKeR said:

 

@syper @ByteHeaven could you try using the MQTTRefreshRate=60 env variable. Setting the refresh to every 60 seconds or even 120. Instead of the default 20 seconds. Also close the website since I noticed that the web browser has its own 3 second times, each tab would start a new 3s process. I will have to rewrite that...

 

I suspect that when the server/ui becomes slow the unraid-api does not back off and just queues up more tasks ending up slowing down the UI indefinitely. 

 

I would like to rewrite that whole logic but my current fix would require an external redis service. Or implement some sort of logic for exponential backoff https://stackoverflow.com/a/52772266/2515404

 

 

 

Thank you, I had the entire Unraid non responsive even after reboot through ssh (all dockers worked just fine, but no UI). Manually shut down Unraid-api through ssh and UI came responsive, trying now that 60 seconds...

 

Just a stupid question, as I do not have a clue what that MQTTRefreshRate is, my need for this is: when electricity price goes over 18 euro cents, my HA from RPI4 shuts down cleanly Unraid through this. (and when price goes down again below that, same HA cuts down power on Meross plug after checking that power consumption is below 30 watts: thus Unraid IS shut down), counts to five and turns it back on, and server starts up... 

 

So, is that meaningful to have as low as possible so it works? Or can I through in something like 3600? Point being "poll for updates" for what? Does toggle "shut down this" works without poll? I do not need anything else from Unraid to my HA (this was only way I figured out how to get this working so it will automatically shutdown based on electricity price...)

Link to comment
  • 2 weeks later...
On 11/25/2023 at 1:23 PM, BoKKeR said:

@syper @ByteHeaven could you try using the MQTTRefreshRate=60 env variable. Setting the refresh to every 60 seconds or even 120. Instead of the default 20 seconds. Also close the website since I noticed that the web browser has its own 3 second times, each tab would start a new 3s process. I will have to rewrite that...

 

I suspect that when the server/ui becomes slow the unraid-api does not back off and just queues up more tasks ending up slowing down the UI indefinitely. 

 

I would like to rewrite that whole logic but my current fix would require an external redis service. Or implement some sort of logic for exponential backoff https://stackoverflow.com/a/52772266/2515404

 

 

Hello,
thank you for the answer

my server becomes slow as soon as I start Unraid API even though I am not even opening the UI.

Same with MQTTRefreshRate=60 env variable

In log MQTT : 
 

Quote

2023-12-05 13:55:33: New connection from 192.168.0.100:58258 on port 1883. 2023-12-05 13:55:33: New client connected from 192.168.0.100:58258 as mqttjs_a72ea9d9 (p2, c1, k60, u'jimmy'). 2023-12-05 13:55:33: Client mqttjs_a72ea9d9 disconnected due to malformed packet. 2023-12-05 13:55:34: New connection from 192.168.0.100:58270 on port 1883. 2023-12-05 13:55:34: New client connected from 192.168.0.100:58270 as mqttjs_a72ea9d9 (p2, c1, k60, u'jimmy'). 2023-12-05 13:55:34: Client mqttjs_a72ea9d9 disconnected due to malformed packet. 2023-12-05 13:55:35: New connection from 192.168.0.100:58278 on port 1883. 2023-12-05 13:55:35: New client connected from 192.168.0.100:58278 as mqttjs_a72ea9d9 (p2, c1, k60, u'jimmy'). 2023-12-05 13:55:35: Client mqttjs_a72ea9d9 disconnected due to malformed packet. 2023-12-05 13:55:36: New connection from 192.168.0.100:58288 on port 1883. 2023-12-05 13:55:36: New client connected from 192.168.0.100:58288 as mqttjs_a72ea9d9 (p2, c1, k60, u'jimmy'). 2023-12-05 13:55:36: Client mqttjs_a72ea9d9 disconnected due to malformed packet. 2023-12-05 13:55:37: New connection from 192.168.0.100:58304 on port 1883. 2023-12-05 13:55:37: New client connected from 192.168.0.100:58304 as mqttjs_a72ea9d9 (p2, c1, k60, u'jimmy'). 2023-12-05 13:55:37: Client mqttjs_a72ea9d9 disconnected due to malformed packet. 2023-12-05 13:55:38: New connection from 192.168.0.100:36580 on port 1883. 2023-12-05 13:55:38: New client connected from 192.168.0.100:36580 as mqttjs_a72ea9d9 (p2, c1, k60, u'jimmy'). 2023-12-05 13:55:38: Client mqttjs_a72ea9d9 disconnected due to malformed packet. 2023-12-05 13:55:39: New connection from 192.168.0.100:36584 on port 1883. 2023-12-05 13:55:39: New client connected from 192.168.0.100:36584 as mqttjs_a72ea9d9 (p2, c1, k60, u'jimmy'). 2023-12-05 13:55:39: Client mqttjs_a72ea9d9 disconnected due to malformed packet.


 

Edited by syper
Link to comment
On 11/25/2023 at 5:25 AM, skank said:

 

I just noticed that all are called buttons now instead of switches.

So you should use the service call: button.press i think

 

So then u can turn it off.

So, the button service call works to shut down the server... and the WOL component turns it on just fine. 

This has allowed me to create and android widget that will power up/down my backup server!

Here is my HA config that creates switch.backup

 

~~~

  - platform: wake_on_lan
    mac: "BC:5F:F4:xx:xx:xx"
    name: "Backup"
    host: 192.168.1.101
    broadcast_address: 192.168.1.255
    turn_off:
        service: button.press
        data: {}
        target:
          entity_id: button.backup_server_backup_power_off

~~~

Edited by mattw
Link to comment
  • 2 weeks later...
  • 2 weeks later...

@BoKKeR
First - I'd like ti thank you for this! It has a lot of usefulness :)
I am using unraid 6.12.6 and latest container, everything works well for me.


I was wondering if it is possible, in addition to the array info (utilization, free space, etc) to also get info about individual HDDs in the array - specifically space used + free and the HDD temperature - it would be great to implement an alert automation when unraid detects a HDD is too hot

Plus - any information on the machine itself - CPU load, Memory, etc. - that would be awesome if possible

Edited by chompy18
Link to comment
3 hours ago, chompy18 said:

@BoKKeR
First - I'd like ti thank you for this! It has a lot of usefulness :)
I am using unraid 6.12.6 and latest container, everything works well for me.


I was wondering if it is possible, in addition to the array info (utilization, free space, etc) to also get info about individual HDDs in the array - specifically space used + free and the HDD temperature - it would be great to implement an alert automation when unraid detects a HDD is too hot

Plus - any information on the machine itself - CPU load, Memory, etc. - that would be awesome if possible

I saw it is relatively simple to add the above by modifying `utils/extractServerDetails.ts` to extract the values - and I am happy to fork and implement, but unfortunately I was unable to run it locally running `npm run dev` - I am getting errors in `npm install` 

Are there any instructions on how to run this locally in dev mode?

Link to comment

I have seen some reports of it working and not working on 6.12.6, I am currently away from my computer so I can’t test it but please submit your dashboard html files after running the container with WRITE_HTML_OUTPUT=true and send them over to me in a PM since they are not anonymised. @k11su @mkono87

 

@chompy18 try running npm ci instead, alternatively check how the docker file is setup. The packages are broken since before I took over the fork 

 

I will have to revisit the Unraid dashboard getting slow once I find more time to write a backing off strategy 

Link to comment
  • 4 weeks later...
On 1/1/2024 at 8:55 AM, chompy18 said:

@BoKKeR
I was wondering if it is possible, in addition to the array info (utilization, free space, etc) to also get info about individual HDDs in the array - specifically space used + free and the HDD temperature - it would be great to implement an alert automation when unraid detects a HDD is too hot

Plus - any information on the machine itself - CPU load, Memory, etc. - that would be awesome if possible

 

Something I would be very interested in the "Power" values on the dashboard, especially the "UPS Load" (which is the amount of power the server is currently pulling from the UPS).
 

<tbody title="Power Status" class="sortable" sort="7fd06ad571f773b4fcd62b5a2b604649">
<tr title=""><td><i class="fa fa-fw fa-close control tile" onclick="dismiss($(this))" title="Close Tile"></i><i class="fa fa-fw fa-chevron-up control openclose" onclick="openClose($(this))" title="Show/Hide Content"></i><i class="icon-ups f32"></i><div class="section">Power<br>
<span><i class="ups fa fa-bar-chart"></i>UPS Model: </span><span id="ups_model">Back-UPS BX950MI</span><br></div>
<a href="/Dashboard/Settings/UPSsettings" title="Go to UPS settings"><i class="fa fa-fw fa-cog control"></i></a>
</td></tr>
<tr title=""><td><span class="w36"><i class="ups fa fa-fw fa-plug"></i>UPS status:</span><span id="ups_status"><span class="green-text">Online</span></span></td></tr>
<tr title=""><td><span class="w36"><i class="ups fa fa-fw fa-bars"></i>UPS Load: </span><span id="ups_loadpct"><span class="green-text">88 W (17 %)</span></span></td></tr>
<tr title=""><td><span class="w36"><i class="ups fa fa-fw fa-battery"></i>Battery charge:</span><span id="ups_bcharge"><span class="green-text">100 %</span></span></td></tr>
<tr title=""><td><span class="w36"><i class="ups fa fa-fw fa-clock-o"></i>Runtime left:</span><span id="ups_timeleft"><span class="green-text">24 minutes</span></span></td></tr>
<tr title=""><td><span class="w36"><i class="ups fa fa-fw fa-bolt"></i>Nominal power:</span><span id="ups_nompower"><span class="green-text">520 W</span></span></td></tr>
<tr title=""><td><span class="w36"><i class="ups fa fa-fw fa-ellipsis-h"></i>Output voltage:</span><span id="ups_outputv"><span>-</span></span></td></tr>
</tbody>

 

Link to comment

Bokker, any possible fix for getting rid of nchan error thats spamming the unraid log like crazy which came after last update:

 

Also have a question if there is a possible fix for neededing rsetart container whenever HA is restarted, was working before last update.

 

To add to above poster i also have issues with attributes on status sensor.

 

Example of nchan error:
Jan 29 05:28:42 UNRAID monitor: Stop running nchan processes
Jan 29 05:29:15 UNRAID monitor: Stop running nchan processes
Jan 29 05:29:48 UNRAID monitor: Stop running nchan processes
Jan 29 05:30:21 UNRAID monitor: Stop running nchan processes
Jan 29 05:30:54 UNRAID monitor: Stop running nchan processes
Jan 29 05:31:28 UNRAID monitor: Stop running nchan processes
Jan 29 05:32:01 UNRAID monitor: Stop running nchan processes
Jan 29 05:32:34 UNRAID monitor: Stop running nchan processes
Jan 29 05:33:07 UNRAID monitor: Stop running nchan processes
Jan 29 05:33:40 UNRAID monitor: Stop running nchan processes
Jan 29 05:34:13 UNRAID monitor: Stop running nchan processes
Jan 29 05:34:46 UNRAID monitor: Stop running nchan processes

Edited by ABEIDO
Link to comment

@BlaM I would like to add this also, but unfortunately I dont own a UPS, is there a way I can emulate a UPS? Since once a feature  is implemented it has to be maintained going forward.

 

@light2089 Thanks for finding this bug and opening a PR (I somehow didnt get a github notification). I cant reproduce it on my 2 systems running 6.12.6, Are you using any custom theme? Could you run the container with 

WRITE_HTML_OUTPUT=true

and send me over the dashboard.html file from your /config folder in private? So I can find a version a code that works for all of us.

 

@ABEIDO The logs are coming from unraid itself. Since the container needs to ping the dashboard there is no way this container can fix it. The unraid team might be able to help in the future how to surpress them. I will look into the HA problem

 

Link to comment

After the files from @light2089 I have fixed so the version returns an empty string in the meanwhile if the version is not found. I will investigate further since it works on my test machines and I suspect its some kind of a custom setting which hides the version on the main page

Edited by BoKKeR
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.