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>
980 B
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) vsreported_state(what the device confirmed), plusstatusandlast_seen. - Owns the health-check loop (or delegates to health-check-service): a ticker
goroutine that flips a device to
offlinewhenlast_seenexceeds 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.