let factors = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
let ZoneOnOffCopy;
let GroupIDCopy;
let TargetCopy;
let ModusCopy;
let RampCopy;
let LowerCopy;
let BoostCopy;
let buttons_apply = [];
let button_back;
let GetSettingsStatus = 0;
let myIndex;
let selected_Zones = [];

class ApplySettingsForZone {

    constructor(buttons_apply,button_back) {
        this.buttons_apply = buttons_apply;
        this.button_back = button_back;
    }
    init(mainViewModel) {
        this.mainViewModel = mainViewModel;
            buttons_apply[0] = document.getElementById("lvd6c7f335ef8fa4720b511a83fe5f28163");
            buttons_apply[1] = document.getElementById("lvdb55d376007ae48c8a7a17ba22686a5e9");
            buttons_apply[2] = document.getElementById("lvd253529f96d6e4533b4c67e2d80884ad4");
            buttons_apply[3] = document.getElementById("lvdf5a07d01e1f14188944ff76af7c99537");
            buttons_apply[4] = document.getElementById("lvd1091a2a59ecf4d129cc8068e563f9250");
            buttons_apply[5] = document.getElementById("lvd6961ff2ace2c4cf2b835d7b8b0b5a53c");
            buttons_apply[6] = document.getElementById("lvd38bc808fbdf24f9aaed474758705a44d");
            buttons_apply[7] = document.getElementById("lvdf9cfc69385ec40548606e461c4ed7e9b");
            buttons_apply[8] = document.getElementById("lvd60f8d34385174f52bed8384bda03edcb");
            buttons_apply[9] = document.getElementById("lvd802bc85a249948ba911c2fc90360a229");
            buttons_apply[10] = document.getElementById("lvd510fc792bbee4c4d8a2817a607860573");
            buttons_apply[11] = document.getElementById("lvd0b9c5b03e4594e2f8323320e1aa45d45");
            buttons_apply[12] = document.getElementById("lvdb89fcd4a5d094db285f6bfccd5d47456");
            buttons_apply[13] = document.getElementById("lvd3ea4897308d14753ba24316c0ac51f94");
            buttons_apply[14] = document.getElementById("lvdc933ea361b2e4627beb9853303b1a74d");
            buttons_apply[15] = document.getElementById("lvdd200c64cb51c4e31804d5be623e2ca88");
            buttons_apply[16] = document.getElementById("lvd6c780d67a0c84e73ac2762d614e82c71");
            buttons_apply[17] = document.getElementById("lvdf20f58159e3747eab5b1a3ec19d4e888");
            buttons_apply[18] = document.getElementById("lvd743828665d404c74a2c9335b66cd9f74");
            buttons_apply[19] = document.getElementById("lvd048bee2c512948b293c5e39b39168e1c");
            buttons_apply[20] = document.getElementById("lvd4866dfe5b79f423c817c137e6279a7d9");
            buttons_apply[21] = document.getElementById("lvdcbe6be9b46ed4b57a2d34ca74ab89bbc");
            buttons_apply[22] = document.getElementById("lvd816a3d93e8264c7cba08d38b236a1700");
            buttons_apply[23] = document.getElementById("lvd96a2768099844ba6a43a0838df900f5a");
            button_back = document.getElementById("lvdeb5ee04fb78f49a88d258c9aa1d85f9c");
            ApplySettings.initApplySettings(buttons_apply, button_back);
            this.initialized = true;
    }

    cleanUp(mainViewModel) {
// Add your own cleanUp code

        this.initialized = false;
    }

    onActiveChanged(active) {

// Add your own active state handling code

        this.active = active;
}

    static create(buttons_apply) {
        return new ApplySettingsForZone(buttons_apply,button_back);
    }

}

class ApplySettings {

    static initApplySettings(buttons_apply,button_back) {
        if (window.sigApi !== undefined) {
            const fm = new ApplySettings(window.sigApi,buttons_apply,button_back);
        } else {
            // ist sigApi noch nicht geladen, als EventListener fuer 'SigApiReady' registrieren
            window.addEventListener('SigApiReady', () => {
                const fm = new ApplySettings(window.sigApi,buttons_apply,button_back);
            });
        }
    }

    constructor(api, buttons_apply,button_back) {

        this.events = null;
        this.eventMediator = null;
        this.datapointAPI = null;
        this._initAPIs(api);

        this.buttons_apply =  buttons_apply;
        this.button_back = button_back;
        this._registerEvents(buttons_apply,button_back);
    }

    _initAPIs(api) {
        if ((api !== null) && (api !== undefined)) {
            if (api.datapointManager !== undefined) {
                this.datapointAPI = api.datapointManager;
            }
            if (api.eventMediator !== undefined) {
                this.eventMediator = api.eventMediator;
            }
            if (api.events !== undefined) {
                this.events = api.events;
            }
        }
    }

