How alous12/practica_3_iot works
Vigilante Inteligente is an Alexa-controlled ESP32 security device: users link a device by its displayed code, then query or change its door and operating settings. Alexa requests enter the Lambda skill, which resolves the user’s Thing, accesses DynamoDB for links, and reads or updates its AWS IoT Device Shadow. The ESP32 reports PIR and door state and applies Shadow deltas; its local rule and settings logic also support autonomous behavior. The graph follows documented and indexed runtime structure; unsampled modules are included only where README or index evidence supports them.
Main entry points: main.cpp ESP32 runtime · SmartObject.cpp State orchestrator · handlers.py Intent handlers · device_gateway.py Device gateway
Components 20
Alexa and cloud
- Intent model
alexa/interaction-model.es-US.json - Lambda entry
lambda/lambda_function.py - Skill setup
lambda/vigilante/skill.py - Intent handlers
lambda/vigilante/handlers.py - Speech responses
lambda/vigilante/speech.py - Link repository
lambda/vigilante/link_repository.py - Device gateway
lambda/vigilante/device_gateway.py - Shadow state
lambda/vigilante/device_state.py
Firmware connectivity
- ESP32 runtime
src/main.cpp - WiFi connection
src/net/WifiConnection.cpp - NTP time sync
src/net/TimeSync.cpp - MQTT Shadow client
src/net/ShadowClient.cpp
Device behavior
- State orchestrator
src/app/SmartObject.cpp - PIR sensor
src/sensors/PirSensor.cpp - Servo lock
src/actuators/DoorLock.cpp - Auto-lock rule
src/rules/AutoLockRule.cpp - Operating settings
src/settings
AWS services
- DynamoDB links
- IoT Device Shadow
Other components
- Alexa user
Connections 27
- Alexa user → Intent model: speaks intents
README.md - Intent model → Lambda entry: routes requests
README.md - Lambda entry → Skill setup: invokes skill
lambda/lambda_function.py - Skill setup → Intent handlers: registers handlers
lambda/vigilante/skill.py - Intent handlers → Link repository: resolves links
lambda/vigilante/handlers.py - Intent handlers → Device gateway: requests device state
lambda/vigilante/handlers.py - Intent handlers → Speech responses: formats responses
lambda/vigilante/handlers.py - Link repository → DynamoDB links: reads and writes
lambda/vigilante/link_repository.py - Device gateway → IoT Device Shadow: reads and updates
lambda/vigilante/device_gateway.py - Device gateway → Shadow state: parses shadow
lambda/vigilante/device_gateway.py - ESP32 runtime → WiFi connection: maintains connection
src/main.cpp - ESP32 runtime → NTP time sync: starts time sync
src/main.cpp - ESP32 runtime → MQTT Shadow client: maintains shadow session
src/main.cpp - ESP32 runtime → State orchestrator: runs loop
src/main.cpp - ESP32 runtime → PIR sensor: constructs and registers
src/main.cpp - ESP32 runtime → Servo lock: constructs and registers
src/main.cpp - ESP32 runtime → Auto-lock rule: registers rule
src/main.cpp - ESP32 runtime → Operating settings: registers settings
src/main.cpp - State orchestrator → MQTT Shadow client: publishes and receives deltas
- State orchestrator → PIR sensor: reads and reports
- State orchestrator → Servo lock: applies and reports
- State orchestrator → Operating settings: applies and reports
- State orchestrator → Auto-lock rule: evaluates rules
- Auto-lock rule → PIR sensor: checks motion
- Auto-lock rule → Servo lock: closes door
- MQTT Shadow client → IoT Device Shadow: exchanges Shadow state
README.md - IoT Device Shadow → Device gateway: serves state and deltas
lambda/vigilante/device_gateway.py