small changes and fixes

This commit is contained in:
Joel 2021-01-30 01:53:25 +01:00
parent 76a01e4cd9
commit 6c579bb5fb
No known key found for this signature in database
GPG key ID: BDDDBECD0808290E
6 changed files with 21 additions and 16 deletions

View file

@ -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)