{
  "title": "TA652FC-W Thermostat List",
  "image": null,
  "mobileHide": true,
  "mobileOrder": null,
  "configuration": {
    "description": "TA652FC-W Thermostat List (v.1.0.0, 2023-05-25)",
    "widgets": {
      "232da62c-8c7e-7d1b-bcd6-899e909a43ba": {
        "type": "latest",
        "sizeX": 7.5,
        "sizeY": 6.5,
        "config": {
          "timewindow": {
            "displayValue": "",
            "selectedTab": 0,
            "realtime": {
              "realtimeType": 1,
              "interval": 1000,
              "timewindowMs": 60000,
              "quickInterval": "CURRENT_DAY"
            },
            "history": {
              "historyType": 0,
              "interval": 1000,
              "timewindowMs": 60000,
              "fixedTimewindow": {
                "startTimeMs": 1672134803627,
                "endTimeMs": 1672221203627
              },
              "quickInterval": "CURRENT_DAY"
            },
            "aggregation": {
              "type": "NONE",
              "limit": 200
            }
          },
          "showTitle": true,
          "backgroundColor": "rgb(255, 255, 255)",
          "color": "rgba(0, 0, 0, 0.87)",
          "padding": "4px",
          "settings": {
            "entitiesTitle": "TA652FC-W Thermostats",
            "enableSearch": true,
            "enableSelectColumnDisplay": true,
            "enableStickyHeader": true,
            "enableStickyAction": true,
            "reserveSpaceForHiddenAction": "true",
            "displayEntityName": true,
            "displayEntityLabel": true,
            "displayEntityType": false,
            "displayPagination": true,
            "defaultPageSize": 10,
            "defaultSortOrder": "entityName",
            "useRowStyleFunction": false,
            "entityNameColumnTitle": "Device name",
            "entityLabelColumnTitle": "Label"
          },
          "title": "New Entities table",
          "dropShadow": true,
          "enableFullscreen": true,
          "titleStyle": {
            "fontSize": "16px",
            "fontWeight": 400,
            "padding": "5px 10px 5px 10px"
          },
          "useDashboardTimewindow": false,
          "showLegend": false,
          "datasources": [
            {
              "type": "entity",
              "name": null,
              "entityAliasId": "73e2797f-d347-784f-9f26-2a24aab7395e",
              "filterId": null,
              "dataKeys": [
                {
                  "name": "type",
                  "type": "entityField",
                  "label": "Type",
                  "color": "#e91e63",
                  "settings": {},
                  "_hash": 0.2975901043633382
                },
                {
                  "name": "active",
                  "type": "attribute",
                  "label": "Active",
                  "color": "#8bc34a",
                  "settings": {},
                  "_hash": 0.9836070312446519,
                  "aggregationType": null,
                  "units": null,
                  "decimals": null,
                  "funcBody": null,
                  "usePostProcessing": null,
                  "postFuncBody": null
                },
                {
                  "name": "roomTemp",
                  "type": "timeseries",
                  "label": "Room Temp",
                  "color": "#4caf50",
                  "settings": {},
                  "_hash": 0.9594098739434804,
                  "aggregationType": "NONE",
                  "units": null,
                  "decimals": null,
                  "funcBody": null,
                  "usePostProcessing": null,
                  "postFuncBody": null
                },
                {
                  "name": "changeOverTemp",
                  "type": "timeseries",
                  "label": "Change Over Temp",
                  "color": "#ffc107",
                  "settings": {
                    "columnWidth": "0px",
                    "useCellStyleFunction": false,
                    "useCellContentFunction": false,
                    "defaultColumnVisibility": "visible",
                    "columnSelectionToDisplay": "enabled"
                  },
                  "_hash": 0.36221424662217094,
                  "aggregationType": "NONE",
                  "units": null,
                  "decimals": null,
                  "funcBody": null,
                  "usePostProcessing": null,
                  "postFuncBody": null
                },
                {
                  "name": "spValue",
                  "type": "attribute",
                  "label": "Setpoint",
                  "color": "#607d8b",
                  "settings": {},
                  "_hash": 0.6273381598191303,
                  "aggregationType": null,
                  "units": null,
                  "decimals": null,
                  "funcBody": null,
                  "usePostProcessing": null,
                  "postFuncBody": null
                },
                {
                  "name": "fanStatus",
                  "type": "attribute",
                  "label": "Fan status",
                  "color": "#9c27b0",
                  "settings": {},
                  "_hash": 0.9436168734459278,
                  "aggregationType": null,
                  "units": null,
                  "decimals": null,
                  "funcBody": null,
                  "usePostProcessing": null,
                  "postFuncBody": null
                },
                {
                  "name": "currentTempUnit",
                  "type": "attribute",
                  "label": "Unit",
                  "color": "#f44336",
                  "settings": {},
                  "_hash": 0.7860563692413678,
                  "aggregationType": null,
                  "units": null,
                  "decimals": null,
                  "funcBody": null,
                  "usePostProcessing": null,
                  "postFuncBody": null
                }
              ],
              "alarmFilterConfig": {
                "statusList": [
                  "ACTIVE"
                ]
              }
            }
          ],
          "displayTimewindow": true,
          "mobileHide": true,
          "actions": {
            "actionCellButton": [
              {
                "name": "Edit thermostat",
                "icon": "edit",
                "useShowWidgetActionFunction": null,
                "showWidgetActionFunction": "return true;",
                "type": "customPretty",
                "customHtml": "<form #editEntityForm=\"ngForm\" [formGroup]=\"editEntityFormGroup\"\n      (ngSubmit)=\"save()\"  class=\"edit-entity-form\">\n    <mat-toolbar fxLayout=\"row\" color=\"primary\">\n        <h2>Edit Thermostat - {{entityName}}</h2>\n        <span fxFlex></span>\n        <button mat-icon-button (click)=\"cancel()\" type=\"button\">\n            <mat-icon class=\"material-icons\">close</mat-icon>\n        </button>\n    </mat-toolbar>\n    <mat-progress-bar color=\"warn\" mode=\"indeterminate\" *ngIf=\"isLoading$ | async\">\n    </mat-progress-bar>\n    <div style=\"height: 4px;\" *ngIf=\"!(isLoading$ | async)\"></div>\n    <div mat-dialog-content fxLayout=\"column\">\n        <div fxLayout=\"row\" fxLayoutGap=\"8px\" fxLayout.xs=\"column\"  fxLayoutGap.xs=\"0\">\n<!--        <mat-form-field fxFlex class=\"mat-block\">\n                <mat-label>Device Name</mat-label>\n                <input matInput formControlName=\"entityName\" required readonly=\"\">\n            </mat-form-field>-->\n            <mat-form-field fxFlex class=\"mat-block\">\n                <mat-label>Device Label</mat-label>\n                <input matInput formControlName=\"entityLabel\" >\n            </mat-form-field>\n        </div>\n<!--    <div formGroupName=\"attributes\" fxLayout=\"column\">\n            <div fxLayout=\"row\" fxLayoutGap=\"8px\" fxLayout.xs=\"column\"  fxLayoutGap.xs=\"0\">\n                <mat-form-field fxFlex class=\"mat-block\">\n                    <mat-label>xPos</mat-label>\n                    <input type=\"number\" step=\"any\" matInput formControlName=\"xPos\">\n                </mat-form-field>\n                <mat-form-field fxFlex class=\"mat-block\">\n                    <mat-label>yPos</mat-label>\n                    <input type=\"number\" step=\"any\" matInput formControlName=\"yPos\">\n                </mat-form-field>\n            </div>\n        </div>\n        <tb-entity-autocomplete\n            *ngIf=isTenant\n            [entityType]='\"CUSTOMER\"'\n            formControlName=\"customerId\"\n        >\n        </tb-entity-autocomplete>-->\n    </div>\n    <div mat-dialog-actions fxLayout=\"row\" fxLayoutAlign=\"end center\">\n        <button mat-button color=\"primary\"\n                type=\"button\"\n                [disabled]=\"(isLoading$ | async)\"\n                (click)=\"cancel()\" cdkFocusInitial>\n            Cancel\n        </button>\n        <button mat-button mat-raised-button color=\"primary\"\n                type=\"submit\"\n                [disabled]=\"(isLoading$ | async) || editEntityForm.invalid || !editEntityForm.dirty\">\n            Save\n        </button>\n    </div>\n</form>",
                "customCss": "/*=======================================================================*/\n/*==========  There are two examples: for edit and add entity  ==========*/\n/*=======================================================================*/\n/*========================  Edit entity example  ========================*/\n/*=======================================================================*/\n/*\n.edit-entity-form .boolean-value-input {\n    padding-left: 5px;\n}\n\n.edit-entity-form .boolean-value-input .checkbox-label {\n    margin-bottom: 8px;\n    color: rgba(0,0,0,0.54);\n    font-size: 12px;\n}\n\n.relations-list .header {\n    padding-right: 5px;\n    padding-bottom: 5px;\n    padding-left: 5px;\n}\n\n.relations-list .header .cell {\n    padding-right: 5px;\n    padding-left: 5px;\n    font-size: 12px;\n    font-weight: 700;\n    color: rgba(0, 0, 0, .54);\n    white-space: nowrap;\n}\n\n.relations-list .mat-form-field-infix {\n    width: auto !important;\n}\n\n.relations-list .body {\n    padding-right: 5px;\n    padding-bottom: 15px;\n    padding-left: 5px;\n}\n\n.relations-list .body .row {\n    padding-top: 5px;\n}\n\n.relations-list .body .cell {\n    padding-right: 5px;\n    padding-left: 5px;\n}\n\n.relations-list .body .md-button {\n    margin: 0;\n}\n*/\n/*========================================================================*/\n/*=========================  Add entity example  =========================*/\n/*========================================================================*/\n/*\n.add-entity-form .boolean-value-input {\n    padding-left: 5px;\n}\n\n.add-entity-form .boolean-value-input .checkbox-label {\n    margin-bottom: 8px;\n    color: rgba(0,0,0,0.54);\n    font-size: 12px;\n}\n\n.relations-list .header {\n    padding-right: 5px;\n    padding-bottom: 5px;\n    padding-left: 5px;\n}\n\n.relations-list .header .cell {\n    padding-right: 5px;\n    padding-left: 5px;\n    font-size: 12px;\n    font-weight: 700;\n    color: rgba(0, 0, 0, .54);\n    white-space: nowrap;\n}\n\n.relations-list .mat-form-field-infix {\n    width: auto !important;\n}\n\n.relations-list .body {\n    padding-right: 5px;\n    padding-bottom: 15px;\n    padding-left: 5px;\n}\n\n.relations-list .body .row {\n    padding-top: 5px;\n}\n\n.relations-list .body .cell {\n    padding-right: 5px;\n    padding-left: 5px;\n}\n\n.relations-list .body .md-button {\n    margin: 0;\n}\n*/\n",
                "customFunction": "let $injector = widgetContext.$scope.$injector;\nlet customDialog = $injector.get(widgetContext.servicesMap.get('customDialog'));\nlet entityService = $injector.get(widgetContext.servicesMap.get('entityService'));\nlet deviceService = $injector.get(widgetContext.servicesMap.get('deviceService'));\nlet attributeService = $injector.get(widgetContext.servicesMap.get('attributeService'));\n\nopenEditEntityDialog();\n\nfunction openEditEntityDialog() {\n    customDialog.customDialog(htmlTemplate, EditEntityDialogController).subscribe();\n}\n\nfunction EditEntityDialogController(instance) {\n    let vm = instance;\n    \n    const NULL_UUID = '13814000-1dd2-11b2-8080-808080808080';\n\n    vm.entityName = entityName;\n    //vm.attributes = {};\n    vm.entity = {};\n    vm.isTenant = widgetContext.currentUser.authority == 'TENANT_ADMIN';\n\n    vm.editEntityFormGroup = vm.fb.group({\n        //entityName: ['', [vm.validators.required]],\n        entityLabel: [null]/*,\n        attributes: vm.fb.group({\n            xPos: [null],\n            yPos: [null]\n        }),\n        customerId: [null]*/\n    });\n\n    getEntityInfo();\n\n    vm.cancel = function() {\n        vm.dialogRef.close(null);\n    };\n\n    vm.save = function() {\n        widgetContext.rxjs.forkJoin([\n            saveAttributes(entityId),\n            saveEntity()\n        ]).subscribe(\n            function () {\n                widgetContext.updateAliases();\n                vm.dialogRef.close(null);\n            }\n        );\n    };\n\n    function getEntityAttributes(attributes) {\n        /*for (var i = 0; i < attributes.length; i++) {\n            vm.attributes[attributes[i].key] = attributes[i].value;\n        }*/\n    }\n\n    function getEntityInfo() {\n        widgetContext.rxjs.forkJoin([\n            attributeService.getEntityAttributes(entityId, 'SERVER_SCOPE'),\n            entityService.getEntity(entityId.entityType, entityId.id)\n        ]).subscribe(\n            function (data) {\n                getEntityAttributes(data[0]);\n                vm.entity = data[1];\n                vm.editEntityFormGroup.patchValue({\n                    //entityName: vm.entity.name,\n                    entityLabel: vm.entity.label/*,\n                    attributes: vm.attributes,\n                    customerId: vm.entity.customerId.id !== NULL_UUID ? vm.entity.customerId.id : null*/\n                }, {emitEvent: false});\n            }\n        );\n    }\n\n    function saveEntity() {\n        const formValues = vm.editEntityFormGroup.value;\n        \n        /*let customerId;\n        if (formValues.customerId === null) {\n            customerId = {\n                id: NULL_UUID,\n                entityType: \"CUSTOMER\"\n            };\n        } else {\n            customerId = {\n                id: formValues.customerId,\n                entityType: \"CUSTOMER\"\n            };\n        }*/\n        \n        if (vm.entity.label !== formValues.entityLabel /*||\n            vm.entity.customerId.id !== customerId.id*/){\n            vm.entity.label = formValues.entityLabel;\n            //vm.entity.customerId = customerId;\n            return deviceService.saveDevice(vm.entity);\n        }\n        return widgetContext.rxjs.of([]);\n    }\n\n    function saveAttributes(entityId) {\n        /*let attributes = vm.editEntityFormGroup.get('attributes').value;\n        let attributesArray = [];\n        for (let key in attributes) {\n            if (attributes[key] !== vm.attributes[key]) {\n                attributesArray.push({key: key, value: attributes[key]});\n            }\n        }\n        if (attributesArray.length > 0) {\n            return attributeService.saveEntityAttributes(entityId, \"SERVER_SCOPE\", attributesArray);\n        }*/\n        return widgetContext.rxjs.of([]);\n    }\n}\n",
                "customResources": [],
                "openInSeparateDialog": false,
                "openInPopover": false,
                "id": "d9b80e3a-8777-67b0-d4cd-24542a0bdeae"
              },
              {
                "name": "Thermostat detail",
                "icon": "settings",
                "useShowWidgetActionFunction": null,
                "showWidgetActionFunction": "return true;",
                "type": "openDashboard",
                "targetDashboardStateId": "monitor",
                "setEntityId": true,
                "stateEntityParamName": null,
                "openNewBrowserTab": false,
                "targetDashboardId": "7d2c8c40-425c-11ee-b240-6f550152ea2c",
                "openInSeparateDialog": false,
                "openInPopover": false,
                "id": "706e2ef4-5085-7b76-9ea2-def68e71a2bd"
              }
            ]
          }
        },
        "row": 0,
        "col": 0,
        "id": "232da62c-8c7e-7d1b-bcd6-899e909a43ba",
        "typeFullFqn": "system.cards.entities_table"
      }
    },
    "states": {
      "default": {
        "name": "TA652FC-W Thermostat List",
        "root": true,
        "layouts": {
          "main": {
            "widgets": {
              "232da62c-8c7e-7d1b-bcd6-899e909a43ba": {
                "sizeX": 23,
                "sizeY": 10,
                "mobileHide": true,
                "row": 0,
                "col": 0
              }
            },
            "gridSettings": {
              "backgroundColor": "#eeeeee",
              "columns": 24,
              "margin": 10,
              "backgroundSizeMode": "100%",
              "outerMargin": true
            }
          }
        }
      }
    },
    "entityAliases": {
      "73e2797f-d347-784f-9f26-2a24aab7395e": {
        "id": "73e2797f-d347-784f-9f26-2a24aab7395e",
        "alias": "TA652FC-W Thermostats",
        "filter": {
          "type": "deviceType",
          "resolveMultiple": true,
          "deviceNameFilter": "",
          "deviceTypes": [
            "TA652FC-W Thermostat"
          ]
        }
      }
    },
    "filters": {},
    "timewindow": {
      "hideInterval": false,
      "hideAggregation": false,
      "hideAggInterval": false,
      "hideTimezone": false,
      "selectedTab": 0,
      "realtime": {
        "realtimeType": 0,
        "timewindowMs": 300000,
        "quickInterval": "CURRENT_DAY",
        "interval": 1000
      },
      "aggregation": {
        "type": "AVG",
        "limit": 25000
      }
    },
    "settings": {
      "stateControllerId": "entity",
      "showTitle": false,
      "showDashboardsSelect": true,
      "showEntitiesSelect": true,
      "showDashboardTimewindow": true,
      "showDashboardExport": true,
      "toolbarAlwaysOpen": true
    }
  },
  "externalId": null,
  "name": "TA652FC-W Thermostat List"
}