Files
home_automatization/services/device-control-service/README.md
T
cactoandClaude Sonnet 5 6ce487735f Scaffold repo: infra docker-compose, service layout, README
Sets up the microservice home-automation platform skeleton: docker-compose
for mosquitto/postgres/clickhouse/redis/rabbitmq, per-service README stubs
describing responsibilities, and top-level README with architecture/stack.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-26 16:14:36 +05:00

980 B

device-control-service (Go)

Status: not implemented yet.

Responsibility:

  • Expose a gRPC API (see proto/device_control.proto) for issuing commands to devices — called by Laravel (manual control) and rule-engine-service (rule-triggered actions).
  • Publish the command to the device's MQTT topic (devices/{device_id}/commands) and listen for acknowledgements (devices/{device_id}/ack).
  • Maintain the Device Shadow pattern in Redis: desired_state (what the user wants) vs reported_state (what the device confirmed), plus status and last_seen.
  • Owns the health-check loop (or delegates to health-check-service): a ticker goroutine that flips a device to offline when last_seen exceeds a timeout, and emits an event for notification-service.

Not this service's job: deciding when to send a command based on sensor thresholds — that's rule-engine-service's logic. This service only executes and tracks state for whatever command it's given.