Fix bug.
This commit is contained in:
parent
b02aecfb89
commit
4e3c774d72
@ -17,7 +17,7 @@ args = parser.parse_args()
|
|||||||
try:
|
try:
|
||||||
returned_output = subprocess.check_output(["/usr/bin/owread", "-s", "localhost:4304", args.path])
|
returned_output = subprocess.check_output(["/usr/bin/owread", "-s", "localhost:4304", args.path])
|
||||||
try:
|
try:
|
||||||
value = round(float(returned_output.decode("utf-8").strip().strip("'")), 1)
|
value = float(returned_output.decode("utf-8").strip().strip("'"))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
print ("Got garbage: "+returned_output)
|
print ("Got garbage: "+returned_output)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
@ -30,5 +30,5 @@ if "luminosity" in args.metric:
|
|||||||
# conversion en lm
|
# conversion en lm
|
||||||
data[args.metric] = int(float(value) * 122900.45063498567)
|
data[args.metric] = int(float(value) * 122900.45063498567)
|
||||||
else:
|
else:
|
||||||
data[args.metric] = value
|
data[args.metric] = round(value, 1)
|
||||||
print(json.dumps(data))
|
print(json.dumps(data))
|
||||||
|
Loading…
Reference in New Issue
Block a user