diff --git a/app/client/sensorData.html b/app/client/sensorData.html
index d72211c..1d9b4fc 100644
--- a/app/client/sensorData.html
+++ b/app/client/sensorData.html
@@ -1,3 +1,3 @@
- {{owner}} / {{temperatureValue}}°C / {{humidityValue}}% / {{created_at_formatted}}
+ {{owner}} / {{temperatureValue}}°C / {{humidityValue}}% / Bačva puna: {{tankFull}} / {{created_at_formatted}}
diff --git a/app/server/api.js b/app/server/api.js
index 62157c4..a51b182 100644
--- a/app/server/api.js
+++ b/app/server/api.js
@@ -11,6 +11,7 @@ Api.addRoute('sensorData', {
SensorData.insert({
temperatureValue: parseFloat(this.bodyParams.temperatureValue),
humidityValue: parseFloat(this.bodyParams.humidityValue),
+ tankFull: this.bodyParams.tankFull,
owner: this.bodyParams.owner,
created_at: new Date()
});
diff --git a/app/server/startup.js b/app/server/startup.js
index 0bb8176..c54c355 100644
--- a/app/server/startup.js
+++ b/app/server/startup.js
@@ -22,6 +22,7 @@ if (Meteor.isServer) {
SensorData.insert({
temperatureValue: parseFloat(this.bodyParams.temperatureValue),
humidityValue: parseFloat(this.bodyParams.humidityValue),
+ tankFull: this.bodyParams.tankFull,
owner: this.bodyParams.owner,
created_at: new Date()
});
diff --git a/controller/config/__init__.py b/controller/config/__init__.py
index 6df2f0a..68d0971 100644
--- a/controller/config/__init__.py
+++ b/controller/config/__init__.py
@@ -2,6 +2,7 @@
GPIO_PIN_DHT = 4 # BCM
SENSORDATA_URL = 'http://tfm.meteor.com/api/sensorData'
+GPIO_PIN_TANKFULL = 20 # BCM
GPIO_PIN_VALVE = 21 # BCM
API_BASE_URL = 'http://tfm.meteor.com/api'
CONTROLLER_ID = '120' # every controller must have a different one
diff --git a/controller/sensors.py b/controller/sensors.py
index 86fe43e..7c937ee 100644
--- a/controller/sensors.py
+++ b/controller/sensors.py
@@ -3,8 +3,17 @@ import sys
import requests
import Adafruit_DHT
import config
+import config
+import RPi.GPIO as GPIO
+# Try to read the state of GPIO_PIN_TANKFULL
+GPIO.setmode(GPIO.BCM)
+GPIO.setup(config.GPIO_PIN_TANKFULL, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
+tankFull = GPIO.input(config.GPIO_PIN_TANKFULL)
+GPIO.cleanup()
+print 'Bacva puna: {}'.format(tankFull)
+# Go on to DHT
SENSOR_TYPE = Adafruit_DHT.DHT11
if len(sys.argv) == 3:
@@ -27,7 +36,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})
+ response = requests.post(config.SENSORDATA_URL, json={"owner": owner, "temperatureValue": temperature, "humidityValue":humidity, "tankFull":tankFull})
print 'Temp={0:0.1f}*C'.format(temperature)
print 'Humidity={0:0.1f}%'.format(humidity)
if response.status_code != 200: