Simple web app to control Smart Life devices and scenes, deployed on Cloudflare Pages with Pages Functions for the Tuya Home Assistant API proxy.
Note: Only Smart Life accounts created with email and password are supported. Accounts linked to Google are not supported.
Important: Postfix your automation names with a trailing # if you want them treated as automations; otherwise they will be displayed as scenes. This works around Tuya API behavior.
- Vue 3 + Vue Router 4
- Element Plus 2
- Cloudflare Pages + Pages Functions (Wrangler for local dev)
- Node.js 22+
- Node 22 or newer (engines.node ">=22"). Consider using nvm and a local
.nvmrcwith22. - npm (uses package-lock.json)
- Install dependencies
npm ci
- Vite dev server (fast HMR)
Note: this serves the SPA only. API routes (/api/homeassistant/*) are provided by Cloudflare Pages Functions and are not available via the Vite dev server unless you proxy them manually.
npm run dev
- Cloudflare Pages dev (SPA + Functions together)
This builds the SPA with Vite and runs
npm run serve
wrangler pages dev dist, serving dist/ along with the functions under functions/. - Open http://127.0.0.1:8788
- Production build:
npm run build
- Lint with ESLint:
npm run lint
- Requests to
/api/homeassistant/*are proxied to Tuya upstream via Cloudflare Pages Functions located infunctions/api/homeassistant. - Query parameter
regioncontrols the upstream region (default:eu). The function stripsregionbefore forwarding. - Simple permissive CORS headers are applied by the function for local/dev usage.
- Push your branch to GitHub
- Cloudflare Dashboard → Pages → Create project → Connect to Git → select this repository/branch
- Build settings:
- Build command:
npm ci && npm run build - Build output directory:
dist - Functions directory: auto-detected (
functions/)
- Build command:
- Deploy and test your site
- Check outdated packages:
npm outdated
- Upgrade interactively:
npx npm-check-updates -u && npm install - Then validate with lint/build/serve
- The Node-based proxy under
api/homeassistanthas been replaced by Cloudflare Pages Functions and is no longer required. - Icons: https://icons8.com/icons/set/clapperboard
- Tuya integration docs: https://www.home-assistant.io/integrations/tuya/