
Domek App - Smart home & PHEV
Turborepo system: cloud Express API + TimescaleDB + WebSocket, LAN home-bridge on Pi (inverter, LEDs, motion), Expo app with wall mode - no inbound ports to the house.
Technologies
?Challenge
Unify PV, dynamic tariffs, Tuya, and PHEV charging while keeping LAN hardware and cameras private and reachable without port-forwarding.
✓Solution
Split cloud logic from edge agent: ingest from bridge, command queues for LAN devices, Charging Brain with PV surplus rules, go2rtc WebRTC for Tapo cameras.
Key decisions
Charging Brain
Priority rules: user windows → PV export threshold → min 30 min ON grace - no relay chatter.
Cloud brain, edge hands
Bridge only outbound HTTPS; cloud queues LED commands and accepts inverter ingest with X-Bridge-Key.
Privacy-first cameras
Tapo offline → go2rtc on Pi → WebRTC in app (~0.2–0.5 s), local motion via ffmpeg/RTSP.
Results
Automated PHEV charging from PV surplus
Local camera streams without vendor cloud
Real-time energy dashboard on phone & wall tablet


