ElectricBrainUK Posted May 27, 2020 Author Share Posted May 27, 2020 Hi, Sorry I'm not familiar with that particular client but in theory I don't see why it wouldn't work with any mqtt broker. Is the information you are after not on the far right of the first line of your image? Cheers Quote Link to comment
Beaker69 Posted May 28, 2020 Share Posted May 28, 2020 @LuBeDa If you have glances set up you can pull in CPU temps, the only issue I have is that I have a dual xeon and it does not differentiate. As for the board temp again in glances you should see you board or chipset temp. According to the glances wiki hdd temp is only available at present in linux. Hope this helps. Quote Link to comment
Damix21 Posted June 7, 2020 Share Posted June 7, 2020 Hi. I've some trouble with this docker. When I start or stop a VM home assistant don't detect the new status of the VM until I restart Unraid-API docker. Quote Link to comment
ElectricBrainUK Posted June 8, 2020 Author Share Posted June 8, 2020 11 hours ago, Damix21 said: Hi. I've some trouble with this docker. When I start or stop a VM home assistant don't detect the new status of the VM until I restart Unraid-API docker. Hi, thanks for letting me know I will look into it. Cheers, Will Quote Link to comment
ElectricBrainUK Posted June 8, 2020 Author Share Posted June 8, 2020 Hey again @Damix21 I cant seem to replicate the issue on the latest version. Have you tried playing with the environment variables? https://github.com/ElectricBrainUK/UnraidAPI/wiki/Docker-installation Specifically MQTTRefreshRate and MQTTCacheTime Cheers, Will Quote Link to comment
Damix21 Posted June 12, 2020 Share Posted June 12, 2020 You're right, thank you so much! Quote Link to comment
zepheris Posted June 30, 2020 Share Posted June 30, 2020 New to Home Assistant. I've been looking over your sample lovelace UI. I'm specifically looking at the bars. I can't seem to find any of the attributes anywhere in the MQTT server. Looking at the MQTT Server. The topic homeassistant/hades has the following information: (hades is the name of my Unraid server) { "arrayStatus": "Started", "arrayProtection": "Parity is valid.", "moverRunning": false, "parityCheckRunning": false, "title": "Hades", "cpu": "Intel® Xeon® CPU X5650 @ 2.67GHz", "memory": "64 GiB DDR3 Multi-bit ECC ", "motherboard": "Dell Inc. 0Y7JM4, Version A01", "diskSpace": "35.4 TB used of 42 TB (84.3 %)", "on": true } I suspect the CPU section is supposed to show my cpu usage, but all I see is the CPU type. I did check the topic homeassistant/binary_sensor/hades/config and have the following information: { "payload_on": true, "payload_off": false, "value_template": "{{ value_json.on }}", "state_topic": "homeassistant/hades", "json_attributes_topic": "homeassistant/hades", "name": "hades_server", "unique_id": "hades unraid api server", "device": { "identifiers": [ "hades" ], "name": "hades_server", "manufacturer": "Dell Inc. 0Y7JM4, Version A01", "model": "Unraid Server" } } homeassistant/binary_sensor/hades/config I'm confused. Is the Unraid_API docker not publishing all of the information its supposed to? Also to note. I'm receiving the following error in my docker log: There was a problem retrieving a field for a docker image Cannot read property 'contents' of undefined Unfortunately, the message doesn't identify which docker is the problem. I am using a plugin named Docker Folder. Do you think this is causing the error message? I even cloned the Unraid_API repo and built a new docker image to see if that would help and I'm not seeing where the CPU usage and other sensors are listed. Any help is appreciated. -Zeph Quote Link to comment
Beaker69 Posted June 30, 2020 Share Posted June 30, 2020 @zepheris I never had to get in to the depths of MQTT so am not sure about some of the issues that arise. As for the sensors I created templates for CPU, Memory and such. I have posted mine below, which should help. # Server templates sensors - platform: template sensors: panther_cpu: friendly_name: CPU value_template: "{{ state_attr('binary_sensor.panther_server', 'cpu')|replace(' ','')|replace('®','') }}" panther_memory: friendly_name: Memory value_template: "{{ state_attr('binary_sensor.panther_server', 'memory') }}" panther_motherboard: friendly_name: Motherboard value_template: "{{ state_attr('binary_sensor.panther_server', 'motherboard').split(',')[0] }}" panther_arraystatus: friendly_name: Array Status value_template: "{{ state_attr('binary_sensor.panther_server', 'arrayStatus') }}" panther_diskspace: friendly_name: Array Usage value_template: "{{ state_attr('binary_sensor.panther_server', 'diskSpace') }}" vm_kodi_core: friendly_name: Core Count value_template: "{{ state_attr('sensor.panther_vm_kodi_status', 'coreCount') }}" vm_kodi_ram: friendly_name: RAM value_template: "{{ state_attr('sensor.panther_vm_kodi_status', 'ram') }}" vm_kodi_primarygpu: friendly_name: Primary GPU value_template: "{{ state_attr('sensor.panther_vm_kodi_status', 'primaryGPU') }}" vm_win10_core: friendly_name: Core Count value_template: "{{ state_attr('sensor.panther_vm_windows_10_status_2', 'coreCount') }}" vm_win10_ram: friendly_name: RAM value_template: "{{ state_attr('sensor.panther_vm_windows_10_status_2', 'ram') }}" vm_win10_primarygpu: friendly_name: Primary GPU value_template: "{{ state_attr('sensor.panther_vm_windows_10_status_2', 'primaryGPU') }}" 1 Quote Link to comment
zepheris Posted June 30, 2020 Share Posted June 30, 2020 (edited) @Beaker69 Thanks for providing your code. I notice that the CPU usage isn't listed as an attribute. I think I understand why now. I just found this link (https://community.home-assistant.io/t/unraid-api-connect-and-control-unraid-servers-through-home-assistant-via-mqtt/154198/10) that discusses using glances to provide cpu usage. I guess I need to look into it a little more. Thanks EDIT: yep, I can't read very well. Glances https://github.com/nicolargo/glances this is where we're getting CPU usage and other stats. it can be found in the community apps page. Edited June 30, 2020 by zepheris Quote Link to comment
Ong Hui Hoong Posted July 21, 2020 Share Posted July 21, 2020 Hi, i donno what i did wrong, my HA cannot see my VM info at all this is my UnraidAPI config I'm running a VM HA in UNRAID with the IP address of 192.168.11.119 i hide the docker from UnraidAPI web, because i only wan HA to manage my VM i donno what i miss out, this is the only thing i see from HA, (exclude e docker i disable). do anyone have a end to end guide? Quote Link to comment
ElectricBrainUK Posted July 21, 2020 Author Share Posted July 21, 2020 5 minutes ago, Ong Hui Hoong said: Hi, i donno what i did wrong, my HA cannot see my VM info at all this is my UnraidAPI config I'm running a VM HA in UNRAID with the IP address of 192.168.11.119 i hide the docker from UnraidAPI web, because i only wan HA to manage my VM i donno what i miss out, this is the only thing i see from HA, (exclude e docker i disable). do anyone have a end to end guide? Hey, everything youve done looks correct - can you confirm you can see MQTT messages from Unraid API on the broker? Have you changed the MQTTCacheTime? That tells the api how frequently to update. The full guide is available here: https://github.com/ElectricBrainUK/UnraidAPI/wiki I am working on a step by step guide but everything you need should be in the wiki for now. Cheers Quote Link to comment
Ong Hui Hoong Posted July 22, 2020 Share Posted July 22, 2020 16 hours ago, ElectricBrainUK said: Hey, everything youve done looks correct - can you confirm you can see MQTT messages from Unraid API on the broker? Have you changed the MQTTCacheTime? That tells the api how frequently to update. The full guide is available here: https://github.com/ElectricBrainUK/UnraidAPI/wiki I am working on a step by step guide but everything you need should be in the wiki for now. Cheers er... sorry ah, where do i do the MQTTCacheTime configuration ya ... hehe Quote Link to comment
Ong Hui Hoong Posted July 22, 2020 Share Posted July 22, 2020 (edited) the vm show up already, but not all my VM, the pfsense is missing, donno when it started showing up, maybe when i was in office it show up, but i cannot turn on or shut it down Edited July 22, 2020 by Ong Hui Hoong Quote Link to comment
Ong Hui Hoong Posted July 22, 2020 Share Posted July 22, 2020 i added in the 2 MQTT variables in now should i able to start/stop VM from HA? i got this error on HA Quote Link to comment
ElectricBrainUK Posted July 22, 2020 Author Share Posted July 22, 2020 That's great, yes you should be able to. The fact that you are seeing an error in HA suggests to me that your HA is struggling to communicate with the MQTT broker - can you control the VM from unraid-apis web UI? Quote Link to comment
bobobeastie Posted August 1, 2020 Share Posted August 1, 2020 I'm pretty confused, just playing with home assistant today for the first time, using the container homeassistant/home-assistant. Trying to get this to work, I installed electricbrainuk/unraidapi, installed spants/mqtt and I think both are working? I installed MQTT-Explorer in windows and it saw messages. Every time I go to the web gui it makes me fill out username and password in a popup, and the username/password on the left isn't persistent. The instructions mention this: Add the following custom repository: https://github.com/ElectricBrainUK/HA-Addons Build the Addon Fill in the config section Start I don't understand what this means. I can see docker and unraid server details in the unraid-api after I fill out the info in the popup, but I am not getting any discovered devices in MQTT in home assistant. I have the following in configuration.yaml: mqtt: broker: 192.168.1.10 discovery: true discovery_prefix: homeassistant Quote Link to comment
ElectricBrainUK Posted August 1, 2020 Author Share Posted August 1, 2020 Hey, sorry you are confused. The web UI requests a password each time mostly as a way to prevent in authenticated requests from something else on your network, similar to how you need to log on to your unraid ui - I didn't want to undermine that security. However the web UI is not the main way I see people using the API, as otherwise you'd probably be better off just using the unraid ui! However it is a good way to test to make sure things are working correctly. You don't need to worry about those instructions if you're using the docker, those are just to get it working as an add-on for home assistant (via the hass.io supervisor) I will update the docs to reflect this, thanks for pointing out that lack of clarity. Now onto your configuration! If you're seeing messages on the mqtt broker that's a good start. Can you confirm the base topic is the same as the one you've listen in your homeassistant configuration? Otherwise everything looks correct to me. In the unraid API UI do you see your server listed? Can you interact with it there? If so could you share the variables in the unraid API docker configuration? Cheers Quote Link to comment
bobobeastie Posted August 1, 2020 Share Posted August 1, 2020 I left your setting as default, so base topic is homeassistant, I then set up MQTT with Broker equal to my unraid server IP address, where all this lives, the default port, and your default username and password. I do see good information ion unraid API. I see a bunch of messages like this in it's log: Get Main Details for ip: http://192.168.1.10:8123/ Failed Request failed with status code 500 I see sent and received messages in the log for mqtt. In home assistant I can listen to homeassistant in the mqtt config, and then publish on homeassistant and it logs that. Not sure if either of those means anything. Thank you very much for your response, I appreciate it. Quote Link to comment
ElectricBrainUK Posted August 2, 2020 Author Share Posted August 2, 2020 Ah right, the username and password should be the ones you set up when you configured the mqtt broker and you'll also need to add those to the mqtt config you have in your home assistant here: 14 hours ago, bobobeastie said: mqtt: broker: 192.168.1.10 discovery: true discovery_prefix: homeassistant Unless of course your broker doesn't have a username and password in which case you should leave them blank in your unraid API config as well. It sounds like your server is properly set up in the unraid API if you can see and control it from there. However you should only connect the unraid server itself there, not to the home assistant docker which is why you're seeing the following in the logs: 10 hours ago, bobobeastie said: Get Main Details for ip: http://192.168.1.10:8123/ Failed Request failed with status code 500 You can use the manual config section on the left to delete that entry and ensure the unraid server UI is the only listing. Otherwise it all sounds good, so hopefully we will get to the bottom of your issue soon! Quote Link to comment
bobobeastie Posted August 2, 2020 Share Posted August 2, 2020 2 hours ago, ElectricBrainUK said: Ah right, the username and password should be the ones you set up when you configured the mqtt broker and you'll also need to add those to the mqtt config you have in your home assistant here: Unless of course your broker doesn't have a username and password in which case you should leave them blank in your unraid API config as well. It sounds like your server is properly set up in the unraid API if you can see and control it from there. However you should only connect the unraid server itself there, not to the home assistant docker which is why you're seeing the following in the logs: You can use the manual config section on the left to delete that entry and ensure the unraid server UI is the only listing. Otherwise it all sounds good, so hopefully we will get to the bottom of your issue soon! Thank you, I tried deleting the default username and password from unraid api, because I wasn't using any in the MQTT container, I didn't know that's how it worked. After clearing out the username and password, if I go back to edit the container the defaults are back. So I tried setting up a real username and password, which I also placed in a passwords.txt file in the MQTT appdata folder. That file disappears when I restart the container so I believe it worked. I deleted 2 prior configs in unraid api using manual config on the left, then re-set it up, and this brings me back to something that confused me. The box called "Setup Unraid Server", I fill it out with the IP of unraid, login=root, and my root password, but then there's a popup asking for username and password. That seems redundant, am I supposed to put something else in one of those places, because I have ben using root and my root password? I updated configuration.yaml to have this for MQTT: mqtt: broker: 192.168.1.10 port: 1883 discovery: true discovery_prefix: homeassistant username: username password: password Username and password have been changed by me, they are the ones used in unraid api and mqtt... and when I restart home assistant I get this in the log: 2020-08-02 08:35:00 ERROR (Thread-4) [homeassistant.components.mqtt] Unable to connect to the MQTT broker: Connection Refused: not authorised. 2020-08-02 08:35:00 WARNING (Thread-4) [homeassistant.components.mqtt] Disconnected from MQTT server 192.168.1.10:1883 (5) I used the updated username and password in MQTT Explorer and I believe it is working as a see that there are messages, I can't figure out what is in them though. Quote Link to comment
ElectricBrainUK Posted August 2, 2020 Author Share Posted August 2, 2020 Yeah youre right the second request for username and password is probably redundant I will remove it in a future update. But root and your root password is correct yes. However it is unusual that the default are back in the unraid api docker config after editing them, they should persist as the new username and password and Im guessing that is why it is getting unauthenticated on your MQTT broker. Sounds like a problem with the unraid server itself, do other changes to any of your docker file configs persist? If not it might be worth restarting or updating your server. Quote Link to comment
bobobeastie Posted August 2, 2020 Share Posted August 2, 2020 1 hour ago, ElectricBrainUK said: Yeah youre right the second request for username and password is probably redundant I will remove it in a future update. But root and your root password is correct yes. However it is unusual that the default are back in the unraid api docker config after editing them, they should persist as the new username and password and Im guessing that is why it is getting unauthenticated on your MQTT broker. Sounds like a problem with the unraid server itself, do other changes to any of your docker file configs persist? If not it might be worth restarting or updating your server. I did a bunch of stuff, including uninstalling unraid-api and MQTT, had a response here half writtten for half of today, after doing some other home assistant stuff I got back to this. I don't know if it was my issue before, but where you have Container Variable: MQTTBroker and the default is hassio (I think), I just figured out that that was supposed to be the IP address, in this case of my unraid box. If you are open to suggestions from people who don't know anything about MQTT, I would put "broker_hostname-or-ip", or something to that effect, instead of broker, as the default I forgot I had changed that to the IP, went in to home assistant a little later and MQTT had a bunch of entities. Thank you very much for your help! I see that there is a entity for switch.server_name_power_off, I'm hoping/guessing that this is a graceful shutdown? I also want to have buttons to pause docker containers, I see that I can turn them on or off, but pause was in the webui for unraid-api, so I probably just have to change something to enable pausing? Maybe I'm better off stopping and starting, but still want to learn. Thank you. Quote Link to comment
ElectricBrainUK Posted August 2, 2020 Author Share Posted August 2, 2020 28 minutes ago, bobobeastie said: I did a bunch of stuff, including uninstalling unraid-api and MQTT, had a response here half writtten for half of today, after doing some other home assistant stuff I got back to this. I don't know if it was my issue before, but where you have Container Variable: MQTTBroker and the default is hassio (I think), I just figured out that that was supposed to be the IP address, in this case of my unraid box. If you are open to suggestions from people who don't know anything about MQTT, I would put "broker_hostname-or-ip", or something to that effect, instead of broker, as the default I forgot I had changed that to the IP, went in to home assistant a little later and MQTT had a bunch of entities. Thank you very much for your help! I see that there is a entity for switch.server_name_power_off, I'm hoping/guessing that this is a graceful shutdown? I also want to have buttons to pause docker containers, I see that I can turn them on or off, but pause was in the webui for unraid-api, so I probably just have to change something to enable pausing? Maybe I'm better off stopping and starting, but still want to learn. Thank you. Thanks a lot and Im always looking for suggestions to make things clearer so thank you for that! Im planning to release an update soon so will include that. Im glad that it is working for you now though that is the main thing. Yes the shutdown is graceful, not forced. Pause is not an auto discovered device as not everyone wanted it when I was setting that up. You have to configure that manually, here are some details on doing that: https://github.com/ElectricBrainUK/UnraidAPI/wiki/Home-Assistant-Integration For example for pausing a docker it would be something like the bellow - the docker name would have to be the same as what is broadcast by the unraidapi on MQTT: switches: - platform: mqtt command_topic: "homeassistant/servername/dockername/state" payload_on: "paused" payload_off: "started" Quote Link to comment
Migz93 Posted September 22, 2020 Share Posted September 22, 2020 How does the "On" check work? I currently have two Unraid boxes, as the 2nd one has some containers that rely on the first one being up, when I reboot the first one I have to make sure I stop the specific containers on the 2nd one also. Saw this API tool and thought awesome I can just get something configured in HA/Node-Red to automatically stop the containers when I need to but the "On" monitoring seems to be a bit iffy. Originally I had an instance of the API on each box but only configured to point at the box it was hosted on, that obviously didn't capture "On: false" whenever I rebooted the host because obviously the container is stopped as part of the reboot. I then setup both boxes on both of them, so if either one goes down the other one can see it. Except 99% of the time, each boxes monitor for the OTHER box says "On: false" when it's infact up. So I'm not sure what I'm doing wrong, maybe it's something extra I need to configure for the "On" check to work? Quote Link to comment
ElectricBrainUK Posted September 22, 2020 Author Share Posted September 22, 2020 (edited) 58 minutes ago, Migz93 said: How does the "On" check work? I currently have two Unraid boxes, as the 2nd one has some containers that rely on the first one being up, when I reboot the first one I have to make sure I stop the specific containers on the 2nd one also. Saw this API tool and thought awesome I can just get something configured in HA/Node-Red to automatically stop the containers when I need to but the "On" monitoring seems to be a bit iffy. Originally I had an instance of the API on each box but only configured to point at the box it was hosted on, that obviously didn't capture "On: false" whenever I rebooted the host because obviously the container is stopped as part of the reboot. I then setup both boxes on both of them, so if either one goes down the other one can see it. Except 99% of the time, each boxes monitor for the OTHER box says "On: false" when it's infact up. So I'm not sure what I'm doing wrong, maybe it's something extra I need to configure for the "On" check to work? Hey, it looks like you are doing the right thing - there may be an issue with the on check let me look into it - is it just the on check that is incorrectly reported? Edited September 22, 2020 by ElectricBrainUK 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.