    _registerEvents(buttons_apply,button_back) {

        let key = 0;
        let Button1 = 0;
        let Button2 = 0;
        let MultipleSelectionOn = 0;

        button_back.addEventListener("click", () => {

            key = 0;

        });

        for (let index = 0; index < buttons_apply.length; index++) {
            buttons_apply[index].addEventListener("mouseover", () => {

                this.datapointAPI.readDataPoint('10:Global_Set1.MultipleSelectionOfZones', 0)
                    .then((resolve) => {
                        MultipleSelectionOn = resolve.value;

                        if (MultipleSelectionOn === 2) {
                            this.switchFunktion(index);
                        }

            });});
        }

        for (let index = 0; index < buttons_apply.length; index++) {
            buttons_apply[index].addEventListener("click", () => {
                this.datapointAPI.readDataPoint('10:Global_Set1.MultipleSelectionOfZones', 0)
                        .then((resolve) => {
                            MultipleSelectionOn = resolve.value;

                            if (MultipleSelectionOn === 1) {
                                        key++;
                                        if (key === 1) {
                                            Button1 = index;
                                            buttons_apply[index].style.border = "medium solid #0000FF";
                                        }
                                        if (key === 2) {
                                            Button2 = index;
                                            buttons_apply[Button1].style.border = "";
                                            key = 0;
                                            if (Button1 <= Button2) {
                                                        for (let ind = Button1; ind <= Button2; ind++) {
                                                            this.switchFunktion(ind);
                                                        }
                                                    } else {
                                                        this.switchFunktion(Button2);
                                                        this.switchFunktion(Button1);
                                                    }
                                        }
                                    } // END IF MULTIPLE SELECTION
                                    else if (MultipleSelectionOn === 0) {
                                        this.switchFunktion(index);
                                    }  // END ELSE MULTIPLE SELECTION
                                });});
        } // END FOR

        if ((this.eventMediator !== null) && (this.eventMediator !== undefined) && (this.events !== null) && (this.events !== undefined)) {
    this.eventMediator.subscribe(this.events.getUserDefinedInternalEvent('OpenWindowApplySettings'), () => {
                this.datapointAPI.readDataPoint('10:ZoneSettingsCopy1.ZoneOn', 0)
                    .then((resolve) => {
                        ZoneOnOffCopy = resolve.value;
                        this.datapointAPI.readDataPoint('10:ZoneSettingsCopy1.GroupID', 0)
                            .then((resolve) => {
                                GroupIDCopy = resolve.value;
                                this.datapointAPI.readDataPoint('10:ZoneSettingsCopy1.TargetTemperatur', 0)
                                    .then((resolve) => {
                                        TargetCopy = resolve.value;
                                        this.datapointAPI.readDataPoint('10:ZoneSettingsCopy1.Mode', 0)
                                            .then((resolve) => {
                                                ModusCopy = resolve.value;
                                                this.datapointAPI.readDataPoint('10:ZoneSettingsCopy1.Rampe', 0)
                                                    .then((resolve) => {
                                                        RampCopy = resolve.value;
                                                        this.datapointAPI.readDataPoint('10:ZoneSettingsCopy1.Lower', 0)
                                                            .then((resolve) => {
                                                                LowerCopy = resolve.value;
                                                                this.datapointAPI.readDataPoint('10:ZoneSettingsCopy1.Boost', 0)
                                                                    .then((resolve) => {
                                                                        BoostCopy = resolve.value;
                                                                        factors = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
                                                                        sigApi.datapointManager.readDataPoint('10:SelectedZone1.ZoneID', 0)
                                                                            .then((resolve) => {
                                                                                for (let index = 0; index < buttons_apply.length; index++) {
                                                                                    if (index === (resolve.value - 1)){
                                                                                        buttons_apply[index].style.border = "medium solid #00ff00";
                                                                                        buttons_apply[index].style.backgroundColor = "#298A08"


                                                                                        //    buttons_apply[index].style.backgroundColor = "#ff0000";
                                                                                    }
                                                                                    else {
                                                                                        buttons_apply[index].style.border = "";
                                                                                        buttons_apply[index].style.backgroundColor= "#BEBEBE";
                                                                                    }
                                                                                }
                                                                            });
                                                                    });
                                                            });
                                                    });
                                            });
                                    });
                            });
                    });
            });

            this.eventMediator.subscribe(this.events.getUserDefinedInternalEvent('ApplySettingsForZone1'), () => {
                this.datapointAPI.readDataPoint('10:Zone1.GetSettings', 0)
                    .then((resolve) => {
                        if (resolve.value === 1){
                            this.datapointAPI.readDataPoint('10:Zone1.FactorsCheck', 0)
                                .then((resolve) => {
                                    factors[0] = resolve.value;
                                    selected_Zones.push(1);
                                });
                        }
                        else {
                            factors[0] = 0;
                            myIndex = selected_Zones.indexOf(1);
                            if (myIndex !== -1) {
                                selected_Zones.splice(myIndex, 1);
                            }
                        }
                    });
            });

            this.eventMediator.subscribe(this.events.getUserDefinedInternalEvent('ApplySettingsForZone2'), () => {
                this.datapointAPI.readDataPoint('10:Zone2.GetSettings', 0)
                    .then((resolve) => {
                        if (resolve.value === 1){
                            this.datapointAPI.readDataPoint('10:Zone2.FactorsCheck', 0)
                                .then((resolve) => {
                                    factors[1] = resolve.value;
                                    selected_Zones.push(2);
                                });
                        }
                        else {
                            factors[1] = 0;
                            myIndex = selected_Zones.indexOf(2);
                            if (myIndex !== -1) {
                                selected_Zones.splice(myIndex, 1);
                            }
                        }
                    });
            });

            this.eventMediator.subscribe(this.events.getUserDefinedInternalEvent('ApplySettingsForZone3'), () => {
                this.datapointAPI.readDataPoint('10:Zone3.GetSettings', 0)
                    .then((resolve) => {
                        if (resolve.value === 1){
                            this.datapointAPI.readDataPoint('10:Zone3.FactorsCheck', 0)
                                .then((resolve) => {
                                    factors[2] = resolve.value;
                                    selected_Zones.push(3);
                                });
                        }
                        else {
                            factors[2] = 0;
                            myIndex = selected_Zones.indexOf(3);
                            if (myIndex !== -1) {
                                selected_Zones.splice(myIndex, 1);
                            }
                        }
                    });
            });

            this.eventMediator.subscribe(this.events.getUserDefinedInternalEvent('ApplySettingsForZone4'), () => {
                this.datapointAPI.readDataPoint('10:Zone4.GetSettings', 0)
                    .then((resolve) => {
                        if (resolve.value === 1){
                            this.datapointAPI.readDataPoint('10:Zone4.FactorsCheck', 0)
                                .then((resolve) => {
                                    factors[3] = resolve.value;
                                    selected_Zones.push(4);
                                });
                        }
                        else {
                            factors[3] = 0;
                            myIndex = selected_Zones.indexOf(4);
                            if (myIndex !== -1) {
                                selected_Zones.splice(myIndex, 1);
                            }
                        }
                    });
            });

            this.eventMediator.subscribe(this.events.getUserDefinedInternalEvent('ApplySettingsForZone5'), () => {
                this.datapointAPI.readDataPoint('10:Zone5.GetSettings', 0)
                    .then((resolve) => {
                        if (resolve.value === 1){
                            this.datapointAPI.readDataPoint('10:Zone5.FactorsCheck', 0)
                                .then((resolve) => {
                                    factors[4] = resolve.value;
                                    selected_Zones.push(5);
                                });
                        }
                        else {
                            factors[4] = 0;
                            myIndex = selected_Zones.indexOf(5);
                            if (myIndex !== -1) {
                                selected_Zones.splice(myIndex, 1);
                            }
                        }
                    });
            });

            this.eventMediator.subscribe(this.events.getUserDefinedInternalEvent('ApplySettingsForZone6'), () => {
                this.datapointAPI.readDataPoint('10:Zone6.GetSettings', 0)
                    .then((resolve) => {
                        if (resolve.value === 1){
                            this.datapointAPI.readDataPoint('10:Zone6.FactorsCheck', 0)
                                .then((resolve) => {
                                    factors[5] = resolve.value;
                                    selected_Zones.push(6);
                                });
                        }
                        else {
                            factors[5] = 0;
                            myIndex = selected_Zones.indexOf(6);
                            if (myIndex !== -1) {
                                selected_Zones.splice(myIndex, 1);
                            }
                        }
                    });
            });

            this.eventMediator.subscribe(this.events.getUserDefinedInternalEvent('ApplySettingsForZone7'), () => {
                this.datapointAPI.readDataPoint('10:Zone7.GetSettings', 0)
                    .then((resolve) => {
                        if (resolve.value === 1){
                            this.datapointAPI.readDataPoint('10:Zone7.FactorsCheck', 0)
                                .then((resolve) => {
                                    factors[6] = resolve.value;
                                    selected_Zones.push(7);
                                });
                        }
                        else {
                            factors[6] = 0;
                            myIndex = selected_Zones.indexOf(7);
                            if (myIndex !== -1) {
                                selected_Zones.splice(myIndex, 1);
                            }
                        }
                    });
            });

            this.eventMediator.subscribe(this.events.getUserDefinedInternalEvent('ApplySettingsForZone8'), () => {
                this.datapointAPI.readDataPoint('10:Zone8.GetSettings', 0)
                    .then((resolve) => {
                        if (resolve.value === 1){
                            this.datapointAPI.readDataPoint('10:Zone8.FactorsCheck', 0)
                                .then((resolve) => {
                                    factors[7] = resolve.value;
                                    selected_Zones.push(8);
                                });
                        }
                        else {
                            factors[7] = 0;
                            myIndex = selected_Zones.indexOf(8);
                            if (myIndex !== -1) {
                                selected_Zones.splice(myIndex, 1);
                            }
                        }
                    });
            });

            this.eventMediator.subscribe(this.events.getUserDefinedInternalEvent('ApplySettingsForZone9'), () => {
                this.datapointAPI.readDataPoint('10:Zone9.GetSettings', 0)
                    .then((resolve) => {
                        if (resolve.value === 1){
                            this.datapointAPI.readDataPoint('10:Zone9.FactorsCheck', 0)
                                .then((resolve) => {
                                    factors[8] = resolve.value;
                                    selected_Zones.push(9);
                                });
                        }
                        else {
                            factors[8] = 0;
                            myIndex = selected_Zones.indexOf(9);
                            if (myIndex !== -1) {
                                selected_Zones.splice(myIndex, 1);
                            }
                        }
                    });
            });

            this.eventMediator.subscribe(this.events.getUserDefinedInternalEvent('ApplySettingsForZone10'), () => {
                this.datapointAPI.readDataPoint('10:Zone10.GetSettings', 0)
                    .then((resolve) => {
                        if (resolve.value === 1){
                            this.datapointAPI.readDataPoint('10:Zone10.FactorsCheck', 0)
                                .then((resolve) => {
                                    factors[9] = resolve.value;
                                    selected_Zones.push(10);
                                });
                        }
                        else {
                            factors[9] = 0;
                            myIndex = selected_Zones.indexOf(10);
                            if (myIndex !== -1) {
                                selected_Zones.splice(myIndex, 1);
                            }
                        }
                    });
            });

            this.eventMediator.subscribe(this.events.getUserDefinedInternalEvent('ApplySettingsForZone11'), () => {
                this.datapointAPI.readDataPoint('10:Zone11.GetSettings', 0)
                    .then((resolve) => {
                        if (resolve.value === 1){
                            this.datapointAPI.readDataPoint('10:Zone11.FactorsCheck', 0)
                                .then((resolve) => {
                                    factors[10] = resolve.value;
                                    selected_Zones.push(11);
                                });
                        }
                        else {
                            factors[10] = 0;
                            myIndex = selected_Zones.indexOf(11);
                            if (myIndex !== -1) {
                                selected_Zones.splice(myIndex, 1);
                            }
                        }
                    });
            });

            this.eventMediator.subscribe(this.events.getUserDefinedInternalEvent('ApplySettingsForZone12'), () => {
                this.datapointAPI.readDataPoint('10:Zone12.GetSettings', 0)
                    .then((resolve) => {
                        if (resolve.value === 1){
                            this.datapointAPI.readDataPoint('10:Zone12.FactorsCheck', 0)
                                .then((resolve) => {
                                    factors[11] = resolve.value;
                                    selected_Zones.push(12);
                                });
                        }
                        else {
                            factors[11] = 0;
                            myIndex = selected_Zones.indexOf(12);
                            if (myIndex !== -1) {
                                selected_Zones.splice(myIndex, 1);
                            }
                        }
                    });
            });

            this.eventMediator.subscribe(this.events.getUserDefinedInternalEvent('ApplySettingsForZone13'), () => {
                this.datapointAPI.readDataPoint('10:Zone13.GetSettings', 0)
                    .then((resolve) => {
                        if (resolve.value === 1){
                            this.datapointAPI.readDataPoint('10:Zone13.FactorsCheck', 0)
                                .then((resolve) => {
                                    factors[12] = resolve.value;
                                    selected_Zones.push(13);
                                });
                        }
                        else {
                            factors[12] = 0;
                            myIndex = selected_Zones.indexOf(13);
                            if (myIndex !== -1) {
                                selected_Zones.splice(myIndex, 1);
                            }
                        }
                    });
            });

            this.eventMediator.subscribe(this.events.getUserDefinedInternalEvent('ApplySettingsForZone14'), () => {
                this.datapointAPI.readDataPoint('10:Zone14.GetSettings', 0)
                    .then((resolve) => {
                        if (resolve.value === 1){
                            this.datapointAPI.readDataPoint('10:Zone14.FactorsCheck', 0)
                                .then((resolve) => {
                                    factors[13] = resolve.value;
                                    selected_Zones.push(14);
                                });
                        }
                        else {
                            factors[13] = 0;
                            myIndex = selected_Zones.indexOf(14);
                            if (myIndex !== -1) {
                                selected_Zones.splice(myIndex, 1);
                            }
                        }
                    });
            });

            this.eventMediator.subscribe(this.events.getUserDefinedInternalEvent('ApplySettingsForZone15'), () => {
                this.datapointAPI.readDataPoint('10:Zone15.GetSettings', 0)
                    .then((resolve) => {
                        if (resolve.value === 1){
                            this.datapointAPI.readDataPoint('10:Zone15.FactorsCheck', 0)
                                .then((resolve) => {
                                    factors[14] = resolve.value;
                                    selected_Zones.push(15);
                                });
                        }
                        else {
                            factors[14] = 0;
                            myIndex = selected_Zones.indexOf(15);
                            if (myIndex !== -1) {
                                selected_Zones.splice(myIndex, 1);
                            }
                        }
                    });
            });

            this.eventMediator.subscribe(this.events.getUserDefinedInternalEvent('ApplySettingsForZone16'), () => {
                this.datapointAPI.readDataPoint('10:Zone16.GetSettings', 0)
                    .then((resolve) => {
                        if (resolve.value === 1){
                            this.datapointAPI.readDataPoint('10:Zone16.FactorsCheck', 0)
                                .then((resolve) => {
                                    factors[15] = resolve.value;
                                    selected_Zones.push(16);
                                });
                        }
                        else {
                            factors[15] = 0;
                            myIndex = selected_Zones.indexOf(16);
                            if (myIndex !== -1) {
                                selected_Zones.splice(myIndex, 1);
                            }
                        }
                    });
            });

            this.eventMediator.subscribe(this.events.getUserDefinedInternalEvent('ApplySettingsForZone17'), () => {
                this.datapointAPI.readDataPoint('10:Zone17.GetSettings', 0)
                    .then((resolve) => {
                        if (resolve.value === 1){
                            this.datapointAPI.readDataPoint('10:Zone17.FactorsCheck', 0)
                                .then((resolve) => {
                                    factors[16] = resolve.value;
                                    selected_Zones.push(17);
                                });
                        }
                        else {
                            factors[16] = 0;
                            myIndex = selected_Zones.indexOf(17);
                            if (myIndex !== -1) {
                                selected_Zones.splice(myIndex, 1);
                            }
                        }
                    });
            });

            this.eventMediator.subscribe(this.events.getUserDefinedInternalEvent('ApplySettingsForZone18'), () => {
                this.datapointAPI.readDataPoint('10:Zone18.GetSettings', 0)
                    .then((resolve) => {
                        if (resolve.value === 1){
                            this.datapointAPI.readDataPoint('10:Zone18.FactorsCheck', 0)
                                .then((resolve) => {
                                    factors[17] = resolve.value;
                                    selected_Zones.push(18);
                                });
                        }
                        else {
                            factors[17] = 0;
                            myIndex = selected_Zones.indexOf(18);
                            if (myIndex !== -1) {
                                selected_Zones.splice(myIndex, 1);
                            }
                        }
                    });
            });

            this.eventMediator.subscribe(this.events.getUserDefinedInternalEvent('ApplySettingsForZone19'), () => {
                this.datapointAPI.readDataPoint('10:Zone19.GetSettings', 0)
                    .then((resolve) => {
                        if (resolve.value === 1){
                            this.datapointAPI.readDataPoint('10:Zone19.FactorsCheck', 0)
                                .then((resolve) => {
                                    factors[18] = resolve.value;
                                    selected_Zones.push(19);
                                });
                        }
                        else {
                            factors[18] = 0;
                            myIndex = selected_Zones.indexOf(19);
                            if (myIndex !== -1) {
                                selected_Zones.splice(myIndex, 1);
                            }
                        }
                    });
            });

            this.eventMediator.subscribe(this.events.getUserDefinedInternalEvent('ApplySettingsForZone20'), () => {
                this.datapointAPI.readDataPoint('10:Zone20.GetSettings', 0)
                    .then((resolve) => {
                        if (resolve.value === 1){
                            this.datapointAPI.readDataPoint('10:Zone20.FactorsCheck', 0)
                                .then((resolve) => {
                                    factors[19] = resolve.value;
                                    selected_Zones.push(20);
                                });
                        }
                        else {
                            factors[19] = 0;
                            myIndex = selected_Zones.indexOf(20);
                            if (myIndex !== -1) {
                                selected_Zones.splice(myIndex, 1);
                            }
                        }
                    });
            });

            this.eventMediator.subscribe(this.events.getUserDefinedInternalEvent('ApplySettingsForZone21'), () => {
                this.datapointAPI.readDataPoint('10:Zone21.GetSettings', 0)
                    .then((resolve) => {
                        if (resolve.value === 1){
                            this.datapointAPI.readDataPoint('10:Zone21.FactorsCheck', 0)
                                .then((resolve) => {
                                    factors[20] = resolve.value;
                                    selected_Zones.push(21);
                                });
                        }
                        else {
                            factors[20] = 0;
                            myIndex = selected_Zones.indexOf(21);
                            if (myIndex !== -1) {
                                selected_Zones.splice(myIndex, 1);
                            }
                        }
                    });
            });

            this.eventMediator.subscribe(this.events.getUserDefinedInternalEvent('ApplySettingsForZone22'), () => {
                this.datapointAPI.readDataPoint('10:Zone22.GetSettings', 0)
                    .then((resolve) => {
                        if (resolve.value === 1){
                            this.datapointAPI.readDataPoint('10:Zone22.FactorsCheck', 0)
                                .then((resolve) => {
                                    factors[21] = resolve.value;
                                    selected_Zones.push(22);
                                });
                        }
                        else {
                            factors[21] = 0;
                            myIndex = selected_Zones.indexOf(22);
                            if (myIndex !== -1) {
                                selected_Zones.splice(myIndex, 1);
                            }
                        }
                    });
            });

            this.eventMediator.subscribe(this.events.getUserDefinedInternalEvent('ApplySettingsForZone23'), () => {
                this.datapointAPI.readDataPoint('10:Zone23.GetSettings', 0)
                    .then((resolve) => {
                        if (resolve.value === 1){
                            this.datapointAPI.readDataPoint('10:Zone23.FactorsCheck', 0)
                                .then((resolve) => {
                                    factors[22] = resolve.value;
                                    selected_Zones.push(23);
                                });
                        }
                        else {
                            factors[22] = 0;
                            myIndex = selected_Zones.indexOf(23);
                            if (myIndex !== -1) {
                                selected_Zones.splice(myIndex, 1);
                            }
                        }
                    });
            });

            this.eventMediator.subscribe(this.events.getUserDefinedInternalEvent('ApplySettingsForZone24'), () => {
                this.datapointAPI.readDataPoint('10:Zone24.GetSettings', 0)
                    .then((resolve) => {
                        if (resolve.value === 1){
                            this.datapointAPI.readDataPoint('10:Zone24.FactorsCheck', 0)
                                .then((resolve) => {
                                    factors[23] = resolve.value;
                                    selected_Zones.push(24);
                                });
                        }
                        else {
                            factors[23] = 0;
                            myIndex = selected_Zones.indexOf(24);
                            if (myIndex !== -1) {
                                selected_Zones.splice(myIndex, 1);
                            }
                        }
                    });
            });

            this.eventMediator.subscribe(this.events.getUserDefinedInternalEvent('apply_for_selected_zones'), () => {
                this._apply_for_selected_zones(selected_Zones, factors);
            });
        }
    }

    switchFunktion(index){
        switch (index) {
                case 0:  this.selectZone('10:Zone1.GetSettings','10:Zone1.FactorsCheck',0);break;
                case 1:  this.selectZone('10:Zone2.GetSettings','10:Zone2.FactorsCheck',1);break;
                case 2:  this.selectZone('10:Zone3.GetSettings','10:Zone3.FactorsCheck',2); break;
                case 3:  this.selectZone('10:Zone4.GetSettings','10:Zone4.FactorsCheck',3); break;
                case 4:  this.selectZone('10:Zone5.GetSettings','10:Zone5.FactorsCheck',4); break;
                case 5:  this.selectZone('10:Zone6.GetSettings','10:Zone6.FactorsCheck',5); break;
                case 6:  this.selectZone('10:Zone7.GetSettings','10:Zone7.FactorsCheck',6); break;
                case 7:  this.selectZone('10:Zone8.GetSettings','10:Zone8.FactorsCheck',7); break;
                case 8:  this.selectZone('10:Zone9.GetSettings','10:Zone9.FactorsCheck',8); break;
                case 9:  this.selectZone('10:Zone10.GetSettings','10:Zone10.FactorsCheck',9); break;
                case 10: this.selectZone('10:Zone11.GetSettings','10:Zone11.FactorsCheck',10); break;
                case 11: this.selectZone('10:Zone12.GetSettings','10:Zone12.FactorsCheck',11); break;
                case 12: this.selectZone('10:Zone13.GetSettings','10:Zone13.FactorsCheck',12); break;
                case 13: this.selectZone('10:Zone14.GetSettings','10:Zone14.FactorsCheck',13); break;
                case 14: this.selectZone('10:Zone15.GetSettings','10:Zone15.FactorsCheck',14); break;
                case 15: this.selectZone('10:Zone16.GetSettings','10:Zone16.FactorsCheck',15); break;
                case 16: this.selectZone('10:Zone17.GetSettings','10:Zone17.FactorsCheck',16); break;
                case 17: this.selectZone('10:Zone18.GetSettings','10:Zone18.FactorsCheck',17); break;
                case 18: this.selectZone('10:Zone19.GetSettings','10:Zone19.FactorsCheck',18); break;
                case 19: this.selectZone('10:Zone20.GetSettings','10:Zone20.FactorsCheck',19); break;
                case 20: this.selectZone('10:Zone21.GetSettings','10:Zone21.FactorsCheck',20); break;
                case 21: this.selectZone('10:Zone22.GetSettings','10:Zone22.FactorsCheck',21); break;
                case 22: this.selectZone('10:Zone23.GetSettings','10:Zone23.FactorsCheck',22); break;
                case 23: this.selectZone('10:Zone24.GetSettings','10:Zone24.FactorsCheck',23); break;
            }
    }

