UNPKG

iobroker.heatingcontrol

Version:
3,013 lines 148 kB
<html>

<head>
    <!-- Load ioBroker scripts and styles-->
    <link rel="stylesheet" type="text/css" href="../../lib/css/fancytree/ui.fancytree.min.css" />
    <link rel="stylesheet" type="text/css" href="../../css/adapter.css" />
    <link rel="stylesheet" type="text/css" href="../../lib/css/materialize.css">

    <script type="text/javascript" src="../../lib/js/jquery-3.2.1.min.js"></script>
    <script type="text/javascript" src="../../socket.io/socket.io.js"></script>

    <script type="text/javascript" src="../../lib/js/materialize.js"></script>
    <script type="text/javascript" src="../../lib/js/jquery-ui.min.js"></script>
    <script type="text/javascript" src="../../lib/js/jquery.fancytree-all.min.js"></script>

    <script type="text/javascript" src="../../js/translate.js"></script>
    <script type="text/javascript" src="../../lib/js/selectID.js"></script>
    <script type="text/javascript" src="../../js/adapter-settings.js"></script>


    <!-- my own styles -->
    <link rel="stylesheet" type="text/css" href="style.css" />
    <script type="text/javascript" src="words.js"></script>


    <style>

        #dialog-room-edit {
            max-height: 95% !important;
            max-width: 85% !important;
            width: 80% !important;
            height: 90% !important;
            overflow: visible !important;
            top: 10px !important;
        }

        #dialog-select-member {
            max-height: 95% !important;
            max-width: 85% !important;
            width: 80% !important;
            height: 90% !important;
            overflow: visible !important;
            top: 10px !important;
        }

        .collapsible-body {
            margin-left: 2rem !important;
            padding-top: 0 !important;
        }

        redlabel {
            color: red;
        }
    </style>

    <script type="text/javascript">

        //==========================================================================
        //load / save profile
        function SaveProfile(instance) {
            console.log('SaveProfile called ');
            $('#checkResultSaveProfile').html("saving...");

            sendTo(instance, 'saveProfile', null, function (result) {

                generateFile('heatingcontrol_profile.json', result);

                console.log('profile saved ');

                $('#checkResultSaveProfile').html("profile saved");
            });


        }


        function generateFile(filename, obj) {
            var el = document.createElement('a');
            el.setAttribute('href', 'data:application/json;charset=utf-8,' + encodeURIComponent(JSON.stringify(obj, null, 2)));
            el.setAttribute('download', filename);

            el.style.display = 'none';
            document.body.appendChild(el);

            el.click();

            document.body.removeChild(el);
        }



        function LoadProfile(instance) {
            console.log('Load profile called');

            var input = document.createElement('input');
            input.setAttribute('type', 'file');
            input.setAttribute('id', 'files');
            input.setAttribute('opacity', 0);
            input.addEventListener('change', function (e) {
                hchandleFileSelect(e, instance, function () { });
            }, false);
            (input.click)();
        }

        function hchandleFileSelect(evt, instance) {

            console.log('handleFileSelect ' + instance);

            var f = evt.target.files[0];

            if (f) {
                var r = new FileReader();
                r.onload = function (e) {
                    var contents = e.target.result;

                    $('#checkResultLoadProfile').html("loading...");

                    sendTo(instance, 'loadProfile', contents, function (result) {

                        console.log('profile loaded with ' + result);

                        $('#checkResultLoadProfile').html(result);
                        
                        myOnChange(true)
                    });
                }

                r.readAsText(f);
            }
        }

        //==========================================================================

        function DeleteUnusedConfig() {

            let deleted = 0;

            const RoomList = table2values('rooms');

            for (let d = 0; d < DeviceList.length; d++) {

                const room = DeviceList[d].room;

                let bFound = false;
                for (r = 0; r < RoomList.length; r++) {
                    if (room == RoomList[r].name) {
                        bFound = true;
                    }
                }
                if (!bFound) {
                    console.log('delete device ' + DeviceList[d].name);
                    deleted++;

                    DeviceList.splice(d, 1);
                }

            } 

            //and finally rearrange id's
            for (let i = 0; i < DeviceList.length; i++) {
                //console.log("### " + i + " " + JSON.stringify(DeviceList[i]));
                DeviceList[i].id = i + 1;
                //console.log("+++ " + i + " " + JSON.stringify(DeviceList[i]));
            }

            console.log("new device list " + JSON.stringify(DeviceList));

            $('#result_deleteunusedConfig').html(deleted + " unused device deleted");
        }

        //==========================================================================
        function findObjectIdByKey(array, key, value) {

            //Achtung: key wird auf int geparsed!!

            if (array !== null && typeof array !== 'undefined') {

                for (let i = 0; i < array.length; i++) {

                    let val1 = array[i][key];
                    if (typeof array[i][key] !== 'number') {
                        val1 = parseInt(array[i][key]);
                    }

                    let val2 = value;

                    console.log('check for ' + val1 + ' (' + typeof val1 + ') and ' + val2 + ' (' + typeof val2 + ')');
                    if (val1 === val2) {
                        console.log('found');
                        return i;
                    }
                }
            }

            console.log('not found');
            return -1;
        }


        function show_hide_column(table_name, col_name, col_no, do_show) {

            //this is only for header
            var element = document.getElementById(col_name);
            if (element != null) {
                if (do_show) {
                    element.classList.remove("hide");
                }
                else {
                    element.classList.add("hide");
                }

                //here we have all other rows
                var tbl = document.getElementById(table_name);
                var rows = tbl.getElementsByTagName('tr');

                for (var row = 0; row < rows.length; row++) {
                    var cols = rows[row].children;
                    if (col_no >= 0 && col_no < cols.length) {
                        var cell = cols[col_no];
                        if (cell.tagName == 'TD' || cell.tagName == 'TH') {
                            if (do_show) {
                                cell.classList.remove("hide");
                            }
                            else {
                                cell.classList.add("hide");
                            }
                        }
                    }
                }
            }
        }

        var AdapterIsOnline = false;

        function showHideSettings() {
            console.log('showHideSettings');

            //always hide

            if (!AdapterIsOnline) {
                $('.col-adapternotonline').show();
            }
            else {
                $('.col-adapternotonline').hide();
            }

            var TypeDPPresent = $('#Path2PresentDPType')[0].value
            if (TypeDPPresent == 1) {
                $('.col_Path2PresentDPLimit').hide();
            }
            else {
                $('.col_Path2PresentDPLimit').show();
            }

            var TypeDPGuestPresent = $('#Path2GuestsPresentDPType')[0].value
            if (TypeDPGuestPresent == 1) {
                $('.col_Path2GuestsPresentDPLimit').hide();
            }
            else {
                $('.col_Path2GuestsPresentDPLimit').show();
            }

            var TypeDPPartyNow = $('#Path2PartyNowDPType')[0].value
            if (TypeDPPartyNow == 1) {
                $('.col_Path2PartyNowDPLimit').hide();
            }
            else {
                $('.col_Path2PartyNowDPLimit').show();
            }

            var ThermostatModeIfNoHeatingperiod = $('#ThermostatModeIfNoHeatingperiod')[0].value;

            if (ThermostatModeIfNoHeatingperiod == 2) {

                $('.col-FixTempIfNoHeatingPeriod').show();
            }
            else {
                $('.col-FixTempIfNoHeatingPeriod').hide();
            }

            var elementPageActors = document.getElementById("page-actors");
            var elementPageSensors = document.getElementById("page-sensors");
            var elementPageAddTempSensors = document.getElementById("page-addTempSensors");

            var $useActors = $('#UseActors');
            if ($useActors.prop('checked')) {
                console.log('show actor settings');

                if (ThermostatModeIfNoHeatingperiod == 2) {
                    $('.col-useactorifnoheating').hide();
                }
                else {
                    $('.col-useactorifnoheating').show();
                }
                $('.col-useactorifnothermostat').show();
                $('.col-ActorOnDelay').show();
                $('.col-ActorOffDelay').show();
                $('.col-InterActorDelay').show();
                $('.col-regulatortype').show();
                $('.col-extendedInfoLogActor').show();
                $('.col-ExtHandlingActorAckWaitTime').show();
                $('.col-ExtHandlingActorRepTime').show();

                elementPageActors.classList.remove("hide");
            }
            else {
                console.log('hide actor settings');

                $('.col-useactorifnoheating').hide();
                $('.col-useactorifnothermostat').hide();
                

                $('.col-ActorOnDelay').hide();
                $('.col-ActorOffDelay').hide();
                $('.col-InterActorDelay').hide();
                $('.col-regulatortype').hide();
                $('.col-extendedInfoLogActor').hide();
                $('.col-ExtHandlingActorAckWaitTime').hide();
                $('.col-ExtHandlingActorRepTime').hide();

                elementPageActors.classList.add("hide");
            }
            var $useSensors = $('#UseSensors');

            if ($useSensors.prop('checked')) {
                console.log('show sensor settings');

                elementPageSensors.classList.remove("hide");

                $('.col-SensorOpenDelay').show();
                $('.col-SensorCloseDelay').show();
                $('.col-extendedInfoLogWindow').show();
            }
            else {
                console.log('hide sensors settings');

                elementPageSensors.classList.add("hide");

                $('.col-SensorOpenDelay').hide();
                $('.col-SensorCloseDelay').hide();
                $('.col-extendedInfoLogWindow').hide();
            }

            var $UseAddTempSensors = $('#UseAddTempSensors');

            if ($UseAddTempSensors.prop('checked')) {
                console.log('show additional sensor settings');

                elementPageAddTempSensors.classList.remove("hide");
                $('.col-AddTempSensorsTempLimit').show();
                $('.col-AddTempSensorsTempLimit-descr').show();
                $('.col-AddTempSensorsMaxTimeDiff').show();
                $('.col-AddTempSensorsMaxTimeDiff-descr').show();
                $('.col-AddTempSensorsUseEveryOffsetChange').show();
                $('.col-AddTempSensorsUseEveryOffsetChange-descr').show();

            }
            else {
                console.log('hide additional sensors settings');

                elementPageAddTempSensors.classList.add("hide");
                $('.col-AddTempSensorsTempLimit').hide();
                $('.col-AddTempSensorsTempLimit-descr').hide();
                $('.col-AddTempSensorsMaxTimeDiff').hide();
                $('.col-AddTempSensorsMaxTimeDiff-descr').hide();
                $('.col-AddTempSensorsUseEveryOffsetChange').hide();
                $('.col-AddTempSensorsUseEveryOffsetChange-descr').hide();
            }


            var $useFixHeatingPeriod = $('#UseFixHeatingPeriod');

            if ($useFixHeatingPeriod.prop('checked')) {
                console.log('show sensor fix heating period settings');
                $('.col-FixHeatingPeriod-Start').show();
                $('.col-FixHeatingPeriod-End').show();
            }
            else {
                console.log('hide sensor fix heating period settings');
                $('.col-FixHeatingPeriod-Start').hide();
                $('.col-FixHeatingPeriod-End').hide();
            }

            var $useVisFromPittini = $('#UseVisFromPittini');

            if ($useVisFromPittini.prop('checked')) {
                console.log('show settings for Pittini vis');
                $('.col-PittiniPathImageWindowOpen').show();
                $('.col-PittiniPathImageWindowClosed').show();

                $('.col-VisMinProfilTemp').show();
                $('.col-VisMaxProfilTemp').show();
                $('.col-VisStepWidthProfilTemp').show();
            }
            else {
                console.log('hide settings for Pittini vis');
                $('.col-PittiniPathImageWindowOpen').hide();
                $('.col-PittiniPathImageWindowClosed').hide();

                $('.col-VisMinProfilTemp').hide();
                $('.col-VisMaxProfilTemp').hide();
                $('.col-VisStepWidthProfilTemp').hide();
            }

            //first col of device tables
            show_hide_column("table_thermostats", "thermostat_col_0", 0, false);
            show_hide_column("table_actors", "actor_col_0", 0, false);
            show_hide_column("table_sensors", "sensor_col_0", 0, false);
            show_hide_column("table_addtempsensors", "addtempsensor_col_0", 0, false);

            var $ThermostatHandlesWindowOpen = $('#ThermostatHandlesWindowOpen');
            if ($ThermostatHandlesWindowOpen.prop('checked')) {
                console.log('show settings ThermostatHandlesWindowOpen');
                $('.col-WaitForTempIfWindowOpen').show();
            }
            else {
                console.log('hide settings ThermostatHandlesWindowOpen');
                $('.col-WaitForTempIfWindowOpen').hide();
            }
            show_hide_column("table_rooms", "rooms_col_3", 2, false);

            ShowHideNotificationSettings($('#notificationsType').val());

            ShowHideNotificationDiscordSettings($('#discordTarget').val());

            ShowHideCustumizedNotifications($('#useCustumizedNotifications').prop('checked')); 

        }


        function ShowHideCustumizedNotifications(current) {
            console.log("ShowHideCustumizedNotifications " + current);

            if (current) {

                $('.useCustumizedNotificationsWithInstanceName').show();
                $('.useCustumizedNotificationsNewTargetTemp').show();

                if ($('#UseActors').prop('checked')) {
                    $('.useCustumizedNotificationsActorOn').show();
                    $('.useCustumizedNotificationsActorOff').show();
                }
                $('.useCustumizedNotificationsWindowOpen').show();
                $('.useCustumizedNotificationsWindowClose').show();

            }
            else {
                $('.useCustumizedNotificationsWithInstanceName').hide();
                $('.useCustumizedNotificationsNewTargetTemp').hide();
                $('.useCustumizedNotificationsActorOn').hide();
                $('.useCustumizedNotificationsActorOff').hide();
                $('.useCustumizedNotificationsWindowOpen').hide();
                $('.useCustumizedNotificationsWindowClose').hide();

            }


            // alles hide, wenn Benachrichtigung off
            console.log("ShowHideCustumizedNotifications notification enabled " + $('#notificationEnabled').prop('checked'));

            if ($('#notificationEnabled').prop('checked')) {

                $('.customizedNotifications').show();
            }
            else {
                $('.customizedNotifications').hide();
            }
        }



        function ShowHideNotificationDiscordSettings(current) {
            console.log("ShowHideNotificationDiscordSettings " + current);

            if ($('#notificationEnabled').prop('checked')) {
                if (current === 'UserId') {
                    $('.discordUserId').show();
                    $('.discordUserTag').hide();
                    $('.discordServerChannel').hide();
                }
                else if (current === 'UserTag') {
                    $('.discordUserId').hide();
                    $('.discordUserTag').show();
                    $('.discordServerChannel').hide();
                }
                else if (current === 'ServerChannel') {
                    $('.discordUserId').hide();
                    $('.discordUserTag').hide();
                    $('.discordServerChannel').show();
                }
            }
            else {
                $('.discordUserId').hide();
                $('.discordUserTag').hide();
                $('.discordServerChannel').hide();
            }


        }

        function ShowHideNotificationSettings(current) {

            console.log("ShowHideNotificationSettings " + current + " " + $('#notificationEnabled').prop('checked'));

            if ($('#notificationEnabled').prop('checked')) {

                $('.notificationsType').show();
                $('.col-notificationsTemperature').show();
                if ($('#UseActors').prop('checked')) {
                    $('.col-notificationsActor').show();
                }
                $('.col-notificationsWindow').show();


                if (current === 'Telegram') {
                    $('.email').hide();
                    $('.pushover').hide();
                    $('.whatsapp').hide();
                    $('.signal').hide();
                    $('.telegram').show();
                    $('.discord').hide();
                } else if (current === 'E-Mail') {
                    $('.telegram').hide();
                    $('.pushover').hide();
                    $('.whatsapp').hide();
                    $('.signal').hide();
                    $('.email').show();
                    $('.discord').hide();
                } else if (current === 'Pushover') {
                    $('.telegram').hide();
                    $('.email').hide();
                    $('.whatsapp').hide();
                    $('.signal').hide();
                    $('.pushover').show();
                    $('.discord').hide();
                } else if (current === 'WhatsApp') {
                    $('.telegram').hide();
                    $('.email').hide();
                    $('.pushover').hide();
                    $('.signal').hide();
                    $('.whatsapp').show();
                    $('.discord').hide();
                } else if (current === 'Signal') {
                    $('.telegram').hide();
                    $('.email').hide();
                    $('.pushover').hide();
                    $('.whatsapp').hide();
                    $('.signal').show();
                    $('.discord').hide();
                } else if (current === 'Discord') {
                    $('.telegram').hide();
                    $('.email').hide();
                    $('.pushover').hide();
                    $('.whatsapp').hide();
                    $('.signal').hide();
                    $('.discord').show();
                }
            }
            else {

                $('.notificationsType').hide();
                $('.col-notificationsTemperature').hide();
                $('.col-notificationsActor').hide();
                $('.col-notificationsWindow').hide();

                $('.telegram').hide();
                $('.email').hide();
                $('.pushover').hide();
                $('.whatsapp').hide();
                $('.signal').hide();
                $('.discord').hide();
            }
        }


        var DeviceList = [];

        var timeout2;
        function getFunctions(actualValue, onChange, instance) {
            timeout2 = setTimeout(function () {
                getFunctions(actualValue, onChange, instance);
            }, 4000);

            //function sendTo(_adapter_instance, command, message, callback)
            sendTo(instance, 'listFunctions', null, function (list) {
                if (timeout2) {
                    clearTimeout(timeout2);
                    timeout2 = null;
                }

                AdapterIsOnline = true;

                console.log('got functions ' + JSON.stringify(list));

                var $sel = $('#Gewerk');
                for (var i = 0; i < list.length; i++) {
                    $sel.append('<option value="' + list[i].name + '" ' + ((actualValue == list[i].name) ? 'selected' : '') + '>' + list[i].name + '</option>');
                }
                $sel.select();

                showHideSettings()

            });
        }


        var timeout3;
        function getRooms(onChange, instance) {
            timeout3 = setTimeout(function () {
                getRooms(onChange, instance);
            }, 4000);

            //function sendTo(_adapter_instance, command, message, callback)
            sendTo(instance, 'listRooms', true, function (obj) {
                if (timeout3) {
                    clearTimeout(timeout3);
                    timeout3 = null;
                }

                console.log('got rooms ' + JSON.stringify(obj));

                values2table('rooms', obj.list, onChange, tableRoomsOnReady);

                newRooms = obj.newRooms;

                $('#checkResultRooms').html(newRooms + ' new room(s) ');

                if (newRooms > 0) {
                    onChange(true);
                }
            });
        }

        var timeout4;
        function getThermostats(onChange, instance, room) {
            timeout4 = setTimeout(function () {
                getThermostats(onChange, instance, room);
            }, 4000);


            var gewerk = $("#Gewerk option:selected").text();

            const data = {
                room: room,
                gewerk: gewerk
            };

            console.log('get thermostats for  ' + room + " with " + gewerk + " " + JSON.stringify(data));

            //function sendTo(_adapter_instance, command, message, callback)
            sendTo(instance, 'listThermostats', data, function (result) {
                if (timeout4) {
                    clearTimeout(timeout4);
                    timeout4 = null;
                }

                console.log('got thermostats for  ' + room + " " + JSON.stringify(result));

                if (result.list.length > 0) {

                    var newThermostats = table2values('thermostats');

                    for (let i = 0; i < result.list.length; i++) {

                        const device = {
                            name: result.list[i].Name,
                            OID_Current: result.list[i].OID_Current,
                            OID_Target: result.list[i].OID_Target,
                            id: -1, //new
                            isActive: true,
                            room: result.room,
                            type: 1

                        }
                        newThermostats.push(device);
                        console.log('newThermostats  ' + JSON.stringify(newThermostats));
                    }
                    values2table('thermostats', newThermostats, OnChange, tableDevicesOnReady);
                    onChange(true);
                }
                $('#checkResultThermostats').html(result.status);

            });
        }

        var timeout5;
        function getActors(onChange, instance, room) {
            timeout5 = setTimeout(function () {
                getActors(onChange, instance, room);
            }, 4000);

            var gewerk = $("#Gewerk option:selected").text();

            const data = {
                room: room,
                gewerk: gewerk
            };

            console.log('get actors for  ' + room + " with " + gewerk + " " + JSON.stringify(data));


            //function sendTo(_adapter_instance, command, message, callback)
            sendTo(instance, 'listActors', data, function (result) {
                if (timeout5) {
                    clearTimeout(timeout5);
                    timeout5 = null;
                }

                console.log('got actors for  ' + room + " " + JSON.stringify(result));
                if (result.list.length > 0) {

                    var newActors = table2values('actors');

                    for (let i = 0; i < result.list.length; i++) {

                        const device = {
                            name: result.list[i].Name,
                            OID_Target: result.list[i].OID,
                            id: -1, //new
                            isActive: true,
                            room: result.room,
                            type: 1

                        }
                        newActors.push(device);
                        console.log('newActors  ' + JSON.stringify(newActors));
                    }
                    values2table('actors', newActors, OnChange, tableDevicesOnReady);
                    onChange(true);
                }
                $('#checkResultActors').html(result.status);

            });
        }

        var timeout6;
        function getSensors(onChange, instance, room) {
            timeout6 = setTimeout(function () {
                getSensors(onChange, instance, room);
            }, 4000);

            var gewerk = $("#Gewerk option:selected").text();

            const data = {
                room: room,
                gewerk: gewerk
            };

            console.log('get sensors for  ' + room + " with " + gewerk + " " + JSON.stringify(data));


            //function sendTo(_adapter_instance, command, message, callback)
            sendTo(instance, 'listSensors', data, function (result) {
                if (timeout6) {
                    clearTimeout(timeout6);
                    timeout6 = null;
                }

                console.log('got sensors for  ' + room + " " + JSON.stringify(result));
                if (result.list.length > 0) {

                    var newSensors = table2values('sensors');

                    for (let i = 0; i < result.list.length; i++) {

                        const device = {
                            name: result.list[i].Name,
                            OID_Current: result.list[i].OID,
                            id: -1, //new
                            isActive: true,
                            room: result.room,
                            type: 1

                        }
                        newSensors.push(device);
                        console.log('newSensors  ' + JSON.stringify(newSensors));
                    }
                    values2table('sensors', newSensors, OnChange, tableDevicesOnReady);
                    onChange(true);
                }
                $('#checkResultSensors').html(result.status);

            });
        }

        var timeout7;
        function getAddTempSensors(onChange, instance, room) {
            timeout7 = setTimeout(function () {
                getAddTempSensors(onChange, instance, room);
            }, 4000);

            var gewerk = $("#Gewerk option:selected").text();

            const data = {
                room: room,
                gewerk: gewerk
            };

            console.log('get add temp sensors for  ' + room + " with " + gewerk + " " + JSON.stringify(data));


            //function sendTo(_adapter_instance, command, message, callback)
            sendTo(instance, 'listAddTempSensors', data, function (result) {
                if (timeout7) {
                    clearTimeout(timeout7);
                    timeout7 = null;
                }

                console.log('got add temp sensors for  ' + room + " " + JSON.stringify(result));
                if (result.list.length > 0) {

                    var newAddTempSensors = table2values('addtempsensors');

                    for (let i = 0; i < result.list.length; i++) {

                        const device = {
                            name: result.list[i].Name,
                            OID_Current: result.list[i].OID,
                            id: -1, //new
                            isActive: true,
                            room: result.room,
                            type: 4

                        }
                        newAddTempSensors.push(device);
                        console.log('newAddTempSensors  ' + JSON.stringify(newAddTempSensors));
                    }
                    values2table('addtempsensors', newAddTempSensors, OnChange, tableDevicesOnReady);
                    onChange(true);
                }
                $('#checkResultAddTempSensors').html(result.status);

            });
        }

        var timeout8;
        function getTelegramUser(onChange, instance, currentVal) {
            timeout8 = setTimeout(function () {
                getTelegramUser(onChange, instance);
            }, 4000);

            let telegraminstance = $(telegramInstance).val()

            console.log('get TelegramUser ' + telegraminstance + " HC instance " + instance);

            const data = {
                telegraminstance: telegraminstance
            };

            //function sendTo(_adapter_instance, command, message, callback)
            sendTo(instance, 'getTelegramUser', data, function (result) {
                if (timeout8) {
                    clearTimeout(timeout8);
                    timeout8 = null;
                }

                console.log('got telegram user ' + JSON.stringify(result));
                //got telegram user "Error: No instanceName provided or not a string"

                let actualValue = "";
                if (currentVal != null) {
                    actualValue = currentVal;
                }

                //fill select box

                var $sel = $('#telegramUser');
                //remove old ones
                $sel.children().remove().end().append('<option value="allTelegramUsers"' + ((actualValue == "allTelegramUsers") ? 'selected' : '') + '>All Receiver</option>');

                for (var i = 0; i < result.length; i++) {
                    //console.log('user ' + i + " " + JSON.stringify(result[i]));

                    if (result[i].firstName != null && typeof result[i].firstName != undefined && result[i].firstName.length > 0) {

                        console.log('append ' + result[i].id + " " + result[i].firstName);

                        $sel.append('<option value="' + result[i].id + '" ' + ((actualValue == result[i].id) ? 'selected' : '') + '>' + result[i].firstName + '</option>');
                    }
                }
                $sel.select();

                console.log("12345");

            });
        }



        var myOnChange = null;
        function OnChange() {
            //do nothing
            console.log('on change called');

            if (myOnChange != null) {
                myOnChange();
            }
        }


        function initDialogRoom(room, callback) {

            console.log('initDialogRoom');

            var $editDialog = $('#dialog-room-edit');
            if (!$editDialog.data('inited')) {
                $editDialog.data('inited', true);
                $editDialog.modal({
                    dismissible: false
                });

                $editDialog.find('.btn-set').on('click', function () {
                    var $editDialog = $('#dialog-room-edit');
                    var callback = $editDialog.data('callback');
                    if (typeof callback === 'function') callback();
                    $editDialog.data('callback', null);
                });
            }

            //to do fill table
            var ThermostatList4Room = [];
            var ActorList4Room = [];
            var SensorList4Room = [];
            var AddTempSensorList4Room = [];

            if (DeviceList != null) {
                console.log('fill table for ' + room + " " + DeviceList.length);

                for (let i = 0; i < DeviceList.length; i++) {
                    //console.log('list entry ' + DeviceList[i].room);

                    if (DeviceList[i].room === room) {
                        if (DeviceList[i].type === 1) {
                            ThermostatList4Room.push(DeviceList[i]);
                        }
                        if (DeviceList[i].type === 2) {
                            ActorList4Room.push(DeviceList[i]);
                        }
                        if (DeviceList[i].type === 3) {

                            const sensor = DeviceList[i];
                            console.log(JSON.stringify(sensor));
                            //just make it compatibel
                            if (typeof sensor.DataType == undefined || sensor.DataType == null) {

                                console.log("change sensor to boolean");

                                sensor.DataType = "boolean";
                                sensor.valueOpen = true;
                                sensor.valueClosed = false;

                                console.log(JSON.stringify(sensor));
                            }

                            SensorList4Room.push(sensor);
                        }
                        if (DeviceList[i].type === 4) {
                            AddTempSensorList4Room.push(DeviceList[i]);
                        }


                    }
                }
            }
            console.log('Thermostatlist ' + JSON.stringify(ThermostatList4Room));
            console.log('Actorlist ' + JSON.stringify(ActorList4Room));
            console.log('Sensorlist ' + JSON.stringify(SensorList4Room));
            console.log('AddTempSensorlist ' + JSON.stringify(AddTempSensorList4Room));

            values2table('thermostats', ThermostatList4Room, OnChange, tableDevicesOnReady);
            values2table('actors', ActorList4Room, OnChange, tableDevicesOnReady);
            values2table('sensors', SensorList4Room, OnChange, tableDevicesOnReady);
            values2table('addtempsensors', AddTempSensorList4Room, OnChange, tableDevicesOnReady);

            $editDialog.data('callback', callback);
            $editDialog.modal('open');

            showHideSettings();

        }



        // the function loadSettings has to exist ...
        function load(settings, onChange) {

            if (!settings) return;

            console.log('##on change');

            // example: select elements with id=key and class=value and insert value
            for (var key in settings) {
                if (!settings.hasOwnProperty(key)) continue;
                var $value = $('#' + key + '.value');
                if ($value.attr('type') === 'checkbox') {

                    $value.prop('checked', settings[key]).on('change', function () {
                        console.log('on change checked');
                        showHideSettings();
                        onChange();
                    });
                } else {
                    $value.val(settings[key]).on('change', function () {
                        console.log('on change');
                        showHideSettings();
                        onChange();
                    }).on('keyup', function () {
                        $(this).trigger('change');
                    });
                }
            }

            var $btn_check4newrooms = $('#btn_check4newrooms');
            $btn_check4newrooms.click(function () {
                console.log('check 4 new rooms');

                var _id = 'heatingcontrol.' + instance;
                console.log('my instance ' + _id);

                getRooms(onChange, _id, true);
            });




            var $btnsave_profile = $('#btn_save_profile');
            $btnsave_profile.click(function () {
                console.log('btn save profile');

                var _id = 'heatingcontrol.' + instance;
                console.log('my instance ' + _id);
                SaveProfile(_id);

            });

            var $btnload_profile = $('#btn_load_profile');
            $btnload_profile.click(function () {
                console.log('btn load profile');

                var _id = 'heatingcontrol.' + instance;
                console.log('my instance ' + _id);
                LoadProfile(_id);

            });


            myOnChange = onChange;
            // Signal to admin, that no changes yet
            onChange(false);

            $('.timepicker').timepicker({
                "twelveHour": false
            });

            

            showHideSettings();
            M.updateTextFields();

            var _id = 'heatingcontrol.' + instance;
            console.log('my instance ' + _id);
            getFunctions(settings.Gewerk, onChange, _id);

            if (typeof settings.devices !== 'undefined' && settings.devices != null && settings.devices.length > 0) {
                DeviceList = settings.devices;
                console.log('using devices from settings ' + JSON.stringify(DeviceList));
            }


            if (typeof settings.rooms !== 'undefined' && settings.rooms != null && settings.rooms.length > 0) {
                values2table('rooms', settings.rooms, onChange, tableRoomsOnReady);
                console.log('using rooms from settings ' + JSON.stringify(settings.rooms));
            }
            else {
                //see issue #356, no rooms can be added if room list is empty, only after search for rooms it is possible
                //solution: add a empty list to table
                values2table('rooms', null, onChange, tableRoomsOnReady);
                console.log('create an empty list for rooms');
            }

            //===========================================
            //OID selecters
            $('#OID_Path2FeiertagAdapter').on('click', function () {
                initSelectId(function (sid) {
                    sid.selectId('show', $('#Path2FeiertagAdapter').val(), function (newId) {
                        if (newId) {
                            $('#Path2FeiertagAdapter').val(newId).trigger('change');
                        }
                    });
                });
            });
            $('#OID_Path2PresentDP').on('click', function () {
                initSelectId(function (sid) {
                    sid.selectId('show', $('#Path2PresentDP').val(), function (newId) {
                        if (newId) {
                            $('#Path2PresentDP').val(newId).trigger('change');
                        }
                    });
                });
            });
            $('#OID_Path2VacationDP').on('click', function () {
                initSelectId(function (sid) {
                    sid.selectId('show', $('#Path2VacationDP').val(), function (newId) {
                        if (newId) {
                            $('#Path2VacationDP').val(newId).trigger('change');
                        }
                    });
                });
            });
            $('#OID_Path2HolidayPresentDP').on('click', function () {
                initSelectId(function (sid) {
                    sid.selectId('show', $('#Path2HolidayPresentDP').val(), function (newId) {
                        if (newId) {
                            $('#Path2HolidayPresentDP').val(newId).trigger('change');
                        }
                    });
                });
            });
            $('#OID_Path2GuestsPresentDP').on('click', function () {
                initSelectId(function (sid) {
                    sid.selectId('show', $('#Path2GuestsPresentDP').val(), function (newId) {
                        if (newId) {
                            $('#Path2GuestsPresentDP').val(newId).trigger('change');
                        }
                    });
                });
            });
            $('#OID_Path2PartyNowDP').on('click', function () {
                initSelectId(function (sid) {
                    sid.selectId('show', $('#Path2PartyNowDP').val(), function (newId) {
                        if (newId) {
                            $('#Path2PartyNowDP').val(newId).trigger('change');
                        }
                    });
                });
            });

            //===========================================================================
            //maintanance functions
            console.log('aaa');

            $('#btn_deleteunusedDP').on('click', function () {

                sendTo(_id, 'deleteUnusedDP', null, function (result) {

                    console.log('deleteUnusedDP done ');

                    $('#result_deleteunusedDP').html(result);
                });
            });

            $('#btn_deleteunusedConfig').on('click', function () {
                DeleteUnusedConfig();
            });


            $('#notificationsType').on('change', function () {
                console.log('bbb ' + $(this).val()); 
                ShowHideNotificationSettings($(this).val());
            });

            $('#discordTarget').on('change', function () {
                console.log('b1b1b1 ' + $(this).val());
                ShowHideNotificationDiscordSettings($(this).val());
            });

            getAdapterInstances('telegram', function (instances) {
                fillInstances('telegramInstance', instances, settings['telegramInstance'], 'telegram');
            });

            getAdapterInstances('whatsapp-cmb', function (instances) {
                fillInstances('whatsappInstance', instances, settings['whatsappInstance'], 'whatsapp-cmb');
            });

            getAdapterInstances('signal-cmb', function (instances) {
                fillInstances('signalInstance', instances, settings['signalInstance'], 'signal-cmb');
            });

            getAdapterInstances('email', function (instances) {
                fillInstances('emailInstance', instances, settings['emailInstance'], 'email');
            });

            getAdapterInstances('pushover', function (instances) {
                fillInstances('pushoverInstance', instances, settings['pushoverInstance'], 'pushover');
            });

            getAdapterInstances('discord', function (instances) {
                fillInstances('discordInstance', instances, settings['discordInstance'], 'discord');
            });

            $('#telegramInstance').on('change', function () {
                getTelegramUser(onChange, instance, "allTelegramUsers");
               
            });
            //initil set data
            console.log("telegram " + settings['telegramUser']);
            getTelegramUser(onChange, instance, settings['telegramUser'] );

            //===========================================================================
            //power interruptions
            values2table('PowerInterruptions', settings.PowerInterruptions, onChange, tablePowerInterruptionsOnReady);
   
            //++++++++++ TABS ++++++++++
            //Enhance Tabs with onShow-Function
            $('ul.tabs li a').on('click', function () { onTabShow($(this).attr('href')); });
            function onTabShow(tabId) {
                console.log('onTabShow');
                switch (tabId) {
                    case "#tab-main":
                        loadOptions();
                        break;

                }
            }


            function loadOptions() {
                $('.collapsible').collapsible();
            }
            loadOptions();
        }

        function tablePowerInterruptionsOnReady() {
            console.log('tablePowerInterruptionsOnReady, do nothing');
        }

        function fillInstances(id, arr, val, name) {
            var $sel = $('#' + id);
            $sel.html('<option value="">' + _('none') + '</option>');
            for (var i = 0; i < arr.length; i++) {
                var _id = arr[i]._id.replace('system.adapter.', '');
                $sel.append('<option value="' + _id + '"' + (_id === val ? ' selected' : '') + '>' + _id + '</option>');
            }
            $sel.select();
        }


        // ... and the function save has to exist.
        // you have to make sure the callback is called with the settings object as first param!
        function save(callback) {
            var obj = {};
            $('.value').each(function () {
                var $this = $(this);

                var id = $this.attr('id');

                if ($this.attr('type') === 'checkbox') {
                    obj[$this.attr('id')] = $this.prop('checked');
                } else {
                    obj[$this.attr('id')] = $this.val();
                }
            });

            obj.rooms = table2values('rooms');

            if (obj != null && obj.rooms != null) {
                for (let i = 0; i < obj.rooms.length; i++) {
                    console.log('check room ' + obj.rooms[i].name);
                    obj.rooms[i].name = obj.rooms[i].name.replace('.', '_');
                }
            }

            if (DeviceList != null) {
                obj.devices = DeviceList;
            }

            //===========================================================================
            //power interruptions
            obj.PowerInterruptions = table2values('PowerInterruptions');

            callback(obj);
        }

        function tableRoomsOnReady() {

            console.log('tableRoomsOnReady');

            $('#rooms .table-values-div .table-values .values-buttons[data-command="edit"]').on('click', function () {
                let id = $(this).data('index');
                let room = $('#rooms .values-input[data-name="name"][data-index="' + id + '"]').val();
                $('#dialogDeviceEditRoom').html(room);

                let val1 = $('#rooms .values-input[data-name="WaitForTempIfWindowOpen"][data-index="' + id + '"]').val();
                $('#WaitForTempIfWindowOpen').val(val1);
                console.log('set val1 ' + val1);


                setTimeout(function () {
                    initDialogRoom(room, function () {

                        //this is reached when dialog is closing
                        let room = $('#dialogDeviceEditRoom')[0].innerHTML;

                        console.log('closing for ' + room);

                        //xxx
                        //find room data in table and update
                        let WaitForTempIfWindowOpen = $('#WaitForTempIfWindowOpen').val();
                        console.log('WaitForTempIfWindowOpen ' + WaitForTempIfWindowOpen);
                        if (WaitForTempIfWindowOpen >= 0) {
                            $('#rooms .values-input[data-name="WaitForTempIfWindowOpen"][data-index="' + id + '"]').val(WaitForTempIfWindowOpen).trigger('change');
                        }
                        let thermostats = table2values('thermostats');
                        let actors = table2values('actors');
                        let sensors = table2values('sensors');
                        let addtempsensors = table2values('addtempsensors');

                        

                        console.log('Thermostatlist ' + JSON.stringify(thermostats));
                        console.log('Actorlist ' + JSON.stringify(actors));
                        console.log('Sensorlist ' + JSON.stringify(sensors));
                        console.log('AddTempSensorlist ' + JSON.stringify(addtempsensors));

                        //now update DeviceList
                        if (thermostats != null) {
                            for (let i = 0; i < thermostats.length; i++) {
                                //if exist, only update
                                if (thermostats[i].id > 0) {
                                    console.log("update thermostats " + JSON.stringify(thermostats[i]));
                                    DeviceList[thermostats[i].id - 1].name = thermostats[i].name;
                                    DeviceList[thermostats[i].id - 1].isActive = thermostats[i].isActive;
                                    DeviceList[thermostats[i].id - 1].OID_Target = thermostats[i].OID_Target;
                                    DeviceList[thermostats[i].id - 1].OID_Current = thermostats[i].OID_Current;
                                    DeviceList[thermostats[i].id - 1].useExtHandling = thermostats[i].useExtHandling;
                                }
                                else {
                                    //if not exist, add at the end of list
                                    thermostats[i].id = DeviceList.length + 1;
                                    thermostats[i].type = 1;
                                    thermostats[i].room = room;
                                    console.log("add thermostats " + JSON.stringify(thermostats[i]));
                                    DeviceList.push(thermostats[i]);
                                }
                            }
                        }

                        if (actors != null) {
                            for (let i = 0; i < actors.length; i++) {
                                //if exist, only update
                                if (actors[i].id > 0) {
                                    console.log("update actors " + JSON.stringify(actors[i]));
                                    DeviceList[actors[i].id - 1].name = actors[i].name;
                                    DeviceList[actors[i].id - 1].isActive = actors[i].isActive;
                                    DeviceList[actors[i].id - 1].OID_Target = actors[i].OID_Target;
                                    DeviceList[actors[i].id - 1].useExtHandling = actors[i].useExtHandling;
                                }
                                else {
                                    //if not exist, add at the end of list
                                    actors[i].id = DeviceList.length + 1;
                                    actors[i].type = 2;
                                    actors[i].room = room;
                                    console.log("add actors " + JSON.stringify(actors[i]));
                                    DeviceList.push(actors[i]);
                                }
                            }
                        }

                        if (sensors != null) {
                            for (let i = 0; i < sensors.length; i++) {
                                //if exist, only update
                                if (sensors[i].id > 0) {
                                    console.log("update sensors " + JSON.stringify(sensors[i]));
                                    DeviceList[sensors[i].id - 1].name = sensors[i].name;
                                    DeviceList[sensors[i].id - 1].isActive = sensors[i].isActive;
                                    DeviceList[sensors[i].id - 1].OID_Current = sensors[i].OID_Current;

                                    if (sensors[i].DataType == "boolean") {
                                        DeviceList[sensors[i].id - 1].DataType = "boolean";

                                        if (sensors[i].valueClosed.length > 3) {
                                            DeviceList[sensors[i].id - 1].valueClosed = (sensors[i].valueClosed.toLowerCase() == 'true');
                                        }
                                        else {
                                            DeviceList[sensors[i].id - 1].valueClosed = false;
                                        }
                                        if (sensors[i].valueOpen.length > 3) {
                                            DeviceList[sensors[i].id - 1].valueOpen = (sensors[i].valueOpen.toLowerCase() == 'true');
                                        }
                                        else {
                                            DeviceList[sensors[i].id - 1].valueOpen = true;
                                        }
                                    }
                                    else if (sensors[i].DataType == "number") {
                                        DeviceList[sensors[i].id - 1].DataType = "number";

                                        DeviceList[sensors[i].id - 1].valueClosed = parseInt(sensors[i].valueClosed);
                                        DeviceList[sensors[i].id - 1].valueOpen = parseInt(sensors[i].valueOpen);
                                    }
                                    else if (sensors[i].DataType == "string") {
                                        DeviceList[sensors[i].id - 1].DataType = "string";
                                        DeviceList[sensors[i].id - 1].valueClosed = sensors[i].valueClosed;
                                        DeviceList[sensors[i].id - 1].valueOpen = sensors[i].valueOpen;
                                    }

                                    console.log("update sensors " + JSON.stringify(DeviceList[sensors[i].id - 1]));

                                }
                                else {
                                    //if not exist, add at the end of list
                                    sensors[i].id = DeviceList.length + 1;
                                    sensors[i].type = 3;
                                    sensors[i].room = room;

                                    if (sensors[i].DataType == "boolean") {
                                        if (sensors[i].valueClosed.length > 3) {
                                            sensors[i].valueClosed = (sensors[i].valueClosed.toLowerCase() == 'true');
                                        }
                                        else {
                                            sensors[i].valueClosed = false;
                                        }
                                        if (sensors[i].valueOpen.length > 3) {
                                            sensors[i].valueOpen = (sensors[i].valueOpen.toLowerCase() == 'true');
                                        }
                                        else {
                                            sensors[i].valueOpen = true;
                                        }
                                    }
                                    else if (sensors[i].DataType == "number") {
                                        sensors[i].valueClosed = parseInt(sensors[i].valueClosed);
                                        sensors[i].valueOpen = parseInt(sensors[i].valueOpen);
                                    }
                                    else if (sensors[i].DataType == "string") {
                                        sensors[i].valueClosed = sensors[i].valueClosed;
                                        sensors[i].valueOpen = sensors[i].valueOpen;
                                    }


                                    console.log("add sensors " + JSON.stringify(sensors[i]));
                                    DeviceList.push(sensors[i]);
                                }
                            }
                        }

                        if (addtempsensors != null) {
                            for (let i = 0; i < addtempsensors.length; i++) {
                                //if exist, only update
                                if (addtempsensors[i].id > 0) {
                                    console.log("update add temp sensors " + JSON.stringify(addtempsensors[i]));
                                    DeviceList[addtempsensors[i].id - 1].name = addtempsensors[i].name;
                                    DeviceList[addtempsensors[i].id - 1].isActive = addtempsensors[i].isActive;
                                    DeviceList[addtempsensors[i].id - 1].OID_Current = addtempsensors[i].OID_Current;

                                }
                                else {
                                    //if not exist, add at the end of list
                                    addtempsensors[i].id = DeviceList.length + 1;
                                    addtempsensors[i].type = 4;
                                    addtempsensors[i].room = room;
                                    console.log("add add temp sensors " + JSON.stringify(addtempsensors[i]));
                                    DeviceList.push(addtempsensors[i]);
                                }
                            }
                        }
                        

                        //find out if deleted

                        //create org list
                        var ThermostatList4Room = [];
                        var ActorList4Room = [];
                        var SensorList4Room = [];
                        var AddTempSensorList4Room = [];
                        for (let i = 0; i < DeviceList.length; i++) {

                            if (DeviceList[i].room === room) {
                                if (DeviceList[i].type === 1) {
                                    ThermostatList4Room.push(DeviceList[i]);
                                }
                                if (DeviceList[i].type === 2) {
                                    ActorList4Room.push(DeviceList[i]);
                                }
                                if (DeviceList[i].type === 3) {
                                    SensorList4Room.push(DeviceList[i]);
                                }
                                if (DeviceList[i].type === 4) {
                                    AddTempSensorList4Room.push(DeviceList[i]);
                                }
                            }
                        }
                        //check if something deleted
                        if (ThermostatList4Room.length > thermostats.length) {
                            let deletedThermostats = ThermostatList4Room.length - thermostats.length;
                            console.log("something deleted in thermostats " + deletedThermostats);

                            for (let t = 0; t < ThermostatList4Room.length; t++) {

                                let id2find = findObjectIdByKey(thermostats, 'id', ThermostatList4Room[t].id);

                                if (id2find == -1) { //not found
                                    console.log("deleted " + JSON.stringify(ThermostatList4Room[t]));
                                    let id2delete = findObjectIdByKey(DeviceList, 'id', ThermostatList4Room[t].id);
                                    DeviceList.splice(id2delete, 1);
                                }
                            }
                        }

                        if (ActorList4Room.length > actors.length) {
                            let deletedActors = ActorList4Room.length - actors.length;
                            console.log("something deleted in actors " + deletedActors);

                            for (let a = 0; a < ActorList4Room.length; a++) {

                                let id2find = findObjectIdByKey(actors, 'id', ActorList4Room[a].id);

                                if (id2find == -1) { //not found
                                    console.log("deleted " + JSON.stringify(ActorList4Room[a]));
                                    let id2delete = findObjectIdByKey(DeviceList, 'id', ActorList4Room[a].id);
                                    DeviceList.splice(id2delete, 1);
                                }
                            }
                        }
                        if (SensorList4Room.length > sensors.length) {
                            let deletedSensors = SensorList4Room.length - sensors.length;
                            console.log("something deleted in sensors " + deletedSensors);

                            for (let s = 0; s < SensorList4Room.length; s++) {

                                let id2find = findObjectIdByKey(sensors, 'id', SensorList4Room[s].id);

                                if (id2find == -1) { //not found
                                    console.log("deleted " + JSON.stringify(SensorList4Room[s]));
                                    let id2delete = findObjectIdByKey(DeviceList, 'id', SensorList4Room[s].id);
                                    DeviceList.splice(id2delete, 1);
                                }
                            }
                        }

                        if (AddTempSensorList4Room.length > addtempsensors.length) {
                            let deletedAddTempSensors = AddTempSensorList4Room.length - addtempsensors.length;
                            console.log("something deleted in add temp sensors " + deletedAddTempSensors);

                            for (let s = 0; s < AddTempSensorList4Room.length; s++) {

                                let id2find = findObjectIdByKey(addtempsensors, 'id', AddTempSensorList4Room[s].id);

                                if (id2find == -1) { //not found
                                    console.log("deleted " + JSON.stringify(AddTempSensorList4Room[s]));
                                    let id2delete = findObjectIdByKey(DeviceList, 'id', AddTempSensorList4Room[s].id);
                                    DeviceList.splice(id2delete, 1);
                                }
                            }
                        }

                        



                        //and finally rearrange id's
                        for (let i = 0; i < DeviceList.length; i++) {
                            //console.log("### " + i + " " + JSON.stringify(DeviceList[i]));
                            DeviceList[i].id = i + 1;
                            //console.log("+++ " + i + " " + JSON.stringify(DeviceList[i]));
                        }

                        console.log("new device list " + JSON.stringify(DeviceList));
                    });
                }, 20)
            });


            var $btn_check4newThermostats = $('#btn_check4newThermostats');
            $btn_check4newThermostats.click(function () {
                console.log('check 4 new Thermostats');

                var _id = 'heatingcontrol.' + instance;
                let room = $('#dialogDeviceEditRoom').html();

                console.log('my instance ' + _id + " in " + room);

                getThermostats(myOnChange, _id, room);
            });

            var $btn_check4newActors = $('#btn_check4newActors');
            $btn_check4newActors.click(function () {
                console.log('check 4 new Actors');

                var _id = 'heatingcontrol.' + instance;
                let room = $('#dialogDeviceEditRoom').html();

                console.log('my instance ' + _id + " in " + room);

                getActors(myOnChange, _id, room);
            });

            var $btn_check4newSensors = $('#btn_check4newSensors');
            $btn_check4newSensors.click(function () {
                console.log('check 4 new Sensors');

                var _id = 'heatingcontrol.' + instance;
                let room = $('#dialogDeviceEditRoom').html();

                console.log('my instance ' + _id + " in " + room);

                getSensors(myOnChange, _id, room);
            });

            var $btn_check4newAddTempSensors = $('#btn_check4newAddTempSensors');
            $btn_check4newAddTempSensors.click(function () {
                console.log('check 4 new Add Temp Sensors');

                var _id = 'heatingcontrol.' + instance;
                let room = $('#dialogDeviceEditRoom').html();

                console.log('my instance ' + _id + " in " + room);

                getAddTempSensors(myOnChange, _id, room);
            });


           


            showHideSettings();
        }

        function getName(obj) {

            let name = "unknown";
            if (obj && obj.common && obj.common.name) {

                if (typeof obj.common.name === 'object') {
                    name = obj.common.name[systemLang] || obj.common.name.en;
                }
                else {
                    name = obj.common.name;
                }
            } else if (obj && obj.name) {

                if (typeof obj.name === 'object') {
                    name = obj.name[systemLang] || obj.name.en;
                }
                else {
                    name = obj.name;
                }
            } else {
                var parts = obj.id.split('.');
                var last = parts.pop();
                name = last[0].toUpperCase() + last.substring(1).toLowerCase();
            }

            if (name.includes(":")) {
                var nameparts = name.split(':');
                name = nameparts[0];
            }

            return name;

        }

        function getOID(obj) {
            let OID = "unknown";
            if (obj && obj._id) {
                OID = obj._id;
            }

            return OID;

        }


        function tableDevicesOnReady() {

            console.log('tableDevicesOnReady');

            $('#thermostats .table-values-div .table-values .values-buttons[data-command="edit1"]').on('click', function () {

                let id = $(this).data('index');

                console.log('edit thermostats clicked ID=' + id);

                initSelectId(function (sid) {
                    sid.selectId('show', $('#thermostats .values-input[data-name="name"][data-index="' + id + '"]').val(), function (newId) {
                        if (newId) {
                            $('#thermostats .values-input[data-name="name"][data-index="' + id + '"]').val(newId).trigger('change');
                            socket.emit('getObject', newId, function (err, obj) {
                                let name = getName(obj);

                                let OID_Current = getOID(obj);

                                $('#thermostats .values-input[data-name="OID_Current"][data-index="' + id + '"]').val(OID_Current).trigger('change');

                            });
                        }
                    });
                });


            });

            $('#thermostats .table-values-div .table-values .values-buttons[data-command="edit2"]').on('click', function () {

                let id = $(this).data('index');

                console.log('edit thermostats clicked ID=' + id);

                initSelectId(function (sid) {
                    sid.selectId('show', $('#thermostats .values-input[data-name="name"][data-index="' + id + '"]').val(), function (newId) {
                        if (newId) {
                            $('#thermostats .values-input[data-name="name"][data-index="' + id + '"]').val(newId).trigger('change');
                            socket.emit('getObject', newId, function (err, obj) {
                                let name = getName(obj);

                                let OID_Target = getOID(obj);

                                $('#thermostats .values-input[data-name="name"][data-index="' + id + '"]').val(name).trigger('change');
                                $('#thermostats .values-input[data-name="OID_Target"][data-index="' + id + '"]').val(OID_Target).trigger('change');

                            });
                        }
                    });
                });


            });

            $('#actors .table-values-div .table-values .values-buttons[data-command="edit"]').on('click', function () {

                let id = $(this).data('index');

                console.log('edit actors clicked ID=' + id);

                initSelectId(function (sid) {
                    sid.selectId('show', $('#actors .values-input[data-name="name"][data-index="' + id + '"]').val(), function (newId) {
                        if (newId) {
                            $('#actors .values-input[data-name="name"][data-index="' + id + '"]').val(newId).trigger('change');
                            socket.emit('getObject', newId, function (err, obj) {
                                var name = getName(obj);

                                var OID_Target = getOID(obj);
                                $('#actors .values-input[data-name="name"][data-index="' + id + '"]').val(name).trigger('change');
                                $('#actors .values-input[data-name="OID_Target"][data-index="' + id + '"]').val(OID_Target).trigger('change');
                            });
                        }
                    });
                });
            });

            $('#sensors .table-values-div .table-values .values-buttons[data-command="edit"]').on('click', function () {

                let id = $(this).data('index');

                console.log('edit sensors clicked ID=' + id);

                initSelectId(function (sid) {
                    sid.selectId('show', $('#sensors .values-input[data-name="name"][data-index="' + id + '"]').val(), function (newId) {
                        if (newId) {
                            $('#sensors .values-input[data-name="name"][data-index="' + id + '"]').val(newId).trigger('change');
                            socket.emit('getObject', newId, function (err, obj) {
                                var name = getName(obj);
                                var OID_Current = getOID(obj);
                                $('#sensors .values-input[data-name="name"][data-index="' + id + '"]').val(name).trigger('change');
                                $('#sensors .values-input[data-name="OID_Current"][data-index="' + id + '"]').val(OID_Current).trigger('change');
                            });
                        }
                    });
                });
            });

            $('#addtempsensors .table-values-div .table-values .values-buttons[data-command="edit"]').on('click', function () {

                let id = $(this).data('index');

                console.log('edit add temp sensors clicked ID=' + id);

                initSelectId(function (sid) {
                    sid.selectId('show', $('#addtempsensors .values-input[data-name="name"][data-index="' + id + '"]').val(), function (newId) {
                        if (newId) {
                            $('#addtempsensors .values-input[data-name="name"][data-index="' + id + '"]').val(newId).trigger('change');
                            socket.emit('getObject', newId, function (err, obj) {
                                var name = getName(obj);
                                var OID_Current = getOID(obj);
                                $('#addtempsensors .values-input[data-name="name"][data-index="' + id + '"]').val(name).trigger('change');
                                $('#addtempsensors .values-input[data-name="OID_Current"][data-index="' + id + '"]').val(OID_Current).trigger('change');
                            });
                        }
                    });
                });
            });


            showHideSettings();

        }

       


        var selectId;
        function initSelectId(callback) {
            if (selectId) {
                return callback(selectId);
            }
            socket.emit('getObjects', function (err, objs) {
                selectId = $('#dialog-select-member').selectId('init', {
                    noMultiselect: true,
                    objects: objs,
                    imgPath: '../../lib/css/fancytree/',
                    filter: { type: 'state' },
                    name: 'scenes-select-state',
                    texts: {
                        select: _('Select'),
                        cancel: _('Cancel'),
                        all: _('All'),
                        id: _('ID'),
                        name: _('Name'),
                        role: _('Role'),
                        room: _('Room'),
                        value: _('Value'),
                        selectid: _('Select ID'),
                        from: _('From'),
                        lc: _('Last changed'),
                        ts: _('Time stamp'),
                        wait: _('Processing...'),
                        ack: _('Acknowledged'),
                        selectAll: _('Select all'),
                        unselectAll: _('Deselect all'),
                        invertSelection: _('Invert selection')
                    },
                    columns: ['image', 'name', 'role', 'room']
                });
                callback(selectId);
            });
        }


    </script>
