-100 for nonexistent sensor
This commit is contained in:
@@ -17,4 +17,4 @@ PICTURE_TRANSFER_FILE='/mnt/zoblakdata/picture_transfer_ready.jpg'
|
||||
PICTURE_INPUT_FILE='/mnt/zoblakdata/picture.jpg' # must match file in PICTURE_COMMAND
|
||||
PICTURE_COMMAND="""avconv -i rtsp://192.168.5.10:554//user=admin_password=_channel=1_stream=0.sdp -i /home/pi/projects/tfm/controller/zoblakLogo.png -filter_complex "[0:v]drawtext=fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf:fontsize=30:box=1:boxcolor=black@0.75:text='%d\.%m\.%Y\. %H\:%M\:%S':fontcolor=white@0.8: x=10: y=10[text]; [text][1:v]overlay=main_w-overlay_w-5:5 [filtered]" -map "[filtered]" -f image2 -vframes 1 /mnt/zoblakdata/picture.jpg""" # filename must match PICTURE_INPUT_FILE path
|
||||
PICTURE_URL = 'http://agrar.zoblak.com/api/v1.0/picture'
|
||||
ONE_WIRE_THERMO_SENSORS = ['/dev/sys/bus/w1/devices/xxx/w1_slave'] # xxx -serial
|
||||
ONE_WIRE_THERMO_SENSORS = ['/sys/bus/w1/devices/xxx/w1_slave'] # xxx -serial
|
||||
|
||||
@@ -1,20 +1,25 @@
|
||||
import re
|
||||
|
||||
def read_one_thermo(filename):
|
||||
NO_OF_DECIMALS = 3
|
||||
textfile = open(filename, 'r')
|
||||
filetext = textfile.read()
|
||||
textfile.close()
|
||||
try:
|
||||
NO_OF_DECIMALS = 3
|
||||
textfile = open(filename, 'r')
|
||||
filetext = textfile.read()
|
||||
textfile.close()
|
||||
|
||||
matches = re.findall("t=(\-?)(\d+)", filetext)
|
||||
sign = -1 if matches[0][0] == '-' else 1
|
||||
whole_reading = matches[0][1]
|
||||
first_part = matches[0][1][0:-NO_OF_DECIMALS]
|
||||
second_part = matches[0][1][-NO_OF_DECIMALS:]
|
||||
first_part = '0' if first_part == '' else first_part
|
||||
|
||||
return (int(first_part) + (int(second_part) / (10.0 ** NO_OF_DECIMALS) )) * sign
|
||||
matches = re.findall("t=(\-?)(\d+)", filetext)
|
||||
sign = -1 if matches[0][0] == '-' else 1
|
||||
whole_reading = matches[0][1]
|
||||
first_part = matches[0][1][0:-NO_OF_DECIMALS]
|
||||
second_part = matches[0][1][-NO_OF_DECIMALS:]
|
||||
first_part = '0' if first_part == '' else first_part
|
||||
|
||||
return (int(first_part) + (int(second_part) / (10.0 ** NO_OF_DECIMALS) )) * sign
|
||||
except Exception as e:
|
||||
print 'errror'
|
||||
print e
|
||||
return -100.0
|
||||
|
||||
def read_many_thermo(filenames):
|
||||
result = []
|
||||
for filename in list(filenames):
|
||||
|
||||
Reference in New Issue
Block a user