How I'm Automating My Productivity With This Smart Home Combo
Tags: productivity, webdev, opensource, javascript
Published: 2019-04-10 11:35:29

Have you ever used timers to enhance your workflow? I have. Setting time boundaries works for me quite well but managing timers is not that pleasant.

It was the case until I found a much better way to support my productivity with a home automation setup!

This post is a part of series where I'm sharing my experience about Pomodoro and building great habits around coding, productivity, focus, journaling, health and more. You can check them out [to steal my experience]((https://blog.swingpulse.com/pomodoro)).

### Worth noting

Most of the time I work from home. Use my experience as a source of inspiration to adapt it for your personal workflow. It's not a step by step instruction. It's a publicly shared usecase with some open sourced code.

### TL;DR

To manage my Pomodoro timers in a most friction-less way I use Google Home Assistant routines and a desktop app to view those timers in a status bar.

# The Overhead with Timers

I really like an idea to tune the environment in my favor. The idea is very simple.

> Instead of spending willpower to fight through things I can organise the environment in a way that will encourage my positive behaviour.

What can I tell about my previous experience with timers?

### Managing timers is a little bit cumbersome

Loading apps, grabbing a phone, swipes, clicks, gestures, hotkeys — it's all quite easy. But it is still some additional actions between me and productivity.

### Avoiding escape hatch

> I used to break Pomodoro routine using friction as an excuse.

Managing myself is a challenge. When I have a challenging Pomodoro session it is easy for me to use frustration as an escape hatch. It is especially easy to ignore timers that pop up from my laptop.

And last year I found a better way that works for me nicely and does not have these problems.

# Automating Formula

This is the formula I came up with: Google Home + Pomodoro Technique + Electron App.

> I've set up my Google Home Assistant to create my pomodoros and wrote [an app](https://blog.swingpulse.com/focutron) to display those timers in Mac OS status bar.

It's a set up that's works pretty well for me for about a year.

### Voice is very natural for this use case

I found that for me setting up timers using voice is the most convenient and frictionless way. It's just a matter of syncing my butt movement with my voice command. And nothing else.

### Voice is a commitment

Once a routine started — I am doing a commitment. For some reason, voice command is a nice trigger to start at work I will commit to.

## Setting up Google Home Automation

Google Assistant has a feature called «Routines». Basically, you are binding one keyword phrase too many actions. So I've set up a Google Home Assistant routine to create many timers from a single command.

In my case, I'm using three different key phrases. Each of them creates different number of pomodoro sessions — 1 session, 2 sessions and 4 sessions.

The commands are:

> Hey, Google! Time to work.

> Hey, Google! Time to work hard.

> Hey, Google! Time to work really hard.

!['Timer routine'](https://blog.swingpulse.com/static/be0fb9aff38d3b1c7bf63f6f9c98fbcb/337b6/timers-start.png)

Someday it will mean that Google itself with start doing what I need, but for now the job is on my part.

# Displaying Timers in Status Bar

To know how much time left I can simply ask my Google Assistant. But to get info faster I've done this:

!['Timers demo'](https://blog.swingpulse.com/static/5e2aaae521636eebd6b192db3995335a/8d0ff/timers-demo.png)

I will share some code. The aim is not to be a detailed guide, but more of a overview how you can replicate something similar for your workflow.

### Getting data

There is a URL to get JSON data about timers created from google assistant.

```javascript
const URL = `http://${DEVICE_IP_ADDRESS}:8008/setup/assistant/alarms`
```

JSON response is:

!['Timers JSON'](https://blog.swingpulse.com/static/4c269ec5ccc46a63b6cfa2ef366c11b1/02744/timers-json.png)

We can get the ip address from device settings screen in mobile app or by scanning your local network.

### Displaying data

It was up to me what to do with this data. I've decided to go with an Electron app that displays timers in menu bar. I've open sourced this project.

I called it [FOCUTRON](https://blog.swingpulse.com/focutron). 😄

Please remember that the code is extremely ugly. And it's not user friendly and there might be bugs. Pull requests are welcomed!

# It Just Works

I really like my set up and it is proven to work for me for about a year! You can steal and adapt it for yourself. Tuning environment is a very powerful concept. Now I set up timers by voice with zero friction and can quickly check them out via app. Nice!

What use case comes on your mind?

P.S. Do subscribe to [my blog](https://blog.swingpulse.com/) not to miss good stuff. Also come [say hello at twitter](https://twitter.com/rogovdm)!