meter reader logging improvenets

This commit is contained in:
Bogdan Vlaicu
2021-02-12 19:10:08 -05:00
parent b5f6cc815c
commit ecd5a32be5
3 changed files with 8 additions and 5 deletions
+2
View File
@@ -8,6 +8,8 @@ RUN apk add --no-cache curl
RUN apk add --no-cache python3 RUN apk add --no-cache python3
RUN apk add --no-cache nano RUN apk add --no-cache nano
RUN apk add cmd:pip3
# install .py script dependency # install .py script dependency
RUN pip3 install boto3 RUN pip3 install boto3
RUN pip3 install requests RUN pip3 install requests
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "Meter Reader", "name": "Meter Reader",
"version": "0.1.16", "version": "0.1.19",
"slug": "meterreader", "slug": "meterreader",
"homeassistant_api": "no", "homeassistant_api": "no",
"description": "Put a webcam in front of your utility meter and let AWS Rekognition push the reading over mqtt", "description": "Put a webcam in front of your utility meter and let AWS Rekognition push the reading over mqtt",
+5 -4
View File
@@ -48,7 +48,7 @@ def processor(base_low, baseline, base_up):
found = (response['TextDetections']) found = (response['TextDetections'])
reading = "" reading = ""
for item in found: for item in found:
print("Tekst:", item['DetectedText']) print("DetectedText:", item['DetectedText'])
print("Type:", item['Type']) print("Type:", item['Type'])
print("Confidence", item['Confidence']) print("Confidence", item['Confidence'])
print("Id", item['Id']) print("Id", item['Id'])
@@ -64,15 +64,16 @@ def processor(base_low, baseline, base_up):
try: try:
nw = int(temp) nw = int(temp)
except Exception: except Exception:
print("Conversion failed") print("Conversion to int failed")
pass pass
print("Nw: ", nw) print("Converted int: ", nw)
if (base_low <= nw and nw <= base_up): if (base_low <= nw and nw <= base_up):
print("erg waarschijnlijk juist:") print("Value found in range:")
reading = temp reading = temp
print(temp) print(temp)
print(base_low, nw, base_up) print(base_low, nw, base_up)
print("-----------") print("-----------")
print("Returning reading: ", reading)
return reading return reading