Jeg ønsker å sette opp en flow som sender timeline event og notifikasjon når vaskemaskinen er ferdig. (Kan også gjelde oppvaskmaskin eller tørketrommel).
På Slack fikk jeg tilsendt denne flowen av @espen , men jeg er rimelig fersk i TP og forstår ikke helt logikken.
{
"Id": "1ZaSLYgVtYKz7np",
"ClassId": "ovlxwWGguU5GNry",
"Author": "espenh.no",
"Version": 0,
"CreatedAt": "2020-04-05T21:55:52.550388644+02:00",
"UpdatedAt": "2020-06-04T20:10:25.567005324+02:00",
"Name": "meter_elec to timeline&Todoist",
"Group": "VM/TT/OPPV",
"Description": "",
"Nodes": [
{
"Id": "2",
"Type": "if",
"Label": "less than 1",
"SuccessTransition": "",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "",
"Service": "",
"ServiceInterface": "",
"Config": {
"Expression": [
{
"BooleanOperator": "",
"LeftVariableIsGlobal": false,
"LeftVariableName": "",
"Operand": "lt",
"RightVariable": {
"Value": 1,
"ValueType": "float"
}
}
],
"FalseTransition": "",
"TrueTransition": "7"
},
"Ui": {
"nodeType": "",
"x": 492,
"y": 331
},
"TypeAlias": "If condition"
},
{
"Id": "6",
"Type": "action",
"Label": "Publish timeline",
"SuccessTransition": "23",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "pt:j1/mt:cmd/rt:app/rn:time_owl/ad:1",
"Service": "time_owl",
"ServiceInterface": "cmd.timeline.set",
"Config": {
"DefaultValue": {
"Value": {
"message_en": "Washer finished",
"message_no": "-Vaskemaskinen er ferdig",
"sender": "flow"
},
"ValueType": "str_map"
},
"IsVariableGlobal": false,
"Props": {},
"RegisterAsVirtualService": false,
"VariableName": "",
"VirtualServiceGroup": "",
"VirtualServiceProps": {}
},
"Ui": {
"nodeType": "timeline_action",
"x": 492,
"y": 803
},
"TypeAlias": "Timeline"
},
{
"Id": "7",
"Type": "wait",
"Label": "wait 5 min",
"SuccessTransition": "27",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "",
"Service": "",
"ServiceInterface": "",
"Config": 300000,
"Ui": {
"nodeType": "",
"x": 493,
"y": 488
},
"TypeAlias": "Delay"
},
{
"Id": "11",
"Type": "if",
"Label": "less than 1",
"SuccessTransition": "",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "",
"Service": "",
"ServiceInterface": "",
"Config": {
"Expression": [
{
"BooleanOperator": "",
"LeftVariableIsGlobal": false,
"LeftVariableName": "",
"Operand": "lt",
"RightVariable": {
"Value": 1,
"ValueType": "float"
}
}
],
"FalseTransition": "",
"TrueTransition": "30"
},
"Ui": {
"nodeType": "",
"x": 693,
"y": 337
},
"TypeAlias": "If condition"
},
{
"Id": "12",
"Type": "if",
"Label": "less than 1",
"SuccessTransition": "",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "",
"Service": "",
"ServiceInterface": "",
"Config": {
"Expression": [
{
"BooleanOperator": "",
"LeftVariableIsGlobal": false,
"LeftVariableName": "",
"Operand": "lt",
"RightVariable": {
"Value": 1,
"ValueType": "float"
}
}
],
"FalseTransition": "",
"TrueTransition": "31"
},
"Ui": {
"nodeType": "",
"x": 912,
"y": 341
},
"TypeAlias": "If condition"
},
{
"Id": "19",
"Type": "action",
"Label": "Publish timeline",
"SuccessTransition": "25",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "pt:j1/mt:cmd/rt:app/rn:time_owl/ad:1",
"Service": "time_owl",
"ServiceInterface": "cmd.timeline.set",
"Config": {
"DefaultValue": {
"Value": {
"message_en": "Dryer finished",
"message_no": "-Tørketrommelen ferdig",
"sender": "flow"
},
"ValueType": "str_map"
},
"IsVariableGlobal": false,
"Props": {},
"RegisterAsVirtualService": false,
"VariableName": "",
"VirtualServiceGroup": "",
"VirtualServiceProps": {}
},
"Ui": {
"nodeType": "timeline_action",
"x": 708,
"y": 814
},
"TypeAlias": "Timeline"
},
{
"Id": "20",
"Type": "action",
"Label": "Publish timeline",
"SuccessTransition": "24",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "pt:j1/mt:cmd/rt:app/rn:time_owl/ad:1",
"Service": "time_owl",
"ServiceInterface": "cmd.timeline.set",
"Config": {
"DefaultValue": {
"Value": {
"message_en": "Dishwasher finished",
"message_no": "-Oppvaskmaskinen er ferdig",
"sender": "flow"
},
"ValueType": "str_map"
},
"IsVariableGlobal": false,
"Props": {},
"RegisterAsVirtualService": false,
"VariableName": "",
"VirtualServiceGroup": "",
"VirtualServiceProps": {}
},
"Ui": {
"nodeType": "timeline_action",
"x": 925,
"y": 818
},
"TypeAlias": "Timeline"
},
{
"Id": "21",
"Type": "trigger",
"Label": "vm_finished",
"SuccessTransition": "2",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "pt:j1/mt:evt/rt:dev/rn:zw/ad:1/sv:meter_elec/ad:55_0",
"Service": "meter_elec",
"ServiceInterface": "evt.meter.report",
"Config": {
"IsValueFilterEnabled": false,
"LookupServiceNameAndLocation": false,
"RegisterAsVirtualService": false,
"Timeout": 0,
"ValueFilter": {
"Value": "",
"ValueType": ""
},
"VirtualServiceGroup": "ch_0",
"VirtualServiceProps": {}
},
"Ui": {
"nodeType": "",
"x": 488,
"y": 172
},
"TypeAlias": "Trigger"
},
{
"Id": "22",
"Type": "trigger",
"Label": "tt_finished",
"SuccessTransition": "11",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "pt:j1/mt:evt/rt:dev/rn:zw/ad:1/sv:meter_elec/ad:54_0",
"Service": "meter_elec",
"ServiceInterface": "evt.meter.report",
"Config": {
"IsValueFilterEnabled": false,
"LookupServiceNameAndLocation": false,
"RegisterAsVirtualService": false,
"Timeout": 0,
"ValueFilter": {
"Value": "",
"ValueType": ""
},
"VirtualServiceGroup": "ch_0",
"VirtualServiceProps": {}
},
"Ui": {
"nodeType": "",
"x": 699,
"y": 173
},
"TypeAlias": "Trigger"
},
{
"Id": "23",
"Type": "action",
"Label": "Push notification",
"SuccessTransition": "",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "pt:j1/mt:evt/rt:app/rn:kind_owl/ad:1",
"Service": "kind-owl",
"ServiceInterface": "evt.notification.report",
"Config": {
"DefaultValue": {
"Value": {
"EventName": "custom",
"MessageContent": "Vaskemaskinen er ferdig",
"SiteId": "f8976a62-a96c-4555-9af0-875a471eb74b"
},
"ValueType": "object"
},
"IsVariableGlobal": false,
"Props": {},
"RegisterAsVirtualService": false,
"VariableName": "",
"VirtualServiceGroup": "",
"VirtualServiceProps": {}
},
"Ui": {
"nodeType": "notification_action",
"x": 487,
"y": 956
},
"TypeAlias": "Notification"
},
{
"Id": "24",
"Type": "action",
"Label": "Push notification",
"SuccessTransition": "",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "pt:j1/mt:evt/rt:app/rn:kind_owl/ad:1",
"Service": "kind-owl",
"ServiceInterface": "evt.notification.report",
"Config": {
"DefaultValue": {
"Value": {
"EventName": "custom",
"MessageContent": "Oppvaskmaskinen er ferdig",
"SiteId": "f8976a62-a96c-4555-9af0-875a471eb74b"
},
"ValueType": "object"
},
"IsVariableGlobal": false,
"Props": {},
"RegisterAsVirtualService": false,
"VariableName": "",
"VirtualServiceGroup": "",
"VirtualServiceProps": {}
},
"Ui": {
"nodeType": "notification_action",
"x": 930,
"y": 974
},
"TypeAlias": "Notification"
},
{
"Id": "25",
"Type": "action",
"Label": "Push notification",
"SuccessTransition": "",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "pt:j1/mt:evt/rt:app/rn:kind_owl/ad:1",
"Service": "kind-owl",
"ServiceInterface": "evt.notification.report",
"Config": {
"DefaultValue": {
"Value": {
"EventName": "custom",
"MessageContent": "Tørketrommelen er ferdig",
"SiteId": "f8976a62-a96c-4555-9af0-875a471eb74b"
},
"ValueType": "object"
},
"IsVariableGlobal": false,
"Props": {},
"RegisterAsVirtualService": false,
"VariableName": "",
"VirtualServiceGroup": "",
"VirtualServiceProps": {}
},
"Ui": {
"nodeType": "notification_action",
"x": 703,
"y": 965
},
"TypeAlias": "Notification"
},
{
"Id": "26",
"Type": "trigger",
"Label": "oppv_finished",
"SuccessTransition": "12",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "pt:j1/mt:evt/rt:dev/rn:zw/ad:1/sv:meter_elec/ad:56_0",
"Service": "meter_elec",
"ServiceInterface": "evt.meter.report",
"Config": {
"IsValueFilterEnabled": false,
"LookupServiceNameAndLocation": false,
"RegisterAsVirtualService": false,
"Timeout": 0,
"ValueFilter": {
"Value": "",
"ValueType": ""
},
"VirtualServiceGroup": "ch_0",
"VirtualServiceProps": {}
},
"Ui": {
"nodeType": "",
"x": 916,
"y": 176
},
"TypeAlias": "Trigger"
},
{
"Id": "27",
"Type": "rest_action",
"Label": "rest_action to todoist api",
"SuccessTransition": "6",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "",
"Service": "",
"ServiceInterface": "",
"Config": {
"Auth": {
"ClientID": "",
"ClientSecret": "",
"Enabled": false,
"GrantType": "password",
"Password": "",
"Scope": "",
"Url": "http://",
"Username": ""
},
"Headers": [
{
"Name": "Content-type",
"Value": "application/json"
},
{
"Name": "Authorization",
"Value": "Bearer TOKEN HERE"
}
],
"LogResponse": false,
"Method": "POST",
"RequestPayloadType": "json",
"RequestTemplate": "{\n \"content\": \"Vaskemaskin ferdig\",\n \"project_id\": 2232794671,\n \"section_id\": 9158562,\n \"due_string\": \"today at 22\",\n \"due_lang\": \"en\",\n \"priority\": 2\n }",
"ResponseMapping": [],
"Url": "https://api.todoist.com/rest/v1/tasks"
},
"Ui": {
"nodeType": "",
"x": 490,
"y": 644
},
"TypeAlias": "HTTP msg"
},
{
"Id": "28",
"Type": "rest_action",
"Label": "rest_action to todoist api",
"SuccessTransition": "19",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "",
"Service": "",
"ServiceInterface": "",
"Config": {
"Auth": {
"ClientID": "",
"ClientSecret": "",
"Enabled": false,
"GrantType": "password",
"Password": "",
"Scope": "",
"Url": "http://",
"Username": ""
},
"Headers": [
{
"Name": "Content-type",
"Value": "application/json"
},
{
"Name": "Authorization",
"Value": "Bearer TOKEN HERE"
}
],
"LogResponse": false,
"Method": "POST",
"RequestPayloadType": "json",
"RequestTemplate": "{\n \"content\": \"Tørketrommel ferdig\",\n \"project_id\": 2232794671,\n \"section_id\": 9158562,\n \"due_string\": \"today at 22\",\n \"due_lang\": \"en\",\n \"priority\": 2\n }",
"ResponseMapping": [],
"Url": "https://api.todoist.com/rest/v1/tasks"
},
"Ui": {
"nodeType": "",
"x": 702,
"y": 646
},
"TypeAlias": "HTTP msg"
},
{
"Id": "29",
"Type": "rest_action",
"Label": "rest_action to todoist api",
"SuccessTransition": "20",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "",
"Service": "",
"ServiceInterface": "",
"Config": {
"Auth": {
"ClientID": "",
"ClientSecret": "",
"Enabled": false,
"GrantType": "password",
"Password": "",
"Scope": "",
"Url": "http://",
"Username": ""
},
"Headers": [
{
"Name": "Content-type",
"Value": "application/json"
},
{
"Name": "Authorization",
"Value": "Bearer TOKEN HERE"
}
],
"LogResponse": false,
"Method": "POST",
"RequestPayloadType": "json",
"RequestTemplate": "{\n \"content\": \"Oppvaskmaskin ferdig\",\n \"project_id\": 2232794671,\n \"section_id\": 9158562,\n \"due_string\": \"today at 22\",\n \"due_lang\": \"en\",\n \"priority\": 2\n }",
"ResponseMapping": [],
"Url": "https://api.todoist.com/rest/v1/tasks"
},
"Ui": {
"nodeType": "",
"x": 921,
"y": 651
},
"TypeAlias": "HTTP msg"
},
{
"Id": "30",
"Type": "wait",
"Label": "wait 5 min",
"SuccessTransition": "28",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "",
"Service": "",
"ServiceInterface": "",
"Config": 300000,
"Ui": {
"nodeType": "",
"x": 692,
"y": 488
},
"TypeAlias": "Delay"
},
{
"Id": "31",
"Type": "wait",
"Label": "wait 5 min",
"SuccessTransition": "29",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "",
"Service": "",
"ServiceInterface": "",
"Config": 300000,
"Ui": {
"nodeType": "",
"x": 912,
"y": 497
},
"TypeAlias": "Delay"
}
],
"Settings": null,
"IsDisabled": true,
"IsDefault": false,
"ParallelExecution": "keep_last"
}
Spørsmålene mine:
-
Hvordan setter jeg triggeren til å kun kjøre etter en vask når wallpluggen har nådd 0W (slik at den ikke kjører kontinuerlig når den ikke er i bruk hvis device rapporterer 0W)
-
Jeg ser at Espen har laget en if variabel etter triggeren som baserer seg på “input value”. Er det slik at verdier lest i trigger(evt.meter.report) alltid lagres i flowen og vil kunne hentes opp senere innad i samme flow?