Hei der! Er det nokon der ute som har klart å laga ein brukarvennlig flow for å justera sonos volum opp og ned vha. scene frå ein veggbryter, feks Heatit Z-push button? Eg har ein flow som fungerar, men den reagerer ikkje alltid forutsigbart på gjentatte tastetrykk. Aller helst hadde eg sett at det fantes ein innebygd funksjon som heva eller senka volumet med eit gitt inkrement for kvar gong aksjonen blei kjørt. I koden under vert gjeldande volum lagra i ein variabel, basert på evt.volume.report.
{
"Id": "cVk9M2XjuyWxv1g",
"ClassId": "8ovjy2o7llwhMcJ",
"Author": "jonseim@gmail.com",
"Version": 0,
"CreatedAt": "2020-11-06T18:24:49.430889407+01:00",
"UpdatedAt": "2020-11-06T18:51:33.982129895+01:00",
"Name": "Panel kjøkken Sonos",
"Group": "remote",
"Description": "",
"Nodes": [
{
"Id": "1",
"Type": "action",
"Label": "Play Kjøkken",
"SuccessTransition": "",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "pt:j1/mt:cmd/rt:dev/rn:sonos/ad:1/sv:media_player/ad:000E58F003A801400",
"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
}
},
{
"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:112_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": 41,
"y": 219
}
},
{
"Id": "3",
"Type": "if",
"Label": "scene=1.0",
"SuccessTransition": "",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "",
"Service": "",
"ServiceInterface": "",
"Config": {
"Expression": [
{
"BooleanOperator": "",
"LeftVariableIsGlobal": false,
"LeftVariableName": "",
"Operand": "eq",
"RightVariable": {
"Value": "1.0",
"ValueType": "string"
}
}
],
"FalseTransition": "4",
"TrueTransition": "1"
},
"Ui": {
"nodeType": "",
"x": 65,
"y": 425
}
},
{
"Id": "4",
"Type": "if",
"Label": "scene=2.0",
"SuccessTransition": "",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "",
"Service": "",
"ServiceInterface": "",
"Config": {
"Expression": [
{
"BooleanOperator": "",
"LeftVariableIsGlobal": false,
"LeftVariableName": "",
"Operand": "eq",
"RightVariable": {
"Value": "2.0",
"ValueType": "string"
}
}
],
"FalseTransition": "8",
"TrueTransition": "5"
},
"Ui": {
"nodeType": "",
"x": 332,
"y": 428
}
},
{
"Id": "5",
"Type": "action",
"Label": "Pause Kjøkken",
"SuccessTransition": "",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "pt:j1/mt:cmd/rt:dev/rn:sonos/ad:1/sv:media_player/ad:000E58F003A801400",
"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
}
},
{
"Id": "6",
"Type": "trigger",
"Label": "evt.volume.report",
"SuccessTransition": "7",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "pt:j1/mt:evt/rt:dev/rn:sonos/ad:1/sv:media_player/ad:000E58F003A801400",
"Service": "media_player",
"ServiceInterface": "evt.volume.report",
"Config": {
"IsValueFilterEnabled": false,
"LookupServiceNameAndLocation": false,
"RegisterAsVirtualService": false,
"Timeout": 0,
"ValueFilter": {
"Value": "",
"ValueType": "bool"
},
"VirtualServiceGroup": "ch_0",
"VirtualServiceProps": {}
},
"Ui": {
"nodeType": "",
"x": 979,
"y": 153
}
},
{
"Id": "7",
"Type": "set_variable",
"Label": "volume",
"SuccessTransition": "",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "",
"Service": "",
"ServiceInterface": "",
"Config": {
"DefaultValue": {
"Value": 0,
"ValueType": ""
},
"Name": "volume",
"UpdateGlobal": false,
"UpdateInputMsg": false
},
"Ui": {
"nodeType": "",
"x": 967,
"y": 322
}
},
{
"Id": "8",
"Type": "if",
"Label": "scene=3.0",
"SuccessTransition": "",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "",
"Service": "",
"ServiceInterface": "",
"Config": {
"Expression": [
{
"BooleanOperator": "",
"LeftVariableIsGlobal": false,
"LeftVariableName": "",
"Operand": "eq",
"RightVariable": {
"Value": "3.0",
"ValueType": "string"
}
}
],
"FalseTransition": "11",
"TrueTransition": "10"
},
"Ui": {
"nodeType": "",
"x": 573,
"y": 430
}
},
{
"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:000E58F003A801400",
"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": 680,
"y": 825
}
},
{
"Id": "10",
"Type": "transform",
"Label": "volume: +3",
"SuccessTransition": "9",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "",
"Service": "",
"ServiceInterface": "",
"Config": {
"Expression": "variable+3",
"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": 562,
"y": 617
}
},
{
"Id": "11",
"Type": "if",
"Label": "scene=4.0",
"SuccessTransition": "",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "",
"Service": "",
"ServiceInterface": "",
"Config": {
"Expression": [
{
"BooleanOperator": "",
"LeftVariableIsGlobal": false,
"LeftVariableName": "",
"Operand": "eq",
"RightVariable": {
"Value": "4.0",
"ValueType": "string"
}
}
],
"FalseTransition": "",
"TrueTransition": "12"
},
"Ui": {
"nodeType": "",
"x": 789,
"y": 431
}
},
{
"Id": "12",
"Type": "transform",
"Label": "volume: -3",
"SuccessTransition": "9",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "",
"Service": "",
"ServiceInterface": "",
"Config": {
"Expression": "variable-3",
"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": 773,
"y": 602
}
},
{
"Id": "13",
"Type": "action",
"Label": "cmd.volume.get.report",
"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.get_report",
"Config": {
"DefaultValue": {
"Value": "play",
"ValueType": "string"
},
"IsVariableGlobal": false,
"Props": {},
"RegisterAsVirtualService": false,
"ResponseToTopic": "",
"VariableName": "",
"VirtualServiceGroup": "",
"VirtualServiceProps": {}
},
"Ui": {
"nodeType": "",
"x": 1182,
"y": 330
}
},
{
"Id": "14",
"Type": "trigger",
"Label": "evt.playback.report",
"SuccessTransition": "13",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "pt:j1/mt:evt/rt:dev/rn:sonos/ad:1/sv:media_player/ad:000E58F003A801400",
"Service": "media_player",
"ServiceInterface": "evt.playback.report",
"Config": {
"IsValueFilterEnabled": false,
"LookupServiceNameAndLocation": false,
"RegisterAsVirtualService": false,
"Timeout": 0,
"ValueFilter": {
"Value": "",
"ValueType": "bool"
},
"VirtualServiceGroup": "ch_0",
"VirtualServiceProps": {}
},
"Ui": {
"nodeType": "",
"x": 1193,
"y": 155
}
}
],
"Settings": null,
"IsDisabled": false,
"IsDefault": false,
"ParallelExecution": "parallel"
}