Skip to content
Thakorn S.

Smart IoT room on Volttron

A room that senses and reports on itself.

TSThakorn Swaengkit·Aug 24, 2023·2 min read
Grafana dashboard for the smart room: current temperature 23 °C, CO₂ at 746 ppm, temperature and CO₂ charts, and smart plug status over time.
Fig. 1 · The room’s Grafana dashboard: live temperature, CO₂ and smart plug status.
4agents on the message bus
6indoor air signals polled
ROLELead developer
TIMELINEAug 2023

A smart room built on VOLTTRON: Tuya air-quality sensors and smart plugs, each handled by its own agent, with readings flowing into dashboards and alerts.

One agent per job

The room uses Tuya indoor-air-quality (IAQ) sensors and smart plugs. Instead of one service that does everything, each responsibility is its own agent on the VOLTTRON message bus:

  • TuyaIAQ polls CO₂, temperature, humidity, PM2.5, VOC and illuminance.
  • TuyaSmartPlug manages the outlets, with remote on/off control.
  • AlarmAgent checks readings against configurable thresholds and raises alerts.
  • RESTAgent exposes HTTP endpoints, so outside systems can query status and control devices.

How data moves

Agents talk through VOLTTRON's VIP (VOLTTRON Interconnect Protocol) using publish/subscribe, so they stay loosely coupled and new ones can join without touching the rest. The message bus can run on either ZeroMQ or RabbitMQ.

DEVICESTuya sensors + plugs
CLOUDTuya Cloud API
BUSVOLTTRON agents
DATACrateDB + Grafana
Fig. 2 · Devices to Tuya Cloud to agents to the database and dashboards.

Readings come in from the devices through the Tuya Cloud API, get processed by the agents, land in CrateDB as time series, and show up in Grafana dashboards like the one above.

Alerts on your phone

When a reading crosses a threshold, such as CO₂ climbing in a closed room, the AlarmAgent sends a push alert through LINE Notify.

Running it

Everything is deployed with Docker, so the stack behaves the same in development and production.

What it's a reference for

The project is a working example of patterns that carry over to smart building management, environmental monitoring and home automation:

  • Agent-based microservices
  • Event-driven communication
  • Threshold-based alerting
  • Integration with external APIs

Because each agent does one job, adding a new device type or a new processing step means adding an agent rather than changing the ones that already work.

BUILT WITH
VOLTTRONTuya Cloud APICrateDBGrafanaLINE NotifyDocker
TSThakorn SwaengkitRobotics & AI engineer in Bangkok. I lead software engineering at AltoTech and write about building for the physical world.
Next project · 01Tello Mission ControlAll projects