fixed bug with rpio
This commit is contained in:
BIN
app/app.tar.gz
BIN
app/app.tar.gz
Binary file not shown.
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user