View Single Post
Old 05-27-2019, 10:11 PM
Profezzional Profezzional is offline
Registered User
Profezzional's PC Specs
Join Date: Dec 2018
Location: Columbus, OH
Posts: 7
POST ID # = 1005942
Profezzional Reputation: 14
Default How I integrated iCUE with Google Assistant

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.


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 JavaScript 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:

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 JavaScript.

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.

Last edited by Profezzional; 05-27-2019 at 10:24 PM.
Reply With Quote