Bill Selak
All That is EduAwesome
  • Podcast
    • Subscribe on Apple Podcasts
    • Subscribe on Google Play
    • Subscribe on Stitcher
    • Subscribe on Deezer
  • Blog
    • How-to
    • Editorial
    • Presentations
    • Ed Tech
    • Music
  • Rising Decline Project
    • The Rising Decline Project on Bill Selak Talks: Part 1 of 30
    • The Rising Decline Project on Bill Selak Talks: Part 2 of 30
    • The Rising Decline Project on Bill Selak Talks: Part 29 of 30
    • The Rising Decline Project on Bill Selak Talks: Part 30 of 30
  • Photography
    • Project 52
    • Photo-a-Day Year 4
    • Hollywood Photowalk 2012
    • selakphotography.com
    • Photo-a-Day older blog, with 1095 daily photos
  • Hi, I’m Bill Selak
    • Bio
    • Presentations
    • Consulting
October 17, 2023
Automation, ChatGPT, Coding in Education, DIY Tech, Elgato Stream Deck, Home Automation, IoT, Key Light Control, Lighting Solutions, MacOS, Scripting Tips, Shell Scripting, Tech for Educators, Terminal Commands, Troubleshooting
Like 0 Thanks! You've already liked this
ai, Blog, Coding, Ed Tech, Gallery, How-to

Shedding Light on IoT Woes: Solving Stream Deck Key Light Issues with Shell Scripting and ChatGPT

Today, I faced a frustrating issue: my Elgato Stream Deck refused to cooperate with a new light for my desk at work, the Elgato Key Light. After troubleshooting without success, I turned to ChatGPT. Together, we arrived at an elegant, geeky solution that solved the issue.

The Challenge

As with most IoT items, getting them connected to your network and phone/laptop is rarely straightforward. After a few minutes, I was able to get the Key Light to appear in the Elgato Control Center. Cool. The two big features of this light is that I can change the brightness/temperature in the Control Center, and I can turn on/off the light using my Stream Deck.

But I could only access this light once. Despite exhaustive attempts, the new key light refused to make an appearance in Elgato’s Control Center again. Determined to find a workaround, I turned to ChatGPT, where it suggested a solution with a shell script, a simple text file that contains executable commands in macOS Terminal. Here’s the first draft of that script (with generic IP address, except port 9123 which the light needs):

curl --location --request PUT 'http://192.168.1.1:9123/elgato/lights' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
  "numberOfLights": 1,
  "lights": [
    {
      "brightness": 50,
      "temperature": 300
    }
  ]
}'

I could paste this into Terminal and turn the light on or off by changing the brightness value to 100 or zero! But pasting this into Terminal isn’t user-friendly, which is the whole point of this new light. Feeling more confident, I started to think about integrating it into my Stream Deck. ChatGPT gave me code to turn the light on and off. Here’s the key_light_control-on.sh script:

# !/bin/bash
#Update the settings to set brightness to 100%
curl --location --request PUT 'http://192.168.1.1:9123/elgato/lights' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
"numberOfLights": 1,
"lights": [
{
"on": 1,
"brightness": 100,
"temperature": 143
}
]
}'

And here’s the key_light_control-off.sh script:

# !/bin/bash
# Update the settings to set brightness to 0%curl --location --request PUT 'http://172.16.62.192:9123/elgato/lights' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
"numberOfLights": 1,
"lights": [
{
"on": 1,
"brightness": 0,
"temperature": 143
}
]
}'

If you want to copy this project, here are the steps to provide the necessary permissions for your new script files:

Step 1: Create two files to with the shell script code from aobe

Use a plain text editor like nano, vim, or Visual Studio Code to create your script. If you’re using TextEdit, make sure to switch it to “Plain Text” mode (Format > Make Plain Text) before saving. File extension should be ‘.sh’.

Step 2: Open Terminal

Launch the Terminal application on your macOS system. This will open a command-line interface where you can execute the requisite commands.

Step 3: Navigate to the Folder

Navigate to the folder where your scripts, key_light_control-on.sh and key_light_control-off.sh, are located. You can use the cd (change directory) command for this purpose. For instance, if your scripts are located in the Documents/Stream Deck info/ folder, the command would be:

cd ~/Documents/Stream\ Deck\ info/

Step 4: Change File Permissions

Run the chmod command to change the permissions of each script file, making them executable:

chmod +x key_light_control-on.sh
chmod +x key_light_control-off.sh

This command assigns the executable (x) permission to the files, making them runnable as programs.

Step 5: Verify

To confirm that the permissions have been successfully updated, run the ls -l command in Terminal:

ls -l

Look for your script files in the listing. They should now have an x in their permission settings, denoting that they are executable.

Step 6: Add the scripts as buttons on Stream Deck

Open the Stream Deck software and choose the profile where you want to add the new button. Drag the “Open” action (usually found under the “System” category) to an empty button slot.

After adding the “Open” action to a button, you’ll see a configuration pane on the right side. Here, you can set various properties for the button, including what file to open.

Click on the “Choose” option and navigate to the location of your shell script, such as key_light_control-on.sh or key_light_control-off.sh. Select the script/file to attach it to the button.

Once configured, the changes should automatically save. Press the button on your Stream Deck hardware to test the action and verify that it triggers the script as expected.

Final Thoughts

A photo capturing a dramatic silhouette of an individual standing between the rectangular key light and the Elgato Stream Deck. The progression from a dim light to a brighter one symbolizes the journey from challenge to solution.

With a dash of creativity and a helping hand from ChatGPT, I transformed a frustrating tech issue into a successful journey through the weeds of coding iOT. For educators and tech geeks alike, let’s not forget that challenges like these aren’t just stumbling blocks; they’re opportunities. And more importantly, tools like ChatGPT enable us to tackle complex problems that would’ve required expertise in coding. So, the next time you find yourself stuck with tech, don’t shy away. Dive in headfirst and emerge with new knowledge and skills with the help of ChatGPT.

Phish & Chips: Serving Up Security Questions at This Year’s Admin Meetings Me, Upgraded: Maximize Strengths and Overcoming Weaknesses with ChatGPT
bst122 happyface pt12
Blog, Ed Tech, Featured, Music, Podcast, Rising Decline

Rising Decline Revisited: Happy Face [Part 12 of 18]

bst122 happyface pt11
Blog, Ed Tech, Education Leadership, Featured, Music, Podcast, Rising Decline

Rising Decline Revisited: Happy Face and the Mask We Wear [Part 11 of 18]

bst120 moondoggies pt10
Blog, Ed Tech, Featured, Music, Podcast

Rising Decline Revisited: I Got Fired From Moondoggies [Part 10 of 18]

Featured

  • IMG_5097Navigating New Realms: AI’s Role in Shaping Educator Identities
  • IMG_4958The Educator’s Guide to AI-Powered App Development
  • IMG_4828Punk Rock and Pedagogy: Lessons in Authenticity from Blink 182

Subscribe to Podcast

Apple PodcastsAndroidby EmailRSS

Recent Posts

  • Rising Decline Revisited: Happy Face [Part 12 of 18]
  • Rising Decline Revisited: Happy Face and the Mask We Wear [Part 11 of 18]

Search

  • Featured Posts
  • Presentations
© Bill Selak 2025
Powered by WordPress • Themify WordPress Themes