zugarzeeker / automatron

Personal LINE bot to automate various tasks. Home automation, expense tracking, transaction monitoring

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

automatron

This is my personal LINE bot that helps me automate various tasks of everyday life, such as home control (air conditioner, lights and plugs) and expense tracking (record how much I spend each day). See below for a feature tour.

I recommend every developer to try creating their own personal assistant chat bot. It’s a great way to practice coding and improve problem solving skills. And it helps make life more convenient!

It is written in TypeScript and runs on Google Cloud Run on top of evalaas JavaScript-execution platform.

features

home automation

home automation

I have a Raspberry Pi set up which can control lights, air conditioner, and smart plugs. It receives commands via Google Cloud IoT Core, performs the action, and then reports back to automatron via its API.

expense tracking

expense tracking

Simple expense tracking by typing in the amount + category. Example: 50f means ฿50 for food. Data is saved in Airtable.

On mobile, tapping the bubble’s body (containing the amount) will take me to the created Airtable record. This allows me to easily edit or add remarks to the record. Tapping the bubble’s footer (containing the stats) will take me to Airtable view, which lets me see all the recorded data.

transaction aggregation

transaction_aggregation

I set up IFTTT to read SMS messages and send it to automatron. It then uses transaction-parser-th to parse SMS message and extract transaction information. It is then sent to me as a flex message.

quick_replies

In mobile phone, quick reply buttons lets me quickly turn a transaction into an expense record by simply tapping on the category.

auto_expense

Certain kinds of transactions can be automatically be turned into an expense, for example, when I take BTS Skytrain using Rabbit LINE Pay card. Having many features in one bot enabled this kind of tight integrations.

image-to-text

image_to_text

automatron can also convert image to text using Google Cloud Vision API.

livescript evaluation

livescript

LiveScript interpreter is included, which allows me to do some quick calculations.

cli / api

api

POST /text sends a text command to automatron. This is equivalent to sending a text message through LINE. This allows me to create a CLI tool that lets me talk to automatron from my terminal.

POST /post sends a message to my LINE account directly. This allows the home automation scripts to report back to me whenever the script is invoked.

secrets

The secret data required to run the automation are defined in BotSecrets.ts.

development workflow

developing

Watches for file changes and deploy the compiled code. Since it is my personal bot (I am the only one using it), I want a save-and-deploy workflow; there is no dev/staging environment at all.

node dev

configuration

# download
gsutil cp gs://$GOOGLE_CLOUD_PROJECT-evalaas/evalaas/automatron.env automatron.env

# upload
gsutil cp automatron.env gs://$GOOGLE_CLOUD_PROJECT-evalaas/evalaas/automatron.env

About

Personal LINE bot to automate various tasks. Home automation, expense tracking, transaction monitoring


Languages

Language:TypeScript 91.6%Language:JavaScript 8.4%