https://github.com/lab5e/pi-psu
simple server for resetting power when a Span connected device stops talking
https://github.com/lab5e/pi-psu
Last synced: 12 months ago
JSON representation
simple server for resetting power when a Span connected device stops talking
- Host: GitHub
- URL: https://github.com/lab5e/pi-psu
- Owner: lab5e
- Created: 2021-10-24T14:20:19.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-02-10T17:33:06.000Z (over 4 years ago)
- Last Synced: 2025-02-28T22:38:58.952Z (over 1 year ago)
- Language: Go
- Size: 20.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# pi-psu
This is just a simple server that listens for messages from a Span device and power cycles the device if it hasn't seen any traffic from the device within some time span.
## Deployment
This runs on the host `relay` on the local network. You can inspect the state at and trigger a reboot of the connected device at
## Example
Assuming you have set `PI_PSU_TOKEN` to your SPAN API token, and you are using the board Bjørn made with the relay attached to pin 27, the defaults for the other parameters should do.
```shell
pi-psu --collection 566ecm37cmcahj --device 566ecm37cmcahh
```
## Command line options
```shell
$ pi-psu -h
Usage:
pi-psu [OPTIONS]
Application Options:
--addr= HTTP interface listen address (default: :8080)
--token= Span API token [$PI_PSU_TOKEN]
--collection= Span collection id [$PI_PSU_COLLECTION]
--device= Span device ID [$PI_PSU_DEVICE]
--msg-timeout= time after last message seen from device to when we power cycle (default: 2m)
--minimum-reboot-interval= minimum time between reboots (default: 5m)
--gpio-pin= GPIO pin for relay (default: 27)
--gpio-hold= how long we turn off power (default: 3s)
Help Options:
-h, --help Show this help message
```