{
  "title": "Dynamic Button States",
  "image": null,
  "mobileHide": false,
  "mobileOrder": null,
  "configuration": {
    "description": "",
    "widgets": {
      "7a31e4d2-ee49-0bcf-6fe9-ddbe9a077aef": {
        "typeFullFqn": "system.action_button",
        "type": "latest",
        "sizeX": 3,
        "sizeY": 1,
        "config": {
          "datasources": [
            {
              "type": "entity",
              "entityAliasId": "4f0ce8b7-8eae-0cf6-3422-63903476c4ee",
              "dataKeys": [],
              "alarmFilterConfig": {
                "statusList": [
                  "ACTIVE"
                ]
              }
            }
          ],
          "timewindow": {
            "displayValue": "",
            "selectedTab": 0,
            "realtime": {
              "realtimeType": 1,
              "interval": 1000,
              "timewindowMs": 60000,
              "quickInterval": "CURRENT_DAY"
            },
            "history": {
              "historyType": 0,
              "interval": 1000,
              "timewindowMs": 60000,
              "fixedTimewindow": {
                "startTimeMs": 1708446351305,
                "endTimeMs": 1708532751305
              },
              "quickInterval": "CURRENT_DAY"
            },
            "aggregation": {
              "type": "AVG",
              "limit": 25000
            }
          },
          "showTitle": false,
          "backgroundColor": "#FFFFFF01",
          "color": "rgba(0, 0, 0, 0.87)",
          "padding": "0px",
          "settings": {
            "activatedState": {
              "action": "GET_ATTRIBUTE",
              "defaultValue": true,
              "executeRpc": {
                "method": null,
                "requestTimeout": null,
                "requestPersistent": null,
                "persistentPollingInterval": null
              },
              "getAttribute": {
                "scope": "SERVER_SCOPE",
                "key": "buttonActivated"
              },
              "getTimeSeries": {
                "key": "state"
              },
              "dataToValue": {
                "type": "NONE",
                "dataToValueFunction": "/* Should return boolean value */\nreturn data;",
                "compareToValue": true
              }
            },
            "disabledState": {
              "action": "GET_ATTRIBUTE",
              "defaultValue": false,
              "executeRpc": {
                "method": null,
                "requestTimeout": null,
                "requestPersistent": null,
                "persistentPollingInterval": null
              },
              "getAttribute": {
                "scope": "SERVER_SCOPE",
                "key": "buttonDisabled"
              },
              "getTimeSeries": {
                "key": "state"
              },
              "dataToValue": {
                "type": "NONE",
                "dataToValueFunction": "/* Should return boolean value */\nreturn data;",
                "compareToValue": true
              }
            },
            "appearance": {
              "type": "outlined",
              "showLabel": true,
              "label": "Dynamic Button",
              "showIcon": false,
              "icon": "home",
              "iconSize": 24,
              "iconSizeUnit": "px",
              "mainColor": "var(--tb-primary-500)",
              "backgroundColor": "#FFFFFF",
              "autoScale": true,
              "customStyle": {
                "enabled": null,
                "hovered": null,
                "pressed": null,
                "activated": null,
                "disabled": null
              }
            }
          },
          "title": "Action button",
          "showTitleIcon": false,
          "iconColor": "rgba(0, 0, 0, 0.87)",
          "iconSize": "24px",
          "titleTooltip": "",
          "dropShadow": false,
          "enableFullscreen": false,
          "enableDataExport": false,
          "widgetStyle": {},
          "titleStyle": {
            "fontSize": "16px",
            "fontWeight": 400
          },
          "showLegend": false,
          "useDashboardTimewindow": true,
          "displayTimewindow": true,
          "widgetCss": "",
          "pageSize": 1024,
          "noDataDisplayMessage": "",
          "borderRadius": "4px",
          "configMode": "basic",
          "actions": {
            "click": [
              {
                "id": "2d17bc3b-8ce3-885e-a5d5-8fcda441333b",
                "name": "onClick",
                "icon": "more_horiz",
                "type": "openURL",
                "openNewBrowserTab": false,
                "url": "https://google.com",
                "openInSeparateDialog": false,
                "openInPopover": false
              }
            ]
          }
        },
        "row": 0,
        "col": 0,
        "id": "7a31e4d2-ee49-0bcf-6fe9-ddbe9a077aef"
      },
      "8db3bf0e-2336-bdf1-3f05-8fcec0717059": {
        "typeFullFqn": "system.single_switch",
        "type": "rpc",
        "sizeX": 3.5,
        "sizeY": 1,
        "config": {
          "showTitle": false,
          "backgroundColor": "#FFFFFF00",
          "color": "rgba(0, 0, 0, 0.87)",
          "padding": "0px",
          "settings": {
            "initialState": {
              "action": "GET_ATTRIBUTE",
              "defaultValue": false,
              "executeRpc": {
                "method": "getState",
                "requestTimeout": 5000,
                "requestPersistent": false,
                "persistentPollingInterval": 1000
              },
              "getAttribute": {
                "scope": "SERVER_SCOPE",
                "key": "buttonActivated"
              },
              "getTimeSeries": {
                "key": "state"
              },
              "dataToValue": {
                "type": "NONE",
                "dataToValueFunction": "/* Should return boolean value */\nreturn data;",
                "compareToValue": true
              }
            },
            "onUpdateState": {
              "action": "SET_ATTRIBUTE",
              "executeRpc": {
                "method": "setState",
                "requestTimeout": 5000,
                "requestPersistent": false,
                "persistentPollingInterval": 1000
              },
              "setAttribute": {
                "scope": "SERVER_SCOPE",
                "key": "buttonActivated"
              },
              "putTimeSeries": {
                "key": "state"
              },
              "valueToData": {
                "type": "CONSTANT",
                "constantValue": true,
                "valueToDataFunction": "/* Convert input boolean value to RPC parameters or attribute/time-series value */\nreturn value;"
              }
            },
            "offUpdateState": {
              "action": "SET_ATTRIBUTE",
              "executeRpc": {
                "method": "setState",
                "requestTimeout": 5000,
                "requestPersistent": false,
                "persistentPollingInterval": 1000
              },
              "setAttribute": {
                "scope": "SERVER_SCOPE",
                "key": "buttonActivated"
              },
              "putTimeSeries": {
                "key": "state"
              },
              "valueToData": {
                "type": "CONSTANT",
                "constantValue": false,
                "valueToDataFunction": "/* Convert input boolean value to RPC parameters or attribute/time-series value */ \n return value;"
              }
            },
            "disabledState": {
              "action": "DO_NOTHING",
              "defaultValue": false,
              "getAttribute": {
                "key": "state",
                "scope": null
              },
              "getTimeSeries": {
                "key": "state"
              },
              "dataToValue": {
                "type": "NONE",
                "compareToValue": true,
                "dataToValueFunction": "/* Should return boolean value */\nreturn data;"
              }
            },
            "layout": "right",
            "autoScale": true,
            "showLabel": true,
            "label": "Activate",
            "labelFont": {
              "family": "Roboto",
              "size": 16,
              "sizeUnit": "px",
              "style": "normal",
              "weight": "500",
              "lineHeight": "24px"
            },
            "labelColor": "rgba(0, 0, 0, 0.76)",
            "showIcon": false,
            "iconSize": 24,
            "iconSizeUnit": "px",
            "icon": "mdi:lightbulb-outline",
            "iconColor": "rgba(0, 0, 0, 0.76)",
            "switchColorOn": "var(--tb-primary-500)",
            "switchColorOff": "var(--tb-primary-100)",
            "switchColorDisabled": "#D5D7E5",
            "tumblerColorOn": "#fff",
            "tumblerColorOff": "#fff",
            "tumblerColorDisabled": "#fff",
            "showOnLabel": false,
            "onLabel": "On",
            "onLabelFont": {
              "family": "Roboto",
              "size": 16,
              "sizeUnit": "px",
              "style": "normal",
              "weight": "400",
              "lineHeight": "24px"
            },
            "onLabelColor": "rgba(0, 0, 0, 0.38)",
            "showOffLabel": false,
            "offLabel": "Off",
            "offLabelFont": {
              "family": "Roboto",
              "size": 16,
              "sizeUnit": "px",
              "style": "normal",
              "weight": "400",
              "lineHeight": "24px"
            },
            "offLabelColor": "rgba(0, 0, 0, 0.38)",
            "background": {
              "type": "color",
              "imageUrl": null,
              "color": "#FFFFFF00",
              "overlay": {
                "enabled": false,
                "color": "rgba(255,255,255,0.72)",
                "blur": 3
              }
            }
          },
          "title": "Single Switch",
          "dropShadow": false,
          "enableFullscreen": false,
          "widgetStyle": {},
          "actions": {},
          "widgetCss": "",
          "noDataDisplayMessage": "",
          "titleFont": {
            "size": 12,
            "sizeUnit": "px",
            "family": null,
            "weight": null,
            "style": null,
            "lineHeight": "1.6"
          },
          "showTitleIcon": false,
          "titleTooltip": "",
          "titleStyle": {
            "fontSize": "16px",
            "fontWeight": 400
          },
          "pageSize": 1024,
          "titleIcon": "",
          "iconColor": "rgba(0, 0, 0, 0.87)",
          "iconSize": "14px",
          "configMode": "advanced",
          "datasources": [],
          "targetDevice": {
            "type": "entity",
            "entityAliasId": "4f0ce8b7-8eae-0cf6-3422-63903476c4ee"
          },
          "borderRadius": null,
          "enableDataExport": true
        },
        "row": 0,
        "col": 0,
        "id": "8db3bf0e-2336-bdf1-3f05-8fcec0717059"
      },
      "2800d9df-f4f7-385e-c27b-695299fba898": {
        "typeFullFqn": "system.single_switch",
        "type": "rpc",
        "sizeX": 3.5,
        "sizeY": 1,
        "config": {
          "showTitle": false,
          "backgroundColor": "#FFFFFF00",
          "color": "rgba(0, 0, 0, 0.87)",
          "padding": "0px",
          "settings": {
            "initialState": {
              "action": "GET_ATTRIBUTE",
              "defaultValue": false,
              "executeRpc": {
                "method": "getState",
                "requestTimeout": 5000,
                "requestPersistent": false,
                "persistentPollingInterval": 1000
              },
              "getAttribute": {
                "scope": "SERVER_SCOPE",
                "key": "buttonDisabled"
              },
              "getTimeSeries": {
                "key": "state"
              },
              "dataToValue": {
                "type": "NONE",
                "dataToValueFunction": "/* Should return boolean value */\nreturn data;",
                "compareToValue": true
              }
            },
            "onUpdateState": {
              "action": "SET_ATTRIBUTE",
              "executeRpc": {
                "method": "setState",
                "requestTimeout": 5000,
                "requestPersistent": false,
                "persistentPollingInterval": 1000
              },
              "setAttribute": {
                "scope": "SERVER_SCOPE",
                "key": "buttonDisabled"
              },
              "putTimeSeries": {
                "key": "state"
              },
              "valueToData": {
                "type": "CONSTANT",
                "constantValue": true,
                "valueToDataFunction": "/* Convert input boolean value to RPC parameters or attribute/time-series value */\nreturn value;"
              }
            },
            "offUpdateState": {
              "action": "SET_ATTRIBUTE",
              "executeRpc": {
                "method": "setState",
                "requestTimeout": 5000,
                "requestPersistent": false,
                "persistentPollingInterval": 1000
              },
              "setAttribute": {
                "scope": "SERVER_SCOPE",
                "key": "buttonDisabled"
              },
              "putTimeSeries": {
                "key": "state"
              },
              "valueToData": {
                "type": "CONSTANT",
                "constantValue": false,
                "valueToDataFunction": "/* Convert input boolean value to RPC parameters or attribute/time-series value */ \n return value;"
              }
            },
            "disabledState": {
              "action": "DO_NOTHING",
              "defaultValue": false,
              "getAttribute": {
                "key": "state",
                "scope": null
              },
              "getTimeSeries": {
                "key": "state"
              },
              "dataToValue": {
                "type": "NONE",
                "compareToValue": true,
                "dataToValueFunction": "/* Should return boolean value */\nreturn data;"
              }
            },
            "layout": "right",
            "autoScale": true,
            "showLabel": true,
            "label": "Disable",
            "labelFont": {
              "family": "Roboto",
              "size": 16,
              "sizeUnit": "px",
              "style": "normal",
              "weight": "500",
              "lineHeight": "24px"
            },
            "labelColor": "rgba(0, 0, 0, 0.76)",
            "showIcon": false,
            "iconSize": 24,
            "iconSizeUnit": "px",
            "icon": "mdi:lightbulb-outline",
            "iconColor": "rgba(0, 0, 0, 0.76)",
            "switchColorOn": "var(--tb-primary-500)",
            "switchColorOff": "var(--tb-primary-100)",
            "switchColorDisabled": "#D5D7E5",
            "tumblerColorOn": "#fff",
            "tumblerColorOff": "#fff",
            "tumblerColorDisabled": "#fff",
            "showOnLabel": false,
            "onLabel": "On",
            "onLabelFont": {
              "family": "Roboto",
              "size": 16,
              "sizeUnit": "px",
              "style": "normal",
              "weight": "400",
              "lineHeight": "24px"
            },
            "onLabelColor": "rgba(0, 0, 0, 0.38)",
            "showOffLabel": false,
            "offLabel": "Off",
            "offLabelFont": {
              "family": "Roboto",
              "size": 16,
              "sizeUnit": "px",
              "style": "normal",
              "weight": "400",
              "lineHeight": "24px"
            },
            "offLabelColor": "rgba(0, 0, 0, 0.38)",
            "background": {
              "type": "color",
              "imageUrl": null,
              "color": "#FFFFFF00",
              "overlay": {
                "enabled": false,
                "color": "rgba(255,255,255,0.72)",
                "blur": 3
              }
            }
          },
          "title": "Single Switch",
          "dropShadow": false,
          "enableFullscreen": false,
          "widgetStyle": {},
          "actions": {},
          "widgetCss": "",
          "noDataDisplayMessage": "",
          "titleFont": {
            "size": 12,
            "sizeUnit": "px",
            "family": null,
            "weight": null,
            "style": null,
            "lineHeight": "1.6"
          },
          "showTitleIcon": false,
          "titleTooltip": "",
          "titleStyle": {
            "fontSize": "16px",
            "fontWeight": 400
          },
          "pageSize": 1024,
          "titleIcon": "",
          "iconColor": "rgba(0, 0, 0, 0.87)",
          "iconSize": "14px",
          "configMode": "advanced",
          "datasources": [],
          "targetDevice": {
            "type": "entity",
            "entityAliasId": "4f0ce8b7-8eae-0cf6-3422-63903476c4ee"
          },
          "borderRadius": null,
          "enableDataExport": true
        },
        "row": 0,
        "col": 0,
        "id": "2800d9df-f4f7-385e-c27b-695299fba898"
      }
    },
    "states": {
      "default": {
        "name": "Dynamic Button States",
        "root": true,
        "layouts": {
          "main": {
            "widgets": {
              "7a31e4d2-ee49-0bcf-6fe9-ddbe9a077aef": {
                "sizeX": 3,
                "sizeY": 1,
                "row": 0,
                "col": 2
              },
              "8db3bf0e-2336-bdf1-3f05-8fcec0717059": {
                "sizeX": 3,
                "sizeY": 1,
                "row": 1,
                "col": 2
              },
              "2800d9df-f4f7-385e-c27b-695299fba898": {
                "sizeX": 3,
                "sizeY": 1,
                "row": 2,
                "col": 2
              }
            },
            "gridSettings": {
              "backgroundColor": "#eeeeee",
              "columns": 24,
              "margin": 10,
              "outerMargin": true,
              "backgroundSizeMode": "100%"
            }
          }
        }
      }
    },
    "entityAliases": {
      "4f0ce8b7-8eae-0cf6-3422-63903476c4ee": {
        "id": "4f0ce8b7-8eae-0cf6-3422-63903476c4ee",
        "alias": "Current User",
        "filter": {
          "type": "singleEntity",
          "resolveMultiple": false,
          "singleEntity": {
            "entityType": "CURRENT_USER",
            "id": "13814000-1dd2-11b2-8080-808080808080"
          }
        }
      }
    },
    "filters": {},
    "timewindow": {
      "displayValue": "",
      "hideInterval": false,
      "hideLastInterval": false,
      "hideQuickInterval": false,
      "hideAggregation": false,
      "hideAggInterval": false,
      "hideTimezone": false,
      "selectedTab": 0,
      "realtime": {
        "realtimeType": 0,
        "interval": 1000,
        "timewindowMs": 60000,
        "quickInterval": "CURRENT_DAY"
      },
      "history": {
        "historyType": 0,
        "interval": 1000,
        "timewindowMs": 60000,
        "fixedTimewindow": {
          "startTimeMs": 1708446346471,
          "endTimeMs": 1708532746471
        },
        "quickInterval": "CURRENT_DAY"
      },
      "aggregation": {
        "type": "AVG",
        "limit": 25000
      }
    },
    "settings": {
      "stateControllerId": "entity",
      "showTitle": false,
      "showDashboardsSelect": true,
      "showEntitiesSelect": true,
      "showDashboardTimewindow": true,
      "showDashboardExport": true,
      "toolbarAlwaysOpen": true
    }
  },
  "name": "Dynamic Button States"
}