Jump to content
Corsair Community

How I integrated iCUE with Google Assistant


Profezzional

Recommended Posts

First, this is probably in the wrong category (thinking about it, it may be more appropriate in the CUE SDK category or something) so if any mods would like to move it, please do.

 

Heyo,

 

So I did what I think is a pretty cool thing. As the title suggests, I basically integrated the CUE SDK with Google Assistant. That being said, there's a pretty big asterisk on that statement.

 

What I Did

What I REALLY did was had Google Assistant use IFTTT to modify a text file with a color name in my OneDrive, which then auto-synced to my computer. Meanwhile, I made a web wallpaper with Wallpaper Engine, the ********** in which continuously pings a local Node/Express server I have running, which serves the contents of that file. The wallpaper then parses the HTML color name into RGB, and uses Wallpaper Engine's iCUE integration to set all the LEDs on my rig to that color.

 

So while it's a bit more convoluted than the title suggests, all you have to do is say "Hey Google, make the PC lights ____" and about 10 seconds later, the LED colors change, making it seem to the end user like they're fairly tightly integrated.

 

How I Did it

Here's a link to the Github repo with the code for the Node server and the wallpaper, and a more detailed walkthrough of the PC end of things: https://github.com/profezzional/iCUE-wallpaper-engine

 

On the IFTTT side, it was as simple as making an applet #triggered by Google Assistant, having the text ingredient be the HTML color name, and then the action being append the TextField ingredient to a file in OneDrive. I separated the names with "|". Then when the Node server reads the file contents, it replaces the file with only the new value followed by "|". This is so the file size doesn't keep growing as you continue to use the program.

 

Next Steps

The next thing I'll do is wrap the Node server up into probably an AHK script or something and run that on startup. I may also add applets to start/stop Wallpaper Engine, which might use nodemon on the Node server or something to track a flag in a file, track the Wallpaper Engine process to stop it, and know where it's installed to start it.

 

How I Got There

The motivation for this was I've been thinking about doing this sort of thing ever since I got my RGB LED light bulbs after I got a Google Home Hub. After I finally redid the custom loop in my PC, and right before I get the new Corsair water blocks, I finally decided to sit down and do it.

 

Getting to this point took me about 2 days of trial and error. I was going to start down the path of trying to hook into iCUE's Far Cry 5 integration, but from a couple posts I saw, that was going to be super complicated and I don't like C++ (see this thread). Then I remembered Wallpaper Engine had iCUE integration for wallpapers, so I checked that out and, as primarily a web developer, was very pleased to see I could do things in JS.

 

I had code for a simple C# HTTP server, so I tried to use that initially, but that was being funky, so I used some NodeJS code I had from a much more complicated app and trimmed it down to just the extreme basics, since all I needed was for the server to give me the file contents on any route.

 

My next conundrum was how to get Google Assistant to modify a file. I first tried to dabble with making my own Actions, but that got complicated super quick. Not that I'm afraid of complicated things, I just figured there had to be an easier way. I then tried to use a couple existing Actions like Vodo Drive to modify a file in my Google Drive, but it seems like it's really only for spreadsheets, at least for the time being. Then I stumbled upon IFTTT, and I remembered having heard about it a while ago, but I'm shocked I didn't have this in my life before.

 

I then initially tried to find a way to have the Node server query my Google Drive directly, but the Drive API was also suuuuper complicated. I was trying to find a way to not have to wait for a file to sync from the cloud to my PC, but quickly resigned myself to that, and I'm not disappointed with the delay. I'm sure if I took the time and made the effort to use the Drive API or something, and had the Node server continuously check my Drive for updates, it would be faster. Looking at the OneDrive API, it seems like it may be marginally simpler than Google's, but at this point what I have is fairly smooth and doesn't take too long.

 

 

 

 

So yeah, that's been my journey over the past 2 days. Let me know what you guys think, if you have any suggestions for improvement, or if I'm missing a totally obvious better way to do this.

Side note: I also started this discussion over on the LinusTechTips forums to try to get more input on it, so check over there for more ideas.

Edited by Profezzional
Link to comment
Share on other sites

Oh hey! Good to see someone else using my C++ work. Good luck with your project!

Keep an eye on the forums over June/July though. I finished my project a few months ago and plan to release it with full documentation over the next month or so. In short, it lets you bind programs/scripts that control iCUE profiles to processes, it's pretty neat and might help with what you're trying to achieve.

Link to comment
Share on other sites

