From 7509dfff60cd76d1c62081dcf8d69da1d4dc2f72 Mon Sep 17 00:00:00 2001 From: alex Date: Thu, 24 May 2018 15:04:03 +0200 Subject: [PATCH] Removed ceiling for measured values --- .../raspberrypi-mqtt-light-sensor.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/raspberrypi-mqtt-light-sensor/raspberrypi-mqtt-light-sensor.py b/raspberrypi-mqtt-light-sensor/raspberrypi-mqtt-light-sensor.py index d44e89f..4880c79 100644 --- a/raspberrypi-mqtt-light-sensor/raspberrypi-mqtt-light-sensor.py +++ b/raspberrypi-mqtt-light-sensor/raspberrypi-mqtt-light-sensor.py @@ -1,6 +1,6 @@ """ -Measures the time how long it takes to charge a capacity, averages 10 measurement -and publishes the result via mqtt. +Measures the time how long it takes to charge a capacity, averages 10 measurement +and publishes the result via mqtt. """ import RPi.GPIO as GPIO @@ -52,12 +52,12 @@ def charge_time_ms(pin): delta_t = datetime.now() - start_time elapsed = delta_t.total_seconds() * 1000 + (delta_t.microseconds / 1000) - return math.ceil(elapsed) + return elapsed def mqtt_publish(mqtt_server, topic, value): """ - Publishes the new measured value via mqtt. + Publishes the new measured value via mqtt. """ mqttc = mqtt.Client() mqttc.connect(__MQTT_SERVER) @@ -83,7 +83,7 @@ def mqtt_publish(mqtt_server, topic, value): help='Defines the mqtt topic.') args = parser.parse_args() - + if args.pin is not None: __PIN = args.pin