Panasonic Comfort Cloud - Varmepumpe

Jeg har laget en Flow for Panasonic Comfort Cloud som jeg ønsker å dele, og den kan benyttes om du bruker appen Comfort Cloud. Du burde opprette en egen bruker for dette, da den vil sørge for at du logges ut av appen (brukere kan ikke deles, da vil token utløpe).

Den er helt basic nå, da Futurehome X kun støtter termostat, ikke modus eller viftestyring. Kommer til å legge støtte for det når appen støtter noe slikt.

Brukernavn og passord legges under settings i Flow’en.

{
  "Id": "O9HaVGhKCqIJcID",
  "ClassId": "IvVC1B5xpBZpeZr",
  "Author": "lostfields",
  "Version": 0,
  "Name": "panasonic",
  "Group": "virtual-device",
  "Description": "",
  "Nodes": [
    {
      "Id": "2",
      "Type": "rest_action",
      "Label": "login",
      "SuccessTransition": "3",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": {
        "Headers": [
          {
            "Name": "Content-type",
            "Value": "application/json"
          },
          {
            "Name": "Accept",
            "Value": "application/json"
          },
          {
            "Name": "X-APP-TYPE",
            "Value": "1"
          },
          {
            "Name": "X-APP-VERSION",
            "Value": "2.0.0"
          },
          {
            "Name": "User-Agent",
            "Value": "Futurehome"
          }
        ],
        "LogResponse": true,
        "Method": "POST",
        "RequestPayloadType": "json",
        "RequestTemplate": "{\n    \"language\": \"0\",\n    \"loginId\": \"{{ setting \"username\" }}\",\n    \"password\": \"{{ setting \"password\" }}\"\n}",
        "ResponseMapping": [
          {
            "IsVariableGlobal": false,
            "Name": "",
            "Path": "$.uToken",
            "PathType": "json",
            "TargetVariableName": "auth_token",
            "TargetVariableType": "string",
            "UpdateTriggerMessage": true
          }
        ],
        "Url": "https://accsmart.panasonic.com/auth/login"
      },
      "Ui": {
        "nodeType": "",
        "x": 2314,
        "y": 271
      },
      "TypeAlias": "HTTP msg"
    },
    {
      "Id": "3",
      "Type": "transform",
      "Label": "set header",
      "SuccessTransition": "4",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": {
        "Expression": "",
        "IsLVariableGlobal": false,
        "IsRVariableGlobal": false,
        "LVariableName": "",
        "RValue": {
          "Value": 0,
          "ValueType": "int"
        },
        "RVariableName": "",
        "Rtype": "var",
        "TargetVariableName": "headers",
        "TargetVariableType": "str_map",
        "Template": "{\"X-User-Authorization\":\"{{ variable \"auth_token\" false }}\", \"Content-Type\":\"application/json\", \"Accept\": \"application/json\", \"User-Agent\": \"Futurehome\", \"X-APP-TYPE\": \"1\", \"X-APP-VERSION\": \"2.0.0\"}",
        "TransformType": "template",
        "ValueMapping": [],
        "XPathMapping": []
      },
      "Ui": {
        "nodeType": "",
        "x": 2315,
        "y": 491
      },
      "TypeAlias": "Transform"
    },
    {
      "Id": "4",
      "Type": "rest_action",
      "Label": "get groups",
      "SuccessTransition": "47",
      "TimeoutTransition": "",
      "ErrorTransition": "14",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": {
        "Headers": [],
        "HeadersVariableName": "headers",
        "LogResponse": true,
        "Method": "GET",
        "RequestPayloadType": "json",
        "RequestTemplate": "",
        "ResponseMapping": [
          {
            "IsVariableGlobal": false,
            "Name": "",
            "Path": "$.groupList[0].deviceList[0].deviceGuid",
            "PathType": "json",
            "TargetVariableName": "device_guid",
            "TargetVariableType": "string"
          }
        ],
        "Url": "https://accsmart.panasonic.com/device/group"
      },
      "Ui": {
        "nodeType": "",
        "x": 1780,
        "y": 486
      },
      "TypeAlias": "HTTP msg"
    },
    {
      "Id": "14",
      "Type": "wait",
      "Label": "wait for login",
      "SuccessTransition": "2",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": 10000,
      "Ui": {
        "nodeType": "",
        "x": 2310,
        "y": 795
      },
      "TypeAlias": "Delay"
    },
    {
      "Id": "15",
      "Type": "time_trigger",
      "Label": "update status",
      "SuccessTransition": "48",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": {
        "DefaultMsg": {
          "Value": "",
          "ValueType": ""
        },
        "Expressions": [
          {
            "Comments": "",
            "Expression": "*/5 * * * *",
            "Name": ""
          }
        ],
        "GenerateAstroTimeEvents": false,
        "Latitude": 0,
        "Longitude": 0,
        "SunriseTimeOffset": 0,
        "SunsetTimeOffset": 0
      },
      "Ui": {
        "nodeType": "",
        "x": 1879,
        "y": 122
      },
      "TypeAlias": "Time trigger"
    },
    {
      "Id": "16",
      "Type": "trigger",
      "Label": "Set mode",
      "SuccessTransition": "17",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "pt:j1/mt:cmd/rt:dev/rn:flow/ad:1/sv:thermostat/ad:O9HaVGhKCqIJcID_0",
      "Service": "thermostat",
      "ServiceInterface": "cmd.mode.set",
      "Config": {
        "IsValueFilterEnabled": false,
        "LookupServiceNameAndLocation": true,
        "RegisterAsVirtualService": true,
        "Timeout": 0,
        "ValueFilter": {
          "Value": null,
          "ValueType": ""
        },
        "VirtualServiceGroup": "ch_0",
        "VirtualServiceProps": {
          "sup_modes": [
            "off",
            "auto",
            "heat",
            "cool"
          ]
        }
      },
      "Ui": {
        "nodeType": "",
        "x": 34,
        "y": 259
      },
      "TypeAlias": "Trigger"
    },
    {
      "Id": "17",
      "Type": "set_variable",
      "Label": "save mode",
      "SuccessTransition": "19",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": {
        "DefaultValue": {
          "Value": 0,
          "ValueType": ""
        },
        "Name": "setpoint_mode",
        "UpdateGlobal": false,
        "UpdateInputMsg": false
      },
      "Ui": {
        "nodeType": "",
        "x": 21,
        "y": 476
      },
      "TypeAlias": "Set variable"
    },
    {
      "Id": "18",
      "Type": "trigger",
      "Label": "get mode",
      "SuccessTransition": "19",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "pt:j1/mt:cmd/rt:dev/rn:flow/ad:1/sv:thermostat/ad:O9HaVGhKCqIJcID_0",
      "Service": "thermostat",
      "ServiceInterface": "cmd.mode.get_report",
      "Config": {
        "IsValueFilterEnabled": false,
        "LookupServiceNameAndLocation": false,
        "RegisterAsVirtualService": true,
        "Timeout": 0,
        "ValueFilter": {
          "Value": null,
          "ValueType": ""
        },
        "VirtualServiceGroup": "ch_0",
        "VirtualServiceProps": {
          "sup_modes": [
            "off",
            "heat",
            "cool"
          ]
        }
      },
      "Ui": {
        "nodeType": "",
        "x": 257,
        "y": 260
      },
      "TypeAlias": "Trigger"
    },
    {
      "Id": "19",
      "Type": "action",
      "Label": "send mode",
      "SuccessTransition": "",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "pt:j1/mt:evt/rt:dev/rn:flow/ad:1/sv:thermostat/ad:O9HaVGhKCqIJcID_0",
      "Service": "thermostat",
      "ServiceInterface": "evt.mode.report",
      "Config": {
        "DefaultValue": {
          "Value": "heat",
          "ValueType": "string"
        },
        "IsVariableGlobal": false,
        "Props": {},
        "RegisterAsVirtualService": true,
        "ResponseToTopic": "",
        "VariableName": "mode",
        "VariableType": "string",
        "VirtualServiceGroup": "ch_0",
        "VirtualServiceProps": {}
      },
      "Ui": {
        "nodeType": "",
        "x": 43,
        "y": 1107
      },
      "TypeAlias": "Action"
    },
    {
      "Id": "20",
      "Type": "trigger",
      "Label": "get temp",
      "SuccessTransition": "21",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "pt:j1/mt:cmd/rt:dev/rn:flow/ad:1/sv:sensor_temp/ad:O9HaVGhKCqIJcID_0",
      "Service": "sensor_temp",
      "ServiceInterface": "cmd.sensor.get_report",
      "Config": {
        "IsValueFilterEnabled": false,
        "LookupServiceNameAndLocation": false,
        "RegisterAsVirtualService": true,
        "Timeout": 0,
        "ValueFilter": {
          "Value": "",
          "ValueType": "string"
        },
        "VirtualServiceGroup": "ch_0",
        "VirtualServiceProps": {
          "sup_units": [
            "C"
          ]
        }
      },
      "Ui": {
        "nodeType": "",
        "x": 976,
        "y": 254
      },
      "TypeAlias": "Trigger"
    },
    {
      "Id": "21",
      "Type": "action",
      "Label": "report temp",
      "SuccessTransition": "",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "pt:j1/mt:evt/rt:dev/rn:flow/ad:1/sv:sensor_temp/ad:O9HaVGhKCqIJcID_0",
      "Service": "sensor_temp",
      "ServiceInterface": "evt.sensor.report",
      "Config": {
        "DefaultValue": {
          "Value": 24,
          "ValueType": "float"
        },
        "IsVariableGlobal": false,
        "Props": {
          "unit": "C"
        },
        "RegisterAsVirtualService": true,
        "ResponseToTopic": "",
        "VariableName": "temperature",
        "VariableType": "float",
        "VirtualServiceGroup": "ch_0",
        "VirtualServiceProps": {}
      },
      "Ui": {
        "nodeType": "",
        "x": 799,
        "y": 1103
      },
      "TypeAlias": "Action"
    },
    {
      "Id": "22",
      "Type": "trigger",
      "Label": "set point",
      "SuccessTransition": "23",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "pt:j1/mt:cmd/rt:dev/rn:flow/ad:1/sv:thermostat/ad:O9HaVGhKCqIJcID_0",
      "Service": "thermostat",
      "ServiceInterface": "cmd.setpoint.set",
      "Config": {
        "IsValueFilterEnabled": false,
        "LookupServiceNameAndLocation": false,
        "RegisterAsVirtualService": true,
        "Timeout": 0,
        "ValueFilter": {
          "Value": "",
          "ValueType": "bool"
        },
        "VirtualServiceGroup": "ch_0",
        "VirtualServiceProps": {
          "sup_setpoints": [
            "heat",
            "cool",
            "auto"
          ]
        }
      },
      "Ui": {
        "nodeType": "",
        "x": 1441,
        "y": 253
      },
      "TypeAlias": "Trigger"
    },
    {
      "Id": "23",
      "Type": "transform",
      "Label": "extract setpoint",
      "SuccessTransition": "",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": {
        "Expression": "",
        "IsLVariableGlobal": false,
        "IsRVariableGlobal": false,
        "IsTargetVariableGlobal": false,
        "IsTargetVariableInMemory": true,
        "LVariableName": "",
        "RValue": {
          "Value": 0,
          "ValueType": "int"
        },
        "RVariableName": "",
        "Rtype": "var",
        "TargetVariableName": "",
        "TargetVariableType": "",
        "Template": "",
        "TransformType": "jpath",
        "ValueMapping": [],
        "XPathMapping": [
          {
            "IsTargetVariableGlobal": false,
            "Path": "$val.temp",
            "TargetVariableName": "setpoint_temp",
            "TargetVariableType": "float",
            "UpdateInputVariable": false
          }
        ]
      },
      "Ui": {
        "nodeType": "",
        "x": 1442,
        "y": 875
      },
      "TypeAlias": "Transform"
    },
    {
      "Id": "25",
      "Type": "action",
      "Label": "send setpoint",
      "SuccessTransition": "43",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "pt:j1/mt:evt/rt:dev/rn:flow/ad:1/sv:thermostat/ad:O9HaVGhKCqIJcID_0",
      "Service": "thermostat",
      "ServiceInterface": "evt.setpoint.report",
      "Config": {
        "DefaultValue": {
          "Value": {
            "temp": "19",
            "type": "heat",
            "unit": "C"
          },
          "ValueType": "str_map"
        },
        "IsVariableGlobal": false,
        "Props": {},
        "RegisterAsVirtualService": true,
        "ResponseToTopic": "",
        "VariableName": "setpoint_template",
        "VariableType": "str_map",
        "VirtualServiceGroup": "ch_0",
        "VirtualServiceProps": {
          "sup_setpoints": [
            "heat",
            "cool",
            "auto",
            "off"
          ]
        }
      },
      "Ui": {
        "nodeType": "",
        "x": 1188,
        "y": 1109
      },
      "TypeAlias": "Action"
    },
    {
      "Id": "27",
      "Type": "rest_action",
      "Label": "get device",
      "SuccessTransition": "29",
      "TimeoutTransition": "",
      "ErrorTransition": "14",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": {
        "Headers": [],
        "HeadersVariableName": "headers",
        "LogResponse": true,
        "Method": "GET",
        "RequestPayloadType": "json",
        "RequestTemplate": "",
        "ResponseMapping": [
          {
            "IsVariableGlobal": false,
            "Name": "",
            "Path": "$.parameters.temperatureSet",
            "PathType": "json",
            "TargetVariableName": "device_temp",
            "TargetVariableType": "float"
          },
          {
            "IsVariableGlobal": false,
            "Name": "",
            "Path": "$.parameters.operationMode",
            "PathType": "json",
            "TargetVariableName": "device_mode_index",
            "TargetVariableType": "int"
          },
          {
            "IsVariableGlobal": false,
            "Name": "",
            "Path": "$.parameters.insideTemperature",
            "PathType": "json",
            "TargetVariableName": "temperature",
            "TargetVariableType": "float"
          }
        ],
        "Url": "https://accsmart.panasonic.com/deviceStatus/now/{{ variable \"device_guid\" false }}"
      },
      "Ui": {
        "nodeType": "",
        "x": 1941,
        "y": 1637
      },
      "TypeAlias": "HTTP msg"
    },
    {
      "Id": "28",
      "Type": "transform",
      "Label": "template from device",
      "SuccessTransition": "25",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": {
        "Expression": "",
        "IsLVariableGlobal": false,
        "IsRVariableGlobal": false,
        "IsTargetVariableGlobal": false,
        "IsTargetVariableInMemory": true,
        "LVariableName": "",
        "RValue": {
          "Value": 0,
          "ValueType": "int"
        },
        "RVariableName": "",
        "Rtype": "var",
        "TargetVariableName": "setpoint_template",
        "TargetVariableType": "str_map",
        "Template": " {\n    \"temp\": \"{{variable \"device_temp\" false}}\",\n    \"type\": \"{{ variable \"device_mode\" false }}\",\n    \"unit\": \"C\"\n  }",
        "TransformType": "template",
        "ValueMapping": [],
        "XPathMapping": []
      },
      "Ui": {
        "nodeType": "",
        "x": 1193,
        "y": 875
      },
      "TypeAlias": "Transform"
    },
    {
      "Id": "29",
      "Type": "transform",
      "Label": "transform device_mode_index",
      "SuccessTransition": "28",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": {
        "Expression": "",
        "IsLVariableGlobal": false,
        "IsRVariableGlobal": false,
        "IsTargetVariableGlobal": false,
        "LVariableName": "device_mode_index",
        "RValue": {
          "Value": 0,
          "ValueType": "int"
        },
        "TargetVariableName": "device_mode",
        "TargetVariableType": "string",
        "Template": "",
        "TransformType": "map",
        "ValueMapping": [
          {
            "LValue": {
              "Value": 0,
              "ValueType": "int"
            },
            "RValue": {
              "Value": "auto",
              "ValueType": "string"
            }
          },
          {
            "LValue": {
              "Value": 1,
              "ValueType": "int"
            },
            "RValue": {
              "Value": "dry",
              "ValueType": "string"
            }
          },
          {
            "LValue": {
              "Value": 2,
              "ValueType": "int"
            },
            "RValue": {
              "Value": "cool",
              "ValueType": "string"
            }
          },
          {
            "LValue": {
              "Value": 3,
              "ValueType": "int"
            },
            "RValue": {
              "Value": "heat",
              "ValueType": "string"
            }
          },
          {
            "LValue": {
              "Value": 4,
              "ValueType": "int"
            },
            "RValue": {
              "Value": "fan",
              "ValueType": "string"
            }
          }
        ],
        "XPathMapping": [
          {
            "IsTargetVariableGlobal": false,
            "Path": "",
            "TargetVariableName": "",
            "TargetVariableType": "",
            "UpdateInputVariable": false
          }
        ]
      },
      "Ui": {
        "nodeType": "",
        "x": 1935,
        "y": 1836
      },
      "TypeAlias": "Transform"
    },
    {
      "Id": "30",
      "Type": "trigger",
      "Label": "get fantspeed",
      "SuccessTransition": "31",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "pt:j1/mt:cmd/rt:dev/rn:flow/ad:1/sv:fan_ctrl/ad:O9HaVGhKCqIJcID_0",
      "Service": "fan_ctrl",
      "ServiceInterface": "cmd.mode.get_report",
      "Config": {
        "IsValueFilterEnabled": false,
        "LookupServiceNameAndLocation": false,
        "RegisterAsVirtualService": true,
        "Timeout": 0,
        "ValueFilter": {
          "Value": "",
          "ValueType": "bool"
        },
        "VirtualServiceGroup": "ch_0",
        "VirtualServiceProps": {
          "sup_modes": [
            "auto_low",
            "auto_mid"
          ]
        }
      },
      "Ui": {
        "nodeType": "",
        "x": 734,
        "y": 257
      },
      "TypeAlias": "Trigger"
    },
    {
      "Id": "31",
      "Type": "action",
      "Label": "send fan",
      "SuccessTransition": "",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "pt:j1/mt:cmd/rt:dev/rn:flow/ad:1/sv:fan_ctrl/ad:O9HaVGhKCqIJcID_0",
      "Service": "fan_ctrl",
      "ServiceInterface": "evt.mode.report",
      "Config": {
        "DefaultValue": {
          "Value": "",
          "ValueType": ""
        },
        "IsVariableGlobal": false,
        "Props": {},
        "RegisterAsVirtualService": true,
        "ResponseToTopic": "",
        "VariableName": "",
        "VirtualServiceGroup": "",
        "VirtualServiceProps": {}
      },
      "Ui": {
        "nodeType": "",
        "x": 486,
        "y": 1107
      },
      "TypeAlias": "Action"
    },
    {
      "Id": "32",
      "Type": "trigger",
      "Label": "set fanspeed",
      "SuccessTransition": "33",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "pt:j1/mt:cmd/rt:dev/rn:flow/ad:1/sv:fan_ctrl/ad:O9HaVGhKCqIJcID_0",
      "Service": "fan_ctrl",
      "ServiceInterface": "cmd.mode.set",
      "Config": {
        "IsValueFilterEnabled": false,
        "LookupServiceNameAndLocation": false,
        "RegisterAsVirtualService": true,
        "Timeout": 0,
        "ValueFilter": {
          "Value": "",
          "ValueType": "bool"
        },
        "VirtualServiceGroup": "ch_0",
        "VirtualServiceProps": {}
      },
      "Ui": {
        "nodeType": "",
        "x": 511,
        "y": 258
      },
      "TypeAlias": "Trigger"
    },
    {
      "Id": "33",
      "Type": "set_variable",
      "Label": "save fanspeed",
      "SuccessTransition": "31",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": {
        "DefaultValue": {
          "Value": 0,
          "ValueType": ""
        },
        "Name": "setpoint_fanspeed",
        "UpdateGlobal": false,
        "UpdateInputMsg": false
      },
      "Ui": {
        "nodeType": "",
        "x": 497,
        "y": 470
      },
      "TypeAlias": "Set variable"
    },
    {
      "Id": "36",
      "Type": "rest_action",
      "Label": "set device temperature",
      "SuccessTransition": "27",
      "TimeoutTransition": "",
      "ErrorTransition": "14",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": {
        "Headers": [],
        "HeadersVariableName": "headers",
        "LogResponse": true,
        "Method": "POST",
        "RequestPayloadType": "json",
        "RequestTemplate": "{\n  \"deviceGuid\": \"{{ variable \"device_guid\" false }}\",\n  \"parameters\": {\n    \"temperatureSet\": {{ variable \"script_output_temperatureSet\" false }}\n  }\n}",
        "RequestVariableName": "script_output",
        "ResponseMapping": [
          {
            "IsVariableGlobal": false,
            "Name": "",
            "Path": "$.parameters.temperatureSet",
            "PathType": "json",
            "TargetVariableName": "device_temp",
            "TargetVariableType": "float"
          },
          {
            "IsVariableGlobal": false,
            "Name": "",
            "Path": "$.parameters.operationMode",
            "PathType": "json",
            "TargetVariableName": "device_mode_index",
            "TargetVariableType": "int"
          },
          {
            "IsVariableGlobal": false,
            "Name": "",
            "Path": "$.parameters.insideTemperature",
            "PathType": "json",
            "TargetVariableName": "temperature",
            "TargetVariableType": "float"
          }
        ],
        "Url": "https://accsmart.panasonic.com/deviceStatus/control"
      },
      "Ui": {
        "nodeType": "",
        "x": 2294,
        "y": 1471
      },
      "TypeAlias": "HTTP msg"
    },
    {
      "Id": "37",
      "Type": "trigger",
      "Label": "get setpoint",
      "SuccessTransition": "28",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "pt:j1/mt:cmd/rt:dev/rn:flow/ad:1/sv:thermostat/ad:O9HaVGhKCqIJcID_0",
      "Service": "thermostat",
      "ServiceInterface": "cmd.setpoint.get_report",
      "Config": {
        "IsValueFilterEnabled": false,
        "LookupServiceNameAndLocation": false,
        "RegisterAsVirtualService": true,
        "Timeout": 0,
        "ValueFilter": {
          "Value": "",
          "ValueType": "bool"
        },
        "VirtualServiceGroup": "ch_0",
        "VirtualServiceProps": {
          "sup_setpoints": [
            "heat",
            "cool",
            "auto"
          ]
        }
      },
      "Ui": {
        "nodeType": "",
        "x": 1221,
        "y": 255
      },
      "TypeAlias": "Trigger"
    },
    {
      "Id": "43",
      "Type": "transform",
      "Label": "",
      "SuccessTransition": "23",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": {
        "Expression": "",
        "IsLVariableGlobal": false,
        "IsRVariableGlobal": false,
        "IsTargetVariableGlobal": false,
        "IsTargetVariableInMemory": true,
        "LVariableName": "",
        "RValue": {
          "Value": 0,
          "ValueType": "int"
        },
        "RVariableName": "",
        "Rtype": "var",
        "TargetVariableName": "",
        "TargetVariableType": "",
        "Template": "{ \"temp\": {{ variable \"device_temp\" false }} }",
        "TransformType": "template",
        "ValueMapping": [],
        "XPathMapping": []
      },
      "Ui": {
        "nodeType": "",
        "x": 1286,
        "y": 679
      },
      "TypeAlias": "Transform"
    },
    {
      "Id": "44",
      "Type": "exec",
      "Label": "get parameter changes",
      "SuccessTransition": "45",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": {
        "Command": "",
        "ExecType": "python",
        "InputVariableName": "script_input",
        "IsInputJson": true,
        "IsInputVariableGlobal": false,
        "IsOutputJson": true,
        "IsOutputVariableGlobal": false,
        "OutputVariableName": "script_output",
        "ScriptBody": "import json\nimport sys\n\ndata=json.loads(sys.argv[1])\n\ndef get_params():\n    params = {\n        \"count\": 0,\n        \"temperatureSet\": data[\"device_temp\"]\n    }\n    \n    if data[\"setpoint_temp\"] > 0 and data[\"setpoint_temp\"] != data[\"device_temp\"]:\n        params[\"count\"] += 1\n        params[\"temperatureSet\"] = data[\"setpoint_temp\"]\n\n    return params\n\ndef load():\n    print(json.dumps(get_params()))\n\nload()"
      },
      "Ui": {
        "nodeType": "",
        "x": 1953,
        "y": 974
      },
      "TypeAlias": "Run script"
    },
    {
      "Id": "45",
      "Type": "transform",
      "Label": "extract pssible changes",
      "SuccessTransition": "46",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": {
        "Expression": "",
        "IsLVariableGlobal": false,
        "IsRVariableGlobal": false,
        "IsTargetVariableGlobal": false,
        "IsTargetVariableInMemory": true,
        "LVariableName": "script_output",
        "RValue": {
          "Value": 0,
          "ValueType": "int"
        },
        "RVariableName": "",
        "Rtype": "var",
        "TargetVariableName": "",
        "TargetVariableType": "",
        "Template": "",
        "TransformType": "jpath",
        "ValueMapping": [
          {
            "LValue": {
              "Value": 0,
              "ValueType": "int"
            },
            "RValue": {
              "Value": 0,
              "ValueType": "int"
            }
          }
        ],
        "XPathMapping": [
          {
            "IsTargetVariableGlobal": false,
            "Path": "$.count",
            "TargetVariableName": "script_output_count",
            "TargetVariableType": "int",
            "UpdateInputVariable": false
          },
          {
            "IsTargetVariableGlobal": false,
            "Path": "$.temperatureSet",
            "TargetVariableName": "script_output_temperatureSet",
            "TargetVariableType": "float",
            "UpdateInputVariable": false
          }
        ]
      },
      "Ui": {
        "nodeType": "",
        "x": 1952,
        "y": 1145
      },
      "TypeAlias": "Transform"
    },
    {
      "Id": "46",
      "Type": "if",
      "Label": "has no changes",
      "SuccessTransition": "",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": {
        "Expression": [
          {
            "BooleanOperator": "",
            "LeftVariableIsGlobal": false,
            "LeftVariableName": "script_output_count",
            "Operand": "eq",
            "RightVariable": {
              "Value": 0,
              "ValueType": "int"
            }
          }
        ],
        "FalseTransition": "36",
        "TrueTransition": "27"
      },
      "Ui": {
        "nodeType": "",
        "x": 1952,
        "y": 1299
      },
      "TypeAlias": "If condition"
    },
    {
      "Id": "47",
      "Type": "transform",
      "Label": "fetch parameters",
      "SuccessTransition": "44",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": {
        "Expression": "",
        "IsLVariableGlobal": false,
        "IsRVariableGlobal": false,
        "IsTargetVariableGlobal": false,
        "LVariableName": "",
        "RValue": {
          "Value": 0,
          "ValueType": "int"
        },
        "RVariableName": "",
        "Rtype": "var",
        "TargetVariableName": "script_input",
        "TargetVariableType": "object",
        "Template": "{ \"device_guid\": \"{{ variable \"device_guid\" false }}\", \"device_temp\": {{ variable \"device_temp\" false }}, \"setpoint_temp\": {{ variable \"setpoint_temp\" false }} }",
        "TransformType": "template",
        "ValueMapping": [],
        "XPathMapping": []
      },
      "Ui": {
        "nodeType": "",
        "x": 1954,
        "y": 794
      },
      "TypeAlias": "Transform"
    },
    {
      "Id": "48",
      "Type": "transform",
      "Label": "",
      "SuccessTransition": "49",
      "TimeoutTransition": "",
      "ErrorTransition": "49",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": {
        "Expression": "",
        "IsLVariableGlobal": false,
        "IsRVariableGlobal": false,
        "IsTargetVariableGlobal": false,
        "LVariableName": "",
        "RValue": {
          "Value": 0,
          "ValueType": "int"
        },
        "RVariableName": "",
        "Rtype": "var",
        "TargetVariableName": "device_guid_mapped",
        "TargetVariableType": "string",
        "Template": "\"{{ variable \"device_guid\" false }}\"",
        "TransformType": "template",
        "ValueMapping": [],
        "XPathMapping": []
      },
      "Ui": {
        "nodeType": "",
        "x": 1783,
        "y": 288
      },
      "TypeAlias": "Transform"
    },
    {
      "Id": "49",
      "Type": "if",
      "Label": "no device_guid",
      "SuccessTransition": "",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": {
        "Expression": [
          {
            "BooleanOperator": "",
            "LeftVariableIsGlobal": false,
            "LeftVariableName": "device_guid_mapped",
            "Operand": "eq",
            "RightVariable": {
              "Value": "",
              "ValueType": "string"
            }
          }
        ],
        "FalseTransition": "47",
        "TrueTransition": "4"
      },
      "Ui": {
        "nodeType": "",
        "x": 1998,
        "y": 288
      },
      "TypeAlias": "If condition"
    }
  ],
  "Settings": {
    "device_id": {
      "Value": "0",
      "ValueType": "int"
    },
    "house_id": {
      "Value": "0",
      "ValueType": "int"
    },
    "password": {
      "Value": "",
      "ValueType": "string"
    },
    "username": {
      "Value": "",
      "ValueType": "string"
    }
  },
  "IsDisabled": false,
  "IsDefault": false,
  "ParallelExecution": "keep_last"
}
1 Like