Files
2024-01-09 14:58:30 +03:00

228 lines
6.5 KiB
JSON

{
"templates": {
"button": {
"type": "text",
"width": {
"type": "match_parent"
},
"height": {
"type": "wrap_content"
},
"paddings": {
"left": 16,
"top": 16,
"right": 16,
"bottom": 16
},
"margins": {
"top": 16,
"bottom": 16,
"left": 16,
"right": 16
},
"border": {
"corner_radius": 8
},
"background": [
{
"type": "solid",
"color": "#0E000000"
}
],
"font_size": 16,
"font_weight": "medium",
"text_alignment_vertical": "center",
"text_alignment_horizontal": "center",
"text_color": "#000000",
"alpha": 1.0,
"alignment_horizontal": "center",
"alignment_vertical": "center"
}
},
"card": {
"log_id": "blink_animation",
"variables": [
{
"name": "left_switched",
"type": "boolean",
"value": 0
},
{
"name": "right_switched",
"type": "boolean",
"value": 0
},
{
"name": "text",
"type": "string",
"value": "No buttons switched"
}
],
"variable_triggers": [
{
"condition": "@{left_switched && !right_switched}",
"actions": [
{
"log_id": "left_switched_text",
"url": "div-action://set_variable?name=text&value=Left%20switched"
}
]
},
{
"condition": "@{!left_switched && right_switched}",
"actions": [
{
"log_id": "right_switched_text",
"url": "div-action://set_variable?name=text&value=Right%20switched"
}
]
},
{
"condition": "@{left_switched && right_switched}",
"actions": [
{
"log_id": "both_switched_text",
"url": "div-action://set_variable?name=text&value=Both%20switched"
}
]
},
{
"condition": "@{!left_switched && !right_switched}",
"actions": [
{
"log_id": "no_switched_text",
"url": "div-action://set_variable?name=text&value=No%20buttons%20switched"
}
]
}
],
"states": [
{
"state_id": 0,
"div": {
"type": "container",
"height": {
"type": "fixed",
"value": 200
},
"orientation": "overlap",
"items": [
{
"type": "text",
"font_size": 18,
"font_weight": "medium",
"height": {
"type": "fixed",
"value": 140
},
"text_alignment_vertical": "center",
"text_alignment_horizontal": "center",
"text_color": "#000",
"text": "@{text}"
},
{
"type": "container",
"orientation": "horizontal",
"alignment_vertical": "bottom",
"items": [
{
"type": "state",
"id": "left_button",
"states": [
{
"state_id": "off",
"div": {
"type": "button",
"text": "Left",
"actions": [
{
"log_id": "switch_left",
"url": "div-action://set_variable?name=left_switched&value=1"
},
{
"log_id": "switch_left_to_on",
"url": "div-action://set_state?state_id=0/left_button/on"
}
]
}
},
{
"state_id": "on",
"div": {
"type": "button",
"text": "Left",
"background": [
{
"type": "solid",
"color": "#f1dff2"
}
],
"actions": [
{
"log_id": "switch_left",
"url": "div-action://set_variable?name=left_switched&value=0"
},
{
"log_id": "switch_left_to_off",
"url": "div-action://set_state?state_id=0/left_button/off"
}
]
}
}
]
},
{
"type": "state",
"id": "right_button",
"states": [
{
"state_id": "off",
"div": {
"type": "button",
"text": "Right",
"actions": [
{
"log_id": "switch_right",
"url": "div-action://set_variable?name=right_switched&value=1"
},
{
"log_id": "switch_right_to_on",
"url": "div-action://set_state?state_id=0/right_button/on"
}
]
}
},
{
"state_id": "on",
"div": {
"type": "button",
"text": "Right",
"background": [
{
"type": "solid",
"color": "#f1dff2"
}
],
"actions": [
{
"log_id": "switch_left",
"url": "div-action://set_variable?name=right_switched&value=0"
},
{
"log_id": "switch_right_to_off",
"url": "div-action://set_state?state_id=0/right_button/off"
}
]
}
}
]
}
]
}
]
}
}
]
}
}