BoKKeR Posted September 22, 2023 Author Share Posted September 22, 2023 9 hours ago, Orishas said: Hi, i tested this release it fixes problem that the entity becomes unavailable after a HA restart, but now it always retains the status on:true Thanks, will check on that, I think the problem is unrelated but I will create a fix for it. 3 hours ago, ABEIDO said: Another reflection i had was the Shutdown, Reboot and Parity Check actions should be set as buttons and not as switches which they are now. Or am i missing something? Is this is right? considering the HA developers page states buttons are stateless A button entity is an entity that can fire an event / trigger an action towards a device or service but remains stateless from the Home Assistant perspective. It can be compared to a real live momentary switch, push-button, or some other form of a stateless switch. https://developers.home-assistant.io/docs/core/entity/button/ Quote Link to comment
Kilrah Posted September 22, 2023 Share Posted September 22, 2023 (edited) And it sounds just like what you want, you don't "turn on" or "turn off" a parity check/reboot/shutdown, you only trigger them, hence button. Edited September 22, 2023 by Kilrah Quote Link to comment
ABEIDO Posted September 23, 2023 Share Posted September 23, 2023 19 hours ago, BoKKeR said: Thanks, will check on that, I think the problem is unrelated but I will create a fix for it. Is this is right? considering the HA developers page states buttons are stateless A button entity is an entity that can fire an event / trigger an action towards a device or service but remains stateless from the Home Assistant perspective. It can be compared to a real live momentary switch, push-button, or some other form of a stateless switch. https://developers.home-assistant.io/docs/core/entity/button/ First off, massive thanks to you Bokker for keeping Unraid-API alive and continue improving the functionality. The last fix that fixed HA reboot issues was really nice. Regarding buttons/switches: I think reboot/shutdown/parity check was seen as button before some updates, i could be wrong thou. And also everything works fine anyway with the switch as it is now. It does what is supposed to and the switch goes to on for a bit then back to off(as it is not a static on or off activity) So it just estetics i my mind, like below from a another mqtt service i use. Here reboot is considered as button and gets press the "Press" in ui. So nothing big on the user end, and its really up to you. Restart Functionality for Unraid API Im trying to find a way to restart UnraidAPI container via HA. As stop/start wont work as stop kills the container and then no more connection. All other containers i can work with stop then start. Is there any way to add a restart for especially unraid-api? Quote Link to comment
ArveVM Posted September 28, 2023 Share Posted September 28, 2023 (edited) Thank you so much for picking up this plugin I've setup HomeAssistant to get the data, and I just discovered a minor flaw in naming which I think is inconsistent: My server-name is (originally enough!) unRaid1 - so the friendy_name of the server-entity is "unraid1" - so far so god - then the friendly_name of the array-switch is getting to be "unraid1 unraid1_array" - so a duplication of server-name and a blank space - could friendly name be changed to "unraid1_array" ? - then the dockers come with friendly_names with spaces and underline: "unraid1 _docker_adguard-home" - could friendly name be changed to "unraid1_docker_adguard-home" ? (without the space) I'm not a programmer,, so not sure where the friendly-names get created,, but somehow I guess you can fix this EDIT: just noticed that also deleted dockers get to HA the Adminer and Krusader is deleted from docker-tab,, but not sure I've restarted server after removing,, so that might be why they show up,, But the naming of theese do not include additional space between servername and underscore_docker_name thought I'd share so might be easier to troubleshoot? Edited September 28, 2023 by ArveVM additional findings 2 Quote Link to comment
BoKKeR Posted September 30, 2023 Author Share Posted September 30, 2023 (edited) I just pushed a new release with the following: - added button to restart docker containers - changed switch for parity/restart/power/mover to button I am still looking into a way to set the ON:False upon turning off the server. @ArveVM I couldnt reproduce this problem. Will try again but all my containers/vms have the non space name as default. Could you try removing the mqtt addon and re-adding it? I also added a trim to the server name. Maybe it fixes your problem. Are you using any custom theme? Edited October 1, 2023 by BoKKeR 1 Quote Link to comment
Faspina Posted October 1, 2023 Share Posted October 1, 2023 I had a problem with the latest release, updated the docker this morning and lost my unraid ui. Took me about 30 minute to figure out what was going on. Doing this in the cli brought it back but only temporary. /etc/rc.d/rc.php-fpm restart it kept stopping. All the docker were fine. All my hosted apps fine. Only the UI that kept stopping So I finally stop the unraid-api docker. And the problem went away. I think the docker was hammering the unraid server. Found a bunch of these in the logs and overloaded the UI Oct 1 07:30:18 SERVER nginx: 2023/10/01 07:30:18 [error] 9491#9491: *125230 limiting requests, excess: 20.002 by zone "authlimit", client: 172.17.0.13, server: , request: "GET /login HTTP/1.1", host: "192.168.7.11" They went away when I stopped the unraid-ap docker and the UI came back for good. I confirmed the issue by restarting the container eventually the UI was unresponsive. Not sure what is going on, passing along the info. Let me know if you need anything. Heading out on business tomorrow so i will be unresponsive during the week. Quote Link to comment
ArveVM Posted October 1, 2023 Share Posted October 1, 2023 22 hours ago, BoKKeR said: Could you try removing the mqtt addon and re-adding it? Running Mosquitto as docker in unraid,, Did a "force update",, is that the equivalent of removing/re-adding ?? did'nt seem to have an impact on naming - but got new button which worked I believe it might have to do with my naming,, and possible "old history" where devices have been added for each entity? i have a bunch of theese devices,, with no entities in them: and it "must" be old news,, because the adminer-docker was setup a long time ago,,, and is stuck with my old server-info (upgraded earlier this summer to Gigabyte mobo) i believe it comes down to renaming device which is not effecting the renaming devices? Tried to rename the correct device to "unraidAPI",, and came up with this new naming Will try and delete the old devices,, then rename again and see if it makes any difference,,, And thanks for the quick response,, Quote Link to comment
ArveVM Posted October 1, 2023 Share Posted October 1, 2023 14 minutes ago, ArveVM said: Will try and delete the old devices,, then rename again and see if it makes any difference,,, Deleted all the old devices and renamed the one with updated/active entities to "unraidAPI2",, and the naming of entities are still adding a space between the device-name and the entity-part of the friendly name Can you re-create my issue if you change device-name?? (sorry for the confusion earlier,, ) Quote Link to comment
BoKKeR Posted October 1, 2023 Author Share Posted October 1, 2023 (edited) 5 hours ago, Faspina said: I had a problem with the latest release, updated the docker this morning and lost my unraid ui. Took me about 30 minute to figure out what was going on. Doing this in the cli brought it back but only temporary. /etc/rc.d/rc.php-fpm restart it kept stopping. All the docker were fine. All my hosted apps fine. Only the UI that kept stopping So I finally stop the unraid-api docker. And the problem went away. I think the docker was hammering the unraid server. Found a bunch of these in the logs and overloaded the UI Oct 1 07:30:18 SERVER nginx: 2023/10/01 07:30:18 [error] 9491#9491: *125230 limiting requests, excess: 20.002 by zone "authlimit", client: 172.17.0.13, server: , request: "GET /login HTTP/1.1", host: "192.168.7.11" They went away when I stopped the unraid-ap docker and the UI came back for good. I confirmed the issue by restarting the container eventually the UI was unresponsive. Not sure what is going on, passing along the info. Let me know if you need anything. Heading out on business tomorrow so i will be unresponsive during the week. Sorry, I reverted that change @ArveVM Could you try to remove the mqtt addon, and add it back again. This will just remove the old entities, and once you add it back the existing ones will show again Edited October 1, 2023 by BoKKeR Quote Link to comment
ArveVM Posted October 2, 2023 Share Posted October 2, 2023 10 hours ago, BoKKeR said: @ArveVM Could you try to remove the mqtt addon, and add it back again. This will just remove the old entities, and once you add it back the existing ones will show again. I guess what you meant was delete the integration and re-add the integration? (since the Add-on is the mosquito-engine, and the integration is the "getting data from mosquitto into HA" so I've tried that,, and no success (name is back to unraid1 which is servername in unraid) and there are still spaces in friendly-name and for array the server-name is presented twice (with space between them) Tried once again,, now deleting integration - restart HA (to ensure removal of entities) - add integration,, and it keep getting in with theese "strange" naming conventions,,, servername space servername underscore array - should be servername underscore array? docker switch come with same button same as switch "master sensor" with just server-name (Which seems right) ------- Then I try to rename the device to unraidAPI (Since I want my sensors to reflect the name of the integration/source the data comes from),, and then get theese namings: so now that I've cleaned out (my old crap) and installed integration again: - the device name and entity_id are renaming just fine,, - but the friendly name of docker-entities/mover/paritycheck(poweroff/reboot have an additional "unwanted" space between servername and 'entity' Hope you understand this is not a critical bug,, so if you want to park it that is just fine - I'll just instruct my OCD to live with it Love the getting all entites into one device - and the button is also better - so great work!! Quote Link to comment
lanky8804 Posted October 2, 2023 Share Posted October 2, 2023 Love it that this API has been taken up again. Having issues in docker with nothing showing under the sever?? Quote Link to comment
ArveVM Posted October 2, 2023 Share Posted October 2, 2023 5 hours ago, lanky8804 said: Love it that this API has been taken up again. Having issues in docker with nothing showing under the sever?? Are you sure you have changed to the new docker? I believe it was like your screenshot until i updated to the new repository,,, Quote Link to comment
ByteHeaven Posted October 2, 2023 Share Posted October 2, 2023 (edited) 22 hours ago, BoKKeR said: Sorry, I reverted that change Oh, so reason for entire UI death was this? I already downgraded back to 6.12.3 because did not figure out reason (and it fixed it). Also this HA shutdown did not work this morning So My Unraid was on that 40 eurocent / kWh hour... Now it seems to be working, but there was no update for docker yet in community store? -edit- oh sorry, seems it have been autoupdated 17 hours ago. But after that my Unraid webgui came pretty unresponsive? So is this now incompatible with 6.12.4? Edited October 2, 2023 by ByteHeaven Quote Link to comment
ByteHeaven Posted October 2, 2023 Share Posted October 2, 2023 (edited) On 9/23/2023 at 2:27 PM, ABEIDO said: Restart Functionality for Unraid API Im trying to find a way to restart UnraidAPI container via HA. As stop/start wont work as stop kills the container and then no more connection. All other containers i can work with stop then start. Is there any way to add a restart for especially unraid-api? What I use in HA is: Unraid is behind Meross smart plug (controlled in HA). Bios setting set to start the computer after power break. And I have (based on Nordpool Spot prices) two automations. When Electricity price goes above 18 eurocents an hour, HA shuts the Unraid down through this api docker with a command (clean shutdown). When price goes back below that, HA shuts the Meross smart plug, counts to 5, and puts power back on (with sanity check that power consumption is less than 10 W thus computer IS off, not to turn off power from running computer) Bang, Unraid starts. No need to touch it -edit- Simple is beautiful (compared to hassle around gettin wake up on lan working reliably) Edited October 3, 2023 by ByteHeaven Quote Link to comment
BoKKeR Posted October 3, 2023 Author Share Posted October 3, 2023 10 hours ago, ByteHeaven said: Oh, so reason for entire UI death was this? I already downgraded back to 6.12.3 because did not figure out reason (and it fixed it). Also this HA shutdown did not work this morning So My Unraid was on that 40 eurocent / kWh hour... Now it seems to be working, but there was no update for docker yet in community store? -edit- oh sorry, seems it have been autoupdated 17 hours ago. But after that my Unraid webgui came pretty unresponsive? So is this now incompatible with 6.12.4? It is compatible with 6.12.4, I think an update messed up the dashboard crawling but its reverted now. Offtopic: You might want to change from a smart plug start/stop to a controlled shut down for your data-s sake. I dont think the drives enjoy having the plug pulled, ram wiped etc. Alternative solution would be having a pi zero ssh into your unraid server and send shutdown command, or have a esp32 which bridges the power button headers on your motherboard for a second which initiates a controlled shutdown. @ArveVM I cant really reproduce it, but I will try further on the weekend. Could you confirm that there is no space in the name of the server? Also are you using any custom theme? Quote Link to comment
lanky8804 Posted October 3, 2023 Share Posted October 3, 2023 15 hours ago, ArveVM said: Are you sure you have changed to the new docker? I believe it was like your screenshot until i updated to the new repository,,, Thanks for the reply. My repo was booker/unraidapi-re:6.12 Have changed it to booker/unraidapi-re but still the same issue. The logs from the docker seem odd with the ip being 0.0.0.0:80 My unraid server is on port 8443 Quote Link to comment
lanky8804 Posted October 3, 2023 Share Posted October 3, 2023 Found a solution for anyone else Repo bokker/unraidapi-re:6.12 etc On the WebUI: Server IP - the long one from server GUI, DELETE the HTTPS at the start of it Tick the HTTPS option block Login with root and password. Now have my server details appearing. On to HA now. Quote Link to comment
lanky8804 Posted October 3, 2023 Share Posted October 3, 2023 So have rebooted HA a few times and left it for a while but still nothing being added to MQTT integration. Have searched entities also but nothing new added. Should the UnraidAPI just appear in the MQTT integration or do we still need to install that API addon like in the original version? Quote Link to comment
ByteHeaven Posted October 3, 2023 Share Posted October 3, 2023 (edited) 7 hours ago, BoKKeR said: Offtopic: You might want to change from a smart plug start/stop to a controlled shut down for your data-s sake. I dont think the drives enjoy having the plug pulled, ram wiped etc. Alternative solution would be having a pi zero ssh into your unraid server and send shutdown command, or have a esp32 which bridges the power button headers on your motherboard for a second which initiates a controlled shutdown. Oh, sorry if I wrote unclear, shutdown of server goes with this api from HA (clean shutdown). Turning computer on, when it is shut down goes by: have bios setting to start after power break, and then with shut down computer turn power off and on with smart plug (with sanity check before doing it that power consumption is less than 10W thus computer is NOT on. (thus simple compared to hassle around getting wake on lan working reliably) Edited October 3, 2023 by ByteHeaven Quote Link to comment
ABEIDO Posted October 3, 2023 Share Posted October 3, 2023 Hi, that you went with the restart and buttons, awsome to see that the integration grows. Good work Bokker. Im having 2 issues thou: HA Restart bug: But it seems that the HA restart issue is back which you fixed a couple of updates before. When i restart HA the sensors/switches/buttons goes unavailable again. Doubled naming: Same as above that has strange naming on the 5 ”new” button/switch, doubled unraidserver name. button.unraidservername_unraidservername_mover button.unraidservername_unraidservername__partitycheck button.unraidservername_unraidservername__power_off button.unraidservername_unraidservername__reboot switch.unraidservername_unraidservername__array Quote Link to comment
BoKKeR Posted October 3, 2023 Author Share Posted October 3, 2023 (edited) Good news everyone! I located the naming issues cause https://community.home-assistant.io/t/psa-mqtt-name-changes-in-2023-8/598099 I couldnt reproduce it since I was running the older version of HA. Here is an example error you might have noticed in HA: 2023-10-03 10:48:52.147 WARNING (MainThread) [homeassistant.components.mqtt.mixins] MQTT entity name starts with the device name in your config {'payload_available': 'True', 'payload_not_available': 'False', 'json_attributes_topic': 'homeassistant/unraidvm/home-assistant-container', 'name': 'unraidvm_docker_home-assistant-container_restart', 'unique_id': 'unraidvm_home-assistant-container_restart', 'payload_press': 'restart', 'device': {'identifiers': ['unraidvm'], 'name': 'unraidvm', 'manufacturer': 'ASUS ASUSTeK COMPUTER INC. , Version Rev 2802', 'model': 'Docker', 'connections': []}, 'command_topic': 'homeassistant/unraidvm/home-assistant-container/dockerState', 'encoding': 'utf-8', 'availability_mode': 'latest', 'qos': 0, 'enabled_by_default': True, 'retain': False}, this is not expected. Please correct your configuration. The device name prefix will be stripped off the entity name and becomes '_docker_home-assistant-container_restart' Meaning the friendly name cant start with the same string as the device name! I will have to look into proper naming with the new HA release. I am open to suggestions! Edited October 3, 2023 by BoKKeR Quote Link to comment
ABEIDO Posted October 3, 2023 Share Posted October 3, 2023 31 minutes ago, BoKKeR said: Good news everyone! I located the naming issues cause https://community.home-assistant.io/t/psa-mqtt-name-changes-in-2023-8/598099 I couldnt reproduce it since I was running the older version of HA. Here is an example error you might have noticed in HA: 2023-10-03 10:48:52.147 WARNING (MainThread) [homeassistant.components.mqtt.mixins] MQTT entity name starts with the device name in your config {'payload_available': 'True', 'payload_not_available': 'False', 'json_attributes_topic': 'homeassistant/unraidvm/home-assistant-container', 'name': 'unraidvm_docker_home-assistant-container_restart', 'unique_id': 'unraidvm_home-assistant-container_restart', 'payload_press': 'restart', 'device': {'identifiers': ['unraidvm'], 'name': 'unraidvm', 'manufacturer': 'ASUS ASUSTeK COMPUTER INC. , Version Rev 2802', 'model': 'Docker', 'connections': []}, 'command_topic': 'homeassistant/unraidvm/home-assistant-container/dockerState', 'encoding': 'utf-8', 'availability_mode': 'latest', 'qos': 0, 'enabled_by_default': True, 'retain': False}, this is not expected. Please correct your configuration. The device name prefix will be stripped off the entity name and becomes '_docker_home-assistant-container_restart' Meaning the friendly name cant start with the same string as the device name! I will have to look into proper naming with the new HA release. I am open to suggestions! Yeah theres more integrations with the same issue with naming. Ive never really understood the issue fully more than that entity cannot have the devicename in its name. And i rename everything to fit my naming scheme. With thats said keep it simple and set unraidapi or unraid, short and simple. FYI: When you do update i noticed that parity-check button was misspelled, now we are on a really shallow level of problems :) And regarding the HA restart issue that was back for me (where you need to restart UnraidAPI docker after HA restart), did anyone else notice this or is it something at my setup only? Quote Link to comment
BoKKeR Posted October 3, 2023 Author Share Posted October 3, 2023 1 hour ago, ABEIDO said: Yeah theres more integrations with the same issue with naming. Ive never really understood the issue fully more than that entity cannot have the devicename in its name. And i rename everything to fit my naming scheme. With thats said keep it simple and set unraidapi or unraid, short and simple. FYI: When you do update i noticed that parity-check button was misspelled, now we are on a really shallow level of problems And regarding the HA restart issue that was back for me (where you need to restart UnraidAPI docker after HA restart), did anyone else notice this or is it something at my setup only? Thanks I fixed that typo! Quote Link to comment
Foehammer1982 Posted October 5, 2023 Share Posted October 5, 2023 BoKKeR, THANK YOU SO MUCH FOR CONTINUING THIS PROJECT As you said UnRaid has no readily accessible API so this is the best option out there right now. I was curious as to if the Memory Leak issue that was an issue with the original repo has been addressed yet? The lack of support from electricbrainuk on this project (and particularly this issue) was the death of the UUD (Ultimate Unraid Dashboard) project as sensor information was replaced easily by tools like NetData but this API's shining light is the MQTT control which is great for us Home Assistant users. I was able to get around the memory leak by having a script force the container to restart every 4 hours (yes it was that bad for me) but not having to do this may make it worth revisting UUD and finally getting a page setup for UnRaid in HA Quote Link to comment
BoKKeR Posted October 5, 2023 Author Share Posted October 5, 2023 (edited) 4 hours ago, Foehammer1982 said: BoKKeR, THANK YOU SO MUCH FOR CONTINUING THIS PROJECT As you said UnRaid has no readily accessible API so this is the best option out there right now. I was curious as to if the Memory Leak issue that was an issue with the original repo has been addressed yet? The lack of support from electricbrainuk on this project (and particularly this issue) was the death of the UUD (Ultimate Unraid Dashboard) project as sensor information was replaced easily by tools like NetData but this API's shining light is the MQTT control which is great for us Home Assistant users. I was able to get around the memory leak by having a script force the container to restart every 4 hours (yes it was that bad for me) but not having to do this may make it worth revisting UUD and finally getting a page setup for UnRaid in HA Could you tell me more how you detected the memory leak? What was your setup? @lanky8804 did you manage to figure it out? Could you try removing the info config file and starting fresh? there is also an env variable that might show if the scraping is working: WRITE_HTML_OUTPUT=true Edited October 5, 2023 by BoKKeR Quote Link to comment
Recommended Posts
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.