Sonos speaker - morning play

Eg har tatt dette eitt steg lenger, ved at eg har definert 1 favoritt. Bruker Heatit Z-push button 8 som fjernkontroll - ved enkelttrykk på knappen øverst til venstre startar den å spela frå der den var sist, mens ved å halda inne spelar den favoritten (definert som global variabel). Prøv om du kan henta noko inspirasjon ut frå denne koden:

{
  "Id": "GhwZqP1fQA6Uas1",
  "ClassId": "8ovjy2o7llwhMcJ",
  "Author": "",
  "Version": 0,
  "CreatedAt": "2020-11-19T20:24:33.40963368+01:00",
  "UpdatedAt": "2020-11-29T09:31:53.458934863+01:00",
  "Name": "Panel stue Sonos",
  "Group": "remote",
  "Description": "",
  "Nodes": [
    {
      "Id": "1",
      "Type": "action",
      "Label": "Play Stue",
      "SuccessTransition": "15",
      "TimeoutTransition": "",
      "ErrorTransition": "15",
      "Address": "pt:j1/mt:cmd/rt:dev/rn:sonos/ad:1/sv:media_player/ad:000E58B2AA6901400",
      "Service": "media_player",
      "ServiceInterface": "cmd.playback.set",
      "Config": {
        "DefaultValue": {
          "Value": "play",
          "ValueType": "string"
        },
        "IsVariableGlobal": false,
        "Props": {},
        "RegisterAsVirtualService": false,
        "ResponseToTopic": "",
        "VariableName": "",
        "VirtualServiceGroup": "",
        "VirtualServiceProps": {}
      },
      "Ui": {
        "nodeType": "",
        "x": 76,
        "y": 627
      },
      "TypeAlias": "Action"
    },
    {
      "Id": "2",
      "Type": "trigger",
      "Label": "bryter",
      "SuccessTransition": "3",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "pt:j1/mt:evt/rt:dev/rn:zw/ad:1/sv:scene_ctrl/ad:108_0",
      "Service": "scene_ctrl",
      "ServiceInterface": "evt.scene.report",
      "Config": {
        "IsValueFilterEnabled": false,
        "LookupServiceNameAndLocation": false,
        "RegisterAsVirtualService": false,
        "Timeout": 0,
        "ValueFilter": {
          "Value": "",
          "ValueType": "bool"
        },
        "VirtualServiceGroup": "ch_0",
        "VirtualServiceProps": {}
      },
      "Ui": {
        "nodeType": "",
        "x": 69,
        "y": 205
      },
      "TypeAlias": "Trigger"
    },
    {
      "Id": "3",
      "Type": "if",
      "Label": "scene=1.x",
      "SuccessTransition": "",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": {
        "Expression": [
          {
            "BooleanOperator": "or",
            "LeftVariableIsGlobal": false,
            "LeftVariableName": "",
            "Operand": "eq",
            "RightVariable": {
              "Value": "1.0",
              "ValueType": "string"
            }
          },
          {
            "BooleanOperator": "",
            "LeftVariableIsGlobal": false,
            "LeftVariableName": "",
            "Operand": "eq",
            "RightVariable": {
              "Value": "1.2",
              "ValueType": "string"
            }
          }
        ],
        "FalseTransition": "4",
        "TrueTransition": "1"
      },
      "Ui": {
        "nodeType": "",
        "x": 65,
        "y": 425
      },
      "TypeAlias": "If condition"
    },
    {
      "Id": "4",
      "Type": "if",
      "Label": "scene=2.x",
      "SuccessTransition": "",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": {
        "Expression": [
          {
            "BooleanOperator": "or",
            "LeftVariableIsGlobal": false,
            "LeftVariableName": "",
            "Operand": "eq",
            "RightVariable": {
              "Value": "2.0",
              "ValueType": "string"
            }
          },
          {
            "BooleanOperator": "",
            "LeftVariableIsGlobal": false,
            "LeftVariableName": "",
            "Operand": "eq",
            "RightVariable": {
              "Value": "2.2",
              "ValueType": "string"
            }
          }
        ],
        "FalseTransition": "8",
        "TrueTransition": "5"
      },
      "Ui": {
        "nodeType": "",
        "x": 332,
        "y": 428
      },
      "TypeAlias": "If condition"
    },
    {
      "Id": "5",
      "Type": "action",
      "Label": "Pause Stue",
      "SuccessTransition": "",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "pt:j1/mt:cmd/rt:dev/rn:sonos/ad:1/sv:media_player/ad:000E58B2AA6901400",
      "Service": "media_player",
      "ServiceInterface": "cmd.playback.set",
      "Config": {
        "DefaultValue": {
          "Value": "pause",
          "ValueType": "string"
        },
        "IsVariableGlobal": false,
        "Props": {},
        "RegisterAsVirtualService": false,
        "ResponseToTopic": "",
        "VariableName": "",
        "VirtualServiceGroup": "",
        "VirtualServiceProps": {}
      },
      "Ui": {
        "nodeType": "",
        "x": 335,
        "y": 619
      },
      "TypeAlias": "Action"
    },
    {
      "Id": "7",
      "Type": "set_variable",
      "Label": "volume",
      "SuccessTransition": "",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": {
        "DefaultValue": {
          "Value": 0,
          "ValueType": ""
        },
        "Name": "",
        "UpdateGlobal": false,
        "UpdateInputMsg": false
      },
      "Ui": {
        "nodeType": "",
        "x": 1059,
        "y": 558
      },
      "TypeAlias": "Set variable"
    },
    {
      "Id": "8",
      "Type": "if",
      "Label": "scene=3.x",
      "SuccessTransition": "",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": {
        "Expression": [
          {
            "BooleanOperator": "or",
            "LeftVariableIsGlobal": false,
            "LeftVariableName": "",
            "Operand": "eq",
            "RightVariable": {
              "Value": "3.0",
              "ValueType": "string"
            }
          },
          {
            "BooleanOperator": "",
            "LeftVariableIsGlobal": false,
            "LeftVariableName": "",
            "Operand": "eq",
            "RightVariable": {
              "Value": "3.2",
              "ValueType": "string"
            }
          }
        ],
        "FalseTransition": "11",
        "TrueTransition": "23"
      },
      "Ui": {
        "nodeType": "",
        "x": 573,
        "y": 430
      },
      "TypeAlias": "If condition"
    },
    {
      "Id": "9",
      "Type": "action",
      "Label": "cmd.volume.set",
      "SuccessTransition": "",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "pt:j1/mt:cmd/rt:dev/rn:sonos/ad:1/sv:media_player/ad:000E58B2AA6901400",
      "Service": "media_player",
      "ServiceInterface": "cmd.volume.set",
      "Config": {
        "DefaultValue": {
          "Value": "play",
          "ValueType": "int"
        },
        "IsVariableGlobal": false,
        "Props": {},
        "RegisterAsVirtualService": false,
        "ResponseToTopic": "",
        "VariableName": "volume",
        "VariableType": "int",
        "VirtualServiceGroup": "",
        "VirtualServiceProps": {}
      },
      "Ui": {
        "nodeType": "",
        "x": 572,
        "y": 1177
      },
      "TypeAlias": "Action"
    },
    {
      "Id": "10",
      "Type": "transform",
      "Label": "volume: +2",
      "SuccessTransition": "22",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": {
        "Expression": "variable+2",
        "IsLVariableGlobal": false,
        "IsRVariableGlobal": false,
        "IsTargetVariableGlobal": false,
        "IsTargetVariableInMemory": false,
        "LVariableName": "volume",
        "RValue": {
          "Value": 0,
          "ValueType": "int"
        },
        "RVariableName": "",
        "Rtype": "var",
        "TargetVariableName": "volume",
        "TargetVariableType": "int",
        "Template": "",
        "TransformType": "calc",
        "ValueMapping": [],
        "XPathMapping": []
      },
      "Ui": {
        "nodeType": "",
        "x": 515,
        "y": 770
      },
      "TypeAlias": "Transform"
    },
    {
      "Id": "11",
      "Type": "if",
      "Label": "scene=4.x",
      "SuccessTransition": "",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": {
        "Expression": [
          {
            "BooleanOperator": "or",
            "LeftVariableIsGlobal": false,
            "LeftVariableName": "",
            "Operand": "eq",
            "RightVariable": {
              "Value": "4.0",
              "ValueType": "string"
            }
          },
          {
            "BooleanOperator": "",
            "LeftVariableIsGlobal": false,
            "LeftVariableName": "",
            "Operand": "eq",
            "RightVariable": {
              "Value": "4.2",
              "ValueType": "string"
            }
          }
        ],
        "FalseTransition": "",
        "TrueTransition": "24"
      },
      "Ui": {
        "nodeType": "",
        "x": 789,
        "y": 431
      },
      "TypeAlias": "If condition"
    },
    {
      "Id": "12",
      "Type": "transform",
      "Label": "volume: -2",
      "SuccessTransition": "22",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": {
        "Expression": "variable-2",
        "IsLVariableGlobal": false,
        "IsRVariableGlobal": false,
        "IsTargetVariableGlobal": false,
        "IsTargetVariableInMemory": false,
        "LVariableName": "volume",
        "RValue": {
          "Value": 0,
          "ValueType": "int"
        },
        "RVariableName": "",
        "Rtype": "var",
        "TargetVariableName": "volume",
        "TargetVariableType": "int",
        "Template": "",
        "TransformType": "calc",
        "ValueMapping": [],
        "XPathMapping": []
      },
      "Ui": {
        "nodeType": "",
        "x": 764,
        "y": 775
      },
      "TypeAlias": "Transform"
    },
    {
      "Id": "15",
      "Type": "if",
      "Label": "scene=1.2",
      "SuccessTransition": "",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": {
        "Expression": [
          {
            "BooleanOperator": "",
            "LeftVariableIsGlobal": false,
            "LeftVariableName": "",
            "Operand": "eq",
            "RightVariable": {
              "Value": "1.2",
              "ValueType": "string"
            }
          }
        ],
        "FalseTransition": "",
        "TrueTransition": "16"
      },
      "Ui": {
        "nodeType": "",
        "x": 124,
        "y": 798
      },
      "TypeAlias": "If condition"
    },
    {
      "Id": "16",
      "Type": "action",
      "Label": "Play favourite",
      "SuccessTransition": "",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "pt:j1/mt:cmd/rt:dev/rn:sonos/ad:1/sv:media_player/ad:000E58B2AA6901400",
      "Service": "media_player",
      "ServiceInterface": "cmd.favorites.set",
      "Config": {
        "DefaultValue": {
          "Value": "",
          "ValueType": "string"
        },
        "IsVariableGlobal": true,
        "Props": {},
        "RegisterAsVirtualService": false,
        "ResponseToTopic": "",
        "VariableName": "sonos_favourite",
        "VariableType": "string",
        "VirtualServiceGroup": "",
        "VirtualServiceProps": {}
      },
      "Ui": {
        "nodeType": "",
        "x": 40,
        "y": 971
      },
      "TypeAlias": "Action"
    },
    {
      "Id": "20",
      "Type": "trigger",
      "Label": "evt.volume.report",
      "SuccessTransition": "21",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "pt:j1/mt:evt/rt:dev/rn:sonos/ad:1/sv:media_player/ad:000E58B2AA6901400",
      "Service": "media_player",
      "ServiceInterface": "evt.volume.report",
      "Config": {
        "IsValueFilterEnabled": false,
        "LookupServiceNameAndLocation": false,
        "RegisterAsVirtualService": false,
        "Timeout": 0,
        "ValueFilter": {
          "Value": "",
          "ValueType": "int"
        },
        "VirtualServiceGroup": "ch_0",
        "VirtualServiceProps": {}
      },
      "Ui": {
        "nodeType": "",
        "x": 1019,
        "y": 143
      },
      "TypeAlias": "Trigger"
    },
    {
      "Id": "21",
      "Type": "wait",
      "Label": "10s",
      "SuccessTransition": "7",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": 10000,
      "Ui": {
        "nodeType": "",
        "x": 1009,
        "y": 369
      },
      "TypeAlias": "Delay"
    },
    {
      "Id": "22",
      "Type": "wait",
      "Label": "0.3s",
      "SuccessTransition": "9",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": 300,
      "Ui": {
        "nodeType": "",
        "x": 584,
        "y": 985
      },
      "TypeAlias": "Delay"
    },
    {
      "Id": "23",
      "Type": "if",
      "Label": "volume<98",
      "SuccessTransition": "",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": {
        "Expression": [
          {
            "BooleanOperator": "",
            "LeftVariableIsGlobal": false,
            "LeftVariableName": "volume",
            "Operand": "lt",
            "RightVariable": {
              "Value": 98,
              "ValueType": "int"
            }
          }
        ],
        "FalseTransition": "",
        "TrueTransition": "10"
      },
      "Ui": {
        "nodeType": "",
        "x": 558,
        "y": 618
      },
      "TypeAlias": "If condition"
    },
    {
      "Id": "24",
      "Type": "if",
      "Label": "volume>2",
      "SuccessTransition": "",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": {
        "Expression": [
          {
            "BooleanOperator": "",
            "LeftVariableIsGlobal": false,
            "LeftVariableName": "volume",
            "Operand": "gt",
            "RightVariable": {
              "Value": 2,
              "ValueType": "int"
            }
          }
        ],
        "FalseTransition": "",
        "TrueTransition": "12"
      },
      "Ui": {
        "nodeType": "",
        "x": 785,
        "y": 613
      },
      "TypeAlias": "If condition"
    }
  ],
  "Settings": null,
  "IsDisabled": false,
  "IsDefault": false,
  "ParallelExecution": "keep_last"
}

For å finna ut kva id du skal setja favorittvariabelen til, må du finna ein måte trigga cmd.playlists.get_report, og ta ein titt på rapporten i message stream.