I actually ended up not even trying the C++ approach, but I'll be looking forward to seeing what you come up with!

 

While changing the profile based on other programs would be a neat addition to what I was originally going for, and something I would definitely use, part of my goal was to do something like the instant lighting feature in iCUE, but being able to use any color instead of the preset ones they have. I think the same limitation would apply for profiles, since I don't want to go through and make a profile for every single color option, unless you were able to create profiles dynamically or something.

 

That's another reason why I like the way I went about it, because I can use practically any color. You can also technically use rgb values straight from the Google assistant, but you have to say the numbers just the right way for it to interpret them correctly, so I found it's just easy to have preset color names.

Edited by Profezzional
Link to comment
Share on other sites

So with what I did, you DO have to create and export each profile, so no procedural profiles. That said, I can think of 2 ways to have them in a really hacky way. With the program, you can actually have lighting controllers (the programs/scripts) that use the other SDK or otherwise not use CgSDK, so you're stuff should be able to work with it fine as well.
Link to comment
Share on other sites

Edit: Too complex for me to use, but still amazing work dude.

 

True, there is a lot going on, but once you have it set up, it's actually pretty simple to use, with just the one voice command to the Google Assistant and waiting 5-10 seconds. It's really convenient for me since I have the Google Home hub, but if you have a phone with the assistant that can pick up your voice decently, it'd of course work with that too.

 

I made a little AutoHotKey script to run the Node server, which I'll put in the Github repo when I get around to it sometime today probably. Then for further convenience, it's just a matter of putting shortcuts to the AHK script and wallpaperengine32.exe (in your Steam library folder) in the startup menu (by doing "shell:startup" in the Run menu) so everything runs on startup.

 

So if you already have iCUE and Wallpaper Engine, you only have to install NodeJS, AutoHotKey, and possibly OneDrive if you don't already have it. Then installing IFTTT on your phone and creating the one applet, since I haven't taken the time yet to try to publish the one I made. Suuuper simple, right? xDDD

 

I think other cloud services would work, but OneDrive was the most convenient one that IFTTT lets you use to append to a text file. You could use Google Drive or Dropbox and have IFTTT create a text file, if you tweaked the server slightly, having it read the text file then delete it, and have it give the last read color value to the client instead of the now-nonexistent file's contents.

 

In addition, you could make a second IFTTT applet that's "turn the PC lights off", which would just append "black" to the text file.

 

Further testing/development is put on hold temporarily while I deal with Windows deactivating itself after I swapped motherboards, so Wallpaper Engine isn't actually working because that.

 

 

 

 

 

So with what I did, you DO have to create and export each profile, so no procedural profiles. That said, I can think of 2 ways to have them in a really hacky way. With the program, you can actually have lighting controllers (the programs/scripts) that use the other SDK or otherwise not use CgSDK, so you're stuff should be able to work with it fine as well.

 

I guess I'm not understanding what your program does. It allows you to programmatically switch between already-created iCUE profiles, right? So you're using the CgSDK dll from FC5 to change the profile? I know you're planning to release your project over the next month or so, but would you mind sharing it with me ahead of time? Partly because I'm impatient, but mostly because I think our forces combined can make this a pretty seamless setup and user experience.

 

Using the normal SDK to have the pseudo-dynamic profiles (basically mimicking the instant lighting feature in iCUE, but with any color) is definitely an option; it's actually basically what the Wallpaper Engine part is doing, but just using the SDK they ported to JavaScript as a middleman, because I was too lazy to deal with the C++ stuff directly haha.

 

You had mentioned you were working on making a C# wrapper; was that for the CgSDK or the normal SDK? While I could follow your walkthrough to get myself setup to use the C++, I'd be much more interested in using C#.

 

All that being said, you're right, however the text file gets read and the colors get applied don't really matter, the only thing you really need is something that continually checks the file and can use any of the SDKs, whether it's the normal one in either JS or C++ to change the LEDs manually, or whether it's using CgSDK to change a preset profile.

 

Thinking about it more, using a single exe that just directly uses the SDK would be a lot simpler than the Node/WE process that I'm using; you could even throw a little GUI on it to add color-name-to-RGB-value mappings.

 

(Side note: you can technically say RGB values to the assistant, but you have to say them in just the right way for it to interpret the numbers correctly, to avoid having to do a TON of parsing work on the back end, which is why I went with hardcoded name-to-value mappings)

Link to comment
Share on other sites

×
×
  • Create New...