diff --git a/app/server/api.js b/app/server/api.js index 1768804..7540ac8 100644 --- a/app/server/api.js +++ b/app/server/api.js @@ -21,8 +21,6 @@ Api.addRoute('sensorData', { tankFull: this.bodyParams.tankFull, startPumpingAt: this.bodyParams.startPumpingAt, stopPumpingAt: this.bodyParams.stopPumpingAt, - drainingPeriodUnit: parseInt(this.bodyParams.drainingPeriodUnit), - drainingPeriodAmount: this.bodyParams.drainingPeriodAmount, owner: this.bodyParams.owner, controllerId: this.bodyParams.controllerId, created_at: new Date() @@ -118,8 +116,8 @@ function stateOrDefault(id) { }, time: new Date(), config: { - draining_period_amount: drainingPeriodAmount, - draining_period_unit: drainingPeriodUnit + draining_period_amount: 40, + draining_period_unit: 'minutes' }, set_by: 'server' }); diff --git a/app/server/startup.js b/app/server/startup.js index b09abbe..9471617 100644 --- a/app/server/startup.js +++ b/app/server/startup.js @@ -26,8 +26,6 @@ if (Meteor.isServer) { tankFull: this.bodyParams.tankFull, startPumpingAt: this.bodyParams.startPumpingAt, stopPumpingAt: this.bodyParams.stopPumpingAt, - drainingPeriodUnit: parseInt(this.bodyParams.drainingPeriodUnit), - drainingPeriodAmount: this.bodyParams.drainingPeriodAmount, owner: this.bodyParams.owner, created_at: new Date() }); diff --git a/controller/config/copy__init__.py.example b/controller/config/copy__init__.py.example index 31d96a7..453bf67 100644 --- a/controller/config/copy__init__.py.example +++ b/controller/config/copy__init__.py.example @@ -12,8 +12,6 @@ GPIO_PIN_OUT_VALVE = 21 # BCM GPIO_PIN_IN_VALVE = 18 # BCM START_PUMPING_AT = 'TANKLEVEL4' STOP_PUMPING_AT = 'TANKFULL' -DRAINING_PERIOD_AMOUNT = 40 -DRAINING_PERIOD_UNIT = 'minutes' API_BASE_URL = 'http://agrar.zoblak.com/api/v1.0' CONTROLLER_ID = '120' # every controller must have a different one STATE_FILE = '/var/run/controller_state' diff --git a/controller/sensors.py b/controller/sensors.py index ad240d4..9bfa85e 100644 --- a/controller/sensors.py +++ b/controller/sensors.py @@ -35,8 +35,6 @@ print 'Bacva puna: {}'.format(tankFull) SENSOR_TYPE = Adafruit_DHT.DHT11 controller_id = config.CONTROLLER_ID owner = "Controller: %s" % controller_id -drainingPeriodAmount = config.DRAINING_PERIOD_AMOUNT -drainingPeriodUnit = config.DRAINING_PERIOD_UNIT startPumpingAt = config.START_PUMPING_AT stopPumpingAt = config.STOP_PUMPING_AT @@ -53,7 +51,7 @@ humidity, temperature = Adafruit_DHT.read_retry(SENSOR_TYPE, config.GPIO_PIN_DHT # 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, "tankLevel0": "1" if tankLevel0 else "0","tankLevel1": "1" if tankLevel1 else "0","tankLevel2": "1" if tankLevel2 else "0","tankLevel3": "1" if tankLevel3 else "0", "tankLevel4": "1" if tankLevel4 else "0", "tankFull": "1" if tankFull else "0", - "startPumpingAt": startPumpingAt,"stopPumpingAt": stopPumpingAt,"drainingPeriodAmount":drainingPeriodAmount,"drainingPeriodUnit":drainingPeriodUnit,"controllerId": controller_id + "startPumpingAt": startPumpingAt,"stopPumpingAt": stopPumpingAt,"controllerId": controller_id }) print 'Temp={0:0.1f}*C'.format(temperature) print 'Humidity={0:0.1f}%'.format(humidity)