small changes and fixes
This commit is contained in:
parent
76a01e4cd9
commit
6c579bb5fb
6 changed files with 21 additions and 16 deletions
|
@ -7,8 +7,12 @@ import LogstashLogging
|
|||
from LogstashLogging import logstash_logger
|
||||
from threading import Thread
|
||||
import logging
|
||||
from Battery import Battery
|
||||
from Buzzer import Buzzer
|
||||
|
||||
try:
|
||||
from Battery import Battery
|
||||
from Buzzer import Buzzer
|
||||
except Exception as e:
|
||||
logstash_logger.error("unable to import battery or buzzer in daemon")
|
||||
|
||||
__run = """raspivid -t 0 -b 5000000 -w 1280 -h 720 -fps 30 -n -o - | gst-launch-1.0 fdsrc ! video/x-h264,width=1280,height=720,framerate=30/1,noise-reduction=1,profile=high,stream-format=byte-stream ! h264parse ! queue ! flvmux streamable=true ! rtmpsink location=\"rtmp://localhost/live/stream\""""
|
||||
|
||||
|
@ -21,7 +25,7 @@ def check_battery():
|
|||
battery = Battery.percent()
|
||||
except Exception as e:
|
||||
logstash_logger.error(f"could not check battery -> {str(e)}")
|
||||
if battery <= 15:
|
||||
if -100 <= battery <= 15:
|
||||
logstash_logger.warning(f"LOW BATTERY DETECTED: '{battery}'")
|
||||
Buzzer.set(True)
|
||||
time.sleep(1)
|
||||
|
|
Reference in a new issue