Skip to content

Instantly share code, notes, and snippets.

@alivinco
Last active July 27, 2020 10:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alivinco/ee8b1ca14b93d18055531650ea7ca4ca to your computer and use it in GitHub Desktop.
Save alivinco/ee8b1ca14b93d18055531650ea7ca4ca to your computer and use it in GitHub Desktop.
{
"Id": "JzzGQqO90HtDMsC",
"ClassId": "Rn9keoAamHlK7lg",
"Author": "",
"Version": 0,
"CreatedAt": "2020-03-12T17:35:03.974671693+01:00",
"UpdatedAt": "2020-03-12T17:35:03.974671693+01:00",
"Name": "corona-monitor",
"Group": "virtual",
"Description": "",
"Nodes": [
{
"Id": "1",
"Type": "trigger",
"Label": "Manual trigger",
"SuccessTransition": "3",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "pt:j1/mt:cmd/rt:dev/rn:flow/ad:1/sv:out_bin_switch/ad:JzzGQqO90HtDMsC_0",
"Service": "out_bin_switch",
"ServiceInterface": "cmd.binary.set",
"Config": {
"InputVariableType": "",
"IsValueFilterEnabled": false,
"LookupServiceNameAndLocation": false,
"RegisterAsVirtualService": false,
"Timeout": 0,
"ValueFilter": {
"Value": null,
"ValueType": "bool"
},
"ValueJPath": "",
"ValueJPathResultType": "",
"VirtualServiceGroup": "",
"VirtualServiceProps": null
},
"Ui": {
"nodeType": "",
"x": 89,
"y": 164
}
},
{
"Id": "2",
"Type": "time_trigger",
"Label": "Every 20 minutes",
"SuccessTransition": "3",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "",
"Service": "",
"ServiceInterface": "",
"Config": {
"DefaultMsg": {
"Value": "",
"ValueType": ""
},
"Expressions": [
{
"Comments": "",
"Expression": "@every 20m",
"Name": ""
}
],
"GenerateAstroTimeEvents": false,
"Latitude": 0,
"Longitude": 0,
"SunriseTimeOffset": 0,
"SunsetTimeOffset": 0
},
"Ui": {
"nodeType": "",
"x": 436,
"y": 172
}
},
{
"Id": "3",
"Type": "rest_action",
"Label": "Get data from VG.no",
"SuccessTransition": "7",
"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": "Accept",
"Value": "application/json, text/javascript, */*; q=0.01"
}
],
"LogResponse": false,
"Method": "GET",
"RequestPayloadType": "json",
"RequestTemplate": "",
"ResponseMapping": [
{
"IsVariableGlobal": false,
"Name": "total",
"Path": "$.totals.confirmed",
"PathType": "json",
"TargetVariableName": "corona.total.new",
"TargetVariableType": "int"
},
{
"IsVariableGlobal": false,
"Name": "dead",
"Path": "$.totals.dead",
"PathType": "json",
"TargetVariableName": "corona.dead.new",
"TargetVariableType": "int"
}
],
"Url": "https://www.vg.no/spesial/2020/corona-viruset/data/norway-table-overview/?region=municipality"
},
"Ui": {
"nodeType": "",
"x": 232,
"y": 391
}
},
{
"Id": "4",
"Type": "if",
"Label": "Notify if delta is above 100",
"SuccessTransition": "",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "",
"Service": "",
"ServiceInterface": "",
"Config": {
"Expression": [
{
"BooleanOperator": "",
"LeftVariableIsGlobal": false,
"LeftVariableName": "corona.total.delta",
"Operand": "gt",
"RightVariable": {
"Value": 100,
"ValueType": "int"
}
}
],
"FalseTransition": "",
"TrueTransition": "9"
},
"Ui": {
"nodeType": "",
"x": 217,
"y": 787
}
},
{
"Id": "6",
"Type": "transform",
"Label": "Update total variable",
"SuccessTransition": "10",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "",
"Service": "",
"ServiceInterface": "",
"Config": {
"Expression": "variable",
"IsLVariableGlobal": false,
"IsRVariableGlobal": false,
"IsTargetVariableGlobal": true,
"LVariableName": "corona.total.new",
"RValue": {
"Value": 0,
"ValueType": "int"
},
"RVariableName": "",
"Rtype": "var",
"TargetVariableName": "corona.total",
"TargetVariableType": "int",
"Template": "",
"TransformType": "calc",
"ValueMapping": [],
"XPathMapping": []
},
"Ui": {
"nodeType": "",
"x": 173,
"y": 1432
}
},
{
"Id": "7",
"Type": "transform",
"Label": "Calculate delta",
"SuccessTransition": "4",
"TimeoutTransition": "",
"ErrorTransition": "11",
"Address": "",
"Service": "",
"ServiceInterface": "",
"Config": {
"Expression": "[corona.total.new] - [corona.total]",
"IsLVariableGlobal": false,
"IsRVariableGlobal": false,
"IsTargetVariableGlobal": false,
"LVariableName": "",
"RValue": {
"Value": 0,
"ValueType": "int"
},
"RVariableName": "",
"Rtype": "var",
"TargetVariableName": "corona.total.delta",
"TargetVariableType": "int",
"Template": "",
"TransformType": "calc",
"ValueMapping": [],
"XPathMapping": []
},
"Ui": {
"nodeType": "",
"x": 270,
"y": 573
}
},
{
"Id": "8",
"Type": "action",
"Label": "Push notification",
"SuccessTransition": "6",
"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": "Hello world",
"SiteId": ""
},
"ValueType": "object"
},
"IsVariableGlobal": false,
"Props": {},
"RegisterAsVirtualService": false,
"VariableName": "notification.msg",
"VariableType": "object",
"VirtualServiceGroup": "",
"VirtualServiceProps": {}
},
"Ui": {
"nodeType": "notification_action",
"x": 177,
"y": 1226
}
},
{
"Id": "9",
"Type": "transform",
"Label": "Create notification",
"SuccessTransition": "8",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "",
"Service": "",
"ServiceInterface": "",
"Config": {
"Expression": "",
"IsLVariableGlobal": false,
"IsRVariableGlobal": false,
"IsTargetVariableGlobal": false,
"LVariableName": "corona.total.new",
"RValue": {
"Value": 0,
"ValueType": "int"
},
"RVariableName": "",
"Rtype": "var",
"TargetVariableName": "notification.msg",
"TargetVariableType": "object",
"Template": "{\n \"EventName\": \"custom\",\n \"MessageContent\": \"New corona update . Number of infected people = {{.Variable}}\",\n \"SiteId\": \"replace_with_your_site_id\"\n }",
"TransformType": "template",
"ValueMapping": [],
"XPathMapping": []
},
"Ui": {
"nodeType": "",
"x": 165,
"y": 1004
}
},
{
"Id": "10",
"Type": "action",
"Label": "Hue visual alarm indicator",
"SuccessTransition": "",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "pt:j1/mt:cmd/rt:dev/rn:hue/ad:1/sv:scene_ctrl/ad:l4_0",
"Service": "scene_ctrl",
"ServiceInterface": "cmd.scene.set",
"Config": {
"DefaultValue": {
"Value": "lselect",
"ValueType": "string"
},
"IsVariableGlobal": false,
"Props": {},
"RegisterAsVirtualService": false,
"ResponseToTopic": "",
"VariableName": "",
"VirtualServiceGroup": "",
"VirtualServiceProps": {}
},
"Ui": {
"nodeType": "",
"x": 174,
"y": 1666
}
},
{
"Id": "11",
"Type": "set_variable",
"Label": "Init corona total variable",
"Address": "",
"Service": "",
"ServiceInterface": "",
"SuccessTransition": "",
"ErrorTransition": "",
"Config": {
"Name": "corona.total",
"UpdateGlobal": true,
"UpdateInputMsg": false,
"DefaultValue": {
"Value": 0,
"ValueType": "int"
}
},
"Ui": {
"x": 429,
"y": 787,
"nodeType": ""
}
}
],
"IsDisabled": false,
"ParallelExecution": "parallel"
}
@alivinco
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment