Shortcut to check Cheerlights

I’ve been playing with the Cheerlights API again lately (I also used it in my Pi Zero Cluster).

What is Cheerlights?

CheerLights is an “Internet of Things” project created by Hans Scharler in 2011 that allows people’s lights all across th…


This content originally appeared on DEV Community and was authored by Andy Piper

I've been playing with the Cheerlights API again lately (I also used it in my Pi Zero Cluster).

What is Cheerlights?

CheerLights is an “Internet of Things” project created by Hans Scharler in 2011 that allows people’s lights all across the world to synchronize to one color set by Twitter. This is a way to connect physical things with social networking experiences.

I thought it might be fun to build a quick Shortcut for iOS/macOS so that I can ask what the colour is currently set to. Why? Firstly, because I can... and secondly, sometimes I might not have another device handy to confirm a result with, if for any reason I want to check my gadget or project is showing the colour I should expect. Honestly though, it's a bit of a stretch, but interesting to experiment with building Shortcuts.

Shortcuts app on macOS showing the workflow for the Cheerlights shortcut

This is super simple - we only want to know the colour by name (in this case, we don't care about the RGB or Hex code values - but in my next post, I'll be doing something with those...). The basic ThingSpeak channel has an HTTP endpoint which returns the text of the colour name.

Try it out at the command line:

$ curl -s https://api.thingspeak.com/channels/1417/field/1/last.txt                                                             purple

No additional processing needed here. To build it step-by-step in Shortcuts:

  1. Get Contents of URL action, configured with the URL https://api.thingspeak.com/channels/1417/field/1/last.txt - this will return a plain text value, as we saw in the command line example. this is all we need to do, but in order for Siri to have a slightly nicer response to us, we can add a few additional steps

  2. Set Variable action, putting the value from the URL into a variable named cheerlights.

  3. Replace Text action, creating a string "Cheerlights are currently set to ZZZ", replacing "ZZZ" with the value of the cheerlights variable.

  4. Show Result action, to display or say the result. It turns out that this is important, otherwise you would need to use the Speak Text action to have the result read out (and this uses a different voice to the regular Siri voice you've chosen).

Clicking the Run button results in a pop-up:

Pop up window showing the text "Cheerlights are currently set to cyan"

Shortcuts sync via iCloud, so now you can ask Siri for the current Cheerlights colour from your Watch, iPhone, HomePod, etc 💡

"Hey Siri, Cheerlights colour"

"Cheerlights are currently set to red"

One final thing you can do is to help Siri with the pronunciation. In iOS Settings, Accessibility -> Spoken Content -> Pronunciations, add a new entry. Enter the phrase as "Cheerlights", then hit the microphone in the Substitution field and say the word. You'll get back a list of phonetic options to tap through to try Siri's response, and you can choose the one you like the best. Nice!

iOS Settings panel showing the Pronunciations value configured here

Cheerlights also has an MQTT interface, and you can set new colours using Twitter. If you are building something that needs a colour or that might be fun to synchronise with other lights, take a look, it's a great API to play with.

If you'd like to chill out with Cheerlights, check out the soothing Twitch channel 🎵


This content originally appeared on DEV Community and was authored by Andy Piper


Print Share Comment Cite Upload Translate Updates
APA

Andy Piper | Sciencx (2022-02-06T17:03:17+00:00) Shortcut to check Cheerlights. Retrieved from https://www.scien.cx/2022/02/06/shortcut-to-check-cheerlights/

MLA
" » Shortcut to check Cheerlights." Andy Piper | Sciencx - Sunday February 6, 2022, https://www.scien.cx/2022/02/06/shortcut-to-check-cheerlights/
HARVARD
Andy Piper | Sciencx Sunday February 6, 2022 » Shortcut to check Cheerlights., viewed ,<https://www.scien.cx/2022/02/06/shortcut-to-check-cheerlights/>
VANCOUVER
Andy Piper | Sciencx - » Shortcut to check Cheerlights. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/02/06/shortcut-to-check-cheerlights/
CHICAGO
" » Shortcut to check Cheerlights." Andy Piper | Sciencx - Accessed . https://www.scien.cx/2022/02/06/shortcut-to-check-cheerlights/
IEEE
" » Shortcut to check Cheerlights." Andy Piper | Sciencx [Online]. Available: https://www.scien.cx/2022/02/06/shortcut-to-check-cheerlights/. [Accessed: ]
rf:citation
» Shortcut to check Cheerlights | Andy Piper | Sciencx | https://www.scien.cx/2022/02/06/shortcut-to-check-cheerlights/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.