diff --git a/app/app.tar.gz b/app/app.tar.gz index c31d43d..9dd0b76 100644 Binary files a/app/app.tar.gz and b/app/app.tar.gz differ diff --git a/controller/sensors.py b/controller/sensors.py index 2981731..fe08568 100644 --- a/controller/sensors.py +++ b/controller/sensors.py @@ -11,7 +11,7 @@ GPIO.setup(config.GPIO_PIN_TANKFULL, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) # tank sensor has inverse logic - 0 when it is full 1 when it is not # so we are inverting its value here -tankFull = (not GPIO.input(config.GPIO_PIN_TANKFULL)) +tankFull = not (GPIO.input(config.GPIO_PIN_TANKFULL) == GPIO.LOW) GPIO.cleanup() print 'Bacva puna: {}'.format(tankFull) @@ -32,7 +32,7 @@ humidity, temperature = Adafruit_DHT.read_retry(SENSOR_TYPE, config.GPIO_PIN_DHT # guarantee the timing of calls to read the sensor). # If this happens try again! if temperature is not None and humidity is not None: - response = requests.post(config.SENSORDATA_URL, json={"owner": owner, "temperatureValue": temperature, "humidityValue":humidity, "tankFull":tankFull, + response = requests.post(config.SENSORDATA_URL, json={"owner": owner, "temperatureValue": temperature, "humidityValue":humidity, "tankFull": "1" if tankFull else "0", "controllerId": controller_id }) print 'Temp={0:0.1f}*C'.format(temperature)