Sette parameter i TP?

Hvordan setter jeg et parameter til en enhet i en flow?

Det er i allefall en start mot å lage en scene hvor lyset starter en sakte ned dimming. Men er bare fibaro dimmerne som har en tidsparameter for auto off.

I min dimming flow lagde jeg en global variable, og en loop counter oppdater den. Den går ned til 10% og stopper. Jeg starter dimming fra 80% som er min “normal.” Har en Ikea lampe som bruker 1-254 som verdier, så dimmer den til 80 først.

{
  "Id": "1tnGnyIH9h1gJ14",
  "ClassId": "hghuvzIj5l8ZHt2",
  "Author": "espenh.no",
  "Version": 0,
  "CreatedAt": "2022-01-13T16:10:02.704337969+01:00",
  "UpdatedAt": "2022-01-21T23:22:35.873791578+01:00",
  "Name": "LR Lights dim",
  "Group": "dimming flows",
  "Description": "Dim LR lights at 2300",
  "Nodes": [
    {
      "Id": "5",
      "Type": "loop",
      "Label": "repeat 71 times",
      "SuccessTransition": "6",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": {
        "EndValue": 72,
        "SaveToVariable": false,
        "StartValue": 0,
        "Step": 1
      },
      "Ui": {
        "nodeType": "",
        "x": 518,
        "y": 983
      },
      "TypeAlias": "Loop"
    },
    {
      "Id": "6",
      "Type": "transform",
      "Label": "set level",
      "SuccessTransition": "7",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": {
        "Expression": "80-loop_counter",
        "IsLVariableGlobal": false,
        "IsRVariableGlobal": false,
        "IsTargetVariableGlobal": true,
        "IsTargetVariableInMemory": true,
        "LVariableName": "",
        "RValue": {
          "Value": 0,
          "ValueType": "int"
        },
        "RVariableName": "",
        "Rtype": "var",
        "TargetVariableName": "LR Dim mode",
        "TargetVariableType": "int",
        "Template": "",
        "TransformType": "calc",
        "ValueMapping": [],
        "XPathMapping": []
      },
      "Ui": {
        "nodeType": "",
        "x": 1009,
        "y": 347
      },
      "TypeAlias": "Transform"
    },
    {
      "Id": "7",
      "Type": "action",
      "Label": "LR window strip dim",
      "SuccessTransition": "12",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "pt:j1/mt:cmd/rt:dev/rn:hue/ad:1/sv:out_lvl_switch/ad:l4_0",
      "Service": "out_lvl_switch",
      "ServiceInterface": "cmd.lvl.set",
      "Config": {
        "DefaultValue": {
          "Value": "",
          "ValueType": "int"
        },
        "IsVariableGlobal": true,
        "Props": {},
        "RegisterAsVirtualService": false,
        "ResponseToTopic": "",
        "VariableName": "LR Dim mode",
        "VariableType": "int",
        "VirtualServiceGroup": "",
        "VirtualServiceProps": {}
      },
      "Ui": {
        "nodeType": "",
        "x": 1011,
        "y": 493
      },
      "TypeAlias": "Action"
    },
    {
      "Id": "8",
      "Type": "if",
      "Label": "check if at end of dim cycle",
      "SuccessTransition": "",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": {
        "Expression": [
          {
            "BooleanOperator": "",
            "LeftVariableIsGlobal": true,
            "LeftVariableName": "LR Dim mode",
            "Operand": "gt",
            "RightVariable": {
              "Value": 10,
              "ValueType": "int"
            }
          }
        ],
        "FalseTransition": "",
        "TrueTransition": "9"
      },
      "Ui": {
        "nodeType": "",
        "x": 1361,
        "y": 261
      },
      "TypeAlias": "If condition"
    },
    {
      "Id": "9",
      "Type": "wait",
      "Label": "wait 25 seconds",
      "SuccessTransition": "5",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": 25000,
      "Ui": {
        "nodeType": "",
        "x": 1305,
        "y": 1287
      },
      "TypeAlias": "Delay"
    },
    {
      "Id": "11",
      "Type": "time_trigger",
      "Label": "start dimming",
      "SuccessTransition": "17",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": {
        "DefaultMsg": {
          "Value": "",
          "ValueType": ""
        },
        "Expressions": [
          {
            "Comments": "",
            "Expression": "25 23 * * *",
            "Name": "2300"
          }
        ],
        "GenerateAstroTimeEvents": false,
        "Latitude": 0,
        "Longitude": 0,
        "SunriseTimeOffset": 0,
        "SunsetTimeOffset": 0
      },
      "Ui": {
        "nodeType": "",
        "x": 77,
        "y": 419
      },
      "TypeAlias": "Time trigger"
    },
    {
      "Id": "12",
      "Type": "action",
      "Label": "shelf strip",
      "SuccessTransition": "14",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "pt:j1/mt:cmd/rt:dev/rn:hue/ad:1/sv:out_lvl_switch/ad:l18_0",
      "Service": "out_lvl_switch",
      "ServiceInterface": "cmd.lvl.set",
      "Config": {
        "DefaultValue": {
          "Value": "",
          "ValueType": "int"
        },
        "IsVariableGlobal": true,
        "Props": {},
        "RegisterAsVirtualService": false,
        "ResponseToTopic": "",
        "VariableName": "LR Dim mode",
        "VariableType": "int",
        "VirtualServiceGroup": "",
        "VirtualServiceProps": {}
      },
      "Ui": {
        "nodeType": "",
        "x": 984,
        "y": 645
      },
      "TypeAlias": "Action"
    },
    {
      "Id": "14",
      "Type": "action",
      "Label": "lr window lamp",
      "SuccessTransition": "30",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "pt:j1/mt:cmd/rt:dev/rn:zigbee/ad:1/sv:out_lvl_switch/ad:1_1",
      "Service": "out_lvl_switch",
      "ServiceInterface": "cmd.lvl.set",
      "Config": {
        "DefaultValue": {
          "Value": "",
          "ValueType": "int"
        },
        "IsVariableGlobal": true,
        "Props": {},
        "RegisterAsVirtualService": false,
        "ResponseToTopic": "",
        "VariableName": "LR Dim mode",
        "VariableType": "int",
        "VirtualServiceGroup": "",
        "VirtualServiceProps": {}
      },
      "Ui": {
        "nodeType": "",
        "x": 999,
        "y": 813
      },
      "TypeAlias": "Action"
    },
    {
      "Id": "16",
      "Type": "action",
      "Label": "",
      "SuccessTransition": "5",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "pt:j1/mt:cmd/rt:dev/rn:zigbee/ad:1/sv:out_lvl_switch/ad:1_1",
      "Service": "out_lvl_switch",
      "ServiceInterface": "cmd.lvl.set",
      "Config": {
        "DefaultValue": {
          "Value": 85,
          "ValueType": "int"
        },
        "IsVariableGlobal": false,
        "Props": {},
        "RegisterAsVirtualService": false,
        "ResponseToTopic": "",
        "VariableName": "",
        "VirtualServiceGroup": "",
        "VirtualServiceProps": {}
      },
      "Ui": {
        "nodeType": "",
        "x": 492,
        "y": 762
      },
      "TypeAlias": "Action"
    },
    {
      "Id": "17",
      "Type": "action",
      "Label": "",
      "SuccessTransition": "24",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "pt:j1/mt:cmd/rt:dev/rn:zigbee/ad:1/sv:out_lvl_switch/ad:1_1",
      "Service": "out_lvl_switch",
      "ServiceInterface": "cmd.lvl.set",
      "Config": {
        "DefaultValue": {
          "Value": 150,
          "ValueType": "int"
        },
        "IsVariableGlobal": false,
        "Props": {},
        "RegisterAsVirtualService": false,
        "ResponseToTopic": "",
        "VariableName": "",
        "VirtualServiceGroup": "",
        "VirtualServiceProps": {}
      },
      "Ui": {
        "nodeType": "",
        "x": 86,
        "y": 632
      },
      "TypeAlias": "Action"
    },
    {
      "Id": "18",
      "Type": "action",
      "Label": "",
      "SuccessTransition": "23",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "pt:j1/mt:cmd/rt:dev/rn:zigbee/ad:1/sv:out_lvl_switch/ad:1_1",
      "Service": "out_lvl_switch",
      "ServiceInterface": "cmd.lvl.set",
      "Config": {
        "DefaultValue": {
          "Value": 125,
          "ValueType": "int"
        },
        "IsVariableGlobal": false,
        "Props": {},
        "RegisterAsVirtualService": false,
        "ResponseToTopic": "",
        "VariableName": "",
        "VirtualServiceGroup": "",
        "VirtualServiceProps": {}
      },
      "Ui": {
        "nodeType": "",
        "x": 92,
        "y": 996
      },
      "TypeAlias": "Action"
    },
    {
      "Id": "19",
      "Type": "action",
      "Label": "",
      "SuccessTransition": "22",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "pt:j1/mt:cmd/rt:dev/rn:zigbee/ad:1/sv:out_lvl_switch/ad:1_1",
      "Service": "out_lvl_switch",
      "ServiceInterface": "cmd.lvl.set",
      "Config": {
        "DefaultValue": {
          "Value": 100,
          "ValueType": "int"
        },
        "IsVariableGlobal": false,
        "Props": {},
        "RegisterAsVirtualService": false,
        "ResponseToTopic": "",
        "VariableName": "",
        "VirtualServiceGroup": "",
        "VirtualServiceProps": {}
      },
      "Ui": {
        "nodeType": "",
        "x": 499,
        "y": 432
      },
      "TypeAlias": "Action"
    },
    {
      "Id": "22",
      "Type": "wait",
      "Label": "wait 15 sec",
      "SuccessTransition": "16",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": 15000,
      "Ui": {
        "nodeType": "",
        "x": 502,
        "y": 605
      },
      "TypeAlias": "Delay"
    },
    {
      "Id": "23",
      "Type": "wait",
      "Label": "wait 15 sec",
      "SuccessTransition": "19",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": 15000,
      "Ui": {
        "nodeType": "",
        "x": 86,
        "y": 1157
      },
      "TypeAlias": "Delay"
    },
    {
      "Id": "24",
      "Type": "wait",
      "Label": "wait 15 sec",
      "SuccessTransition": "18",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": 15000,
      "Ui": {
        "nodeType": "",
        "x": 85,
        "y": 848
      },
      "TypeAlias": "Delay"
    },
    {
      "Id": "30",
      "Type": "action",
      "Label": "corner lamp",
      "SuccessTransition": "31",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "pt:j1/mt:cmd/rt:dev/rn:hue/ad:1/sv:out_lvl_switch/ad:l20_0",
      "Service": "out_lvl_switch",
      "ServiceInterface": "cmd.lvl.set",
      "Config": {
        "DefaultValue": {
          "Value": "",
          "ValueType": "int"
        },
        "IsVariableGlobal": true,
        "Props": {},
        "RegisterAsVirtualService": false,
        "ResponseToTopic": "",
        "VariableName": "LR Dim mode",
        "VariableType": "int",
        "VirtualServiceGroup": "",
        "VirtualServiceProps": {}
      },
      "Ui": {
        "nodeType": "",
        "x": 1011,
        "y": 966
      },
      "TypeAlias": "Action"
    },
    {
      "Id": "31",
      "Type": "action",
      "Label": "fireplace lamp",
      "SuccessTransition": "8",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "pt:j1/mt:cmd/rt:dev/rn:hue/ad:1/sv:out_lvl_switch/ad:l19_0",
      "Service": "out_lvl_switch",
      "ServiceInterface": "cmd.lvl.set",
      "Config": {
        "DefaultValue": {
          "Value": "",
          "ValueType": "int"
        },
        "IsVariableGlobal": true,
        "Props": {},
        "RegisterAsVirtualService": false,
        "ResponseToTopic": "",
        "VariableName": "LR Dim mode",
        "VariableType": "int",
        "VirtualServiceGroup": "",
        "VirtualServiceProps": {}
      },
      "Ui": {
        "nodeType": "",
        "x": 1019,
        "y": 1111
      },
      "TypeAlias": "Action"
    }
  ],
  "Settings": null,
  "IsDisabled": false,
  "IsDefault": false,
  "ParallelExecution": "keep_last"
}
1 Like