    selectZone(ZoneName,FactorsCheck, index) {
        this.datapointAPI.readDataPoint(ZoneName, 0)
            .then((resolve) => {
                GetSettingsStatus = resolve.value;
                if (GetSettingsStatus === 0) {
                    this.datapointAPI.writeDataPoint(ZoneName, 1).then(() => {
                        this.datapointAPI.readDataPoint(FactorsCheck, 0)
                            .then((resolve) => {
                                factors[index] = resolve.value;
                                selected_Zones.push(index+1);
                            });
                    });
                } else {
                    this.datapointAPI.writeDataPoint(ZoneName, 0).then(() => {
                        factors[index] = 0;
                        myIndex = selected_Zones.indexOf(index+1);
                        if (myIndex !== -1) {
                            selected_Zones.splice(myIndex, 1);
                        }
                    });
                }
            });
    }

    _apply_for_selected_zones(selected_Zones){
        selected_Zones.forEach(element => this._setforzone(element));
        selected_Zones.length = 0;
        factors = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
    }

 _setforzone(element){
        switch (element) {
            case 1:
                this.setforzone('10:Zone1.ZoneOn', '10:Zone1.GroupID','10:SetPointManager1.SetPointLVD','10:Zone1.OperationMode','10:ModeOfWork1.LowParticipation','10:ModeOfWork1.BooParticipation', '10:ModeOfWork1.RamParticipation', factors[0],ZoneOnOffCopy,GroupIDCopy,TargetCopy,ModusCopy,RampCopy,LowerCopy,BoostCopy);
                break;
            case 2:
                this.setforzone('10:Zone2.ZoneOn', '10:Zone2.GroupID','10:SetPointManager2.SetPointLVD','10:Zone2.OperationMode','10:ModeOfWork2.LowParticipation','10:ModeOfWork2.BooParticipation', '10:ModeOfWork2.RamParticipation', factors[1],ZoneOnOffCopy,GroupIDCopy,TargetCopy,ModusCopy,RampCopy,LowerCopy,BoostCopy);
                break;
            case 3:
                this.setforzone('10:Zone3.ZoneOn', '10:Zone3.GroupID','10:SetPointManager3.SetPointLVD','10:Zone3.OperationMode','10:ModeOfWork3.LowParticipation','10:ModeOfWork3.BooParticipation', '10:ModeOfWork3.RamParticipation', factors[2],ZoneOnOffCopy,GroupIDCopy,TargetCopy,ModusCopy,RampCopy,LowerCopy,BoostCopy);
                break;
            case 4:
                this.setforzone('10:Zone4.ZoneOn', '10:Zone4.GroupID','10:SetPointManager4.SetPointLVD','10:Zone4.OperationMode','10:ModeOfWork4.LowParticipation','10:ModeOfWork4.BooParticipation', '10:ModeOfWork4.RamParticipation', factors[3],ZoneOnOffCopy,GroupIDCopy,TargetCopy,ModusCopy,RampCopy,LowerCopy,BoostCopy);
                break;
            case 5:
                this.setforzone('10:Zone5.ZoneOn', '10:Zone5.GroupID','10:SetPointManager5.SetPointLVD','10:Zone5.OperationMode','10:ModeOfWork5.LowParticipation','10:ModeOfWork5.BooParticipation', '10:ModeOfWork5.RamParticipation', factors[4],ZoneOnOffCopy,GroupIDCopy,TargetCopy,ModusCopy,RampCopy,LowerCopy,BoostCopy);
                break;
            case 6:
                this.setforzone('10:Zone6.ZoneOn', '10:Zone6.GroupID','10:SetPointManager6.SetPointLVD','10:Zone6.OperationMode','10:ModeOfWork6.LowParticipation','10:ModeOfWork6.BooParticipation', '10:ModeOfWork6.RamParticipation', factors[5],ZoneOnOffCopy,GroupIDCopy,TargetCopy,ModusCopy,RampCopy,LowerCopy,BoostCopy);
                break;
            case 7:
                this.setforzone('10:Zone7.ZoneOn', '10:Zone7.GroupID','10:SetPointManager7.SetPointLVD','10:Zone7.OperationMode','10:ModeOfWork7.LowParticipation','10:ModeOfWork7.BooParticipation', '10:ModeOfWork7.RamParticipation', factors[6],ZoneOnOffCopy,GroupIDCopy,TargetCopy,ModusCopy,RampCopy,LowerCopy,BoostCopy);
                break;
            case 8:
                this.setforzone('10:Zone8.ZoneOn', '10:Zone8.GroupID','10:SetPointManager8.SetPointLVD','10:Zone8.OperationMode','10:ModeOfWork8.LowParticipation','10:ModeOfWork8.BooParticipation', '10:ModeOfWork8.RamParticipation', factors[7],ZoneOnOffCopy,GroupIDCopy,TargetCopy,ModusCopy,RampCopy,LowerCopy,BoostCopy);
                break;
            case 9:
                this.setforzone('10:Zone9.ZoneOn', '10:Zone9.GroupID','10:SetPointManager9.SetPointLVD','10:Zone9.OperationMode','10:ModeOfWork9.LowParticipation','10:ModeOfWork9.BooParticipation', '10:ModeOfWork9.RamParticipation', factors[8],ZoneOnOffCopy,GroupIDCopy,TargetCopy,ModusCopy,RampCopy,LowerCopy,BoostCopy);
                break;
            case 10:
                this.setforzone('10:Zone10.ZoneOn', '10:Zone10.GroupID','10:SetPointManager10.SetPointLVD','10:Zone10.OperationMode','10:ModeOfWork10.LowParticipation','10:ModeOfWork10.BooParticipation', '10:ModeOfWork10.RamParticipation', factors[9],ZoneOnOffCopy,GroupIDCopy,TargetCopy,ModusCopy,RampCopy,LowerCopy,BoostCopy);
                break;
            case 11:
                this.setforzone('10:Zone11.ZoneOn', '10:Zone11.GroupID','10:SetPointManager11.SetPointLVD','10:Zone11.OperationMode','10:ModeOfWork11.LowParticipation','10:ModeOfWork11.BooParticipation', '10:ModeOfWork11.RamParticipation', factors[10],ZoneOnOffCopy,GroupIDCopy,TargetCopy,ModusCopy,RampCopy,LowerCopy,BoostCopy);
                break;
            case 12:
                this.setforzone('10:Zone12.ZoneOn', '10:Zone12.GroupID','10:SetPointManager12.SetPointLVD','10:Zone12.OperationMode','10:ModeOfWork12.LowParticipation','10:ModeOfWork12.BooParticipation', '10:ModeOfWork12.RamParticipation', factors[11],ZoneOnOffCopy,GroupIDCopy,TargetCopy,ModusCopy,RampCopy,LowerCopy,BoostCopy);
                break;
            case 13:
                this.setforzone('10:Zone13.ZoneOn', '10:Zone13.GroupID','10:SetPointManager13.SetPointLVD','10:Zone13.OperationMode','10:ModeOfWork13.LowParticipation','10:ModeOfWork13.BooParticipation', '10:ModeOfWork13.RamParticipation', factors[12],ZoneOnOffCopy,GroupIDCopy,TargetCopy,ModusCopy,RampCopy,LowerCopy,BoostCopy);
                break;
            case 14:
                this.setforzone('10:Zone14.ZoneOn', '10:Zone14.GroupID','10:SetPointManager14.SetPointLVD','10:Zone14.OperationMode','10:ModeOfWork14.LowParticipation','10:ModeOfWork14.BooParticipation', '10:ModeOfWork14.RamParticipation', factors[13],ZoneOnOffCopy,GroupIDCopy,TargetCopy,ModusCopy,RampCopy,LowerCopy,BoostCopy);
                break;
            case 15:
                this.setforzone('10:Zone15.ZoneOn', '10:Zone15.GroupID','10:SetPointManager15.SetPointLVD','10:Zone15.OperationMode','10:ModeOfWork15.LowParticipation','10:ModeOfWork15.BooParticipation', '10:ModeOfWork15.RamParticipation', factors[14],ZoneOnOffCopy,GroupIDCopy,TargetCopy,ModusCopy,RampCopy,LowerCopy,BoostCopy);
                break;
            case 16:
                this.setforzone('10:Zone16.ZoneOn', '10:Zone16.GroupID','10:SetPointManager16.SetPointLVD','10:Zone16.OperationMode','10:ModeOfWork16.LowParticipation','10:ModeOfWork16.BooParticipation', '10:ModeOfWork16.RamParticipation', factors[15],ZoneOnOffCopy,GroupIDCopy,TargetCopy,ModusCopy,RampCopy,LowerCopy,BoostCopy);
                break;
            case 17:
                this.setforzone('10:Zone17.ZoneOn', '10:Zone17.GroupID','10:SetPointManager17.SetPointLVD','10:Zone17.OperationMode','10:ModeOfWork17.LowParticipation','10:ModeOfWork17.BooParticipation', '10:ModeOfWork17.RamParticipation', factors[16],ZoneOnOffCopy,GroupIDCopy,TargetCopy,ModusCopy,RampCopy,LowerCopy,BoostCopy);
                break;
            case 18:
                this.setforzone('10:Zone18.ZoneOn', '10:Zone18.GroupID','10:SetPointManager18.SetPointLVD','10:Zone18.OperationMode','10:ModeOfWork18.LowParticipation','10:ModeOfWork18.BooParticipation', '10:ModeOfWork18.RamParticipation', factors[17],ZoneOnOffCopy,GroupIDCopy,TargetCopy,ModusCopy,RampCopy,LowerCopy,BoostCopy);
                break;
            case 19:
                this.setforzone('10:Zone19.ZoneOn', '10:Zone19.GroupID','10:SetPointManager19.SetPointLVD','10:Zone19.OperationMode','10:ModeOfWork19.LowParticipation','10:ModeOfWork19.BooParticipation', '10:ModeOfWork19.RamParticipation', factors[18],ZoneOnOffCopy,GroupIDCopy,TargetCopy,ModusCopy,RampCopy,LowerCopy,BoostCopy);
                break;
            case 20:
                this.setforzone('10:Zone20.ZoneOn', '10:Zone20.GroupID','10:SetPointManager20.SetPointLVD','10:Zone20.OperationMode','10:ModeOfWork20.LowParticipation','10:ModeOfWork20.BooParticipation', '10:ModeOfWork20.RamParticipation', factors[19],ZoneOnOffCopy,GroupIDCopy,TargetCopy,ModusCopy,RampCopy,LowerCopy,BoostCopy);
                break;
            case 21:
                this.setforzone('10:Zone21.ZoneOn', '10:Zone21.GroupID','10:SetPointManager21.SetPointLVD','10:Zone21.OperationMode','10:ModeOfWork21.LowParticipation','10:ModeOfWork21.BooParticipation', '10:ModeOfWork21.RamParticipation', factors[20],ZoneOnOffCopy,GroupIDCopy,TargetCopy,ModusCopy,RampCopy,LowerCopy,BoostCopy);
                break;
            case 22:
                this.setforzone('10:Zone22.ZoneOn', '10:Zone22.GroupID','10:SetPointManager22.SetPointLVD','10:Zone22.OperationMode','10:ModeOfWork22.LowParticipation','10:ModeOfWork22.BooParticipation', '10:ModeOfWork22.RamParticipation', factors[21],ZoneOnOffCopy,GroupIDCopy,TargetCopy,ModusCopy,RampCopy,LowerCopy,BoostCopy);
                break;
            case 23:
                this.setforzone('10:Zone23.ZoneOn', '10:Zone23.GroupID','10:SetPointManager23.SetPointLVD','10:Zone23.OperationMode','10:ModeOfWork23.LowParticipation','10:ModeOfWork23.BooParticipation', '10:ModeOfWork23.RamParticipation', factors[22],ZoneOnOffCopy,GroupIDCopy,TargetCopy,ModusCopy,RampCopy,LowerCopy,BoostCopy);
                break;
            case 24:
                this.setforzone('10:Zone24.ZoneOn', '10:Zone24.GroupID','10:SetPointManager24.SetPointLVD','10:Zone24.OperationMode','10:ModeOfWork24.LowParticipation','10:ModeOfWork24.BooParticipation', '10:ModeOfWork24.RamParticipation', factors[23],ZoneOnOffCopy,GroupIDCopy,TargetCopy,ModusCopy,RampCopy,LowerCopy,BoostCopy);
                break;
        }
 }


