A little bit of Minecraft is healthy, but it's summer time and it pains me to see my kids spending the day in the basement staring at the TV screen. I wanted a fun and simple way to monitor and limit their screen time. My kids love cats, so we created Screen Kitty.
How it works
The TV (or XBox) plugs into the Weaved smart plug. A Google Apps Script acts as both a RESTful endpoint, and has a timed script that runs every minute. A very simple web front end runs on any smart phone or computer to control starting/stopping screen time, and gives a status update. When the kids want to play, they click "Play" on the web app. That runs through the Google Apps Script and turns on the Weaved smart plug. Every minute, the script pushes an update via PubNub to any web clients and updates the "...minutes left" display. If my kids want a break, they can tap "stop," which causes the Weaved plug to turn off and the timer to pause. When there are 5 minutes or less remaining, the web app announces the time left each minute, using the text-to-speech of the Google translate API. When the minutes get to 0, Screen Kitty shuts it all down by turning off the Weaved plug relay. Each day at midnight, the Google script resets the timer.
Challenges I ran into
The Weaved plug was very easy to set up, but it's still in beta so they're working through little bugs and fixes in the API. Fortunately the reps on the forum are very responsive and they seem to be making quick progress.
Accomplishments that I'm proud of
I always love creating something that's lightweight and requires only a little custom code, while pulling together other existing services and resources. In this case, combining Weaved with Google and PubNub gave me a lot of functionality without much effort.
What's next for Screen Kitty
I did manage to get the IR Blaster working on the Weaved plug to control the TV. However, for my kids I wanted a hard switch that they couldn't easily turn back on. In other use cases this same codebase could be modified to easily control several components, using a combination of the IR Blaster and the plug relay switch.