From 4e3c774d72b3cefd4528dda476396a2f37a23398 Mon Sep 17 00:00:00 2001 From: yohan <783b8c87@scimetis.net> Date: Sat, 10 Feb 2024 00:13:42 +0100 Subject: [PATCH] Fix bug. --- read_one-wire_sensor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/read_one-wire_sensor.py b/read_one-wire_sensor.py index 5e899c9..4392627 100755 --- a/read_one-wire_sensor.py +++ b/read_one-wire_sensor.py @@ -17,7 +17,7 @@ args = parser.parse_args() try: returned_output = subprocess.check_output(["/usr/bin/owread", "-s", "localhost:4304", args.path]) try: - value = round(float(returned_output.decode("utf-8").strip().strip("'")), 1) + value = float(returned_output.decode("utf-8").strip().strip("'")) except ValueError: print ("Got garbage: "+returned_output) sys.exit(1) @@ -30,5 +30,5 @@ if "luminosity" in args.metric: # conversion en lm data[args.metric] = int(float(value) * 122900.45063498567) else: - data[args.metric] = value + data[args.metric] = round(value, 1) print(json.dumps(data))