// Datenpunkte erstellen, 1 Device mit 3 Pumpen createDatapoints(1, 3); function createDatapoints(nDevCnt, nPumpCnt) { createState("Datenpunkte.SwimSpa.actualPowerConsumption", { read: true, write: true, name: "Momentanverbrauch in W", unit: 'W', type: "number", role: "value.power.consumption", desc: "Momentanverbrauch in W", def: 0, min: 0 }); let spaStates = {}; for (let nCurDev = 0; nCurDev < nDevCnt; nCurDev++) { spaStates[nCurDev.toString()] = nCurDev.toString(); } createState("Datenpunkte.SwimSpa.preferredHeating", 0, { read: true, write: true, name: "bevorzugtes Heizen", type: 'number', min: 0, max: nDevCnt-1, role: 'value', states: spaStates, desc: "ID des Whirlpool/SwimSpa der (bevorzugt) beheizt werden soll." }); createState("Datenpunkte.SwimSpa.preferredHeatingName", { read: true, write: false, name: "Name des bevorzugt beheizten Gerätes", type: "string", role: "info.name", desc: "Name des Gerätes das bevorzugt beheizt wird", def: "" }); createState("Datenpunkte.SwimSpa.automaticHeating", { read: true, write: true, name: "Automatisches Heizen", type: "boolean", role: "switch.enable", desc: "Automatisches Heizen aktiv/inaktiv", def: true }); // Variablen pro SpaController for (let nCurDev = 0; nCurDev < nDevCnt; nCurDev++) { createState("Datenpunkte.SwimSpa." + nCurDev + ".ID", { read: true, write: true, name: "ID", type: "string", role: "info.address", desc: "Geräte ID", def: "" }); createState("Datenpunkte.SwimSpa." + nCurDev + ".U_ID", { read: true, write: true, name: "U_ID", type: "string", role: "info.address", desc: "Geräte U_ID", def: "" }); createState("Datenpunkte.SwimSpa." + nCurDev + ".Name", { read: true, write: true, name: "Name", type: "string", role: "info", desc: "Name", def: "" }); createState("Datenpunkte.SwimSpa." + nCurDev + ".Temperatureinheit", { read: true, write: true, name: "Temperatureinheit", type: "string", role: "info", desc: "Temperatureinheit", def: "°C" }); createState("Datenpunkte.SwimSpa." + nCurDev + ".AktuelleTemperatur", { read: true, write: true, name: "AktuelleTemperatur", type: "number", role: "value.temperature", desc: "Aktuelle Temperatur", def: -1 }); createState("Datenpunkte.SwimSpa." + nCurDev + ".ZielTemperatur", { read: true, write: true, name: "ZielTemperatur", type: "number", role: "value.temperature", desc: "Zieltemperatur", def: -1 }); createState("Datenpunkte.SwimSpa." + nCurDev + ".EchteZielTemperatur", { read: true, write: true, name: "EchteZielTemperatur", type: "number", role: "value.temperature", desc: "Echte Zieltemperatur", def: -1 }); createState("Datenpunkte.SwimSpa." + nCurDev + ".Heizer", { read: true, write: true, name: "Heizer", type: "string", role: "info.status", desc: "Aktivität Heizer", def: "" }); createState("Datenpunkte.SwimSpa." + nCurDev + ".Wasserpflege", { read: true, write: true, name: "Wasserpflege", type: "string", role: "info.status", desc: "Status Wasserpflege", def: "" }); createState("Datenpunkte.SwimSpa." + nCurDev + ".WasserpflegeIndex", { read: true, write: true, name: "WasserpflegeIndex", type: "number", role: "info.status", desc: "Status Wasserpflege (Index)", def: -1 }); createState("Datenpunkte.SwimSpa." + nCurDev + ".WasserpflegeModi", { read: true, write: true, name: "WasserpflegeModi", type: "string", role: "text", desc: "Auswählbare Wasserpflegemodi", def: "" }); // Pumpen for (let nCurPump = 1; nCurPump < nPumpCnt+1; nCurPump++) { /*createState("Datenpunkte.SwimSpa." + nCurDev + ".Pumpen.TESTP" + nCurPump, { name: "Pumpe P" + nCurPump, role: "switch", desc: "Pumpe P" + nCurPump }); setObject("Datenpunkte.SwimSpa." + nCurDev + ".Pumpen.TESTP" + nCurPump, { common: { name: "Pumpe P" + nCurPump, role: "switch", desc: "Pumpe P" + nCurPump }, type: 'channel' });*/ createState("Datenpunkte.SwimSpa." + nCurDev + ".Pumpen.P" + nCurPump + ".Name", { read: true, write: true, name: "Name", type: "string", role: "info.name", desc: "Name der Pumpe", def: "" }); createState("Datenpunkte.SwimSpa." + nCurDev + ".Pumpen.P" + nCurPump + ".Modus", { read: true, write: true, name: "Modus", type: "string", role: "state", desc: "Aktueller Modus", def: "" }); createState("Datenpunkte.SwimSpa." + nCurDev + ".Pumpen.P" + nCurPump + ".Modi", { read: true, write: true, name: "Modi", type: "string", role: "text", desc: "Auswählbare Modi", def: "" }); } // Licht createState("Datenpunkte.SwimSpa." + nCurDev + ".Lichter.LI1", { name: "Beleuchtung", type: "channel", role: "light.switch", desc: "Beleuchtung" }); createState("Datenpunkte.SwimSpa." + nCurDev + ".Lichter.LI.Name", { read: true, write: true, name: "Name", type: "string", role: "info.name", desc: "Name des Lichts", def: "" }); createState("Datenpunkte.SwimSpa." + nCurDev + ".Lichter.LI.Is_On", { read: true, write: true, name: "Is_On", type: "boolean", role: "state", desc: "Aktueller Status", def: "" }); // Sensoren: Boolean var sSensors = ["FILTER STATUS:CLEAN", "FILTER STATUS:PURGE", "SMART WINTER MODE:ACTIVE"]; for (let i = 0; i < sSensors.length; i++) { createState("Datenpunkte.SwimSpa." + nCurDev + ".Sensoren." + sSensors[i].replace(/ /g, "_").replace(/:/g, "_") + ".Name", { read: true, write: true, name: "Name", type: "string", role: "info.name", desc: "Name des Sensors", def: "" }); createState("Datenpunkte.SwimSpa." + nCurDev + ".Sensoren." + sSensors[i].replace(/ /g, "_").replace(/:/g, "_") + ".State", { read: true, write: true, name: "State", type: "boolean", role: "state", desc: "Sensorstatus", def: "" }); } // Sensoren: String sSensors = ["CIRCULATING PUMP", "OZONE"]; for (let i = 0; i < sSensors.length; i++) { createState("Datenpunkte.SwimSpa." + nCurDev + ".Sensoren." + sSensors[i].replace(/ /g, "_").replace(/:/g, "_") + ".Name", { read: true, write: true, name: "Name", type: "string", role: "info.name", desc: "Name des Sensors", def: "" }); createState("Datenpunkte.SwimSpa." + nCurDev + ".Sensoren." + sSensors[i].replace(/ /g, "_").replace(/:/g, "_") + ".State", { read: true, write: true, name: "State", type: "string", role: "state", desc: "Sensorstatus", def: "" }); } // buttons for functions createState("Datenpunkte.SwimSpa." + nCurDev + ".enableHeating", { read: true, write: true, name: "enableHeating", type: "boolean", role: "button", desc: "Heizen aktivieren", def: false }); createState("Datenpunkte.SwimSpa." + nCurDev + ".disableHeating", { read: true, write: true, name: "disableHeating", type: "boolean", role: "button", desc: "Heizen deaktivieren", def: false }); } }