https://github.com/cafjs/caf_rpi_nap
CAF library that shutdowns, and restarts after certain time, a RPi+WittyPi combo.
https://github.com/cafjs/caf_rpi_nap
Last synced: 5 months ago
JSON representation
CAF library that shutdowns, and restarts after certain time, a RPi+WittyPi combo.
- Host: GitHub
- URL: https://github.com/cafjs/caf_rpi_nap
- Owner: cafjs
- Created: 2016-07-24T03:54:42.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2020-04-01T19:38:25.000Z (about 6 years ago)
- Last Synced: 2025-10-12T01:21:33.360Z (9 months ago)
- Language: JavaScript
- Size: 18.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.md
- Contributing: CONTRIBUTING.md
- License: LICENSE-2.0.txt
Awesome Lists containing this project
README
# Caf.js
Co-design permanent, active, stateful, reliable cloud proxies with your web app or gadget.
See https://www.cafjs.com
## Raspberry Pi Library for Power Management
This library shutdowns and restarts after certain time a RPi+WittyPi combo.
It runs in the device not in the cloud.
## API
lib/proxy_iot_nap.js
## Configuration Example
### iot.json
{
"module": "caf_rpi_nap#plug_iot",
"name": "nap",
"description": "Access to shutdown/delayed restart for this device.",
"env" : {
"maxRetries" : "$._.env.maxRetries",
"retryDelay" : "$._.env.retryDelay",
"deviceRTC" : "process.env.DEVICE_RTC||/dev/i2c-1",
"deviceAddress" : "process.env.DEVICE_ADDRESS||0x68",
"allowMock" : "process.env.ALLOW_MOCK||true",
"shutdownCommand" : "process.env.SHUTDOWN_COMMAND||shutdown.sh'
},
"components" : [
{
"module": "caf_rpi_nap#proxy_iot",
"name": "proxy",
"description": "Proxy to shutdown/delayed restart service",
"env" : {
}
}
]
}
where `deviceRTC` and `deviceAddress` are associated with the i2c interface that the WittyPi exposes. `allowMock` simulates shutdown and restart with error messages. Mocking only changes behavior when there is no i2c device, avoiding component error in that case.