deleted draining period and amount from config file as this does not work like i thought it would
This commit is contained in:
@@ -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'
|
||||
});
|
||||
|
||||
@@ -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()
|
||||
});
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user