Kan du vise litt om hvordan nodene rt satt opp? Innholdet, parametrene, innstillinger osv

Time Trigger, første Actions, Delay, er kanskje ikke interesssant. Det er Loop, Transform og påfølgene actions some er mer spesifikk.

Første er Loop - ganske enkelt.
loop

Da Transform. Du må lage en global variable (min heter LR Dim mode) som er av type integer.
formula er 80-loop counter (loop counter starter med 1 og videre til 72 for meg). Det blir neste nivå lysene er satt til.

Neste er actions som faktisk dimmer lysene. Her man velger det er en global variable og da velger LR Dim mode. Lysene blir satt til den nivå, som starter med 79, , neste runde 78, 77, osv.

Min blir på 10% - jeg lar de står på svakt slikt at man blir trøtt av dempet lys. :slight_smile:

Det her med en global variabel er jeg litt usikker på hvordan lages. Lages den og lagres i en node ved siden av eller…?

Hei, her er et eksempel på en global variabel


Hvor ‘set variable’ ser slik ut

Da har du en global variabel som kan brukes på tvers av flows

1 Like

Om du lurer på hvordan å etablere en global variable første gang:

I mange nodes (som den ketilH viste til, får man opp muligheten.
variable

Når du ser dette, hukker du av for “is global” og da klikker du på add. Du får opp slik:
gvariable

Her skriver man inn navn du vil ha på variable, e.g. “LR Dim Mode” og en valfri beskrivelse. Du må klikke på save, og du vil da få en global variable som heter LR Dim mode.
Du kan bekrefte det finns og nåværende verdi ved å se på “context” i flows på TP.