MQTT Corsair iCUE control

No dice. :frowning: just downloaded the latest from GitHub. Rebuilt, and done everything again Even deleted the service and re-created it.

I have it saved in C:\icue2mqttRelease and have editied the \Properties\Resources.resx. Something isnā€™t working correct here.

I canā€™t work it out. Itā€™s not reading the URL I have saved in the resources.resx file.

Very odd. Any chance you could send me a zip of C:\icue2mqttRelease to try out?

Sure. I will private message you a link.

I see the password and user name are set to the words ā€œpasswordā€ and ā€œuserā€ respectively. Are these anonymized values or are they the actual values of the home assistant mqtt user. If no credentials are required for the mqtt broker then they should be blank otherwise the required creds

yes, i changed it. my mqtt server needs a username and password.

Hi, just wanted to report Iā€™m having the same issue as @cjsimmons, the windows log message is:

No MQTT broker URL. Stopping

Cloned and rebuilt moments ago, I had the start/stop issue with the initial released build as well.

Hi, my apologies I realised I made a mistake and was using a embedded resource file for the properties. For this to work, you would need to set the properties before running the build. Any changes after the build would not effect it.

I have just checked in a fix. I changed it so it no longer uses the resources.resx file. Instead there is a properties.json file in the root dir. You will need to pull down the updated code and do the build then copy the new published files to the release dir. Finally edit the properties.json file and set the MQTT url, mqttCredentialsPwd and mqttCredentialsUser values for your system. This can now be changed post build.

I am confident this was the problem

Thanks for the fix, I was able to start the service and the devices appeared within Home Assistant. Can you explain why the service is utilizing 40Mbps of network bandwidth?

Hi, interesting, I had not looked at the network bandwidth it is using. In task manager the process fluctuates between 1 and 4Mbps which still seems high given the light weight nature of MQTT.

Iā€™ll look into it I wonder if I should set the retain flag on the MQTT discovery publish, thought I am not 100% sure what that does yet. In the mean-time if you are concerned, the full source code is on the GitHub repo.

Yep, thatā€™s working. YAY. Iā€™ve also noticed the issue with bandwidth. I think itā€™s polling iCUE too frequently as after just a minute of running this, the MQTT topics for each corsair device had over 400,000 messages. It seems to be polling multiple times every second.

Currently the service is using about 12-20% CPU, 18MB Ram and about 12-18 Mbps network. This is rather high. No so much the RAM usage, but smaller is always better, but the CPU and Network should be lower. Maybe an option in the properties.json so that we can change the polling interval. If not, maybe once a second??

Also, I noticed a typo with the MQTT topic for both the switch and light entries. Itā€™s icue2mtt.

Thanks for your hard work on this.

Just noticed something elseā€¦ It overloaded HA which I have running on a different system. Not sure how that worked, but I couldnā€™t access HA while it was running. Looking at the docker container, HA was up at 100% CPU. As soon as I killed the icue2mqtt process, HA loaded up.

Maybe cause the mqtt topics are constantly changing, so HA is updating and just overloaded the CPU??

I donā€™t really have any control on the polling of icue side as it is just handled by the Corsair SDK. I only get the state of the LEDs on startup and then store them in objects, I update those values when MQTT changes the colour. This means it is only using the SDK to change the colour, it also means that if the control switch is turned off and the colours changed in iCue software it will not update the colour displayed in home assistant.

The iCue SDK itself is a bit of a black box however it believe this is a http client too and there is a chance it may be the cause.

As stated I only see a average of 4.1Mbps. I do also see 1% CPU which given the CPU is quite high. I will check the forums.

Also Iā€™ll look to fix the typo thank you

I see some suggestions about updating iCue?

Uploaded a update with QoS0 on MQTT not sure this will make a diff thought

Just rebuilt. No change to HA becoming unresponsive. :sob:

On a positive note, CPU usage dropped to about 5%, but Network usage increased to almost 30Mbps. :scream:

Sorry for the delay. I have finally had some time to look into this more. I was able to observe that the home assistant host CPU was indeed high (originally thought this was the PC running icue).

I did some debugging and worked out this was caused by subscribing to the state topics of MQTT. I have removed this subscription and simply send the state in response to a set message and the CPU seems very reasonable now. I believe this will sort out the problem you were encountering

Iā€™ve had confirmation from a user on github that the changes fixed the CPU and network load

Seems to be working ok now. CPU usage is mostly 0% and using 14.5MB RAM.

Itā€™s been a while since I last tried this, did it use to poll iCUE and show in HA what colours each device is showing? I seem to recall it was doing this, but itā€™s not now. I was looking to have my Philips Hue sync with the colours of my Corsair products.

Ah I see. The intent behind this was to allow HA to control the iCue devices. I then use scripts to set both my Hue and iCue devices at the same time. When the app starts up it will report the colours and if you change it in HA it will show the updated colours but if you change them in the iCue software it will not currently update HA.

The reason this was working before is the software was listening to messages over MQTT of the state topic and responding with the current state. The problem was that sending the current state to over MQTT was causing HA to broadcast the state topic again. I think this is intended to broadcast the state of devices to all MQTT devices that might be wanting to know when a device changes state. The problem was that this was the causing the state broadcast loop that was causing the performance issues.

The iCue SDK does not (as far as I know) have any events for state change that I could use to then update HA when the colour is changed outside of HA. When I get the time, I could look to add a configurable polling which would check the iCue software for a colour change then broadcast it over MQTT but I would suggest maybe looking to just control it all from iCue

All good here. Itā€™s not a big deal, just something that Iā€™ve been looking to do for a long time. Iā€™m not programmer, so this kind of stuff is way beyond me.