add: debian file, perform various fixes
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
Package: watcher
|
||||
Version: 0.2
|
||||
Maintainer: Charles
|
||||
Architecture: all
|
||||
Description: Watches cameras and temp sensors
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
systemctl daemon-reload
|
||||
# Make sure its enabled
|
||||
systemctl enable --now watcher
|
||||
# Restart it; it might have already been installed and running
|
||||
systemctl restart watcher
|
||||
@@ -0,0 +1,14 @@
|
||||
# Install to /etc/systemd/system/watcher.service
|
||||
[Unit]
|
||||
Description=Run watcher
|
||||
After=network-online.target
|
||||
Wants=network-online.target systemd-networkd-wait-online.service
|
||||
|
||||
[Service]
|
||||
Type=exec
|
||||
ExecStart=/usr/local/bin/watcher --watcher_config /etc/watcher_config.yaml --watcher_name /etc/watcher_name.txt
|
||||
Restart=on-failure
|
||||
RestartSec=5s
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,14 @@
|
||||
# Install to /etc/systemd/system/watcher.service
|
||||
[Unit]
|
||||
Description=Run watcher
|
||||
After=network-online.target
|
||||
Wants=network-online.target systemd-networkd-wait-online.service
|
||||
|
||||
[Service]
|
||||
Type=exec
|
||||
ExecStart=/usr/local/bin --watcher_config /etc/watcher.yaml
|
||||
Restart=on-failure
|
||||
RestartSec=5s
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,20 @@
|
||||
home: Sunnyvale
|
||||
name: Office
|
||||
h264:
|
||||
binary: "/usr/bin/libcamera-vid"
|
||||
arguments:
|
||||
- "-n"
|
||||
- "-t"
|
||||
- "0"
|
||||
- "--codec"
|
||||
- "h264"
|
||||
- "--mode"
|
||||
- "1640:1232"
|
||||
- "--inline"
|
||||
- "-o"
|
||||
- "-"
|
||||
sensor:
|
||||
binary: "/usr/bin/python3"
|
||||
arguments:
|
||||
- "/usr/local/bin/temperature.py"
|
||||
sensor_rate_ms: 10000
|
||||
@@ -0,0 +1,17 @@
|
||||
import bme280
|
||||
import smbus2
|
||||
from time import sleep
|
||||
|
||||
port = 1
|
||||
address = 0x77 # Adafruit BME280 address. Other BME280s may be different
|
||||
bus = smbus2.SMBus(port)
|
||||
|
||||
bme280.load_calibration_params(bus,address)
|
||||
|
||||
while True:
|
||||
bme280_data = bme280.sample(bus,address)
|
||||
humidity = bme280_data.humidity
|
||||
pressure = bme280_data.pressure
|
||||
ambient_temperature = bme280_data.temperature
|
||||
print(humidity, pressure, ambient_temperature)
|
||||
sleep(1)
|
||||
Executable
BIN
Binary file not shown.
Reference in New Issue
Block a user