{"id":27493,"date":"2023-01-14T10:37:09","date_gmt":"2023-01-14T18:37:09","guid":{"rendered":"https:\/\/www.podfeet.com\/blog\/?p=27493"},"modified":"2023-01-14T10:37:09","modified_gmt":"2023-01-14T18:37:09","slug":"stream-deck-down-the-rabbit-hole-part-1","status":"publish","type":"post","link":"https:\/\/www.podfeet.com\/blog\/2023\/01\/stream-deck-down-the-rabbit-hole-part-1\/","title":{"rendered":"Stream Deck \u2014 Down the Rabbit Hole, Part 1"},"content":{"rendered":"<p>As is so often the case, I wish to blame Allison for what I\u2019m about to tell you. I\u2019ve had a project on the boil for a while now which had me seriously considering buying an Elgato Stream Deck. It is entirely <a href=\"https:\/\/www.podfeet.com\/blog\/2022\/02\/stream-deck\/\">Allison\u2019s fault<\/a>, however, that I actually bought one.<\/p>\n<p>I bought the Stream Deck Mk. 2, which is the second version of the 15-key device. It is exactly the same size and, in its stand, sits at the same angle, as my Elgato Wave XLR microphone interface. That\u2019s is also <a href=\"https:\/\/www.podfeet.com\/blog\/2022\/02\/abandon-apollo-solo-for-wave-xlr\/\">Allison\u2019s fault<\/a>, though she may like to pass the blame on to Marty Sobo for <a href=\"https:\/\/www.podfeet.com\/blog\/2022\/02\/elgato-wave-xlr\/\">that first review<\/a>.<\/p>\n<p>I\u2019ve titled this story, in fact series of stories, \u201cStream Deck \u2014 Down the Rabbit Hole\u201d because that\u2019s pretty much what happened once it landed on my desk. I\u2019ve spent some time working on that project I mentioned, and it will do a great job for that, but I\u2019ve also been experimenting with what else I can do, and learning a few tricks along the way. It\u2019s this process I\u2019d like to share.<\/p>\n<p><a href=\"https:\/\/nanoleaf.me\/en-NZ\/products\/essentials\/bulbs\/?category=bulbs&amp;standard=homekit&amp;pack=A60-E27&amp;size=each\"><img loading=\"lazy\" decoding=\"async\" class=\"alignright size-medium wp-image-27495\" src=\"https:\/\/www.podfeet.com\/blog\/wp-content\/uploads\/2022\/12\/nanoleaf-essentials-smart-rgb-light-bulb-e27nl45-0800wt240e27@2x-300x300.jpg\" alt=\"NanoLeaf Essentials smart bulb with packaging product shot.\" width=\"300\" height=\"300\" srcset=\"https:\/\/www.podfeet.com\/blog\/wp-content\/uploads\/2022\/12\/nanoleaf-essentials-smart-rgb-light-bulb-e27nl45-0800wt240e27@2x-300x300.jpg 300w, https:\/\/www.podfeet.com\/blog\/wp-content\/uploads\/2022\/12\/nanoleaf-essentials-smart-rgb-light-bulb-e27nl45-0800wt240e27@2x-1024x1024.jpg 1024w, https:\/\/www.podfeet.com\/blog\/wp-content\/uploads\/2022\/12\/nanoleaf-essentials-smart-rgb-light-bulb-e27nl45-0800wt240e27@2x-200x200.jpg 200w, https:\/\/www.podfeet.com\/blog\/wp-content\/uploads\/2022\/12\/nanoleaf-essentials-smart-rgb-light-bulb-e27nl45-0800wt240e27@2x-768x768.jpg 768w, https:\/\/www.podfeet.com\/blog\/wp-content\/uploads\/2022\/12\/nanoleaf-essentials-smart-rgb-light-bulb-e27nl45-0800wt240e27@2x-1536x1536.jpg 1536w, https:\/\/www.podfeet.com\/blog\/wp-content\/uploads\/2022\/12\/nanoleaf-essentials-smart-rgb-light-bulb-e27nl45-0800wt240e27@2x-650x650.jpg 650w, https:\/\/www.podfeet.com\/blog\/wp-content\/uploads\/2022\/12\/nanoleaf-essentials-smart-rgb-light-bulb-e27nl45-0800wt240e27@2x.jpg 1600w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>The first task I thought I would tackle was home automation. I\u2019ve not got very far into this area of technology yet, however my study is well appointed with four <a href=\"https:\/\/nanoleaf.me\/en-NZ\/products\/nanoleaf-essentials\/\">NanoLeaf Essentials<\/a> colour smart bulbs in ceiling fittings, and a set of <a href=\"https:\/\/nanoleaf.me\/en-NZ\/products\/nanoleaf-canvas\/\">NanoLeaf Canvas<\/a> light panels on the wall above my monitor, as well as a stereo pair of HomePod minis. I\u2019d been using either the Home app on my phone, or talking to S-lady on the HomePods to control the lights, but S-lady requires a level of concentration to say the right thing without any awkward pauses, lest she stop listening. Not to mention the awkward pauses S-lady herself sometimes has, nor her sometimes inexplicable inability to perform simple actions she has done many times before.<\/p>\n<p>So I got to wondering\u2026 could the Stream Deck offer me a more direct option for controlling my lights? The short answer was yes.<\/p>\n<p>I looked for HomeKit integration in the long list of plugins available for the Stream Deck software. I was disappointed, however, as none exists.<\/p>\n<p>My next idea was to see whether I could trigger Apple Shortcuts. This proved more fruitful, with a plugin available to do just that. I headed into the macOS Shortcuts app to see what I could set up but Shortcuts\u2019 support for HomeKit isn\u2019t what I\u2019d hoped for. You cannot, for instance, toggle the state of a light. The Shortcut must either turn the light on, or turn it off. Neither can you raise or lower the brightness \u2014 you have to set an explicit level.<\/p>\n<p>I managed to address toggling by fetching the current status and using an if-else block, but the number of bugs I encountered while working out even these simple automations put me right off using Shortcuts. Even if the shortcuts were simple and reliable, I\u2019d need a whole bunch of them to do all the commands I want.<\/p>\n<p>I decided to do an internet search to see if anyone else had managed to link up Stream Deck with HomeKit lights; the results weren\u2019t encouraging without using a whole separate integration tool like <a href=\"https:\/\/homebridge.io\/\">HomeBridge<\/a> \u2014 a route I did not fancy going down at all. On a whim, I searched \u201cStream Deck NanoLeaf\u201d and was surprised to discover there was a NanoLeaf-specific plugin! On searching the Stream Deck plugin directory, I discovered there were, in fact, two.<\/p>\n<p><a href=\"https:\/\/nanoleaf.me\/en-NZ\/products\/nanoleaf-canvas\/?category=canvas\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-medium wp-image-27496\" src=\"https:\/\/www.podfeet.com\/blog\/wp-content\/uploads\/2022\/12\/nanoleaf-canvas-light-panels-starter-kit-9nl29-0005sw-9pk@2x-300x300.jpg\" alt=\"NanoLeaf Canvas light panels with packaging product shot\" width=\"300\" height=\"300\" srcset=\"https:\/\/www.podfeet.com\/blog\/wp-content\/uploads\/2022\/12\/nanoleaf-canvas-light-panels-starter-kit-9nl29-0005sw-9pk@2x-300x300.jpg 300w, https:\/\/www.podfeet.com\/blog\/wp-content\/uploads\/2022\/12\/nanoleaf-canvas-light-panels-starter-kit-9nl29-0005sw-9pk@2x-1024x1024.jpg 1024w, https:\/\/www.podfeet.com\/blog\/wp-content\/uploads\/2022\/12\/nanoleaf-canvas-light-panels-starter-kit-9nl29-0005sw-9pk@2x-200x200.jpg 200w, https:\/\/www.podfeet.com\/blog\/wp-content\/uploads\/2022\/12\/nanoleaf-canvas-light-panels-starter-kit-9nl29-0005sw-9pk@2x-768x768.jpg 768w, https:\/\/www.podfeet.com\/blog\/wp-content\/uploads\/2022\/12\/nanoleaf-canvas-light-panels-starter-kit-9nl29-0005sw-9pk@2x-1536x1536.jpg 1536w, https:\/\/www.podfeet.com\/blog\/wp-content\/uploads\/2022\/12\/nanoleaf-canvas-light-panels-starter-kit-9nl29-0005sw-9pk@2x-650x650.jpg 650w, https:\/\/www.podfeet.com\/blog\/wp-content\/uploads\/2022\/12\/nanoleaf-canvas-light-panels-starter-kit-9nl29-0005sw-9pk@2x.jpg 1600w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>The <em>NanoLeaf Tiles<\/em> plugin offered control of any of NanoLeaf\u2019s light panel products and included actions for brightness up and down, as well as an absolute brightness, the basic setting of colour or scene, and an on\/off toggle.<\/p>\n<p>The <em>NanoLeaf Controller<\/em> plugin appeared to offer less, with only a single brightness action, however that action can take an absolute or incremental value. In the end, I preferred <em>NanoLeaf Controller<\/em> due to it\u2019s easier setup process. Both of these plugins communicate directly with the light panel controller, skipping any need for HomeKit. I now had buttons set up to toggle the Canvas panels off and on, to raise and lower the brightness in 10% increments, and to select my three favourite patterns.<\/p>\n<p>But\u2026 neither of these plugins would work for my NanoLeaf bulbs, and I have specific needs for those, which necessitates a brief diversion.<\/p>\n<p>My study is an odd little space. It is made out of the remaining half of a small bedroom, when the other half was taken to provide an ensuite and walk-in wardrobe in the next bedroom. This not only makes the study quite small, it also makes the door invisible from the working space. Couple this with only a small window which looks out onto a bank, which is covered in trees, and backed by a fence, and it will become apparent that not much natural light makes it into this room. Since we moved into the house, I have had strong, daylight-white bulbs on the ceiling.<\/p>\n<p>For a long time I had three CFL and later LED bulbs of 120 W equivalent brightness which bathed the room in bright light no matter how much natural light there was. I wavered for a long time on getting smart bulbs because I was used to 1400 lumens of light per bulb and all the smart bulbs I could find were well below this, most quoting only 800 lumens. The NanoLeaf Essentials bulbs quote 1000 lumens which is just enough.<\/p>\n<p>The reason for smart bulbs in this tiny room may not be apparent, given I need as much light as I can get. I do like to warm the colour a little in the evenings, but the real reason for them is the weeks I am on call for my job. Being woken by a phone call at 2am is an exercise in waking up enough to understand and deal with the problem, but not so much as to risk not getting back to sleep.<\/p>\n<p>Walking into a brightly lit room while still waking up is a recipe for never getting back to sleep no matter how quickly I solve the issue, and also for a headache. For this part of my life, I had a scene that set all four bulbs to a red colour at 10% brightness. This is enough to see my way into the room, considering my eyes are adjusted to full darkness when I am awoken. Each night I was on call, I\u2019d log in a couple of necessary applications on my Mac, dim the screens, then ask S-lady to set my \u201con call\u201d scene to dim the lights as I walked out of the room. Could I get the Stream Deck to do this?<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignright size-medium wp-image-27494\" src=\"https:\/\/www.podfeet.com\/blog\/wp-content\/uploads\/2022\/12\/IMG_3583-300x225.jpeg\" alt=\"Elgato Stream Deck with buttons for controlling NanoLeaf bulbs and light panels.\" width=\"300\" height=\"225\" srcset=\"https:\/\/www.podfeet.com\/blog\/wp-content\/uploads\/2022\/12\/IMG_3583-300x225.jpeg 300w, https:\/\/www.podfeet.com\/blog\/wp-content\/uploads\/2022\/12\/IMG_3583-1024x768.jpeg 1024w, https:\/\/www.podfeet.com\/blog\/wp-content\/uploads\/2022\/12\/IMG_3583-768x576.jpeg 768w, https:\/\/www.podfeet.com\/blog\/wp-content\/uploads\/2022\/12\/IMG_3583-650x488.jpeg 650w, https:\/\/www.podfeet.com\/blog\/wp-content\/uploads\/2022\/12\/IMG_3583.jpeg 1280w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/>I needed to be able to control the Essentials bulbs from my Mac. Another internet search finally led me to <a href=\"https:\/\/sixcolors.com\/post\/2021\/04\/tip-control-homekit-via-stream-deck\/\">an article by Jason Snell<\/a>, where he explained a similar search had led him to a Mac app called <a href=\"https:\/\/apps.apple.com\/nz\/app\/homecontrol-menu-for-homekit\/id1547121417?mt=12\">HomeControl<\/a>. This provides a menu bar icon with a drop-down menu of controls for all the devices and scenes known to HomeKit. This is pretty nifty in itself, but the functionality which makes it valuable for automation is every action it can perform can also be triggered via the app\u2019s URL scheme. Stream Deck has a built in action to open a URL, so simply copying the HomeControl URL into Stream Deck\u2019s action makes the magic happen!<\/p>\n<p>With the buttons now successfully setting my ceiling lights according to my preset scenes, I was still left with the manual task of dimming my screens. I got to wondering if that could also be automated. Spoiler alert: it can.<\/p>\n<p>I found a small app called <a href=\"https:\/\/github.com\/nriley\/brightness\">Brightness<\/a> which did just what I needed. It is available via <a href=\"https:\/\/github.com\/Homebrew\/brew\">Homebrew<\/a>, which I was already using, so I went ahead and installed it. It didn\u2019t work! I found the GitHub repo and read through the issues where I discovered the Homebrew version had not been updated for Apple Silicon and several users had hit the same errors as me. The solution, it was explained, was to install it by compiling from source.<\/p>\n<p>This sounds a little daunting but it was very simple, following the instructions on GitHub. I could now simply run a command from Terminal to set the brightness of my MacBook Pro display, or my Studio Display, or both. All I needed to do was add the command as an action. Except&#8230; it wasn\u2019t that simple!<\/p>\n<p>The Stream Deck software doesn\u2019t contain an action to \u201crun a command\u201d. It <em>does<\/em> contain an action to <em>open an application<\/em>. Some more internet searching told me I could simply put the name of my script \u2026 wait \u2026 script? It was easy enough to put my brightness command in a script, though it seemed like a needless extra step. But it solved another problem \u2014 the Stream Deck action to <em>open<\/em> will not let you supply any parameters.<\/p>\n<p>So now I had three scripts in my home folder which set the brightness on both of my screens to a high, medium, and low setting \u2014 in fact 80%, 65%, and 10% respectively. I added these onto my Stream Deck buttons by using the Multi-action action. But wait! There\u2019s more!<\/p>\n<p>When testing my new buttons, I realised the Stream Deck itself was still at full brightness, which was now quite obvious in the dimly lit room. I checked the available actions, and there was one to set the Stream Deck\u2019s own brightness. It\u2019s a little limited with only 5 settings, one of which is completely off, but it did a good enough job. Now just one button would have my room lights, my monitors, and my Stream Deck all adjust accordingly.<\/p>\n<p>Some time later, I realised there was one button I had not thought of. When I\u2019m <em>not<\/em> on call, and I want to leave the room\u2026 I just want to turn all the lights off. This one was easy, with a scene to turn off all of the lights, but needed one extra feature. If all the lights go out the moment I press that button, I still have <em>some<\/em> light from the screens, but I\u2019m risking my neck getting out of the room. So I added another standard Stream Deck action to the button \u2014 a delay for 10 seconds. Now I had 10 seconds to leave the room.<\/p>\n<p>My journey down the rabbit hole does not end here, as you will note from my extensive use of the past tense. Things have since moved on, but that is for part 2. And\u2026 part 3!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As is so often the case, I wish to blame Allison for what I\u2019m about to tell you. I\u2019ve had a project on the boil for a while now which had me seriously considering buying an Elgato Stream Deck. It is entirely Allison\u2019s fault, however, that I actually bought one. I bought the Stream Deck [&hellip;]<\/p>\n","protected":false},"author":29,"featured_media":27494,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[147],"tags":[3120,1821,1265,842,1352,2700,5026],"class_list":["post-27493","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog-posts","tag-apple-homekit","tag-automation","tag-elgato","tag-lighting","tag-smart-home","tag-smart-lighting","tag-stream-deck"],"jetpack_featured_media_url":"https:\/\/www.podfeet.com\/blog\/wp-content\/uploads\/2022\/12\/IMG_3583.jpeg","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.podfeet.com\/blog\/wp-json\/wp\/v2\/posts\/27493","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.podfeet.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.podfeet.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.podfeet.com\/blog\/wp-json\/wp\/v2\/users\/29"}],"replies":[{"embeddable":true,"href":"https:\/\/www.podfeet.com\/blog\/wp-json\/wp\/v2\/comments?post=27493"}],"version-history":[{"count":3,"href":"https:\/\/www.podfeet.com\/blog\/wp-json\/wp\/v2\/posts\/27493\/revisions"}],"predecessor-version":[{"id":27525,"href":"https:\/\/www.podfeet.com\/blog\/wp-json\/wp\/v2\/posts\/27493\/revisions\/27525"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.podfeet.com\/blog\/wp-json\/wp\/v2\/media\/27494"}],"wp:attachment":[{"href":"https:\/\/www.podfeet.com\/blog\/wp-json\/wp\/v2\/media?parent=27493"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.podfeet.com\/blog\/wp-json\/wp\/v2\/categories?post=27493"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.podfeet.com\/blog\/wp-json\/wp\/v2\/tags?post=27493"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}