fixed bug with rpio

This commit is contained in:
Senad Uka
2016-04-10 11:57:13 +02:00
parent 0b4a886de6
commit 3b8fb3dce4
2 changed files with 2 additions and 2 deletions

Binary file not shown.

View File

@@ -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)