|
|
|
@ -46,7 +46,7 @@ export class ConfigurationPage {
|
|
|
|
|
|
|
|
|
|
return returnValue;
|
|
|
|
|
}
|
|
|
|
|
async uploadStandardSketch(){
|
|
|
|
|
uploadStandardSketch() {
|
|
|
|
|
var values = {
|
|
|
|
|
SSID: this.ssid,
|
|
|
|
|
PASSWORD: this.pw,
|
|
|
|
@ -54,16 +54,31 @@ export class ConfigurationPage {
|
|
|
|
|
SENSEBOX_ID: this.senseboxid,
|
|
|
|
|
defineSensors: this.buildDefines(),
|
|
|
|
|
NUM_SENSORS: this.sensors.length,
|
|
|
|
|
TEMPERSENSOR_ID:this.temp,
|
|
|
|
|
RELLUFSENSOR_ID:this.humi,
|
|
|
|
|
BELEUCSENSOR_ID:this.lux,
|
|
|
|
|
UVINTESENSOR_ID:this.uv,
|
|
|
|
|
LUFTDRSENOSR_ID:this.pressure,
|
|
|
|
|
REGENMSENSOR_ID:this.rain,
|
|
|
|
|
PM10SENSOR_ID:this.pm10,
|
|
|
|
|
PM25SENSOR_ID:this.pm25
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
this.sensors.map((sensor)=>{
|
|
|
|
|
switch (sensor.typ) {
|
|
|
|
|
case "HDC1080":
|
|
|
|
|
values["TEMPERSENSOR_ID"] = sensor.id
|
|
|
|
|
values["RELLUFSENSOR_ID"] = sensor.id2
|
|
|
|
|
break;
|
|
|
|
|
case "BMP280":
|
|
|
|
|
values["LUFTDRSENSOR_ID"] = sensor.id
|
|
|
|
|
break;
|
|
|
|
|
case "TSL45315":
|
|
|
|
|
values["BELEUCSENSOR_ID"] = sensor.id
|
|
|
|
|
break;
|
|
|
|
|
case "VEML6070":
|
|
|
|
|
values["UVINTESENSOR_ID"] = sensor.id
|
|
|
|
|
break;
|
|
|
|
|
case "SDS1001":
|
|
|
|
|
values["PM10SENSORID"] = sensor.id
|
|
|
|
|
values["PM25SENSOR_ID"] = sensor.id2
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
this.http.get("assets/templates/homev2Wifi.tpl", { responseType: "text" }).subscribe(data => {
|
|
|
|
|
let sketch = this.applyTemplate(data, values);
|
|
|
|
|
console.log(sketch)
|
|
|
|
@ -73,7 +88,7 @@ export class ConfigurationPage {
|
|
|
|
|
buildDefines() {
|
|
|
|
|
let defineString = ""
|
|
|
|
|
this.sensors.map((sensor) => {
|
|
|
|
|
defineString+="#define "+sensor.type+"_CONNECTED\n"
|
|
|
|
|
defineString += "#define " + sensor.typ + "_CONNECTED\n"
|
|
|
|
|
})
|
|
|
|
|
return defineString;
|
|
|
|
|
}
|
|
|
|
@ -109,7 +124,7 @@ export class ConfigurationPage {
|
|
|
|
|
|
|
|
|
|
ionViewDidLoad() {
|
|
|
|
|
this.sensors = [
|
|
|
|
|
{title:"Temperatur",type:"HDC1080",id:"09327523"},
|
|
|
|
|
{ typ: "HDC1080", id: "5bb610bf043f3f001b6a4c55" },
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|