</head>
<body>
    <!-- you have to put your config page in a div with id adapter-container -->
    <div class="m adapter-container">

        <div class="row">
            <div class="col s12">
                <ul class="tabs">
                    <li class="tab col s2"><a href="#tab-main" class="translate" active>Main settings</a></li>
                    <li class="tab col s2 le-settings"><a href="#tab-profiles" class="translate">profile</a></li>
                    <li class="tab col s2 le-settings"><a href="#tab-devices" class="translate">devices</a></li>
                </ul>
            </div>

            <!-- tab "main - settings"  -->
            <div id="tab-main" class="col s12 page">
                <div class="row">
                    <div class="col s6 m4 l2">
                        <img src="heatingcontrol.png" class="logo">
                    </div>

                    <div class="col s6 col-adapternotonline">
                        <span class="translate">AdapterNotOnline</span>
                    </div>
                </div>

                <ul class="collapsible">
                    <li>
                        <div class="collapsible-header">
                            <i class="material-icons">expand_more</i><h6 class="translate">GeneralSettings</h6>
                        </div>
                        <div class="collapsible-body">
                            <div class="row">

                                <div class="input-field col s6">
                                    <select id="Gewerk" class="value">
                                        <option value="1" class="translate">nothing</option>
                                    </select>
                                    <label for="Gewerk" class="translate">Gewerk</label>
                                </div>
                            </div>

                            <div class="row">
                                <div class="input-field col s6">
                                    <input type="text" id="timezone" class="value" />
                                    <label for="timezone" class="translate">timezone</label>
                                </div>
                            </div>
                        </div>
                    </li>

                    <li>
                        <div class="collapsible-header">
                            <i class="material-icons">expand_more</i><h6 class="translate">DPSettings</h6>
                        </div>
                        <div class="collapsible-body">
                            <div class="row">
                                <div class="input-field col s4">
                                    <input type="text" id="Path2FeiertagAdapter" class="value" />
                                    <label for="Path2FeiertagAdapter" class="translate">Path2FeiertagAdapter</label>

                                </div>
                                <div class="col s1 m2 l1">
                                    <a id="OID_Path2FeiertagAdapter" class="btn-floating waves-effect waves-light blue table-button-add"><i class="material-icons">add</i></a>
                                </div>
                            </div>

                            <div class="row">
                                <div class="input-field col s4">
                                    <input type="text" id="Path2PresentDP" class="value" />
                                    <label for="Path2PresentDP" class="translate">Path2PresentDP</label>

                                </div>
                                <div class="col s1 m2 l1">
                                    <a id="OID_Path2PresentDP" class="btn-floating waves-effect waves-light blue table-button-add"><i class="material-icons">add</i></a>
                                </div>

                                <div class="input-field col s3">
                                    <select id="Path2PresentDPType" class="value">
                                        <option value="1" class="translate">boolean</option>
                                        <option value="2" class="translate">number</option>
                                    </select>
                                    <label for="Path2PresentDPType" class="translate">Path2PresentDPType</label>
                                </div>

                                <div class="input-field col s3 col_Path2PresentDPLimit">
                                    <input type="number" id="Path2PresentDPLimit" class="value" min="0" step="1" />
                                    <label for="Path2PresentDPLimit" class="translate">Path2PresentDPLimit</label>

                                </div>

                            </div>

                            <div class="row">
                                <div class="input-field col s4">
                                    <input type="text" id="Path2VacationDP" class="value" />
                                    <label for="Path2VacationDP" class="translate">Path2VacationDP</label>

                                </div>
                                <div class="col s1 m2 l1">
                                    <a id="OID_Path2VacationDP" class="btn-floating waves-effect waves-light blue table-button-add"><i class="material-icons">add</i></a>
                                </div>
                            </div>

                            <div class="row">
                                <div class="input-field col s4">
                                    <input type="text" id="Path2HolidayPresentDP" class="value" />
                                    <label for="Path2HolidayPresentDP" class="translate">Path2HolidayPresentDP</label>

                                </div>
                                <div class="col s1 m2 l1">
                                    <a id="OID_Path2HolidayPresentDP" class="btn-floating waves-effect waves-light blue table-button-add"><i class="material-icons">add</i></a>
                                </div>
                            </div>

                            <div class="row">
                                <div class="input-field col s4">
                                    <input type="text" id="Path2GuestsPresentDP" class="value" />
                                    <label for="Path2GuestsPresentDP" class="translate">Path2GuestsPresentDP</label>

                                </div>
                                <div class="col s1 m2 l1">
                                    <a id="OID_Path2GuestsPresentDP" class="btn-floating waves-effect waves-light blue table-button-add"><i class="material-icons">add</i></a>
                                </div>

                                <div class="input-field col s3">
                                    <select id="Path2GuestsPresentDPType" class="value">
                                        <option value="1" class="translate">boolean</option>
                                        <option value="2" class="translate">number</option>
                                    </select>
                                    <label for="Path2GuestsPresentDPType" class="translate">Path2GuestsPresentDPType</label>
                                </div>

                                <div class="input-field col s3 col_Path2GuestsPresentDPLimit">
                                    <input type="number" id="Path2GuestsPresentDPLimit" class="value" min="0" step="1" />
                                    <label for="Path2GuestsPresentDPLimit" class="translate">Path2GuestsPresentDPLimit</label>
                                </div>

                            </div>

                            <div class="row">
                                <div class="input-field col s4">
                                    <input type="text" id="Path2PartyNowDP" class="value" />
                                    <label for="Path2PartyNowDP" class="translate">Path2PartyNowDP</label>

                                </div>
                                <div class="col s1 m2 l1">
                                    <a id="OID_Path2PartyNowDP" class="btn-floating waves-effect waves-light blue table-button-add"><i class="material-icons">add</i></a>
                                </div>

                                <div class="input-field col s3">
                                    <select id="Path2PartyNowDPType" class="value">
                                        <option value="1" class="translate">boolean</option>
                                        <option value="2" class="translate">number</option>
                                    </select>
                                    <label for="Path2PartyNowDPType" class="translate">Path2PartyNowDPType</label>
                                </div>

                                <div class="input-field col s3 col_Path2PartyNowDPLimit">
                                    <input type="number" id="Path2PartyNowDPLimit" class="value" min="0" step="1" />
                                    <label for="Path2PartyNowDPLimit" class="translate">Path2PartyNowDPLimit</label>
                                </div>

                            </div>
                        </div>
                    </li>

                    <li>
                        <div class="collapsible-header">
                            <i class="material-icons">expand_more</i><h6 class="translate">ThermostatSettings</h6>
                        </div>
                        <div class="collapsible-body">
                            <div class="row">
                                <div class="input-field col s3 col-usechangesfromthermostat">
                                    <select id="UseChangesFromThermostat" class="value">
                                        <option value="1" class="translate">no</option>
                                        <option value="2" class="translate">as_override</option>
                                        <option value="3" class="translate">as_new_profile_setting</option>
                                        <option value="5" class="translate">until_next_profile_point</option>
                                    </select>
                                    <label for="UseChangesFromThermostat" class="translate">UseChangesFromThermostat</label>
                                </div>
                            </div>

                            <div class="row">
                                <div class="input-field col s3">
                                    <input type="checkbox" id="ExtendOverride" class="value" />
                                    <label for="ExtendOverride" class="translate">ExtendOverride</label>
                                </div>

                                <div class="input-field col s3 col-overridemode">
                                    <select id="OverrideMode" class="value">
                                        <option value="1" class="translate">timer</option>
                                        <option value="2" class="translate">until_next_profile_point</option>
                                    </select>
                                    <label for="OverrideMode" class="translate">OverrideMode</label>
                                </div>

                            </div>
                            <div class="row">
                                <div class="input-field col s3">
                                    <input type="checkbox" id="ThermostatHandlesWindowOpen" class="value" />
                                    <label for="ThermostatHandlesWindowOpen" class="translate">ThermostatHandlesWindowOpen</label>
                                </div>
                            </div>
                            <div class="row">
                                <div class="input-field col s3 .col-InterThermostatDelay">
                                    <input type="number" id="InterThermostatDelay" class="value" min="0" step="1" />
                                    <label for="InterThermostatDelay" class="translate">InterThermostatDelay</label>
                                </div>
                            </div>


                        </div>
                    </li>

                    <li>
                        <div class="collapsible-header">
                            <i class="material-icons">expand_more</i><h6 class="translate">AdditionalTemperatureSensorSettings</h6>
                        </div>
                        <div class="collapsible-body">
                            <div class="row">
                                <div class="input-field col s4 col-UseAddTempSensors">
                                    <input type="checkbox" id="UseAddTempSensors" class="value" />
                                    <label for="UseAddTempSensors" class="translate">UseAddTempSensors</label>
                                </div>

                                <div class="col s6 col-UseAddTempSensors-descr">
                                    <span class="translate">hint_UseAddTempSensors</span>
                                </div>
                            </div>
                            <div class="row">
                                <div class="input-field col s4 col-AddTempSensorsTempLimit">
                                    <input type="number" id="AddTempSensorsTempLimit" class="value" min="0" max="6" />
                                    <label for="AddTempSensorsTempLimit" class="translate">AddTempSensorsTempLimit</label>
                                </div>
                                <div class="col s6 col-AddTempSensorsTempLimit-descr">
                                    <span class="translate">hint_AddTempSensorsTempLimit</span>
                                </div>
                            </div>
                            <div class="row">
                                <div class="input-field col s4 col-AddTempSensorsMaxTimeDiff">
                                    <input type="number" id="AddTempSensorsMaxTimeDiff" class="value" min="0" max="1000" />
                                    <label for="AddTempSensorsMaxTimeDiff" class="translate">AddTempSensorsMaxTimeDiff</label>
                                </div>
                                <div class="col s6 col-AddTempSensorsMaxTimeDiff-descr">
                                    <span class="translate">hint_AddTempSensorsMaxTimeDiff</span>
                                </div>
                            </div>
                            <div class="row">
                                <div class="input-field col s4 col-AddTempSensorsUseEveryOffsetChange">
                                    <input type="checkbox" id="AddTempSensorsUseEveryOffsetChange" class="value" />
                                    <label for="AddTempSensorsUseEveryOffsetChange" class="translate">AddTempSensorsUseEveryOffsetChange</label>
                                </div>
                                <div class="col s6 col-AddTempSensorsUseEveryOffsetChange-descr">
                                    <span class="translate">hint_AddTempSensorsUseEveryOffsetChange</span>
                                </div>
                            </div>
                            
                        </div>
                    </li>
                    <li>
                        <div class="collapsible-header">
                            <i class="material-icons">expand_more</i><h6 class="translate">SensorSettings</h6>
                        </div>
                        <div class="collapsible-body">
                            <div class="row">
                                <div class="input-field col s6">
                                    <input type="checkbox" id="UseSensors" class="value" />
                                    <label for="UseSensors" class="translate">use_sensors</label>
                                </div>

                                <div class="input-field col s3 col-SensorOpenDelay">
                                    <input type="number" id="SensorOpenDelay" class="value" min="0" step="1" />
                                    <label for="SensorOpenDelay" class="translate">SensorOpenDelay</label>
                                </div>

                                <div class="input-field col s3 col-SensorCloseDelay">
                                    <input type="number" id="SensorCloseDelay" class="value" min="0" step="1" />
                                    <label for="SensorCloseDelay" class="translate">SensorCloseDelay</label>
                                </div>

                            </div>
                        </div>
                    </li>

                    <li>
                        <div class="collapsible-header">
                            <i class="material-icons">expand_more</i><h6 class="translate">ActorSettings</h6>
                        </div>
                        <div class="collapsible-body">
                            <div class="row">
                                <div class="input-field col s6">
                                    <input type="checkbox" id="UseActors" class="value" />
                                    <label for="UseActors" class="translate">use_actors</label>
                                </div>
                            </div>
                            <div class="row">
                                <div class="input-field col s3 col-ActorOnDelay">
                                    <input type="number" id="ActorBeforeOnDelay" class="value" min="0" step="1" />
                                    <label for="ActorBeforeOnDelay" class="translate">ActorBeforeOnDelay</label>
                                </div>

                                <div class="input-field col s3 col-ActorOffDelay">
                                    <input type="number" id="ActorBeforeOffDelay" class="value" min="0" step="1" />
                                    <label for="ActorBeforeOffDelay" class="translate">ActorBeforeOffDelay</label>
                                </div>

                                <div class="input-field col s3 col-InterActorDelay">
                                    <input type="number" id="InterActorDelay" class="value" min="0" step="1" />
                                    <label for="InterActorDelay" class="translate">InterActorDelay</label>
                                </div>
                            </div>

                            <div class="row">
                                <div class="input-field col s3 col-regulatortype">
                                    <select id="regulatorType" class="value">
                                        <option value="1" class="translate">linear</option>
                                        <option value="2" class="translate">linear Hysteresis</option>
                                    </select>
                                    <label for="regulatorType" class="translate">regulatorType</label>
                                </div>
                                <div class="input-field col s3 col-ExtHandlingActorRepTime">
                                    <input type="number" id="ExtHandlingRepTime" class="value" min="0" step="1" />
                                    <label for="ExtHandlingActorRepTime" class="translate">ExtHandlingActorRepTime</label>
                                </div>
                                <div class="input-field col s3 col-ExtHandlingActorAckWaitTime">
                                    <input type="number" id="ExtHandlingActorAckWaitTime" class="value" min="0" step="1" />
                                    <label for="ExtHandlingActorAckWaitTime" class="translate">ExtHandlingActorAckWaitTime</label>
                                </div>
                            </div>

                            <div class="row">
                                <div class="input-field col s3 col-useactorifnoheating">
                                    <select id="UseActorsIfNotHeating" class="value">
                                        <option value="1" class="translate">nothing</option>
                                        <option value="2" class="translate">off</option>
                                        <option value="3" class="translate">on</option>
                                    </select>
                                    <label for="UseActorsIfNotHeating" class="translate">UseActorsIfNotHeating</label>
                                </div>
                                <div class="input-field col s3 col-useactorifnothermostat">
                                    <select id="UseActorsIfNoThermostat" class="value">
                                        <option value="1" class="translate">nothing</option>
                                        <option value="2" class="translate">off</option>
                                        <option value="3" class="translate">on</option>
                                    </select>
                                    <label for="UseActorsIfNoThermostat" class="translate">UseActorsIfNoThermostat</label>
                                </div>
                            </div>



                        </div>
                    </li>

                    <li>
                        <div class="collapsible-header">
                            <i class="material-icons">expand_more</i><h6 class="translate">VisSettings</h6>
                        </div>
                        <div class="collapsible-body">
                            <div class="row">
                                <div class="input-field col s6 col-usevisfrompittini">
                                    <input type="checkbox" id="UseVisFromPittini" class="value" />
                                    <label for="UseVisFromPittini" class="translate">UseVisFromPittini</label>
                                </div>

                                <div class="col s6 col-use-custom-path-descr">
                                    <span class="translate">hint_vis_from_Pittini</span>
                                </div>


                            </div>

                            <div class="row">
                                <div class="input-field col s6 col-VisUseSimple">
                                    <input type="checkbox" id="VisUseSimple" class="value" />
                                    <label for="VisUseSimple" class="translate">VisUseSimple</label>
                                </div>

                            </div>

                            <div class="row">
                                <div class="input-field col s3 col-PittiniPathImageWindowOpen">
                                    <input type="text" id="PittiniPathImageWindowOpen" class="value" />
                                    <label for="PittiniPathImageWindowOpen" class="translate">PittiniPathImageWindowOpen</label>
                                </div>
                                <div class="input-field col s3 col-PittiniPathImageWindowClosed">
                                    <input type="text" id="PittiniPathImageWindowClosed" class="value" />
                                    <label for="PittiniPathImageWindowClosed" class="translate">PittiniPathImageWindowClosed</label>
                                </div>



                            </div>


                            <div class="row">
                                <div class="input-field col s3 col-VisMinProfilTemp">
                                    <input type="number" id="VisMinProfilTemp" min="0" max="20" class="value" />
                                    <label for="VisMinProfilTemp" class="translate">VisMinProfilTemp</label>
                                </div>
                                <div class="input-field col s3 col-VisMaxProfilTemp">
                                    <input type="number" id="VisMaxProfilTemp" min="10" max="30" class="value" />
                                    <label for="VisMaxProfilTemp" class="translate">VisMaxProfilTemp</label>
                                </div>

                                <div class="input-field col s3 col-VisStepWidthProfilTemp">
                                    <select id="VisStepWidthProfilTemp" class="value">
                                        <option value="0.5" class="translate">0.5 °C</option>
                                        <option value="1" class="translate">1 °C</option>
                                        <option value="2" class="translate">2 °C</option>
                                    </select>
                                    <label for="VisStepWidthProfilTemp" class="translate">VisStepWidthProfilTemp</label>
                                </div>

                            </div>

                            <div class="row">
                                <div class="input-field col s3 col-VisMinDecRelTemp">
                                    <input type="number" id="VisMinDecRelTemp" min="1" max="10" class="value" />
                                    <label for="VisMinDecRelTemp" class="translate">VisMinDecRelTemp</label>
                                </div>
                                <div class="input-field col s3 col-VisMaxDecRelTemp">
                                    <input type="number" id="VisMaxDecRelTemp" min="2" max="20" class="value" />
                                    <label for="VisMaxProfilTemp" class="translate">VisMaxDecRelTemp</label>
                                </div>

                                <div class="input-field col s3 col-VisStepWidthDecRelTemp">
                                    <select id="VisStepWidthDecRelTemp" class="value">
                                        <option value="0.5" class="translate">0.5 °C</option>
                                        <option value="1" class="translate">1 °C</option>
                                        <option value="2" class="translate">2 °C</option>
                                    </select>
                                    <label for="VisStepWidthDecRelTemp" class="translate">VisStepWidthDecRelTemp</label>
                                </div>

                            </div>

                            <div class="row">
                                <div class="input-field col s3 col-VisMinDecAbsTemp">
                                    <input type="number" id="VisMinDecAbsTemp" min="3" max="20" class="value" />
                                    <label for="VisMinDecAbsTemp" class="translate">VisMinDecAbsTemp</label>
                                </div>
                                <div class="input-field col s3 col-VisMaxDecAbsTemp">
                                    <input type="number" id="VisMaxDecAbsTemp" min="5" max="30" class="value" />
                                    <label for="VisMaxDecAbsTemp" class="translate">VisMaxDecAbsTemp</label>
                                </div>

                                <div class="input-field col s3 col-VisStepWidthDecAbsTemp">
                                    <select id="VisStepWidthDecAbsTemp" class="value">
                                        <option value="0.5" class="translate">0.5 °C</option>
                                        <option value="1" class="translate">1 °C</option>
                                        <option value="2" class="translate">2 °C</option>
                                    </select>
                                    <label for="VisStepWidthDecAbsTemp" class="translate">VisStepWidthDecAbsTemp</label>
                                </div>

                            </div>

                            <div class="row">
                                <div class="input-field col s3 col-VisMinOverrideTemp">
                                    <input type="number" id="VisMinOverrideTemp" min="3" max="25" class="value" />
                                    <label for="VisMinOverrideTemp" class="translate">VisMinOverrideTemp</label>
                                </div>
                                <div class="input-field col s3 col-VisMaxOverrideTemp">
                                    <input type="number" id="VisMaxOverrideTemp" min="5" max="35" class="value" />
                                    <label for="VisMaxOverrideTemp" class="translate">VisMaxOverrideTemp</label>
                                </div>

                                <div class="input-field col s3 col-VisStepWidthOverrideTemp">
                                    <select id="VisStepWidthOverrideTemp" class="value">
                                        <option value="0.5" class="translate">0.5 °C</option>
                                        <option value="1" class="translate">1 °C</option>
                                        <option value="2" class="translate">2 °C</option>
                                    </select>
                                    <label for="VisStepWidthOverrideTemp" class="translate">VisStepWidthOverrideTemp</label>
                                </div>

                            </div>

                        </div>
                    </li>

                    <li>
                        <div class="collapsible-header">
                            <i class="material-icons">expand_more</i><h6 class="translate">Logging</h6>
                        </div>
                        <div class="collapsible-body">

                            <div class="row">
                                <div class="input-field col s3">
                                    <input type="checkbox" id="extendedInfoLogTemperature" class="value" />
                                    <label for="extendedInfoLogTemperature" class="translate">extendedInfoLogTemperature</label>
                                </div>
                                <div class="input-field col s3 col-extendedInfoLogActor">
                                    <input type="checkbox" id="extendedInfoLogActor" class="value" />
                                    <label for="extendedInfoLogActor" class="translate">extendedInfoLogActor</label>
                                </div>
                                <div class="input-field col s3 col-extendedInfoLogWindow">
                                    <input type="checkbox" id="extendedInfoLogWindow" class="value" />
                                    <label for="extendedInfoLogWindow" class="translate">extendedInfoLogWindow</label>
                                </div>
                            </div>
                        </div>
                    </li>

                    <li>
                        <div class="collapsible-header">
                            <i class="material-icons">expand_more</i><h6 class="translate">Notifications</h6>
                        </div>
                        <div class="collapsible-body">

                            <div class="row">
                                <div class="input-field col s12 m6 l3">
                                    <input class="value" id="notificationEnabled" type="checkbox" />
                                    <label for="notificationEnabled" class="translate">NotificationEnabled</label>
                                </div>

                                <div class="input-field col s11 m2 notificationsType">
                                    <select class="value" id="notificationsType">
                                        <option value="Telegram" class="translate">Telegram</option>
                                        <option value="E-Mail" class="translate">E-Mail</option>
                                        <option value="Pushover" class="translate">Pushover</option>
                                        <option value="WhatsApp" class="translate">WhatsApp</option>
                                        <option value="Signal" class="translate">Signal</option>
                                        <option value="Discord" class="translate">Discord</option>
                                    </select>
                                    <label for="notificationsType" class="translate">notifications type</label>
                                </div>
                            </div>

                            <div class="row">
                                <div class="input-field col s3 col-notificationsTemperature">
                                    <input type="checkbox" id="notificationsTemperature" class="value" />
                                    <label for="notificationsTemperature" class="translate">notificationsTemperature</label>
                                </div>
                                <div class="input-field col s3 col-notificationsActor">
                                    <input type="checkbox" id="notificationsActor" class="value" />
                                    <label for="notificationsActor" class="translate">notificationsActor</label>
                                </div>
                                <div class="input-field col s3 col-notificationsWindow">
                                    <input type="checkbox" id="notificationsWindow" class="value" />
                                    <label for="notificationsWindow" class="translate">notificationsWindow</label>
                                </div>
                            </div>

                            <!-- Telegram -->
                            <div class="row telegram">
                                <div class="input-field col s12 m6 l3 telegram">
                                    <select id="telegramInstance" class="value"></select>
                                    <label for="telegramInstance" class="translate">Telegram instance</label>
                                </div>
                                <div class="input-field col s12 m6 l3 telegram">
                                    <select class="value" id="telegramUser"></select>
                                    <label class="translate" for="telegramUser">Telegram Receiver</label>
                                </div>
                            </div>
                            <div class="row telegram">

                                <div class="input-field col s12 m6 l3 telegram">
                                    <input type="number" class="value" id="telegramWaitToSend" min="0" max="20" />
                                    <label for="telegramWaitToSend" class="translate">Waiting for the send (seconds)</label>
                                </div>
                            </div>
                            <div class="row telegram">
                                <div class="input-field col s12 m6 l3 telegram">
                                    <input class="value" id="telegramSilentNotice" type="checkbox" />
                                    <label for="telegramSilentNotice" class="translate">Silent Notice</label>
                                </div>

                            </div>

                            <!-- WhatsApp -->
                            <div class="row whatsapp">
                                <div class="input-field col s12 m6 l3 whatsapp">
                                    <select id="whatsappInstance" class="value"></select>
                                    <label for="whatsappInstance" class="translate">WhatsApp instance</label>
                                </div>

                            </div>
                            <div class="row whatsapp">
                                <div class="input-field col s12 m6 l3 whatsapp">
                                    <input type="number" class="value" id="whatsappWaitToSend" min="0" max="20" />
                                    <label for="whatsappWaitToSend" class="translate">Waiting for the send (seconds)</label>
                                </div>
                            </div>

                            <!-- Signal -->
                            <div class="row signal">
                                <div class="input-field col s12 m6 l3 signal">
                                    <select id="signalInstance" class="value"></select>
                                    <label for="signalInstance" class="translate">Signal instance</label>
                                </div>

                            </div>
                            <div class="row signal">
                                <div class="input-field col s12 m6 l3 signal">
                                    <input type="number" class="value" id="signalWaitToSend" min="0" max="20" />
                                    <label for="signalWaitToSend" class="translate">Waiting for the send (seconds)</label>
                                </div>
                            </div>

                            <!-- Pushover -->
                            <div class="row pushover">
                                <div class="input-field col s12 m6 l3 pushover">
                                    <select id="pushoverInstance" class="value"></select>
                                    <label for="pushoverInstance" class="translate">Pushover instance</label>
                                </div>

                            </div>
                            <div class="row pushover">
                                <div class="input-field col s12 m6 l3 pushover">
                                    <input type="number" class="value" id="pushoverWaitToSend" min="0" max="20" />
                                    <label for="pushoverWaitToSend" class="translate">Waiting for the send (seconds)</label>
                                </div>
                                <div class="input-field col s12 m6 l3 pushover">
                                    <input class="value" id="pushoverDeviceID" type="text">
                                    <label for="pushoverDeviceID" class="translate">device ID (optional)</label>
                                </div>
                            </div>
                            <div class="row pushover">
                                <div class="input-field col s12 m6 l3 pushover">
                                    <input class="value" id="pushoverSilentNotice" type="checkbox" />
                                    <label for="pushoverSilentNotice" class="translate">Silent Notice</label>
                                </div>

                            </div>
                            <!-- email -->
                            <div class="row email">
                                <div class="input-field col s12 m6 l3 email">
                                    <input class="value" id="emailReceiver" type="text">
                                    <label for="emailReceiver" class="translate">email receiver</label>
                                    <span class="translate">email receiver</span>
                                </div>
                                <div class="input-field col s12 m6 l3 email">
                                    <input class="value" id="emailSender" type="text">
                                    <label for="emailSender" class="translate">email sender</label>
                                    <span class="translate">email sender</span>
                                </div>
                            </div>
                            <div class="row email">
                                <div class="input-field col s12 m6 l3 email">
                                    <select id="emailInstance" class="value"></select>
                                    <label for="emailInstance" class="translate">email instance</label>
                                </div>

                            </div>
                            <div class="row email">
                                <div class="input-field col s12 m6 l3 email">
                                    <input type="number" class="value" id="emailWaitToSend" min="0" max="20" />
                                    <label for="emailWaitToSend" class="translate">Waiting for the send (seconds)</label>
                                </div>

                            </div>



                            <!-- Discord -->
                            <div class="row discord">
                                <div class="input-field col s12 m6 l3 discord">
                                    <select id="discordInstance" class="value"></select>
                                    <label for="discordInstance" class="translate">Discord instance</label>
                                </div>

                            </div>
                            <div class="row discord">

                                <div class="input-field col s11 m2">
                                    <select class="value" id="discordTarget">
                                        <option value="UserTag" class="translate">UserTag</option>
                                        <option value="UserId" class="translate">UserId</option>
                                        <option value="ServerChannel" class="translate">ServerChannel</option>
                                    </select>
                                    <label for="notificationsType" class="translate">discordTarget</label>
                                </div>

                                <div class="input-field col s12 m6 l3 discord discordUserTag">
                                    <input type="text" class="value" id="discordUserTag" />
                                    <label for="discordUserTag" class="translate">DiscordUserTag</label>
                                </div>

                                <div class="input-field col s12 m6 l3 discord discordUserId">
                                    <input type="text" class="value" id="discordUserId" />
                                    <label for="discordUserId" class="translate">DiscordUserId</label>
                                </div>

                                <div class="input-field col s12 m6 l3 discord discordServerChannel">
                                    <input type="text" class="value" id="discordServerId" />
                                    <label for="discordServerId" class="translate">DiscordServerId</label>
                                </div>

                                <div class="input-field col s12 m6 l3 discord discordServerChannel">
                                    <input type="text" class="value" id="discordChannelId" />
                                    <label for="discordChannelId" class="translate">DiscordChannelId</label>
                                </div>

                                <div class="input-field col s12 m6 l3 discord">
                                    <input type="number" class="value" id="discordWaitToSend" min="0" max="20" />
                                    <label for="discordWaitToSend" class="translate">Waiting for the send (seconds)</label>
                                </div>
                            </div>



                            <!-- customized notifications -->
                            <div class="row customizedNotifications">
                                <div class="input-field col s12 m6 l3 useCustomizedNotifications">
                                    <input type="checkbox" class="value" id="useCustumizedNotifications" />
                                    <label for="useCustumizedNotifications" class="translate">useCustumizedNotifications</label>
                                </div>
                            </div>
                            <div class="row customizedNotifications">
                                <div class="input-field col s12 m6 l3 useCustumizedNotificationsWithInstanceName">
                                    <input type="checkbox" class="value" id="useCustumizedNotificationsWithInstanceName" />
                                    <label for="useCustumizedNotificationsWithInstanceName" class="translate">useCustumizedNotificationsWithInstanceName</label>
                                </div>
                            </div>
                            <div class="row customizedNotifications">
                                <div class="input-field col s12 m6 l3 useCustumizedNotificationsNewTargetTemp">
                                    <input type="text" class="value" id="useCustumizedNotificationsNewTargetTemp" />
                                    <label for="useCustumizedNotificationsNewTargetTemp" class="translate">useCustumizedNotificationsNewTargetTemp</label>
                                </div>
                                <div class="input-field col s12 m6 l3 useCustumizedNotificationsActorOn">
                                    <input type="text" class="value" id="useCustumizedNotificationsActorOn" />
                                    <label for="useCustumizedNotificationsActorOn" class="translate">useCustumizedNotificationsActorOn</label>
                                </div>
                                <div class="input-field col s12 m6 l3 useCustumizedNotificationsActorOff">
                                    <input type="text" class="value" id="useCustumizedNotificationsActorOff" />
                                    <label for="useCustumizedNotificationsActorOff" class="translate">useCustumizedNotificationsActorOff</label>
                                </div>
                                <div class="input-field col s12 m6 l3 useCustumizedNotificationsWindowOpen">
                                    <input type="text" class="value" id="useCustumizedNotificationsWindowOpen" />
                                    <label for="useCustumizedNotificationsWindowOpen" class="translate">useCustumizedNotificationsWindowOpen</label>
                                </div>
                                <div class="input-field col s12 m6 l3 useCustumizedNotificationsWindowClose">
                                    <input type="text" class="value" id="useCustumizedNotificationsWindowClose" />
                                    <label for="useCustumizedNotificationsWindowClose" class="translate">useCustumizedNotificationsWindowClose</label>
                                </div>

                            </div>

                        </div>
                    </li>

                    <li>
                        <div class="collapsible-header">
                            <i class="material-icons">expand_more</i><h6 class="translate">Maintenance</h6>
                        </div>
                        <div class="collapsible-body">
                            <div class="row">
                                <a class="waves-effect waves-light btn" id="btn_deleteunusedDP"><span class="translate">DeleteUnusedDP</span></a>
                                <div id="result_deleteunusedDP"></div>
                            </div>
                            <div class="row">
                                <a class="waves-effect waves-light btn" id="btn_deleteunusedConfig"><span class="translate">DeleteUnusedConfig</span></a>
                                <div id="result_deleteunusedConfig"></div>
                            </div>
                            <div class="row">


                                <div class="input-field col s2">
                                    <input type="number" id="MaintenanceModeTemperature" min="20" max="40" class="value" />
                                    <label for="MaintenanceModeTemperature" class="translate">MaintenanceModeTemperature</label>
                                </div>
                            </div>

                        </div>
                    </li>


                </ul>
            </div>

            <!-- tab "profile - settings"  -->
            <div id="tab-profiles" class="col s12 page">

                <ul class="collapsible">
                    <li>
                        <div class="collapsible-header">
                            <i class="material-icons">expand_more</i><h6 class="translate">GeneralProfileSettings</h6>
                        </div>
                        <div class="collapsible-body">

                            <div class="row">
                                <div class="input-field col s1">
                                    <a class="btn-floating btn-small translateT" title="save profile" id="btn_save_profile"><i class="material-icons">file_download</i></a>
                                </div>
                                <div class="input-field col s1">
                                    <a class="btn-floating btn-small translateT" title="load profile" id="btn_load_profile"><i class="material-icons">file_upload</i></a>
                                </div>
                                <div id="checkResultSaveProfile"></div>
                                <div id="checkResultLoadProfile"></div>
                            </div>


                            <div class="row">
                                <div class="input-field col s4">
                                    <select id="ProfileType" class="value">
                                        <option value="1" class="translate">Mo-So</option>
                                        <option value="2" class="translate">Mo-Fr + Sa-So</option>
                                        <option value="3" class="translate">every Day</option>
                                    </select>
                                    <label for="ProfileType" class="translate">ProfileType</label>
                                </div>

                                <div class="input-field col s2">
                                    <input type="number" id="NumberOfProfiles" min="1" max="10" class="value" />
                                    <label for="NumberOfProfiles" class="translate">NumberOfProfiles</label>
                                </div>

                                <div class="input-field col s2">
                                    <input type="number" id="NumberOfPeriods" min="1" max="10" class="value" />
                                    <label for="NumberOfPeriods" class="translate">NumberOfPeriods</label>
                                </div>
                            </div>

                            <div class="row">

                                <div class="input-field col s2">
                                    <select id="TemperatureDecrease" class="value">
                                        <option value="1" class="translate">relative</option>
                                        <option value="2" class="translate">absolute</option>
                                        <option value="3" class="translate">no lowering</option>
                                    </select>
                                    <label for="TemperatureDecrease" class="translate">TemperatureDecrease</label>
                                </div>

                                <div class="input-field col s2">
                                    <input type="checkbox" id="PublicHolidayLikeSunday" class="value" />
                                    <label for="PublicHolidayLikeSunday" class="translate">PublicHolidayLikeSunday</label>
                                </div>

                                <div class="input-field col s2">
                                    <input type="checkbox" id="HolidayPresentLikeSunday" class="value" />
                                    <label for="HolidayPresentLikeSunday" class="translate">HolidayPresentLikeSunday</label>
                                </div>


                            </div>
                            <div class="row">
                                <div class="input-field col s4">
                                    <input type="checkbox" id="UseMinTempPerRoom" class="value" />
                                    <label for="UseMinTempPerRoom" class="translate">UseMinTempPerRoom</label>
                                </div>
                            </div>
                            <div class="row">
                                <div class="input-field col s2">
                                    <input type="checkbox" id="UseFireplaceMode" class="value" />
                                    <label for="UseFireplaceMode" class="translate">UseFireplaceMode</label>
                                </div>
                                <div class="input-field col s2 col-UseFireplaceModeResetAt">
                                    <input type="time" id="UseFireplaceModeResetAt" class="timepicker value" />
                                    <label for="UseFireplaceModeResetAt" class="translate">UseFireplaceModeResetAt</label>
                                </div>
                            </div>

                        </div>
                    </li>
                    <li>
                        <div class="collapsible-header">
                            <i class="material-icons">expand_more</i><h6 class="translate">HeatingperiodSettings</h6>
                        </div>
                        <div class="collapsible-body">

                            <div class="row">
                                <div class="input-field col s4">
                                    <input type="checkbox" id="UseFixHeatingPeriod" class="value" />
                                    <label for="UseFixHeatingPeriod" class="translate">UseFixHeatingPeriod</label>
                                </div>

                                <div class="input-field col s4 col-FixHeatingPeriod-Start">
                                    <input type="text" id="FixHeatingPeriodStart" class="value" maxlength="6" />
                                    <label for="FixHeatingPeriodStart" class="translate">FixHeatingPeriodStart</label>
                                </div>

                                <div class="input-field col s4 col-FixHeatingPeriod-End">
                                    <input type="text" id="FixHeatingPeriodEnd" class="value" maxlength="6" />
                                    <label for="FixHeatingPeriodEnd" class="translate">FixHeatingPeriodEnd</label>
                                </div>

                            </div>

                            <div class="row">
                                <div class="input-field col s4 col-thermostattodeifnoheatingperiod">
                                    <select id="ThermostatModeIfNoHeatingperiod" class="value">
                                        <option value="1" class="translate">fixTempPerRoom</option>
                                        <option value="2" class="translate">fixTempForAll</option>
                                        <option value="3" class="translate">nothing</option>
                                    </select>
                                    <label for="ThermostatModeIfNoHeatingperiod" class="translate">ThermostatModeIfNoHeatingperiod</label>
                                </div>

                                <div class="input-field col s4 col-FixTempIfNoHeatingPeriod">
                                    <input type="number" id="FixTempIfNoHeatingPeriod" class="value" />
                                    <label for="FixTempIfNoHeatingPeriod" class="translate">FixTempIfNoHeatingPeriod</label>
                                </div>

                            </div>
                        </div>
                    </li>
                    <li>
                        <div class="collapsible-header">
                            <i class="material-icons">expand_more</i><h6 class="translate">Power Interruptions</h6>
                        </div>
                        <div class="collapsible-body">

                            <div class="row">
                                <div class="col s12" id="PowerInterruptions">

                                    <a id="addPowerInterruption" class="btn-floating waves-effect waves-light blue table-button-add" title="add power interruption"><i class="material-icons">add</i></a>

                                    <div class="table-powerinterruptions-div">
                                        <table id="table-powerinterruptions" class="table-values" style="width: 100%;">
                                            <thead>
                                                <tr>
                                                    <th id="powerinterruptions_col1" data-name="active" data-type="checkbox" style="background: #64b5f6 " class="header translate">PIactive</th>
                                                    <th id="powerinterruptions_col2" data-name="Start" data-type="text" style="background: #64b5f6 " class="header translate">StartPI</th>
                                                    <th id="powerinterruptions_col3" data-name="End" data-type="text" style="background: #64b5f6 " class="header translate">EndPI</th>
                                                    <th id="powerinterruptions_col4" data-buttons="up down delete" style="width: 100px; background: #64b5f6"></th>
                                                </tr>
                                            </thead>
                                        </table>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </li>
                </ul>
            </div>

            <!-- tab "devices" -->
            <div id="tab-devices" class="col s12 page">

                <div class="row">
                    <div class="input-field col s4">
                        <a class="waves-effect waves-light btn" id="btn_check4newrooms"><span class="translate">Check4NewRooms</span></a>
                        <div id="checkResultRooms"></div>
                    </div>
                    <div class="input-field col s4">
                        <span class="translate">Check4NewRooms_hint</span>
                    </div>
                </div>

                <div class="col s12" id="rooms">

                    <a class="btn-floating waves-effect waves-light blue table-button-add"><i class="material-icons">add</i></a>

                    <div class="table-values-div">
                        <table id="table_rooms" class="table-values" style="width: 100%;">
                            <thead>
                                <tr>
                                    <th id="rooms_col_1" data-name="name" style="width: 20%; background: #64b5f6 " class="translate">room</th>
                                    <th id="rooms_col_2" data-name="isActive" data-type="checkbox" style="background: #64b5f6" class="translate">active</th>
                                    <!-- suould be hidden-->
                                    <th id="rooms_col_3" data-name="WaitForTempIfWindowOpen" data-type="number" style="background: #64b5f6">WaitForTempIfWindowOpen</th>

                                    <th data-buttons="up down edit delete" style="width: 100px; background: #64b5f6"></th>

                                </tr>
                            </thead>
                        </table>
                    </div>
                </div>
            </div>
        </div>
        <div class="m material-dialogs">
            <div id="dialog-select-member" class="modal modal-fixed-footer">
                <div class="modal-content">
                    <div class="row">
                        <div class="col s12 title"></div>
                    </div>
                    <div class="row">
                        <div class="col s12 dialog-content">
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <a class="modal-action modal-close waves-effect waves-green btn btn-set"><i class="large material-icons left">check</i><span class="translate">Select</span></a>
                    <a class="modal-action modal-close waves-effect waves-green btn btn-close"><i class="large material-icons left ">close</i><span class="translate">Cancel</span></a>
                </div>
            </div>
            <div id="dialog-room-edit" class="modal modal-fixed-footer">
                <div class="row">
                    <div class="modal-content">

                        <div class="row">
                            <div class="col s12">
                                <h6 class="title"><span class="translate">Edit Room:</span> <span id="dialogDeviceEditRoom"></span></h6>
                            </div>
                        </div>
                        <div class="col s12">
                            <ul class="tabs">
                                <li id="page-thermostats" class="tab col s3"><a href="#tab-popup_thermostats" class="translate active">thermostats</a></li>
                                <li id="page-actors" class="tab col s3"><a href="#tab-popup_actors" class="translate">actors</a></li>
                                <li id="page-sensors" class="tab col s3"><a href="#tab-popup_sensors" class="translate">sensors</a></li>
                                <li id="page-addTempSensors" class="tab col s3"><a href="#tab-popup_AddTempSensors" class="translate">AddTempSensors</a></li>
                            </ul>
                        </div>
                        <div id="tab-popup_thermostats" class="col s12 page">
                            <div class="row">
                                <div class="col s12 ">
                                    <span class="translate">hint_thermostats</span>
                                </div>
                            </div>

                            <div class="row">
                                <div class="input-field col s4">
                                    <a class="waves-effect waves-light btn" id="btn_check4newThermostats"><span class="translate">Check4NewThermostats</span></a>
                                    <div id="checkResultThermostats"></div>
                                </div>
                                <div class="input-field col s4">
                                    <span class="translate">Check4NewThermostats_hint</span>
                                </div>
                            </div>

                            <div class="row">
                                <div class="input-field col s12 col-WaitForTempIfWindowOpen">
                                    <input type="number" id="WaitForTempIfWindowOpen" class="value" />
                                    <label for="WaitForTempIfWindowOpen" class="translate">WaitForTempIfWindowOpen</label>
                                </div>
                            </div>


                            <div class="row">
                                <div class="col s12" id="thermostats">
                                    <a class="btn-floating waves-effect waves-light blue table-button-add"><i class="material-icons">add</i></a>

                                    <div class="table-values-div">
                                        <table id="table_thermostats" class="table-values" style="width: 100%;">
                                            <thead>
                                                <tr>
                                                    <th id="thermostat_col_0" data-name="id" style="background: #64b5f6;" class="translate">id</th>

                                                    <th id="thermostat_col_1" data-name="name" style="background: #64b5f6" class="translate">thermostat</th>
                                                    <th id="thermostat_col_2" data-name="OID_Current" style="background: #64b5f6" class="translate">OID current</th>
                                                    <th id="thermostat_edit1" data-buttons="edit1" style="width: 100px; background: #64b5f6"></th>
                                                    <th id="thermostat_col_3" data-name="OID_Target" style="background: #64b5f6" class="translate">OID target</th>
                                                    <th id="thermostat_edit2" data-buttons="edit2" style="width: 100px; background: #64b5f6"></th>
                                                    <th id="thermostat_col_4" data-name="useExtHandling" data-type="checkbox" style="background: #64b5f6" class="translate">useExtHandling</th>
                                                    <th data-name="isActive" data-type="checkbox" style="background: #64b5f6" class="translate">active</th>
                                                    <th data-buttons="delete" style="width: 100px; background: #64b5f6"></th>

                                                </tr>
                                            </thead>
                                        </table>
                                    </div>
                                </div>
                            </div>

                        </div>
                        <div id="tab-popup_actors" class="col s12 page">
                            <div class="row">
                                <div class="col s12 ">
                                    <span class="translate">hint_actors</span>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col s12 ">
                                    <span class="translate">useExtHandling_hint</span>
                                </div>
                            </div>
                            <div class="row">
                                <div class="input-field col s4">
                                    <a class="waves-effect waves-light btn" id="btn_check4newActors"><span class="translate">Check4NewActors</span></a>
                                    <div id="checkResultActors"></div>
                                </div>
                                <div class="input-field col s4">
                                    <span class="translate">Check4NewActors_hint</span>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col s12" id="actors">
                                    <a class="btn-floating waves-effect waves-light blue table-button-add"><i class="material-icons">add</i></a>
                                    <div class="table-values-div">
                                        <table id="table_actors" class="table-values" style="width: 100%;">
                                            <thead>
                                                <tr>
                                                    <th id="actor_col_0" data-name="id" style="background: #64b5f6;" class="translate">id</th>
                                                    <th id="actor_col_1" data-name="name" style="background: #64b5f6" class="translate">actor</th>
                                                    <th id="actor_col_2" data-name="OID_Target" style="background: #64b5f6" class="translate">OID</th>
                                                    <th id="actor_col_3" data-name="useExtHandling" data-type="checkbox" style="background: #64b5f6" class="translate">useExtHandling</th>
                                                    <th data-buttons="edit" style="width: 100px; background: #64b5f6"></th>
                                                    <th data-name="isActive" data-type="checkbox" style="background: #64b5f6" class="translate">active</th>
                                                    <th data-buttons="delete" style="width: 100px; background: #64b5f6"></th>
                                                </tr>
                                            </thead>
                                        </table>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div id="tab-popup_sensors" class="col s12 page">
                            <div class="row">
                                <div class="col s12 ">
                                    <span class="translate">hint_sensors</span>
                                </div>
                            </div>

                            <div class="row">
                                <div class="input-field col s4">
                                    <a class="waves-effect waves-light btn" id="btn_check4newSensors"><span class="translate">Check4NewSensors</span></a>
                                    <div id="checkResultSensors"></div>
                                </div>
                                <div class="input-field col s4">
                                    <span class="translate">Check4NewSensors_hint</span>
                                </div>
                            </div>

                            <div class="row">
                                <div class="col s12" id="sensors">
                                    <a class="btn-floating waves-effect waves-light blue table-button-add"><i class="material-icons">add</i></a>
                                    <div class="table-values-div">
                                        <table id="table_sensors" class="table-values" style="width: 100%;">
                                            <thead>
                                                <tr>
                                                    <th id="sensor_col_0" data-name="id" style="background: #64b5f6;" class="translate">id</th>
                                                    <th id="sensor_col_1" data-name="name" style="background: #64b5f6" class="translate">sensor</th>
                                                    <th id="sensor_col_2" data-name="OID_Current" style="background: #64b5f6" class="translate">OID</th>
                                                    <th data-buttons="edit" style="width: 100px; background: #64b5f6"></th>
                                                    <th data-name="isActive" data-type="checkbox" style="background: #64b5f6" class="translate">active</th>
                                                    <th data-name="DataType" data-options="boolean;number;string" data-type="select" style="background: #64b5f6" class="translate">DataType</th>
                                                    <th data-name="valueOpen" data-type="text" style="background: #64b5f6" class="translate">valueOpen</th>
                                                    <th data-name="valueClosed" data-type="text" style="background: #64b5f6" class="translate">ValueClosed</th>
                                                    <th data-buttons="delete" style="width: 100px; background: #64b5f6"></th>

                                                </tr>
                                            </thead>
                                        </table>
                                    </div>
                                </div>
                            </div>
                        </div>

                       
                        <div id="tab-popup_AddTempSensors" class="col s12 page">
                            <div class="row">
                                <div class="col s12 ">
                                    <span class="translate">hint_AddTempSensors</span>
                                </div>
                            </div>

                            <div class="row">
                                <div class="input-field col s4">
                                    <a class="waves-effect waves-light btn" id="btn_check4newAddTempSensors"><span class="translate">Check4NewAddTempSensors</span></a>
                                    <div id="checkResultAddTempSensors"></div>
                                </div>
                                <div class="input-field col s4">
                                    <span class="translate">Check4NewAddTempSensors_hint</span>
                                </div>
                            </div>

                            <div class="row">
                                <div class="col s12" id="addtempsensors">
                                    <a class="btn-floating waves-effect waves-light blue table-button-add"><i class="material-icons">add</i></a>
                                    <div class="table-values-div">
                                        <table id="table_addtempsensors" class="table-values" style="width: 100%;">
                                            <thead>
                                                <tr>
                                                    <th id="addtempsensor_col_0" data-name="id" style="background: #64b5f6;" class="translate">id</th>
                                                    <th id="addtempsensor_col_1" data-name="name" style="background: #64b5f6" class="translate">sensor</th>
                                                    <th id="addtempsensor_col_2" data-name="OID_Current" style="background: #64b5f6" class="translate">OID</th>
                                                    <th data-buttons="edit" style="width: 100px; background: #64b5f6"></th>
                                                    <th data-name="isActive" data-type="checkbox" style="background: #64b5f6" class="translate">active</th>
                                                    <th data-buttons="delete" style="width: 100px; background: #64b5f6"></th>
                                                </tr>
                                            </thead>
                                        </table>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <a class="modal-action modal-close waves-effect waves-green btn btn-set"><i class="large material-icons left">check</i><span class="translate">Ok</span></a>
                    <a class="modal-action modal-close waves-effect waves-green btn btn-close"><i class="large material-icons left">close</i><span class="translate">Cancel</span></a>
                </div>
            </div>
        </div>

    </div>
</body>
</html>