Community showcase: automated home setup to stay in flow
Code Time, Software’s extension for code editors and IDEs, helps you protect valuable code time with Flow Mode—a set of automations that makes it easy to eliminate distractions, mute notifications, and stay focused when you’re in flow.
Once connected to a Slack workspace, Flow Mode enables Slack’s Do Not Disturb mode, sets a custom status message, and adds a purple icon to your status. In some editors and IDEs, like Visual Studio Code, you can also choose to enable Zen mode or enter fullscreen with Flow Mode. Flow Mode can be triggered manually, via a button in the sidebar or status bar, or automatically, based on your coding activity.
Shane Lawrence, a member of the Software community and senior software developer, saw an opportunity to make Flow Mode even more powerful.
He extended Flow Mode to automate his entire workspace setup:
- Change ambient lighting in his workspace to purple
- Silence notifications on his phone
- Set a custom Do Not Disturb status on his home system
Here’s a short demo of Shane’s custom Flow Mode in action:
Overview of the flow automation stack
Shane’s setup uses a few different automation tools and APIs:
- Code Time to detect when he’s in flow and update his Slack status
- Slack Events API to monitor his status and trigger his home automations
- Home Assistant for connecting and controlling his devices
- Philips Hue bulb for his desk light, Hue lightstrips and Nanoleaf Aurora for accent lighting on the wall
- Tasker and the AutoRemote plugin to set his Android phone to Do Not Disturb
Shane wrote a small watcher script in Node.js that checks for changes to his Slack status using the Slack Events API (@slack/events-api). If a new status includes Flow Mode’s purple emoji, 🟣, Shane’s bot sends a custom ‘beginflow’ or ‘endflow’ event to his Home Assistant, a popular open source home automation hub.
Home Assistant then sets a custom Do Not Disturb mode for his home automation system, triggers his workspace lighting, and sends a notification to his phone.
Home Assistant comes with powerful connections out-of-the-box. It integrates directly with Philips smart bulbs and Nanoleaf lights, as well as more than 1,500 other smart devices. To control his phone, Shane uses AutoRemote to listen for notifications from Home Assistant. Tasker then changes his phone’s settings.
In his next iteration, Shane is considering how he might trigger Digital Wellbeing’s Focus Mode to disable all distracting apps on his Android phone. He is also exploring how he could integrate with Spotify to start playing newly recommended songs from the Music Time extension when he’s in flow.
Why defending flow matters
Developers constantly battle meetings, interrupts, and inertia—the ‘enemies’ of developer flow—that interfere with valuable code time. Impromptu Zoom calls and relentless Slack messages make work feel disjointed and chaotic.
Protecting flow helps us silence these distractions and make the most of each workday. From Shane:
As someone who's deeply passionate about the work I do, being in flow is the part of my day where I'm immersed and energized in what I really love most; working on challenging problems and helping online communities be a safer place for everyone to connect.
While I'm fortunate to have been able to keep my job through the pandemic, working from home has introduced its own set of challenges, such as staying focused on days when other distractions want to drag my attention away from important tasks, making it difficult to always sink my teeth into a solid coding session.
Code Time's flow feature combined with my smart home integration helps me quickly tune out all of the distractions at once, helping me focus faster and reduce the chatter of apps and chat messages all competing for my attention.
If you’re interested in automation tech, you can find Shane on Twitch, where he’s currently building a bot service that helps streamers let their viewers redeem channel points to change their smart light colors. He streams Wednesdays at 6pm PT and Saturdays at 7pm PT. Shane’s streams are open to all, coders and non-coders alike.