Devlog #1: RoomOps Zero Core API & Smart Device Integration
Date: August 23, 2026
Project: RoomOps Zero
Status: In Progress (Backend Microservice Layer)
🛠️ Summary & Overview
Implemented the foundational REST API layer for RoomOps Zero using FastAPI to handle local hardware control and environmental telemetry. Integrated Tapo smart devices (L900 Light Strip & L535 Smart Bulb) using an asynchronous client library (tapo), structured via the Factory Design Pattern for modularity. Added an asynchronous weather integration module to feed current climate data directly to the central dashboard.
⚙️ Key Technical Updates
1. Asynchronous REST API (main.py)
- Configured a FastAPI application running on
0.0.0.0:8080via Uvicorn. - Defined explicit request validation models using Pydantic (
TapoBaseModel). - Created non-blocking asynchronous routes for weather retrieval (
GET) and smart device state management (POST).
2. Smart Lighting Integration (tapo_control.py)
- Created async device wrappers (
L900,L535) leveragingApiClientfrom thetapolibrary. - Externalized hardware credentials (IPs, usernames, passwords) into a local
.envfile usingpython-dotenv. - Implemented a Singleton pattern for
L535to avoid redundant object instantiation. - Designed a
DeviceFactoryclass to standardizeturn_onandturn_offoperations across varying hardware models based on incoming payloads.
3. Weather Telemetry Module (weather.py)
- Integrated
python_weatherusing metric units ($^\circ\text{C}$). - Structured as an
asyncutility (get_temperature) to prevent blocking the primary event loop during HTTP requests.
📡 API Endpoints Reference
1. Get Current Weather
-
URL:
GET /api/weather/{city} -
Parameters:
city(path parameter, string) - Response: Current metric temperature integer/float.
2. Control Tapo Device
-
URL:
POST /api/tapo/control -
Headers:
Content-Type: application/json -
Payload Example:
{ "device_name": "l900", "action": "turn_on" }
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.