{
    "i18n": true,
    "type": "tabs",
    "tabsStyle": {
        "width": "calc(100% - 100px)"
    },
    "items": {
        "tabLogon": {
            "type": "panel",
            "label": "Logon information",
            "items": {
                "authinfo": {
                    "type": "header",
                    "size": 2,
                    "style": {
                        "marginTop": 20
                    },
                    "sm": 12,
                    "text": "Authentication information"
                },                
                "HomeId":{
                    "type": "text",
                    "label": "Home-ID:",
                    "help": "Home ID from your Netatmo Energy installation",
                    "xs": 12,
                    "xl": 4,
                    "sm": 12,
                    "md": 6,
                    "lg": 4                      
                },  
                "ClientId":{
                    "newLine": true,
                    "type": "text",
                    "label": "Client-ID:",
                    "help": "Client ID from your Netatmo APP",
                    "xs": 12,
                    "xl": 4,
                    "sm": 12,
                    "md": 6,
                    "lg": 4            
                },
                "ClientSecretID":{
                    "type": "text",
                    "label": "Client-Secret-ID:",
                    "help": "Client Secret ID from your Netatmo APP",
                    "xs": 12,
                    "xl": 4,
                    "sm": 12,
                    "md": 6,
                    "lg": 4   
                },
                "_authenticate": {
                    "newLine": true,
                    "variant": "contained",
                    "color": "primary",
                    "disabled": "!_alive",
                    "type": "sendTo",
                    "error": {
                        "connect timeout": "Connection timeout"
                    },
                    "icon": "auth",
                    "command": "getOAuthStartLink",
                    "jsonData": "{\"client_id\": \"${data.ClientId}\",\"client_secret\": \"${data.ClientSecretID}\",\"redirect_uri_base\": \"${data._origin}\"}",
                    "label": "Authenticate with Netatmo",
                    "openUrl": true,
                    "xs": 12,
                    "xl": 4,
                    "sm": 12,
                    "md": 6,
                    "lg": 4                      
                },
                "Information":{
                    "type": "header",
                    "size": "3",
                    "text": "Additional functions",
                    "xs": 12,
                    "xl": 4,
                    "sm": 12,
                    "md": 6,
                    "lg": 4                      
                },     
                "notificationEnabled":{
                    "type": "checkbox",
                    "label": "Enable / Disable Notifications",
                    "xs": 12,
                    "xl": 4,
                    "sm": 12,
                    "md": 6,
                    "lg": 4                      
                },    
                "sensorsEnabled":{
                    "type": "checkbox",
                    "label": "Enable / Disable sensor actions",
                    "xs": 12,
                    "xl": 4,
                    "sm": 12,
                    "md": 6,
                    "lg": 4                      
                }   
            }
        },
        "tabAPI": {
            "type": "panel",
            "label": "General settings",
            "items": {   
                "TempHeader": {
                    "type": "header",
                    "size": "3",
                    "text": "Temperature control"
                },
                "applyimmediately":{
                    "type": "checkbox",
                    "label": "apply immediately",
                    "xs": 12,
                    "xl": 4,
                    "sm": 12,
                    "md": 6,
                    "lg": 4                     
                },
                "RefreshHeader": {
                    "type": "header",
                    "size": "3",
                    "text": "Update data structure"
                },
                "getchangesimmediately":{
                    "newLine": true,
                    "type": "checkbox",
                    "label": "read API states immediately",
                    "xs": 12,
                    "xl": 4,
                    "sm": 12,
                    "md": 6,
                    "lg": 4                    
                },
                "refreshstates":{
                    "newLine": true,
                    "type": "number",
                    "help": "Refresh states every x seconds",
                    "xs": 12,
                    "xl": 4,
                    "sm": 12,
                    "md": 6,
                    "lg": 4  
                },
                "UpdateStatesIfChanged": {
                    "newLine": true,
                    "type": "checkbox",
                    "label": "Only update datapoints if changes are detected",
                    "default": true,
                    "xs": 12,
                    "xl": 4,
                    "sm": 12,
                    "md": 6,
                    "lg": 4  
                },
                "UpdateStatesChangedTempEveryTime": {
                    "newLine": false,
                    "type": "checkbox",
                    "label": "Change temperature states every time",
                    "hidden": "data.UpdateStatesIfChanged !== true",
                    "default": false,
                    "xs": 12,
                    "xl": 4,
                    "sm": 12,
                    "md": 6,
                    "lg": 4  
                }
            }
        },
        "tabNotification": {
            "type": "panel",
            "label": "Notifications",
            "disabled": "data.notificationEnabled !== true",
            "items": {   
                "NotificationHeader": {
                    "type": "header",
                    "size": "3",
                    "text": "Message services"
                },
                "notificationsType": {
                    "type": "select",
                    "noTranslation": true,
                    "options": [
                      {"label": "Telegram", "value": "telegram"},
                      {"label": "E-Mail",   "value": "email"},
                      {"label": "Pushover", "value": "pushover"},
                      {"label": "WhatsApp", "value": "whatsapp-cmb"},
                      {"label": "Signal", "value": "signal-cmb"}
                    ],
                    "label": "notifications type",
                    "xs": 12,
                    "xl": 4,
                    "sm": 12,
                    "md": 6,
                    "lg": 4  
                  },

                "telegramInstance":{
                    "newLine": true,
                    "type": "selectSendTo",
                    "command": "telegram",
                    "label": "Telegram instance",
                    "hidden": "data.notificationsType !== 'telegram'",
                    "xs": 12,
                    "xl": 4,
                    "sm": 12,
                    "md": 6,
                    "lg": 4            
                },  
                "telegramUser":{
                    "type": "selectSendTo",
                    "command": "getTelegramUser",
                    "label": "Telegram Receiver",
                    "hidden": "data.notificationsType !== 'telegram'",
                    "xs": 12,
                    "xl": 4,
                    "sm": 12,
                    "md": 6,
                    "lg": 4             
                },
                "telegramSilentNotice":{
                    "newLine": true,
                    "type": "checkbox",
                    "label": "Silent Notice",
                    "hidden": "data.notificationsType !== 'telegram'",
                    "xs": 12,
                    "xl": 4,
                    "sm": 12,
                    "md": 6,
                    "lg": 4                       
                },

                "whatsappInstance":{
                    "newLine": true,
                    "type": "selectSendTo",
                    "command": "whatsapp-cmb",
                    "label": "WhatsApp instance",
                    "hidden": "data.notificationsType !== 'whatsapp-cmb'",
                    "xs": 12,
                    "xl": 4,
                    "sm": 12,
                    "md": 6,
                    "lg": 4             
                },
                
                "signalInstance":{
                    "newLine": true,
                    "type": "selectSendTo",
                    "command": "signal-cmb",
                    "label": "Signal instance",
                    "hidden": "data.notificationsType !== 'signal-cmb'",
                    "xs": 12,
                    "xl": 4,
                    "sm": 12,
                    "md": 6,
                    "lg": 4            
                },

                "pushoverInstance":{
                    "newLine": true,
                    "type": "selectSendTo",
                    "command": "pushover",
                    "label": "Pushover instance",
                    "hidden": "data.notificationsType !== 'pushover'",
                    "xs": 12,
                    "xl": 4,
                    "sm": 12,
                    "md": 6,
                    "lg": 4  
                },  
                "pushoverDeviceID":{
                    "type": "text",
                    "label": "device ID (optional)",
                    "hidden": "data.notificationsType !== 'pushover'",
                    "xs": 12,
                    "xl": 4,
                    "sm": 12,
                    "md": 6,
                    "lg": 4             
                },
                "pushoverSilentNotice":{
                    "newLine": true,
                    "type": "checkbox",
                    "label": "Silent Notice",
                    "hidden": "data.notificationsType !== 'pushover'",
                    "xs": 12,
                    "xl": 4,
                    "sm": 12,
                    "md": 6,
                    "lg": 4             
                },  

                "emailInstance":{
                    "newLine": true,
                    "type": "selectSendTo",
                    "command": "email",
                    "label": "email instance",
                    "hidden": "data.notificationsType !== 'email'",
                    "xs": 12,
                    "xl": 4,
                    "sm": 12,
                    "md": 6,
                    "lg": 4  
                },                   
                "emailReceiver":{
                    "newLine": true,
                    "type": "text",
                    "label": "email receiver",
                    "hidden": "data.notificationsType !== 'email'",
                    "xs": 12,
                    "xl": 4,
                    "sm": 12,
                    "md": 6,
                    "lg": 4            
                },  
                "emailSender":{
                    "type": "text",
                    "label": "email sender",
                    "hidden": "data.notificationsType !== 'email'",
                    "xs": 12,
                    "xl": 4,
                    "sm": 12,
                    "md": 6,
                    "lg": 4  
                },
                "sendTestNotification": {
                    "newLine": true,
                    "variant": "outlined",
                    "color": "primary",
                    "disabled": "!_alive || data.notificationsType != originalData.notificationsType || data.telegramInstance != originalData.telegramInstance || data.telegramUser != originalData.telegramUser || data.telegramSilentNotice != originalData.telegramSilentNotice || data.whatsappInstance != originalData.whatsappInstance || data.signalInstance != originalData.signalInstance || data.pushoverInstance != originalData.pushoverInstance || data.pushoverDeviceID != originalData.pushoverDeviceID || data.pushoverSilentNotice != originalData.pushoverSilentNotice || data.emailInstance != originalData.emailInstance || data.emailReceiver != originalData.emailReceiver || data.emailSender != originalData.emailSender",
                    "type": "sendTo",
                    "error": {
                        "connect timeout": "Connection timeout"
                    },
                    "icon": "send",
                    "command": "SendTestNotification",
                    "label": "Send test notification",
                    "xs": 12,
                    "xl": 4,
                    "sm": 12,
                    "md": 6,
                    "lg": 4  
                },

                "genInfoHeader":{
                    "type": "header",
                    "size": "3",
                    "text": "Allgemeine Einstellungen"          
                },  

                "NoticeType":{
                    "type": "select",
                    "options": [
                      {"label": "Long Notifications", "value": "longNotice"},
                      {"label": "Short Notifications", "value": "shortNotice"}
                    ],                    
                    "label": "Notification Style",
                    "xs": 12,
                    "xl": 4,
                    "sm": 12,
                    "md": 6,
                    "lg": 4            
                },
                "notifications":{
                    "type": "select",
                    "options": [
                      {"label": "no notifications", "value": "000"},
                      {"label": "information", "value": "i00"},
                      {"label": "information, warnings", "value": "iw0"},
                      {"label": "information, errors", "value": "i0e"},
                      {"label": "information, warnings, errors", "value": "iwe"},
                      {"label": "warnings", "value": "0w0"},
                      {"label": "warnings, errors", "value": "0we"},
                      {"label": "errors", "value": "00e"}                                                                  
                    ],                    
                    "label": "message type",
                    "xs": 12,
                    "xl": 4,
                    "sm": 12,
                    "md": 6,
                    "lg": 4             
                }
            }
        },
        "tabSubscribes": {
            "type": "panel",
            "label": "Messages",
            "disabled": "data.notificationEnabled !== true",
            "items": {
                "MessageTextHeader": {
                    "type": "header",
                    "size": "3",
                    "text": "Message texts"
                },
                "notify_bat_low":{
                    "newLine": true,
                    "type": "checkbox",
                    "label": "Low battery",
                    "xs": 12,
                    "xl": 2,
                    "sm": 6,
                    "md": 3,
                    "lg": 2                   
                },
                "notify_bat_low_txt":{
                    "type": "text",
                    "label": "Message",
                    "help": "Message if battery goes low",
                    "xs": 12,
                    "xl": 4,
                    "sm": 12,
                    "md": 6,
                    "lg": 4            
                },
                "notify_bat_medium":{
                    "newLine": true,
                    "type": "checkbox",
                    "label": "Medium battery",
                    "xs": 12,
                    "xl": 2,
                    "sm": 6,
                    "md": 3,
                    "lg": 2                  
                },
                "notify_bat_medium_txt":{
                    "type": "text",
                    "label": "Message",
                    "help": "Message if battery goes medium",
                    "xs": 12,
                    "xl": 4,
                    "sm": 12,
                    "md": 6,
                    "lg": 4                                
                },
                "notify_connection_no":{
                    "newLine": true,
                    "type": "checkbox",
                    "label": "Connection",
                    "xs": 12,
                    "xl": 2,
                    "sm": 6,
                    "md": 3,
                    "lg": 2                   
                },
                "notify_connection_no_txt":{
                    "type": "text",
                    "label": "Message",
                    "help": "Message if valve lost connection",
                    "xs": 12,
                    "xl": 4,
                    "sm": 12,
                    "md": 6,
                    "lg": 4    
                },
                "notify_window_open":{
                    "newLine": true,
                    "type": "checkbox",
                    "label": "Window open",
                    "xs": 12,
                    "xl": 2,
                    "sm": 6,
                    "md": 3,
                    "lg": 2                   
                },
                "notify_window_open_txt":{
                    "type": "text",
                    "label": "Message",
                    "help": "Message if window is open",
                    "xs": 12,
                    "xl": 4,
                    "sm": 12,
                    "md": 6,
                    "lg": 4    
                },
                "notify_heating_power_request":{
                    "newLine": true,
                    "type": "checkbox",
                    "label": "Heating request",
                    "xs": 12,
                    "xl": 2,
                    "sm": 6,
                    "md": 3,
                    "lg": 2                    
                },
                "notify_heating_power_request_txt":{
                    "type": "text",
                    "label": "Message",
                    "help": "Message if valve creates a heating request",
                    "xs": 12,
                    "xl": 4,
                    "sm": 12,
                    "md": 6,
                    "lg": 4    
                },
                "notify_anticipating":{
                    "newLine": true,
                    "type": "checkbox",
                    "label": "Anticipating",
                    "xs": 12,
                    "xl": 2,
                    "sm": 6,
                    "md": 3,
                    "lg": 2                    
                },
                "notify_anticipating_txt":{
                    "type": "text",
                    "label": "Message",
                    "help": "Message if boiler anticipates",
                    "xs": 12,
                    "xl": 4,
                    "sm": 12,
                    "md": 6,
                    "lg": 4  
                }
            }
        },
        "tabSensors": {
            "type": "panel",
            "label": "Sensor actions",
            "disabled": "data.sensorsEnabled !== true",
            "items": {
                "MessageTextHeader": {
                    "type": "header",
                    "size": "3",
                    "text": "Reactions to sensor status changes"
                },
                "sensors": {
                    "type": "table",
                    "xs": 12,
                    "xl": 12,
                    "sm": 12,
                    "md": 12,
                    "lg": 12,
                    "label": "Check window/door status",
                    "items": [
                        {
                            "type": "objectId",
                            "attr": "window_sensor",
                            "width": "35%",
                            "title": "Window/Door sensor",
                            "help": "Window/Door sensor (type = boolean)",
                            "filter": true,
                            "sort": true
                        },
                        {
                            "type": "checkbox",
                            "attr": "window_sensor_value",
                            "width": "10%",
                            "title": "Value",
                            "help": "Check value from window/door sensor",
                            "filter": true,
                            "sort": true,
                            "default": false
                        },
                        {
                            "type": "number",
                            "attr": "sensor_delay",
                            "width": "5%",
                            "title": "Delay",
                            "help": "Delay to perform action (seconds)",
                            "min": 0,
                            "max": 3600,
                            "filter": true,
                            "sort": false,
                            "default": 0
                        },
                        {
                            "type": "selectSendTo",
                            "attr": "action",
                            "width": "10%",
                            "command": "GetSensorActions",
                            "title": "Action",
                            "help": "Action to perform",
                            "filter": true,
                            "sort": true,
                            "default": "temp"
                        },
                        {
                            "type": "selectSendTo",
                            "attr": "temp_sensor",
                            "width": "35%",
                            "command": "GetSetTempSensors",
                            "title": "Actor",
                            "help": "Actor to set temperature",
                            "filter": true,
                            "sort": true
                        },
                        {
                            "type": "number",
                            "attr": "set_value",
                            "width": "5%",
                            "title": "Target temperature",
                            "help": "Set temperature of actor",
                            "min": 7,
                            "max": 30,
                            "filter": false,
                            "sort": false,
                            "default": "18"
                        }
                    ]
                }
            }
        }                   
    }
}