        setforzone(z,i,s,o,l,b,r,factor, zoneonoff_c, groupid_c, target_c,modus_c, ramp_c,lower_c,boost_c) {
        let vSelectedZone;
        let vZoneOnOff;
        let vGroupID;
        let vTargetTemperatur;
        let vOparationMode;
        let vLowerPart;
        let vBoostPart;
        let vRampPart;

        // read Selected Zones ID:
        this.datapointAPI.readDataPoint('10:SelectedZone1.ZoneID', 0)
            .then((resolve) => {
                vSelectedZone = resolve.value;

                // read values of selested zone:

                switch (vSelectedZone) {
                    case 1:
                        this.datapointAPI.readDataPoint('10:Zone1.ZoneOn', 0)
                            .then((resolve) => {
                                vZoneOnOff = resolve.value;
                                this.datapointAPI.readDataPoint('10:Zone1.GroupID', 0)
                                    .then((resolve) => {
                                        vGroupID = resolve.value;
                                        this.datapointAPI.readDataPoint('10:SetPointManager1.SetPointLVD', 0)
                                            .then((resolve) => {
                                                vTargetTemperatur = resolve.value;
                                                this.datapointAPI.readDataPoint('10:Zone1.OperationMode', 0)
                                                    .then((resolve) => {
                                                        vOparationMode = resolve.value;
                                                        this.datapointAPI.readDataPoint('10:ModeOfWork1.LowParticipation', 0)
                                                            .then((resolve) => {
                                                                vLowerPart = resolve.value;
                                                                this.datapointAPI.readDataPoint('10:ModeOfWork1.BooParticipation', 0)
                                                                    .then((resolve) => {
                                                                        vBoostPart = resolve.value;
                                                                        this.datapointAPI.readDataPoint('10:ModeOfWork1.RamParticipation', 0)
                                                                            .then((resolve) => {
                                                                                vRampPart = resolve.value;

                                                                        // write these values to the Zone 1:
                                                                    //    this.datapointAPI.writeDataPoint(z, vZoneOnOff)

                                                                                if (zoneonoff_c === 1) {
                                                                                    if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                    {this.datapointAPI.writeDataPoint(z, vZoneOnOff);}
                                                                                }
                                                                                if (groupid_c === 1) {
                                                                                    this.datapointAPI.writeDataPoint(i, vGroupID);
                                                                                }
                                                                                if (target_c === 1) {
                                                                                    this.datapointAPI.writeDataPoint(s, vTargetTemperatur);
                                                                                }
                                                                                if (modus_c === 1) {
                                                                                    this.datapointAPI.writeDataPoint(o, vOparationMode);
                                                                                }
                                                                                if (ramp_c === 1) {
                                                                                    this.datapointAPI.writeDataPoint(r, vRampPart);
                                                                                }
                                                                                if (lower_c === 1) {
                                                                                    this.datapointAPI.writeDataPoint(l, vLowerPart);
                                                                                }
                                                                                if (boost_c === 1) {
                                                                                    this.datapointAPI.writeDataPoint(b, vBoostPart);
                                                                                }


                                                                                /*    this.datapointAPI.writeDataPoint(r, vRampPart)
                                                                                            .then(() => {
                                                                                this.datapointAPI.writeDataPoint(i, vGroupID)
                                                                                    .then(() => {
                                                                                        this.datapointAPI.writeDataPoint(s, vTargetTemperatur)
                                                                                            .then(() => {
                                                                                                this.datapointAPI.writeDataPoint(o, vOparationMode)
                                                                                                    .then(() => {
                                                                                                        this.datapointAPI.writeDataPoint(l, vLowerPart)
                                                                                                            .then(() => {
                                                                                                                this.datapointAPI.writeDataPoint(b, vBoostPart)
                                                                                                                    .then(() => {

                                                                                                                        if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                                                        {this.datapointAPI.writeDataPoint(z, vZoneOnOff)}

                                                                                                                    });
                                                                                                            });

                                                                                                        });
                                                                                                    });
                                                                                            });
                                                                                    }); */
                                                                            });
                                                                    });
                                                            });
                                                    });
                                            });
                                    });
                            });break;
                    case 2:  this.datapointAPI.readDataPoint('10:Zone2.ZoneOn', 0)
                        .then((resolve) => {
                            vZoneOnOff = resolve.value;
                            this.datapointAPI.readDataPoint('10:Zone2.GroupID', 0)
                                .then((resolve) => {
                                    vGroupID = resolve.value;
                                    this.datapointAPI.readDataPoint('10:SetPointManager2.SetPointLVD', 0)
                                        .then((resolve) => {
                                            vTargetTemperatur = resolve.value;
                                            this.datapointAPI.readDataPoint('10:Zone2.OperationMode', 0)
                                                .then((resolve) => {
                                                    vOparationMode = resolve.value;
                                                    this.datapointAPI.readDataPoint('10:ModeOfWork2.LowParticipation', 0)
                                                        .then((resolve) => {
                                                            vLowerPart = resolve.value;
                                                            this.datapointAPI.readDataPoint('10:ModeOfWork2.BooParticipation', 0)
                                                                .then((resolve) => {
                                                                    vBoostPart = resolve.value;
                                                                    this.datapointAPI.readDataPoint('10:ModeOfWork2.RamParticipation', 0)
                                                                        .then((resolve) => {
                                                                            vRampPart = resolve.value;



                                                                    // write these values to the Zone 1:
                                                                            if (zoneonoff_c === 1) {
                                                                                if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                {this.datapointAPI.writeDataPoint(z, vZoneOnOff);}
                                                                            }
                                                                            if (groupid_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(i, vGroupID);
                                                                            }
                                                                            if (target_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(s, vTargetTemperatur);
                                                                            }
                                                                            if (modus_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(o, vOparationMode);
                                                                            }
                                                                            if (ramp_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(r, vRampPart);
                                                                            }
                                                                            if (lower_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(l, vLowerPart);
                                                                            }
                                                                            if (boost_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(b, vBoostPart);
                                                                            }

                                                                                  /*  this.datapointAPI.writeDataPoint(r, vRampPart)
                                                                                        .then(() => {
                                                                                            this.datapointAPI.writeDataPoint(i, vGroupID)
                                                                                                .then(() => {
                                                                                                    this.datapointAPI.writeDataPoint(s, vTargetTemperatur)
                                                                                                        .then(() => {
                                                                                                            this.datapointAPI.writeDataPoint(o, vOparationMode)
                                                                                                                .then(() => {
                                                                                                                    this.datapointAPI.writeDataPoint(l, vLowerPart)
                                                                                                                        .then(() => {
                                                                                                                            this.datapointAPI.writeDataPoint(b, vBoostPart)
                                                                                                                                .then(() => {

                                                                                                                                    if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                                                                    {this.datapointAPI.writeDataPoint(z, vZoneOnOff)}



                                                                                                                });
                                                                                                        });
                                                                                                    });
                                                                                                });
                                                                                        });
                                                                                });*/
                                                                        });
                                                                });
                                                        });
                                                });
                                        });
                                });
                        });break;
                    case 3:  this.datapointAPI.readDataPoint('10:Zone3.ZoneOn', 0)
                        .then((resolve) => {
                            vZoneOnOff = resolve.value;
                            this.datapointAPI.readDataPoint('10:Zone3.GroupID', 0)
                                .then((resolve) => {
                                    vGroupID = resolve.value;
                                    this.datapointAPI.readDataPoint('10:SetPointManager3.SetPointLVD', 0)
                                        .then((resolve) => {
                                            vTargetTemperatur = resolve.value;
                                            this.datapointAPI.readDataPoint('10:Zone3.OperationMode', 0)
                                                .then((resolve) => {
                                                    vOparationMode = resolve.value;
                                                    this.datapointAPI.readDataPoint('10:ModeOfWork3.LowParticipation', 0)
                                                        .then((resolve) => {
                                                            vLowerPart = resolve.value;
                                                            this.datapointAPI.readDataPoint('10:ModeOfWork3.BooParticipation', 0)
                                                                .then((resolve) => {
                                                                    vBoostPart = resolve.value;
                                                                    this.datapointAPI.readDataPoint('10:ModeOfWork3.RamParticipation', 0)
                                                                        .then((resolve) => {
                                                                            vRampPart = resolve.value;


                                                                    // write these values to the Zone 1:
                                                                            if (zoneonoff_c === 1) {
                                                                                if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                {this.datapointAPI.writeDataPoint(z, vZoneOnOff);}
                                                                            }
                                                                            if (groupid_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(i, vGroupID);
                                                                            }
                                                                            if (target_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(s, vTargetTemperatur);
                                                                            }
                                                                            if (modus_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(o, vOparationMode);
                                                                            }
                                                                            if (ramp_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(r, vRampPart);
                                                                            }
                                                                            if (lower_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(l, vLowerPart);
                                                                            }
                                                                            if (boost_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(b, vBoostPart);
                                                                            }

                                                                                 /*   this.datapointAPI.writeDataPoint(r, vRampPart)
                                                                                        .then(() => {
                                                                                            this.datapointAPI.writeDataPoint(i, vGroupID)
                                                                                                .then(() => {
                                                                                                    this.datapointAPI.writeDataPoint(s, vTargetTemperatur)
                                                                                                        .then(() => {
                                                                                                            this.datapointAPI.writeDataPoint(o, vOparationMode)
                                                                                                                .then(() => {
                                                                                                                    this.datapointAPI.writeDataPoint(l, vLowerPart)
                                                                                                                        .then(() => {
                                                                                                                            this.datapointAPI.writeDataPoint(b, vBoostPart)
                                                                                                                                .then(() => {

                                                                                                                                    if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                                                                    {this.datapointAPI.writeDataPoint(z, vZoneOnOff)}



                                                                                                                });
                                                                                                             });
                                                                                                        });
                                                                                                });
                                                                                        });
                                                                                });*/
                                                                        });
                                                                });
                                                        });
                                                });
                                        });
                                });
                        });break;
                    case 4:  this.datapointAPI.readDataPoint('10:Zone4.ZoneOn', 0)
                        .then((resolve) => {
                            vZoneOnOff = resolve.value;
                            this.datapointAPI.readDataPoint('10:Zone4.GroupID', 0)
                                .then((resolve) => {
                                    vGroupID = resolve.value;
                                    this.datapointAPI.readDataPoint('10:SetPointManager4.SetPointLVD', 0)
                                        .then((resolve) => {
                                            vTargetTemperatur = resolve.value;
                                            this.datapointAPI.readDataPoint('10:Zone4.OperationMode', 0)
                                                .then((resolve) => {
                                                    vOparationMode = resolve.value;
                                                    this.datapointAPI.readDataPoint('10:ModeOfWork4.LowParticipation', 0)
                                                        .then((resolve) => {
                                                            vLowerPart = resolve.value;
                                                            this.datapointAPI.readDataPoint('10:ModeOfWork4.BooParticipation', 0)
                                                                .then((resolve) => {
                                                                    vBoostPart = resolve.value;
                                                                    this.datapointAPI.readDataPoint('10:ModeOfWork4.RamParticipation', 0)
                                                                        .then((resolve) => {
                                                                            vRampPart = resolve.value;


                                                                    // write these values to the Zone 1:
                                                                            if (zoneonoff_c === 1) {
                                                                                if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                {this.datapointAPI.writeDataPoint(z, vZoneOnOff);}
                                                                            }
                                                                            if (groupid_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(i, vGroupID);
                                                                            }
                                                                            if (target_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(s, vTargetTemperatur);
                                                                            }
                                                                            if (modus_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(o, vOparationMode);
                                                                            }
                                                                            if (ramp_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(r, vRampPart);
                                                                            }
                                                                            if (lower_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(l, vLowerPart);
                                                                            }
                                                                            if (boost_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(b, vBoostPart);
                                                                            }

                                                                                /*    this.datapointAPI.writeDataPoint(r, vRampPart)
                                                                                        .then(() => {
                                                                                            this.datapointAPI.writeDataPoint(i, vGroupID)
                                                                                                .then(() => {
                                                                                                    this.datapointAPI.writeDataPoint(s, vTargetTemperatur)
                                                                                                        .then(() => {
                                                                                                            this.datapointAPI.writeDataPoint(o, vOparationMode)
                                                                                                                .then(() => {
                                                                                                                    this.datapointAPI.writeDataPoint(l, vLowerPart)
                                                                                                                        .then(() => {
                                                                                                                            this.datapointAPI.writeDataPoint(b, vBoostPart)
                                                                                                                                .then(() => {

                                                                                                                                    if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                                                                    {this.datapointAPI.writeDataPoint(z, vZoneOnOff)}

                                                                                                                });
                                                                                                        });
                                                                                                        });
                                                                                                });
                                                                                        });
                                                                                });*/
                                                                        });
                                                                });
                                                        });
                                                });
                                        });
                                });
                        });break;
                    case 5:  this.datapointAPI.readDataPoint('10:Zone5.ZoneOn', 0)
                        .then((resolve) => {
                            vZoneOnOff = resolve.value;
                            this.datapointAPI.readDataPoint('10:Zone5.GroupID', 0)
                                .then((resolve) => {
                                    vGroupID = resolve.value;
                                    this.datapointAPI.readDataPoint('10:SetPointManager5.SetPointLVD', 0)
                                        .then((resolve) => {
                                            vTargetTemperatur = resolve.value;
                                            this.datapointAPI.readDataPoint('10:Zone5.OperationMode', 0)
                                                .then((resolve) => {
                                                    vOparationMode = resolve.value;
                                                    this.datapointAPI.readDataPoint('10:ModeOfWork5.LowParticipation', 0)
                                                        .then((resolve) => {
                                                            vLowerPart = resolve.value;
                                                            this.datapointAPI.readDataPoint('10:ModeOfWork5.BooParticipation', 0)
                                                                .then((resolve) => {
                                                                    vBoostPart = resolve.value;
                                                                    this.datapointAPI.readDataPoint('10:ModeOfWork5.RamParticipation', 0)
                                                                        .then((resolve) => {
                                                                            vRampPart = resolve.value;


                                                                    // write these values to the Zone 1:
                                                                            if (zoneonoff_c === 1) {
                                                                                if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                {this.datapointAPI.writeDataPoint(z, vZoneOnOff);}
                                                                            }
                                                                            if (groupid_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(i, vGroupID);
                                                                            }
                                                                            if (target_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(s, vTargetTemperatur);
                                                                            }
                                                                            if (modus_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(o, vOparationMode);
                                                                            }
                                                                            if (ramp_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(r, vRampPart);
                                                                            }
                                                                            if (lower_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(l, vLowerPart);
                                                                            }
                                                                            if (boost_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(b, vBoostPart);
                                                                            }

                                                                              /*      this.datapointAPI.writeDataPoint(r, vRampPart)
                                                                                        .then(() => {
                                                                                            this.datapointAPI.writeDataPoint(i, vGroupID)
                                                                                                .then(() => {
                                                                                                    this.datapointAPI.writeDataPoint(s, vTargetTemperatur)
                                                                                                        .then(() => {
                                                                                                            this.datapointAPI.writeDataPoint(o, vOparationMode)
                                                                                                                .then(() => {
                                                                                                                    this.datapointAPI.writeDataPoint(l, vLowerPart)
                                                                                                                        .then(() => {
                                                                                                                            this.datapointAPI.writeDataPoint(b, vBoostPart)
                                                                                                                                .then(() => {

                                                                                                                                    if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                                                                    {this.datapointAPI.writeDataPoint(z, vZoneOnOff)}

                                                                                                                });
                                                                                                        });
                                                                                                        });
                                                                                                });
                                                                                        });
                                                                                });*/
                                                                        });
                                                                });
                                                        });
                                                });
                                        });
                                });
                        });break;
                    case 6:  this.datapointAPI.readDataPoint('10:Zone6.ZoneOn', 0)
                        .then((resolve) => {
                            vZoneOnOff = resolve.value;
                            this.datapointAPI.readDataPoint('10:Zone6.GroupID', 0)
                                .then((resolve) => {
                                    vGroupID = resolve.value;
                                    this.datapointAPI.readDataPoint('10:SetPointManager6.SetPointLVD', 0)
                                        .then((resolve) => {
                                            vTargetTemperatur = resolve.value;
                                            this.datapointAPI.readDataPoint('10:Zone6.OperationMode', 0)
                                                .then((resolve) => {
                                                    vOparationMode = resolve.value;
                                                    this.datapointAPI.readDataPoint('10:ModeOfWork6.LowParticipation', 0)
                                                        .then((resolve) => {
                                                            vLowerPart = resolve.value;
                                                            this.datapointAPI.readDataPoint('10:ModeOfWork6.BooParticipation', 0)
                                                                .then((resolve) => {
                                                                    vBoostPart = resolve.value;
                                                                    this.datapointAPI.readDataPoint('10:ModeOfWork6.RamParticipation', 0)
                                                                        .then((resolve) => {
                                                                            vRampPart = resolve.value;


                                                                    // write these values to the Zone 1:
                                                                            if (zoneonoff_c === 1) {
                                                                                if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                {this.datapointAPI.writeDataPoint(z, vZoneOnOff);}
                                                                            }
                                                                            if (groupid_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(i, vGroupID);
                                                                            }
                                                                            if (target_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(s, vTargetTemperatur);
                                                                            }
                                                                            if (modus_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(o, vOparationMode);
                                                                            }
                                                                            if (ramp_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(r, vRampPart);
                                                                            }
                                                                            if (lower_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(l, vLowerPart);
                                                                            }
                                                                            if (boost_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(b, vBoostPart);
                                                                            }

                                                                              /*      this.datapointAPI.writeDataPoint(r, vRampPart)
                                                                                        .then(() => {
                                                                                            this.datapointAPI.writeDataPoint(i, vGroupID)
                                                                                                .then(() => {
                                                                                                    this.datapointAPI.writeDataPoint(s, vTargetTemperatur)
                                                                                                        .then(() => {
                                                                                                            this.datapointAPI.writeDataPoint(o, vOparationMode)
                                                                                                                .then(() => {
                                                                                                                    this.datapointAPI.writeDataPoint(l, vLowerPart)
                                                                                                                        .then(() => {
                                                                                                                            this.datapointAPI.writeDataPoint(b, vBoostPart)
                                                                                                                                .then(() => {

                                                                                                                                    if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                                                                    {this.datapointAPI.writeDataPoint(z, vZoneOnOff)}



                                                                                                                });
                                                                                                        });
                                                                                                        });
                                                                                                });
                                                                                        });
                                                                                });*/
                                                                        });
                                                                });
                                                        });
                                                });
                                        });
                                });
                        });break;
                    case 7:  this.datapointAPI.readDataPoint('10:Zone7.ZoneOn', 0)
                        .then((resolve) => {
                            vZoneOnOff = resolve.value;
                            this.datapointAPI.readDataPoint('10:Zone7.GroupID', 0)
                                .then((resolve) => {
                                    vGroupID = resolve.value;
                                    this.datapointAPI.readDataPoint('10:SetPointManager7.SetPointLVD', 0)
                                        .then((resolve) => {
                                            vTargetTemperatur = resolve.value;
                                            this.datapointAPI.readDataPoint('10:Zone7.OperationMode', 0)
                                                .then((resolve) => {
                                                    vOparationMode = resolve.value;
                                                    this.datapointAPI.readDataPoint('10:ModeOfWork7.LowParticipation', 0)
                                                        .then((resolve) => {
                                                            vLowerPart = resolve.value;
                                                            this.datapointAPI.readDataPoint('10:ModeOfWork7.BooParticipation', 0)
                                                                .then((resolve) => {
                                                                    vBoostPart = resolve.value;
                                                                    this.datapointAPI.readDataPoint('10:ModeOfWork7.RamParticipation', 0)
                                                                        .then((resolve) => {
                                                                            vRampPart = resolve.value;


                                                                    // write these values to the Zone 1:
                                                                            if (zoneonoff_c === 1) {
                                                                                if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                {this.datapointAPI.writeDataPoint(z, vZoneOnOff);}
                                                                            }
                                                                            if (groupid_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(i, vGroupID);
                                                                            }
                                                                            if (target_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(s, vTargetTemperatur);
                                                                            }
                                                                            if (modus_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(o, vOparationMode);
                                                                            }
                                                                            if (ramp_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(r, vRampPart);
                                                                            }
                                                                            if (lower_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(l, vLowerPart);
                                                                            }
                                                                            if (boost_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(b, vBoostPart);
                                                                            }

                                                                               /*     this.datapointAPI.writeDataPoint(r, vRampPart)
                                                                                        .then(() => {
                                                                                            this.datapointAPI.writeDataPoint(i, vGroupID)
                                                                                                .then(() => {
                                                                                                    this.datapointAPI.writeDataPoint(s, vTargetTemperatur)
                                                                                                        .then(() => {
                                                                                                            this.datapointAPI.writeDataPoint(o, vOparationMode)
                                                                                                                .then(() => {
                                                                                                                    this.datapointAPI.writeDataPoint(l, vLowerPart)
                                                                                                                        .then(() => {
                                                                                                                            this.datapointAPI.writeDataPoint(b, vBoostPart)
                                                                                                                                .then(() => {

                                                                                                                                    if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                                                                    {this.datapointAPI.writeDataPoint(z, vZoneOnOff)}



                                                                                                                });
                                                                                                        });
                                                                                                        });
                                                                                                });
                                                                                        });
                                                                                });*/
                                                                        });
                                                                });
                                                        });
                                                });
                                        });
                                });
                        });break;
                    case 8:  this.datapointAPI.readDataPoint('10:Zone8.ZoneOn', 0)
                        .then((resolve) => {
                            vZoneOnOff = resolve.value;
                            this.datapointAPI.readDataPoint('10:Zone8.GroupID', 0)
                                .then((resolve) => {
                                    vGroupID = resolve.value;
                                    this.datapointAPI.readDataPoint('10:SetPointManager8.SetPointLVD', 0)
                                        .then((resolve) => {
                                            vTargetTemperatur = resolve.value;
                                            this.datapointAPI.readDataPoint('10:Zone8.OperationMode', 0)
                                                .then((resolve) => {
                                                    vOparationMode = resolve.value;
                                                    this.datapointAPI.readDataPoint('10:ModeOfWork8.LowParticipation', 0)
                                                        .then((resolve) => {
                                                            vLowerPart = resolve.value;
                                                            this.datapointAPI.readDataPoint('10:ModeOfWork8.BooParticipation', 0)
                                                                .then((resolve) => {
                                                                    vBoostPart = resolve.value;
                                                                    this.datapointAPI.readDataPoint('10:ModeOfWork8.RamParticipation', 0)
                                                                        .then((resolve) => {
                                                                            vRampPart = resolve.value;


                                                                    // write these values to the Zone 1:
                                                                            if (zoneonoff_c === 1) {
                                                                                if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                {this.datapointAPI.writeDataPoint(z, vZoneOnOff);}
                                                                            }
                                                                            if (groupid_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(i, vGroupID);
                                                                            }
                                                                            if (target_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(s, vTargetTemperatur);
                                                                            }
                                                                            if (modus_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(o, vOparationMode);
                                                                            }
                                                                            if (ramp_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(r, vRampPart);
                                                                            }
                                                                            if (lower_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(l, vLowerPart);
                                                                            }
                                                                            if (boost_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(b, vBoostPart);
                                                                            }

                                                                               /*     this.datapointAPI.writeDataPoint(r, vRampPart)
                                                                                        .then(() => {
                                                                                            this.datapointAPI.writeDataPoint(i, vGroupID)
                                                                                                .then(() => {
                                                                                                    this.datapointAPI.writeDataPoint(s, vTargetTemperatur)
                                                                                                        .then(() => {
                                                                                                            this.datapointAPI.writeDataPoint(o, vOparationMode)
                                                                                                                .then(() => {
                                                                                                                    this.datapointAPI.writeDataPoint(l, vLowerPart)
                                                                                                                        .then(() => {
                                                                                                                            this.datapointAPI.writeDataPoint(b, vBoostPart)
                                                                                                                                .then(() => {

                                                                                                                                    if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                                                                    {this.datapointAPI.writeDataPoint(z, vZoneOnOff)}



                                                                                                                });
                                                                                                        });
                                                                                                        });
                                                                                                });
                                                                                        });
                                                                                });*/
                                                                        });
                                                                });
                                                        });
                                                });
                                        });
                                });
                        });break;
                    case 9:  this.datapointAPI.readDataPoint('10:Zone9.ZoneOn', 0)
                        .then((resolve) => {
                            vZoneOnOff = resolve.value;
                            this.datapointAPI.readDataPoint('10:Zone9.GroupID', 0)
                                .then((resolve) => {
                                    vGroupID = resolve.value;
                                    this.datapointAPI.readDataPoint('10:SetPointManager9.SetPointLVD', 0)
                                        .then((resolve) => {
                                            vTargetTemperatur = resolve.value;
                                            this.datapointAPI.readDataPoint('10:Zone9.OperationMode', 0)
                                                .then((resolve) => {
                                                    vOparationMode = resolve.value;
                                                    this.datapointAPI.readDataPoint('10:ModeOfWork9.LowParticipation', 0)
                                                        .then((resolve) => {
                                                            vLowerPart = resolve.value;
                                                            this.datapointAPI.readDataPoint('10:ModeOfWork9.BooParticipation', 0)
                                                                .then((resolve) => {
                                                                    vBoostPart = resolve.value;
                                                                    this.datapointAPI.readDataPoint('10:ModeOfWork9.RamParticipation', 0)
                                                                        .then((resolve) => {
                                                                            vRampPart = resolve.value;


                                                                    // write these values to the Zone 1:
                                                                            if (zoneonoff_c === 1) {
                                                                                if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                {this.datapointAPI.writeDataPoint(z, vZoneOnOff);}
                                                                            }
                                                                            if (groupid_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(i, vGroupID);
                                                                            }
                                                                            if (target_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(s, vTargetTemperatur);
                                                                            }
                                                                            if (modus_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(o, vOparationMode);
                                                                            }
                                                                            if (ramp_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(r, vRampPart);
                                                                            }
                                                                            if (lower_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(l, vLowerPart);
                                                                            }
                                                                            if (boost_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(b, vBoostPart);
                                                                            }

                                                                             /*       this.datapointAPI.writeDataPoint(r, vRampPart)
                                                                                        .then(() => {
                                                                                            this.datapointAPI.writeDataPoint(i, vGroupID)
                                                                                                .then(() => {
                                                                                                    this.datapointAPI.writeDataPoint(s, vTargetTemperatur)
                                                                                                        .then(() => {
                                                                                                            this.datapointAPI.writeDataPoint(o, vOparationMode)
                                                                                                                .then(() => {
                                                                                                                    this.datapointAPI.writeDataPoint(l, vLowerPart)
                                                                                                                        .then(() => {
                                                                                                                            this.datapointAPI.writeDataPoint(b, vBoostPart)
                                                                                                                                .then(() => {

                                                                                                                                    if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                                                                    {this.datapointAPI.writeDataPoint(z, vZoneOnOff)}



                                                                                                                });
                                                                                                        });
                                                                                                        });
                                                                                                });
                                                                                        });
                                                                                });*/
                                                                        });
                                                                });
                                                        });
                                                });
                                        });
                                });
                        });break;
                    case 10: this.datapointAPI.readDataPoint('10:Zone10.ZoneOn', 0)
                        .then((resolve) => {
                            vZoneOnOff = resolve.value;
                            this.datapointAPI.readDataPoint('10:Zone10.GroupID', 0)
                                .then((resolve) => {
                                    vGroupID = resolve.value;
                                    this.datapointAPI.readDataPoint('10:SetPointManager10.SetPointLVD', 0)
                                        .then((resolve) => {
                                            vTargetTemperatur = resolve.value;
                                            this.datapointAPI.readDataPoint('10:Zone10.OperationMode', 0)
                                                .then((resolve) => {
                                                    vOparationMode = resolve.value;
                                                    this.datapointAPI.readDataPoint('10:ModeOfWork10.LowParticipation', 0)
                                                        .then((resolve) => {
                                                            vLowerPart = resolve.value;
                                                            this.datapointAPI.readDataPoint('10:ModeOfWork10.BooParticipation', 0)
                                                                .then((resolve) => {
                                                                    vBoostPart = resolve.value;
                                                                    this.datapointAPI.readDataPoint('10:ModeOfWork10.RamParticipation', 0)
                                                                        .then((resolve) => {
                                                                            vRampPart = resolve.value;


                                                                    // write these values to the Zone 1:
                                                                            if (zoneonoff_c === 1) {
                                                                                if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                {this.datapointAPI.writeDataPoint(z, vZoneOnOff);}
                                                                            }
                                                                            if (groupid_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(i, vGroupID);
                                                                            }
                                                                            if (target_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(s, vTargetTemperatur);
                                                                            }
                                                                            if (modus_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(o, vOparationMode);
                                                                            }
                                                                            if (ramp_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(r, vRampPart);
                                                                            }
                                                                            if (lower_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(l, vLowerPart);
                                                                            }
                                                                            if (boost_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(b, vBoostPart);
                                                                            }

                                                                                /*    this.datapointAPI.writeDataPoint(r, vRampPart)
                                                                                        .then(() => {
                                                                                            this.datapointAPI.writeDataPoint(i, vGroupID)
                                                                                                .then(() => {
                                                                                                    this.datapointAPI.writeDataPoint(s, vTargetTemperatur)
                                                                                                        .then(() => {
                                                                                                            this.datapointAPI.writeDataPoint(o, vOparationMode)
                                                                                                                .then(() => {
                                                                                                                    this.datapointAPI.writeDataPoint(l, vLowerPart)
                                                                                                                        .then(() => {
                                                                                                                            this.datapointAPI.writeDataPoint(b, vBoostPart)
                                                                                                                                .then(() => {

                                                                                                                                    if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                                                                    {this.datapointAPI.writeDataPoint(z, vZoneOnOff)}



                                                                                                                });
                                                                                                        });
                                                                                                        });
                                                                                                });
                                                                                        });
                                                                                });*/
                                                                        });
                                                                });
                                                        });
                                                });
                                        });
                                });
                        });break;
                    case 11: this.datapointAPI.readDataPoint('10:Zone11.ZoneOn', 0)
                        .then((resolve) => {
                            vZoneOnOff = resolve.value;
                            this.datapointAPI.readDataPoint('10:Zone11.GroupID', 0)
                                .then((resolve) => {
                                    vGroupID = resolve.value;
                                    this.datapointAPI.readDataPoint('10:SetPointManager11.SetPointLVD', 0)
                                        .then((resolve) => {
                                            vTargetTemperatur = resolve.value;
                                            this.datapointAPI.readDataPoint('10:Zone11.OperationMode', 0)
                                                .then((resolve) => {
                                                    vOparationMode = resolve.value;
                                                    this.datapointAPI.readDataPoint('10:ModeOfWork11.LowParticipation', 0)
                                                        .then((resolve) => {
                                                            vLowerPart = resolve.value;
                                                            this.datapointAPI.readDataPoint('10:ModeOfWork11.BooParticipation', 0)
                                                                .then((resolve) => {
                                                                    vBoostPart = resolve.value;
                                                                    this.datapointAPI.readDataPoint('10:ModeOfWork11.RamParticipation', 0)
                                                                        .then((resolve) => {
                                                                            vRampPart = resolve.value;


                                                                    // write these values to the Zone 1:
                                                                            if (zoneonoff_c === 1) {
                                                                                if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                {this.datapointAPI.writeDataPoint(z, vZoneOnOff);}
                                                                            }
                                                                            if (groupid_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(i, vGroupID);
                                                                            }
                                                                            if (target_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(s, vTargetTemperatur);
                                                                            }
                                                                            if (modus_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(o, vOparationMode);
                                                                            }
                                                                            if (ramp_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(r, vRampPart);
                                                                            }
                                                                            if (lower_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(l, vLowerPart);
                                                                            }
                                                                            if (boost_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(b, vBoostPart);
                                                                            }

                                                                              /*      this.datapointAPI.writeDataPoint(r, vRampPart)
                                                                                        .then(() => {
                                                                                            this.datapointAPI.writeDataPoint(i, vGroupID)
                                                                                                .then(() => {
                                                                                                    this.datapointAPI.writeDataPoint(s, vTargetTemperatur)
                                                                                                        .then(() => {
                                                                                                            this.datapointAPI.writeDataPoint(o, vOparationMode)
                                                                                                                .then(() => {
                                                                                                                    this.datapointAPI.writeDataPoint(l, vLowerPart)
                                                                                                                        .then(() => {
                                                                                                                            this.datapointAPI.writeDataPoint(b, vBoostPart)
                                                                                                                                .then(() => {

                                                                                                                                    if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                                                                    {this.datapointAPI.writeDataPoint(z, vZoneOnOff)}



                                                                                                                });
                                                                                                        });
                                                                                                        });
                                                                                                });
                                                                                        });
                                                                                });*/
                                                                        });
                                                                });
                                                        });
                                                });
                                        });
                                });
                        });break;
                    case 12: this.datapointAPI.readDataPoint('10:Zone12.ZoneOn', 0)
                        .then((resolve) => {
                            vZoneOnOff = resolve.value;
                            this.datapointAPI.readDataPoint('10:Zone12.GroupID', 0)
                                .then((resolve) => {
                                    vGroupID = resolve.value;
                                    this.datapointAPI.readDataPoint('10:SetPointManager12.SetPointLVD', 0)
                                        .then((resolve) => {
                                            vTargetTemperatur = resolve.value;
                                            this.datapointAPI.readDataPoint('10:Zone12.OperationMode', 0)
                                                .then((resolve) => {
                                                    vOparationMode = resolve.value;
                                                    this.datapointAPI.readDataPoint('10:ModeOfWork12.LowParticipation', 0)
                                                        .then((resolve) => {
                                                            vLowerPart = resolve.value;
                                                            this.datapointAPI.readDataPoint('10:ModeOfWork12.BooParticipation', 0)
                                                                .then((resolve) => {
                                                                    vBoostPart = resolve.value;
                                                                    this.datapointAPI.readDataPoint('10:ModeOfWork12.RamParticipation', 0)
                                                                        .then((resolve) => {
                                                                            vRampPart = resolve.value;


                                                                    // write these values to the Zone 1:
                                                                            if (zoneonoff_c === 1) {
                                                                                if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                {this.datapointAPI.writeDataPoint(z, vZoneOnOff);}
                                                                            }
                                                                            if (groupid_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(i, vGroupID);
                                                                            }
                                                                            if (target_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(s, vTargetTemperatur);
                                                                            }
                                                                            if (modus_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(o, vOparationMode);
                                                                            }
                                                                            if (ramp_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(r, vRampPart);
                                                                            }
                                                                            if (lower_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(l, vLowerPart);
                                                                            }
                                                                            if (boost_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(b, vBoostPart);
                                                                            }

                                                                              /*      this.datapointAPI.writeDataPoint(r, vRampPart)
                                                                                        .then(() => {
                                                                                            this.datapointAPI.writeDataPoint(i, vGroupID)
                                                                                                .then(() => {
                                                                                                    this.datapointAPI.writeDataPoint(s, vTargetTemperatur)
                                                                                                        .then(() => {
                                                                                                            this.datapointAPI.writeDataPoint(o, vOparationMode)
                                                                                                                .then(() => {
                                                                                                                    this.datapointAPI.writeDataPoint(l, vLowerPart)
                                                                                                                        .then(() => {
                                                                                                                            this.datapointAPI.writeDataPoint(b, vBoostPart)
                                                                                                                                .then(() => {

                                                                                                                                    if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                                                                    {this.datapointAPI.writeDataPoint(z, vZoneOnOff)}



                                                                                                                });
                                                                                                        });
                                                                                                        });
                                                                                                });
                                                                                        });
                                                                                });*/
                                                                        });
                                                                });
                                                        });
                                                });
                                        });
                                });
                        });break;
                    case 13: this.datapointAPI.readDataPoint('10:Zone13.ZoneOn', 0)
                        .then((resolve) => {
                            vZoneOnOff = resolve.value;
                            this.datapointAPI.readDataPoint('10:Zone13.GroupID', 0)
                                .then((resolve) => {
                                    vGroupID = resolve.value;
                                    this.datapointAPI.readDataPoint('10:SetPointManager13.SetPointLVD', 0)
                                        .then((resolve) => {
                                            vTargetTemperatur = resolve.value;
                                            this.datapointAPI.readDataPoint('10:Zone13.OperationMode', 0)
                                                .then((resolve) => {
                                                    vOparationMode = resolve.value;
                                                    this.datapointAPI.readDataPoint('10:ModeOfWork13.LowParticipation', 0)
                                                        .then((resolve) => {
                                                            vLowerPart = resolve.value;
                                                            this.datapointAPI.readDataPoint('10:ModeOfWork13.BooParticipation', 0)
                                                                .then((resolve) => {
                                                                    vBoostPart = resolve.value;
                                                                    this.datapointAPI.readDataPoint('10:ModeOfWork13.RamParticipation', 0)
                                                                        .then((resolve) => {
                                                                            vRampPart = resolve.value;


                                                                    // write these values to the Zone 1:
                                                                            if (zoneonoff_c === 1) {
                                                                                if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                {this.datapointAPI.writeDataPoint(z, vZoneOnOff);}
                                                                            }
                                                                            if (groupid_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(i, vGroupID);
                                                                            }
                                                                            if (target_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(s, vTargetTemperatur);
                                                                            }
                                                                            if (modus_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(o, vOparationMode);
                                                                            }
                                                                            if (ramp_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(r, vRampPart);
                                                                            }
                                                                            if (lower_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(l, vLowerPart);
                                                                            }
                                                                            if (boost_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(b, vBoostPart);
                                                                            }

                                                                             /*       this.datapointAPI.writeDataPoint(r, vRampPart)
                                                                                        .then(() => {
                                                                                            this.datapointAPI.writeDataPoint(i, vGroupID)
                                                                                                .then(() => {
                                                                                                    this.datapointAPI.writeDataPoint(s, vTargetTemperatur)
                                                                                                        .then(() => {
                                                                                                            this.datapointAPI.writeDataPoint(o, vOparationMode)
                                                                                                                .then(() => {
                                                                                                                    this.datapointAPI.writeDataPoint(l, vLowerPart)
                                                                                                                        .then(() => {
                                                                                                                            this.datapointAPI.writeDataPoint(b, vBoostPart)
                                                                                                                                .then(() => {

                                                                                                                                    if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                                                                    {this.datapointAPI.writeDataPoint(z, vZoneOnOff)}



                                                                                                                });
                                                                                                        });
                                                                                                        });
                                                                                                });
                                                                                        });
                                                                                });*/
                                                                        });
                                                                });
                                                        });
                                                });
                                        });
                                });
                        });break;
                    case 14: this.datapointAPI.readDataPoint('10:Zone14.ZoneOn', 0)
                        .then((resolve) => {
                            vZoneOnOff = resolve.value;
                            this.datapointAPI.readDataPoint('10:Zone14.GroupID', 0)
                                .then((resolve) => {
                                    vGroupID = resolve.value;
                                    this.datapointAPI.readDataPoint('10:SetPointManager14.SetPointLVD', 0)
                                        .then((resolve) => {
                                            vTargetTemperatur = resolve.value;
                                            this.datapointAPI.readDataPoint('10:Zone14.OperationMode', 0)
                                                .then((resolve) => {
                                                    vOparationMode = resolve.value;
                                                    this.datapointAPI.readDataPoint('10:ModeOfWork14.LowParticipation', 0)
                                                        .then((resolve) => {
                                                            vLowerPart = resolve.value;
                                                            this.datapointAPI.readDataPoint('10:ModeOfWork14.BooParticipation', 0)
                                                                .then((resolve) => {
                                                                    vBoostPart = resolve.value;
                                                                    this.datapointAPI.readDataPoint('10:ModeOfWork14.RamParticipation', 0)
                                                                        .then((resolve) => {
                                                                            vRampPart = resolve.value;


                                                                    // write these values to the Zone 1:
                                                                            if (zoneonoff_c === 1) {
                                                                                if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                {this.datapointAPI.writeDataPoint(z, vZoneOnOff);}
                                                                            }
                                                                            if (groupid_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(i, vGroupID);
                                                                            }
                                                                            if (target_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(s, vTargetTemperatur);
                                                                            }
                                                                            if (modus_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(o, vOparationMode);
                                                                            }
                                                                            if (ramp_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(r, vRampPart);
                                                                            }
                                                                            if (lower_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(l, vLowerPart);
                                                                            }
                                                                            if (boost_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(b, vBoostPart);
                                                                            }

                                                                              /*      this.datapointAPI.writeDataPoint(r, vRampPart)
                                                                                        .then(() => {
                                                                                            this.datapointAPI.writeDataPoint(i, vGroupID)
                                                                                                .then(() => {
                                                                                                    this.datapointAPI.writeDataPoint(s, vTargetTemperatur)
                                                                                                        .then(() => {
                                                                                                            this.datapointAPI.writeDataPoint(o, vOparationMode)
                                                                                                                .then(() => {
                                                                                                                    this.datapointAPI.writeDataPoint(l, vLowerPart)
                                                                                                                        .then(() => {
                                                                                                                            this.datapointAPI.writeDataPoint(b, vBoostPart)
                                                                                                                                .then(() => {

                                                                                                                                    if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                                                                    {this.datapointAPI.writeDataPoint(z, vZoneOnOff)}

                                                                                                                });
                                                                                                        });
                                                                                                        });
                                                                                                });
                                                                                        });
                                                                                });*/
                                                                        });
                                                                });
                                                        });
                                                });
                                        });
                                });
                        });break;
                    case 15: this.datapointAPI.readDataPoint('10:Zone15.ZoneOn', 0)
                        .then((resolve) => {
                            vZoneOnOff = resolve.value;
                            this.datapointAPI.readDataPoint('10:Zone15.GroupID', 0)
                                .then((resolve) => {
                                    vGroupID = resolve.value;
                                    this.datapointAPI.readDataPoint('10:SetPointManager15.SetPointLVD', 0)
                                        .then((resolve) => {
                                            vTargetTemperatur = resolve.value;
                                            this.datapointAPI.readDataPoint('10:Zone15.OperationMode', 0)
                                                .then((resolve) => {
                                                    vOparationMode = resolve.value;
                                                    this.datapointAPI.readDataPoint('10:ModeOfWork15.LowParticipation', 0)
                                                        .then((resolve) => {
                                                            vLowerPart = resolve.value;
                                                            this.datapointAPI.readDataPoint('10:ModeOfWork15.BooParticipation', 0)
                                                                .then((resolve) => {
                                                                    vBoostPart = resolve.value;
                                                                    this.datapointAPI.readDataPoint('10:ModeOfWork15.RamParticipation', 0)
                                                                        .then((resolve) => {
                                                                            vRampPart = resolve.value;


                                                                    // write these values to the Zone 1:
                                                                            if (zoneonoff_c === 1) {
                                                                                if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                {this.datapointAPI.writeDataPoint(z, vZoneOnOff);}
                                                                            }
                                                                            if (groupid_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(i, vGroupID);
                                                                            }
                                                                            if (target_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(s, vTargetTemperatur);
                                                                            }
                                                                            if (modus_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(o, vOparationMode);
                                                                            }
                                                                            if (ramp_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(r, vRampPart);
                                                                            }
                                                                            if (lower_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(l, vLowerPart);
                                                                            }
                                                                            if (boost_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(b, vBoostPart);
                                                                            }

                                                                                /*    this.datapointAPI.writeDataPoint(r, vRampPart)
                                                                                        .then(() => {
                                                                                            this.datapointAPI.writeDataPoint(i, vGroupID)
                                                                                                .then(() => {
                                                                                                    this.datapointAPI.writeDataPoint(s, vTargetTemperatur)
                                                                                                        .then(() => {
                                                                                                            this.datapointAPI.writeDataPoint(o, vOparationMode)
                                                                                                                .then(() => {
                                                                                                                    this.datapointAPI.writeDataPoint(l, vLowerPart)
                                                                                                                        .then(() => {
                                                                                                                            this.datapointAPI.writeDataPoint(b, vBoostPart)
                                                                                                                                .then(() => {

                                                                                                                                    if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                                                                    {this.datapointAPI.writeDataPoint(z, vZoneOnOff)}



                                                                                                                });
                                                                                                        });
                                                                                                        });
                                                                                                });
                                                                                        });
                                                                                });*/
                                                                        });
                                                                });
                                                        });
                                                });
                                        });
                                });
                        });break;
                    case 16: this.datapointAPI.readDataPoint('10:Zone16.ZoneOn', 0)
                        .then((resolve) => {
                            vZoneOnOff = resolve.value;
                            this.datapointAPI.readDataPoint('10:Zone16.GroupID', 0)
                                .then((resolve) => {
                                    vGroupID = resolve.value;
                                    this.datapointAPI.readDataPoint('10:SetPointManager16.SetPointLVD', 0)
                                        .then((resolve) => {
                                            vTargetTemperatur = resolve.value;
                                            this.datapointAPI.readDataPoint('10:Zone16.OperationMode', 0)
                                                .then((resolve) => {
                                                    vOparationMode = resolve.value;
                                                    this.datapointAPI.readDataPoint('10:ModeOfWork16.LowParticipation', 0)
                                                        .then((resolve) => {
                                                            vLowerPart = resolve.value;
                                                            this.datapointAPI.readDataPoint('10:ModeOfWork16.BooParticipation', 0)
                                                                .then((resolve) => {
                                                                    vBoostPart = resolve.value;
                                                                    this.datapointAPI.readDataPoint('10:ModeOfWork16.RamParticipation', 0)
                                                                        .then((resolve) => {
                                                                            vRampPart = resolve.value;


                                                                    // write these values to the Zone 1:
                                                                            if (zoneonoff_c === 1) {
                                                                                if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                {this.datapointAPI.writeDataPoint(z, vZoneOnOff);}
                                                                            }
                                                                            if (groupid_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(i, vGroupID);
                                                                            }
                                                                            if (target_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(s, vTargetTemperatur);
                                                                            }
                                                                            if (modus_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(o, vOparationMode);
                                                                            }
                                                                            if (ramp_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(r, vRampPart);
                                                                            }
                                                                            if (lower_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(l, vLowerPart);
                                                                            }
                                                                            if (boost_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(b, vBoostPart);
                                                                            }

                                                                                /*    this.datapointAPI.writeDataPoint(r, vRampPart)
                                                                                        .then(() => {
                                                                                            this.datapointAPI.writeDataPoint(i, vGroupID)
                                                                                                .then(() => {
                                                                                                    this.datapointAPI.writeDataPoint(s, vTargetTemperatur)
                                                                                                        .then(() => {
                                                                                                            this.datapointAPI.writeDataPoint(o, vOparationMode)
                                                                                                                .then(() => {
                                                                                                                    this.datapointAPI.writeDataPoint(l, vLowerPart)
                                                                                                                        .then(() => {
                                                                                                                            this.datapointAPI.writeDataPoint(b, vBoostPart)
                                                                                                                                .then(() => {

                                                                                                                                    if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                                                                    {this.datapointAPI.writeDataPoint(z, vZoneOnOff)}



                                                                                                                });
                                                                                                        });
                                                                                                        });
                                                                                                });
                                                                                        });
                                                                                });*/
                                                                        });
                                                                });
                                                        });
                                                });
                                        });
                                });
                        });break;
                    case 17: this.datapointAPI.readDataPoint('10:Zone17.ZoneOn', 0)
                        .then((resolve) => {
                            vZoneOnOff = resolve.value;
                            this.datapointAPI.readDataPoint('10:Zone17.GroupID', 0)
                                .then((resolve) => {
                                    vGroupID = resolve.value;
                                    this.datapointAPI.readDataPoint('10:SetPointManager17.SetPointLVD', 0)
                                        .then((resolve) => {
                                            vTargetTemperatur = resolve.value;
                                            this.datapointAPI.readDataPoint('10:Zone17.OperationMode', 0)
                                                .then((resolve) => {
                                                    vOparationMode = resolve.value;
                                                    this.datapointAPI.readDataPoint('10:ModeOfWork17.LowParticipation', 0)
                                                        .then((resolve) => {
                                                            vLowerPart = resolve.value;
                                                            this.datapointAPI.readDataPoint('10:ModeOfWork17.BooParticipation', 0)
                                                                .then((resolve) => {
                                                                    vBoostPart = resolve.value;
                                                                    this.datapointAPI.readDataPoint('10:ModeOfWork17.RamParticipation', 0)
                                                                        .then((resolve) => {
                                                                            vRampPart = resolve.value;


                                                                    // write these values to the Zone 1:
                                                                            if (zoneonoff_c === 1) {
                                                                                if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                {this.datapointAPI.writeDataPoint(z, vZoneOnOff);}
                                                                            }
                                                                            if (groupid_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(i, vGroupID);
                                                                            }
                                                                            if (target_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(s, vTargetTemperatur);
                                                                            }
                                                                            if (modus_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(o, vOparationMode);
                                                                            }
                                                                            if (ramp_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(r, vRampPart);
                                                                            }
                                                                            if (lower_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(l, vLowerPart);
                                                                            }
                                                                            if (boost_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(b, vBoostPart);
                                                                            }

                                                                               /*     this.datapointAPI.writeDataPoint(r, vRampPart)
                                                                                        .then(() => {
                                                                                            this.datapointAPI.writeDataPoint(i, vGroupID)
                                                                                                .then(() => {
                                                                                                    this.datapointAPI.writeDataPoint(s, vTargetTemperatur)
                                                                                                        .then(() => {
                                                                                                            this.datapointAPI.writeDataPoint(o, vOparationMode)
                                                                                                                .then(() => {
                                                                                                                    this.datapointAPI.writeDataPoint(l, vLowerPart)
                                                                                                                        .then(() => {
                                                                                                                            this.datapointAPI.writeDataPoint(b, vBoostPart)
                                                                                                                                .then(() => {

                                                                                                                                    if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                                                                    {this.datapointAPI.writeDataPoint(z, vZoneOnOff)}



                                                                                                                });
                                                                                                        });
                                                                                                        });
                                                                                                });
                                                                                        });
                                                                                });*/
                                                                        });
                                                                });
                                                        });
                                                });
                                        });
                                });
                        });break;
                    case 18: this.datapointAPI.readDataPoint('10:Zone18.ZoneOn', 0)
                        .then((resolve) => {
                            vZoneOnOff = resolve.value;
                            this.datapointAPI.readDataPoint('10:Zone18.GroupID', 0)
                                .then((resolve) => {
                                    vGroupID = resolve.value;
                                    this.datapointAPI.readDataPoint('10:SetPointManager18.SetPointLVD', 0)
                                        .then((resolve) => {
                                            vTargetTemperatur = resolve.value;
                                            this.datapointAPI.readDataPoint('10:Zone18.OperationMode', 0)
                                                .then((resolve) => {
                                                    vOparationMode = resolve.value;
                                                    this.datapointAPI.readDataPoint('10:ModeOfWork18.LowParticipation', 0)
                                                        .then((resolve) => {
                                                            vLowerPart = resolve.value;
                                                            this.datapointAPI.readDataPoint('10:ModeOfWork18.BooParticipation', 0)
                                                                .then((resolve) => {
                                                                    vBoostPart = resolve.value;
                                                                    this.datapointAPI.readDataPoint('10:ModeOfWork18.RamParticipation', 0)
                                                                        .then((resolve) => {
                                                                            vRampPart = resolve.value;


                                                                    // write these values to the Zone 1:
                                                                            if (zoneonoff_c === 1) {
                                                                                if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                {this.datapointAPI.writeDataPoint(z, vZoneOnOff);}
                                                                            }
                                                                            if (groupid_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(i, vGroupID);
                                                                            }
                                                                            if (target_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(s, vTargetTemperatur);
                                                                            }
                                                                            if (modus_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(o, vOparationMode);
                                                                            }
                                                                            if (ramp_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(r, vRampPart);
                                                                            }
                                                                            if (lower_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(l, vLowerPart);
                                                                            }
                                                                            if (boost_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(b, vBoostPart);
                                                                            }

                                                                                 /*   this.datapointAPI.writeDataPoint(r, vRampPart)
                                                                                        .then(() => {
                                                                                            this.datapointAPI.writeDataPoint(i, vGroupID)
                                                                                                .then(() => {
                                                                                                    this.datapointAPI.writeDataPoint(s, vTargetTemperatur)
                                                                                                        .then(() => {
                                                                                                            this.datapointAPI.writeDataPoint(o, vOparationMode)
                                                                                                                .then(() => {
                                                                                                                    this.datapointAPI.writeDataPoint(l, vLowerPart)
                                                                                                                        .then(() => {
                                                                                                                            this.datapointAPI.writeDataPoint(b, vBoostPart)
                                                                                                                                .then(() => {

                                                                                                                                    if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                                                                    {this.datapointAPI.writeDataPoint(z, vZoneOnOff)}



                                                                                                                });
                                                                                                        });
                                                                                                        });
                                                                                                });
                                                                                        });
                                                                                });*/
                                                                        });
                                                                });
                                                        });
                                                });
                                        });
                                });
                        });break;
                    case 19: this.datapointAPI.readDataPoint('10:Zone19.ZoneOn', 0)
                        .then((resolve) => {
                            vZoneOnOff = resolve.value;
                            this.datapointAPI.readDataPoint('10:Zone19.GroupID', 0)
                                .then((resolve) => {
                                    vGroupID = resolve.value;
                                    this.datapointAPI.readDataPoint('10:SetPointManager19.SetPointLVD', 0)
                                        .then((resolve) => {
                                            vTargetTemperatur = resolve.value;
                                            this.datapointAPI.readDataPoint('10:Zone19.OperationMode', 0)
                                                .then((resolve) => {
                                                    vOparationMode = resolve.value;
                                                    this.datapointAPI.readDataPoint('10:ModeOfWork19.LowParticipation', 0)
                                                        .then((resolve) => {
                                                            vLowerPart = resolve.value;
                                                            this.datapointAPI.readDataPoint('10:ModeOfWork19.BooParticipation', 0)
                                                                .then((resolve) => {
                                                                    vBoostPart = resolve.value;
                                                                    this.datapointAPI.readDataPoint('10:ModeOfWork19.RamParticipation', 0)
                                                                        .then((resolve) => {
                                                                            vRampPart = resolve.value;


                                                                    // write these values to the Zone 1:
                                                                            if (zoneonoff_c === 1) {
                                                                                if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                {this.datapointAPI.writeDataPoint(z, vZoneOnOff);}
                                                                            }
                                                                            if (groupid_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(i, vGroupID);
                                                                            }
                                                                            if (target_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(s, vTargetTemperatur);
                                                                            }
                                                                            if (modus_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(o, vOparationMode);
                                                                            }
                                                                            if (ramp_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(r, vRampPart);
                                                                            }
                                                                            if (lower_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(l, vLowerPart);
                                                                            }
                                                                            if (boost_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(b, vBoostPart);
                                                                            }

                                                                               /*     this.datapointAPI.writeDataPoint(r, vRampPart)
                                                                                        .then(() => {
                                                                                            this.datapointAPI.writeDataPoint(i, vGroupID)
                                                                                                .then(() => {
                                                                                                    this.datapointAPI.writeDataPoint(s, vTargetTemperatur)
                                                                                                        .then(() => {
                                                                                                            this.datapointAPI.writeDataPoint(o, vOparationMode)
                                                                                                                .then(() => {
                                                                                                                    this.datapointAPI.writeDataPoint(l, vLowerPart)
                                                                                                                        .then(() => {
                                                                                                                            this.datapointAPI.writeDataPoint(b, vBoostPart)
                                                                                                                                .then(() => {

                                                                                                                                    if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                                                                    {this.datapointAPI.writeDataPoint(z, vZoneOnOff)}



                                                                                                                });
                                                                                                        });
                                                                                                        });
                                                                                                });
                                                                                        });
                                                                                });*/
                                                                        });
                                                                });
                                                        });
                                                });
                                        });
                                });
                        });break;
                    case 20: this.datapointAPI.readDataPoint('10:Zone20.ZoneOn', 0)
                        .then((resolve) => {
                            vZoneOnOff = resolve.value;
                            this.datapointAPI.readDataPoint('10:Zone20.GroupID', 0)
                                .then((resolve) => {
                                    vGroupID = resolve.value;
                                    this.datapointAPI.readDataPoint('10:SetPointManager20.SetPointLVD', 0)
                                        .then((resolve) => {
                                            vTargetTemperatur = resolve.value;
                                            this.datapointAPI.readDataPoint('10:Zone20.OperationMode', 0)
                                                .then((resolve) => {
                                                    vOparationMode = resolve.value;
                                                    this.datapointAPI.readDataPoint('10:ModeOfWork20.LowParticipation', 0)
                                                        .then((resolve) => {
                                                            vLowerPart = resolve.value;
                                                            this.datapointAPI.readDataPoint('10:ModeOfWork20.BooParticipation', 0)
                                                                .then((resolve) => {
                                                                    vBoostPart = resolve.value;
                                                                    this.datapointAPI.readDataPoint('10:ModeOfWork20.RamParticipation', 0)
                                                                        .then((resolve) => {
                                                                            vRampPart = resolve.value;


                                                                    // write these values to the Zone 1:
                                                                            if (zoneonoff_c === 1) {
                                                                                if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                {this.datapointAPI.writeDataPoint(z, vZoneOnOff);}
                                                                            }
                                                                            if (groupid_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(i, vGroupID);
                                                                            }
                                                                            if (target_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(s, vTargetTemperatur);
                                                                            }
                                                                            if (modus_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(o, vOparationMode);
                                                                            }
                                                                            if (ramp_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(r, vRampPart);
                                                                            }
                                                                            if (lower_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(l, vLowerPart);
                                                                            }
                                                                            if (boost_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(b, vBoostPart);
                                                                            }

                                                                                /*    this.datapointAPI.writeDataPoint(r, vRampPart)
                                                                                        .then(() => {
                                                                                            this.datapointAPI.writeDataPoint(i, vGroupID)
                                                                                                .then(() => {
                                                                                                    this.datapointAPI.writeDataPoint(s, vTargetTemperatur)
                                                                                                        .then(() => {
                                                                                                            this.datapointAPI.writeDataPoint(o, vOparationMode)
                                                                                                                .then(() => {
                                                                                                                    this.datapointAPI.writeDataPoint(l, vLowerPart)
                                                                                                                        .then(() => {
                                                                                                                            this.datapointAPI.writeDataPoint(b, vBoostPart)
                                                                                                                                .then(() => {

                                                                                                                                    if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                                                                    {this.datapointAPI.writeDataPoint(z, vZoneOnOff)}



                                                                                                                });
                                                                                                        });
                                                                                                        });
                                                                                                });
                                                                                        });
                                                                                });*/
                                                                        });
                                                                });
                                                        });
                                                });
                                        });
                                });
                        });break;
                    case 21: this.datapointAPI.readDataPoint('10:Zone21.ZoneOn', 0)
                        .then((resolve) => {
                            vZoneOnOff = resolve.value;
                            this.datapointAPI.readDataPoint('10:Zone21.GroupID', 0)
                                .then((resolve) => {
                                    vGroupID = resolve.value;
                                    this.datapointAPI.readDataPoint('10:SetPointManager21.SetPointLVD', 0)
                                        .then((resolve) => {
                                            vTargetTemperatur = resolve.value;
                                            this.datapointAPI.readDataPoint('10:Zone21.OperationMode', 0)
                                                .then((resolve) => {
                                                    vOparationMode = resolve.value;
                                                    this.datapointAPI.readDataPoint('10:ModeOfWork21.LowParticipation', 0)
                                                        .then((resolve) => {
                                                            vLowerPart = resolve.value;
                                                            this.datapointAPI.readDataPoint('10:ModeOfWork21.BooParticipation', 0)
                                                                .then((resolve) => {
                                                                    vBoostPart = resolve.value;
                                                                    this.datapointAPI.readDataPoint('10:ModeOfWork21.RamParticipation', 0)
                                                                        .then((resolve) => {
                                                                            vRampPart = resolve.value;


                                                                    // write these values to the Zone 1:
                                                                            if (zoneonoff_c === 1) {
                                                                                if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                {this.datapointAPI.writeDataPoint(z, vZoneOnOff);}
                                                                            }
                                                                            if (groupid_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(i, vGroupID);
                                                                            }
                                                                            if (target_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(s, vTargetTemperatur);
                                                                            }
                                                                            if (modus_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(o, vOparationMode);
                                                                            }
                                                                            if (ramp_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(r, vRampPart);
                                                                            }
                                                                            if (lower_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(l, vLowerPart);
                                                                            }
                                                                            if (boost_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(b, vBoostPart);
                                                                            }

                                                                                /*    this.datapointAPI.writeDataPoint(r, vRampPart)
                                                                                        .then(() => {
                                                                                            this.datapointAPI.writeDataPoint(i, vGroupID)
                                                                                                .then(() => {
                                                                                                    this.datapointAPI.writeDataPoint(s, vTargetTemperatur)
                                                                                                        .then(() => {
                                                                                                            this.datapointAPI.writeDataPoint(o, vOparationMode)
                                                                                                                .then(() => {
                                                                                                                    this.datapointAPI.writeDataPoint(l, vLowerPart)
                                                                                                                        .then(() => {
                                                                                                                            this.datapointAPI.writeDataPoint(b, vBoostPart)
                                                                                                                                .then(() => {

                                                                                                                                    if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                                                                    {this.datapointAPI.writeDataPoint(z, vZoneOnOff)}



                                                                                                                });
                                                                                                        });
                                                                                                        });
                                                                                                });
                                                                                        });
                                                                                });*/
                                                                        });
                                                                });
                                                        });
                                                });
                                        });
                                });
                        });break;
                    case 22: this.datapointAPI.readDataPoint('10:Zone22.ZoneOn', 0)
                        .then((resolve) => {
                            vZoneOnOff = resolve.value;
                            this.datapointAPI.readDataPoint('10:Zone22.GroupID', 0)
                                .then((resolve) => {
                                    vGroupID = resolve.value;
                                    this.datapointAPI.readDataPoint('10:SetPointManager22.SetPointLVD', 0)
                                        .then((resolve) => {
                                            vTargetTemperatur = resolve.value;
                                            this.datapointAPI.readDataPoint('10:Zone22.OperationMode', 0)
                                                .then((resolve) => {
                                                    vOparationMode = resolve.value;
                                                    this.datapointAPI.readDataPoint('10:ModeOfWork22.LowParticipation', 0)
                                                        .then((resolve) => {
                                                            vLowerPart = resolve.value;
                                                            this.datapointAPI.readDataPoint('10:ModeOfWork22.BooParticipation', 0)
                                                                .then((resolve) => {
                                                                    vBoostPart = resolve.value;
                                                                    this.datapointAPI.readDataPoint('10:ModeOfWork22.RamParticipation', 0)
                                                                        .then((resolve) => {
                                                                            vRampPart = resolve.value;


                                                                    // write these values to the Zone 1:
                                                                            if (zoneonoff_c === 1) {
                                                                                if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                {this.datapointAPI.writeDataPoint(z, vZoneOnOff);}
                                                                            }
                                                                            if (groupid_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(i, vGroupID);
                                                                            }
                                                                            if (target_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(s, vTargetTemperatur);
                                                                            }
                                                                            if (modus_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(o, vOparationMode);
                                                                            }
                                                                            if (ramp_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(r, vRampPart);
                                                                            }
                                                                            if (lower_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(l, vLowerPart);
                                                                            }
                                                                            if (boost_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(b, vBoostPart);
                                                                            }

                                                                              /*      this.datapointAPI.writeDataPoint(r, vRampPart)
                                                                                        .then(() => {
                                                                                            this.datapointAPI.writeDataPoint(i, vGroupID)
                                                                                                .then(() => {
                                                                                                    this.datapointAPI.writeDataPoint(s, vTargetTemperatur)
                                                                                                        .then(() => {
                                                                                                            this.datapointAPI.writeDataPoint(o, vOparationMode)
                                                                                                                .then(() => {
                                                                                                                    this.datapointAPI.writeDataPoint(l, vLowerPart)
                                                                                                                        .then(() => {
                                                                                                                            this.datapointAPI.writeDataPoint(b, vBoostPart)
                                                                                                                                .then(() => {

                                                                                                                                    if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                                                                    {this.datapointAPI.writeDataPoint(z, vZoneOnOff)}



                                                                                                                });
                                                                                                        });
                                                                                                        });
                                                                                                });
                                                                                        });
                                                                                });*/
                                                                        });
                                                                });
                                                        });
                                                });
                                        });
                                });
                        });break;
                    case 23: this.datapointAPI.readDataPoint('10:Zone23.ZoneOn', 0)
                        .then((resolve) => {
                            vZoneOnOff = resolve.value;
                            this.datapointAPI.readDataPoint('10:Zone23.GroupID', 0)
                                .then((resolve) => {
                                    vGroupID = resolve.value;
                                    this.datapointAPI.readDataPoint('10:SetPointManager23.SetPointLVD', 0)
                                        .then((resolve) => {
                                            vTargetTemperatur = resolve.value;
                                            this.datapointAPI.readDataPoint('10:Zone23.OperationMode', 0)
                                                .then((resolve) => {
                                                    vOparationMode = resolve.value;
                                                    this.datapointAPI.readDataPoint('10:ModeOfWork23.LowParticipation', 0)
                                                        .then((resolve) => {
                                                            vLowerPart = resolve.value;
                                                            this.datapointAPI.readDataPoint('10:ModeOfWork23.BooParticipation', 0)
                                                                .then((resolve) => {
                                                                    vBoostPart = resolve.value;
                                                                    this.datapointAPI.readDataPoint('10:ModeOfWork23.RamParticipation', 0)
                                                                        .then((resolve) => {
                                                                            vRampPart = resolve.value;


                                                                    // write these values to the Zone 1:
                                                                            if (zoneonoff_c === 1) {
                                                                                if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                {this.datapointAPI.writeDataPoint(z, vZoneOnOff);}
                                                                            }
                                                                            if (groupid_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(i, vGroupID);
                                                                            }
                                                                            if (target_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(s, vTargetTemperatur);
                                                                            }
                                                                            if (modus_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(o, vOparationMode);
                                                                            }
                                                                            if (ramp_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(r, vRampPart);
                                                                            }
                                                                            if (lower_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(l, vLowerPart);
                                                                            }
                                                                            if (boost_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(b, vBoostPart);
                                                                            }

                                                                                /*    this.datapointAPI.writeDataPoint(r, vRampPart)
                                                                                        .then(() => {
                                                                                            this.datapointAPI.writeDataPoint(i, vGroupID)
                                                                                                .then(() => {
                                                                                                    this.datapointAPI.writeDataPoint(s, vTargetTemperatur)
                                                                                                        .then(() => {
                                                                                                            this.datapointAPI.writeDataPoint(o, vOparationMode)
                                                                                                                .then(() => {
                                                                                                                    this.datapointAPI.writeDataPoint(l, vLowerPart)
                                                                                                                        .then(() => {
                                                                                                                            this.datapointAPI.writeDataPoint(b, vBoostPart)
                                                                                                                                .then(() => {

                                                                                                                                    if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                                                                    {this.datapointAPI.writeDataPoint(z, vZoneOnOff)}



                                                                                                                });
                                                                                                        });
                                                                                                        });
                                                                                                });
                                                                                        });
                                                                                });*/
                                                                        });
                                                                });
                                                        });
                                                });
                                        });
                                });
                        });break;
                    case 24: this.datapointAPI.readDataPoint('10:Zone24.ZoneOn', 0)
                        .then((resolve) => {
                            vZoneOnOff = resolve.value;
                            this.datapointAPI.readDataPoint('10:Zone24.GroupID', 0)
                                .then((resolve) => {
                                    vGroupID = resolve.value;
                                    this.datapointAPI.readDataPoint('10:SetPointManager24.SetPointLVD', 0)
                                        .then((resolve) => {
                                            vTargetTemperatur = resolve.value;
                                            this.datapointAPI.readDataPoint('10:Zone24.OperationMode', 0)
                                                .then((resolve) => {
                                                    vOparationMode = resolve.value;
                                                    this.datapointAPI.readDataPoint('10:ModeOfWork24.LowParticipation', 0)
                                                        .then((resolve) => {
                                                            vLowerPart = resolve.value;
                                                            this.datapointAPI.readDataPoint('10:ModeOfWork24.BooParticipation', 0)
                                                                .then((resolve) => {
                                                                    vBoostPart = resolve.value;
                                                                    this.datapointAPI.readDataPoint('10:ModeOfWork24.RamParticipation', 0)
                                                                        .then((resolve) => {
                                                                            vRampPart = resolve.value;


                                                                    // write these values to the Zone 1:
                                                                            if (zoneonoff_c === 1) {
                                                                                if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                {this.datapointAPI.writeDataPoint(z, vZoneOnOff);}
                                                                            }
                                                                            if (groupid_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(i, vGroupID);
                                                                            }
                                                                            if (target_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(s, vTargetTemperatur);
                                                                            }
                                                                            if (modus_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(o, vOparationMode);
                                                                            }
                                                                            if (ramp_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(r, vRampPart);
                                                                            }
                                                                            if (lower_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(l, vLowerPart);
                                                                            }
                                                                            if (boost_c === 1) {
                                                                                this.datapointAPI.writeDataPoint(b, vBoostPart);
                                                                            }

                                                                              /*      this.datapointAPI.writeDataPoint(r, vRampPart)
                                                                                        .then(() => {
                                                                                            this.datapointAPI.writeDataPoint(i, vGroupID)
                                                                                                .then(() => {
                                                                                                    this.datapointAPI.writeDataPoint(s, vTargetTemperatur)
                                                                                                        .then(() => {
                                                                                                            this.datapointAPI.writeDataPoint(o, vOparationMode)
                                                                                                                .then(() => {
                                                                                                                    this.datapointAPI.writeDataPoint(l, vLowerPart)
                                                                                                                        .then(() => {
                                                                                                                            this.datapointAPI.writeDataPoint(b, vBoostPart)
                                                                                                                                .then(() => {

                                                                                                                                    if (((factor > 0) && (vZoneOnOff === 1)) || (vZoneOnOff === 0))
                                                                                                                                    {this.datapointAPI.writeDataPoint(z, vZoneOnOff)}



                                                                                                                });
                                                                                                        });
                                                                                                        });
                                                                                                });
                                                                                        });
                                                                                });*/
                                                                        });
                                                                });
                                                        });
                                                });
                                        });
                                });
                        });break;
                }
            });
    }
}

//window.registerWindowModule('Apply_settings_for_zone', ApplySettingsForZone.create);

window.registerDashboardModule('ApplySettingsForZone', ApplySettingsForZone.create);

//ApplySettings.initApplySettings();