TypeScript开发的LINE机器人助手实现家庭自动化和支出跟踪
automatron是一个基于TypeScript开发的LINE机器人助手,部署在Google Cloud Run平台上。它集成了家庭自动化控制、支出跟踪、交易汇总和图像文字识别等功能,旨在简化日常任务。该项目采用Rush管理的monorepo结构,包括核心服务和Web界面两个子项目。项目利用Google Cloud IoT Core进行家庭设备控制,通过Airtable存储支出数据,并集成了Google Cloud Vision API实现图像文字识别。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.
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.
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.
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.
In mobile phone, quick reply buttons lets me quickly turn a transaction into an expense record by simply tapping on the category.
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.
automatron can also convert image to text using Google Cloud Vision API.
LiveScript interpreter is included, which allows me to do some quick calculations.
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.
This project is a monorepo managed by Rush. It contains multiple subprojects: