|
|
2 ay önce | |
|---|---|---|
| .. | ||
| agent | 2 ay önce | |
| scripts | 2 ay önce | |
| systemd | 2 ay önce | |
| README.md | 2 ay önce | |
| heartbeat-poc.py | 2 ay önce | |
| mock-device-cli.py | 2 ay önce | |
| package.json | 2 ay önce | |
| requirements.txt | 2 ay önce | |
Agent này chạy trên thiết bị Pi4 đầu cuối để:
/boot/timelapse/agent.keyScript install chỉ chạy trên Pi/Linux systemd.
cd /opt/timelapse
git pull
# install agent service
sudo bash apps/device-agent/scripts/install-agent.sh
# theo dõi logs
journalctl -u timelapse-agent.service -f
Có thể giả lập thiết bị mà không cần phần cứng thật:
# 1) giả lập thiết bị mới xin claim code
python3 apps/device-agent/mock-device-cli.py claim \
--server http://localhost:3001 \
--count 5
# 2) giả lập heartbeat cho device seed demo
python3 apps/device-agent/mock-device-cli.py heartbeat \
--server http://localhost:3001 \
--demo \
--interval 5
# 3) custom device list
python3 apps/device-agent/mock-device-cli.py heartbeat \
--server http://localhost:3001 \
--device DEMO-001:dev-api-key-demo-001 \
--device DEMO-002:dev-api-key-demo-002
Mẹo: mở dashboard và theo dõi trạng thái thay đổi realtime khi script heartbeat đang chạy.
##
Có thể giả lập thiết bị mà không cần phần cứng thật:
# 1) giả lập thiết bị mới xin claim code
python3 apps/device-agent/mock-device-cli.py claim \
--server http://localhost:3001 \
--count 5
# 2) giả lập heartbeat cho device seed demo
python3 apps/device-agent/mock-device-cli.py heartbeat \
--server http://localhost:3001 \
--demo \
--interval 5
# 3) custom device list
python3 apps/device-agent/mock-device-cli.py heartbeat \
--server http://localhost:3001 \
--device DEMO-001:dev-api-key-demo-001 \
--device DEMO-002:dev-api-key-demo-002
Mẹo: mở dashboard và theo dõi trạng thái thay đổi realtime khi script heartbeat đang chạy.
##
File: /etc/timelapse/agent.env
TL_SERVER_URL=http://<server-ip>:3001
TL_DEVICE_NAME=Pi-DSLR-01
TL_SERIAL_NO=PI4-DSLR-01
TL_HEARTBEAT_INTERVAL=30
TL_CLAIM_POLL_INTERVAL=10
TL_CONFIG_DIR=/boot/timelapse
Khi service chạy lần đầu:
/boot/timelapse/agent.json — metadata (deviceUuid, deviceId)/boot/timelapse/agent.key — API key (chmod 600)