Lagre strømpriser i globale variabler for bruk i andre flows

Hei, Jeg prøver å lagre prisene i globale variabler, men får ikke helt til dette med kalkulasjonen av differansen på pris og gjenomsnittspris.
Pris og gjennomsnittspris blir lagret i de globale variablene, men prisforskjell variablen viser bare 0. Noen kloke hoder som ser hva jeg gjør galt :stuck_out_tongue: ? (Jeg tok utgangspunk i flow laget i appen, ser der at pris og gjennomsnittpris er lagret som int variabler, mens kalkulasjonen er float, uten at jeg helt vet hva forskjellen på de forskjellige typene en kan velge der er ?)

{
  "Id": "630c3d70-fd6a-11ec-950b-9bebc270688b",
  "ClassId": "630c3d70-fd6a-11ec-950b-9bebc270688b",
  "Author": "Tommy",
  "Version": 0,
  "CreatedAt": "2022-07-06T20:29:51.17505Z",
  "UpdatedAt": "2022-07-06T22:35:32.985522515+02:00",
  "Name": "strømprisen er 1.0% lavere enn gjennomsnittet og modusen er home, away eller sleep",
  "Group": "custom",
  "Description": " ",
  "Nodes": [
    {
      "Id": "4",
      "Type": "trigger",
      "Label": "strømprisen er 1.0% lavere enn gjennomsnittet",
      "SuccessTransition": "5",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "pt:j1/mt:evt/rt:app/rn:energy_guard/ad:1",
      "Service": "energy_price",
      "ServiceInterface": "evt.energy_price.report",
      "Config": {
        "InputVariableType": null,
        "IsValueFilterEnabled": false,
        "LookupServiceNameAndLocation": false,
        "PropFilterName": "",
        "PropFilterValue": "",
        "RegisterAsVirtualService": false,
        "Timeout": 0,
        "ValueFilter": {
          "Value": null,
          "ValueType": null
        },
        "ValueJPath": null,
        "ValueJPathResultType": null,
        "VirtualServiceGroup": "",
        "VirtualServiceProps": {}
      },
      "Ui": {
        "nodeType": "",
        "papp": {
          "customValues": null,
          "nodeId": null,
          "nodeName": "energy",
          "nodeType": "energy"
        },
        "x": 134,
        "y": 246
      },
      "TypeAlias": "Trigger"
    },
    {
      "Id": "5",
      "Type": "transform",
      "Label": "get average",
      "SuccessTransition": "6",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": {
        "Expression": "",
        "IsLVariableGlobal": false,
        "IsRVariableGlobal": false,
        "IsTargetVariableGlobal": false,
        "IsTargetVariableInMemory": false,
        "LVariableName": "",
        "RValue": {
          "Value": 0,
          "ValueType": "int"
        },
        "RVariableName": "",
        "Rtype": "var",
        "TargetVariableName": "",
        "TargetVariableType": "",
        "Template": "",
        "TransformType": "jpath",
        "ValueMapping": [],
        "XPathMapping": [
          {
            "IsTargetVariableGlobal": true,
            "Path": "$.average",
            "TargetVariableName": "Prissnitt",
            "TargetVariableType": "int",
            "UpdateInputVariable": false
          }
        ]
      },
      "Ui": {
        "nodeType": "",
        "papp": {
          "customValues": null,
          "nodeId": "1",
          "nodeName": "value",
          "nodeType": "energy"
        },
        "x": 145,
        "y": 442
      },
      "TypeAlias": "Transform"
    },
    {
      "Id": "6",
      "Type": "trigger",
      "Label": "",
      "SuccessTransition": "7",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "pt:j1/mt:evt/rt:app/rn:energy_guard/ad:1",
      "Service": "energy_price",
      "ServiceInterface": "evt.energy_price.report",
      "Config": {
        "InputVariableType": null,
        "IsValueFilterEnabled": false,
        "LookupServiceNameAndLocation": false,
        "PropFilterName": "",
        "PropFilterValue": "",
        "RegisterAsVirtualService": false,
        "Timeout": 0,
        "ValueFilter": {
          "Value": null,
          "ValueType": null
        },
        "ValueJPath": null,
        "ValueJPathResultType": null,
        "VirtualServiceGroup": "",
        "VirtualServiceProps": {}
      },
      "Ui": {
        "nodeType": "",
        "papp": {
          "customValues": null,
          "nodeId": "2",
          "nodeName": "energy",
          "nodeType": "energy"
        },
        "x": 636,
        "y": 509
      },
      "TypeAlias": "Trigger"
    },
    {
      "Id": "7",
      "Type": "transform",
      "Label": "get price",
      "SuccessTransition": "8",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": {
        "Expression": "",
        "IsLVariableGlobal": false,
        "IsRVariableGlobal": false,
        "IsTargetVariableGlobal": false,
        "IsTargetVariableInMemory": false,
        "LVariableName": "",
        "RValue": {
          "Value": 0,
          "ValueType": "int"
        },
        "RVariableName": "",
        "Rtype": "var",
        "TargetVariableName": "",
        "TargetVariableType": "",
        "Template": "",
        "TransformType": "jpath",
        "ValueMapping": [],
        "XPathMapping": [
          {
            "IsTargetVariableGlobal": true,
            "Path": "$.price",
            "TargetVariableName": "Pris",
            "TargetVariableType": "int",
            "UpdateInputVariable": false
          }
        ]
      },
      "Ui": {
        "nodeType": "",
        "papp": {
          "customValues": null,
          "nodeId": "3",
          "nodeName": "value",
          "nodeType": "energy"
        },
        "x": 1032,
        "y": 451
      },
      "TypeAlias": "Transform"
    },
    {
      "Id": "8",
      "Type": "wait",
      "Label": "Wait 1s for variable",
      "SuccessTransition": "9",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": 1000,
      "Ui": {
        "nodeType": "",
        "papp": {
          "customValues": null,
          "nodeId": "4",
          "nodeName": "wait",
          "nodeType": "energy"
        },
        "x": 1348,
        "y": 409
      },
      "TypeAlias": "Delay"
    },
    {
      "Id": "9",
      "Type": "transform",
      "Label": "price - (average * 0.9)",
      "SuccessTransition": "10",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": {
        "Expression": "Pris - (Prissnitt * 0.99)",
        "IsLVariableGlobal": false,
        "IsRVariableGlobal": false,
        "IsTargetVariableGlobal": true,
        "IsTargetVariableInMemory": false,
        "LVariableName": "average",
        "RValue": {
          "Value": 0,
          "ValueType": "float"
        },
        "RVariableName": "",
        "Rtype": "var",
        "TargetVariableName": "Prisforskjell",
        "TargetVariableType": "float",
        "Template": "",
        "TransformType": "calc",
        "ValueMapping": [],
        "XPathMapping": []
      },
      "Ui": {
        "nodeType": "",
        "papp": {
          "customValues": {
            "node_type": "transform_calc",
            "threshold": 0.01
          },
          "nodeId": "",
          "nodeName": "value",
          "nodeType": "energy"
        },
        "x": 1407,
        "y": 622
      },
      "TypeAlias": "Transform"
    },
    {
      "Id": "10",
      "Type": "if",
      "Label": "difference lt 0",
      "SuccessTransition": "11",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": {
        "Expression": [
          {
            "BooleanOperator": "",
            "LeftVariableIsGlobal": false,
            "LeftVariableName": "difference",
            "Operand": "lt",
            "RightVariable": {
              "Value": 0,
              "ValueType": "float"
            }
          }
        ],
        "FalseTransition": "",
        "TrueTransition": "11"
      },
      "Ui": {
        "nodeType": "",
        "papp": {
          "customValues": {
            "node_type": "if_diff"
          },
          "nodeId": "",
          "nodeName": "If",
          "nodeType": "If"
        },
        "x": 1779,
        "y": 328
      },
      "TypeAlias": "If condition"
    },
    {
      "Id": "11",
      "Type": "if",
      "Label": "og modusen er home, away eller sleep",
      "SuccessTransition": "",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "",
      "Service": "tpflow",
      "ServiceInterface": "",
      "Config": {
        "Expression": [
          {
            "BooleanOperator": "or",
            "LeftVariableIsGlobal": true,
            "LeftVariableName": "fh.home.mode",
            "Operand": "eq",
            "RightVariable": {
              "Value": "home",
              "ValueType": "string"
            }
          },
          {
            "BooleanOperator": "or",
            "LeftVariableIsGlobal": true,
            "LeftVariableName": "fh.home.mode",
            "Operand": "eq",
            "RightVariable": {
              "Value": "away",
              "ValueType": "string"
            }
          },
          {
            "BooleanOperator": "or",
            "LeftVariableIsGlobal": true,
            "LeftVariableName": "fh.home.mode",
            "Operand": "eq",
            "RightVariable": {
              "Value": "sleep",
              "ValueType": "string"
            }
          }
        ],
        "FalseTransition": "",
        "TrueTransition": ""
      },
      "Ui": {
        "nodeType": "",
        "papp": {
          "customValues": null,
          "nodeId": "home,away,sleep",
          "nodeName": "If",
          "nodeType": "modeTrigger"
        },
        "x": 1745,
        "y": 517
      },
      "TypeAlias": "If condition"
    },
    {
      "Id": "12",
      "Type": "vinc_trigger",
      "Label": "Home event trigger",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "SuccessTransition": "8",
      "ErrorTransition": "",
      "Config": {
        "Timeout": 0,
        "ValueFilter": "18",
        "IsValueFilterEnabled": true,
        "EventType": "shortcut"
      },
      "Ui": {
        "x": 699,
        "y": 191,
        "nodeType": ""
      },
      "TypeAlias": "Home event"
    }
  ],
  "Settings": null,
  "IsDisabled": false,
  "IsDefault": false,
  "ParallelExecution": "parallel"
}
1 Like