Skip to content

Instantly share code, notes, and snippets.

@wadewegner
Last active January 23, 2018 23:54
Show Gist options
  • Save wadewegner/3795fedceba80a5226fdcf01f3444bab to your computer and use it in GitHub Desktop.
Save wadewegner/3795fedceba80a5226fdcf01f3444bab to your computer and use it in GitHub Desktop.
{"interaction":{"localVariables":[{"condition":"","dataType":"Number","name":"TEMPERATURE_THRESHOLD","description":"","id":0,"initialValue":"11"},{"condition":"","dataType":"Number","name":"HUMIDITY_THRESHOLD","description":"","id":1,"initialValue":"70"},{"condition":"","dataType":"Number","name":"DOOR_OPEN_LIMIT","description":"","id":2,"initialValue":"3"},{"condition":"Smart_Fridge_Reading__e.door__c = \"open\"","dataType":"Number","name":"door_open_counter","eventSource":"Smart_Fridge_Reading__e","description":"","id":3,"initialValue":"0","value":{"name":"Count","type":"catalog","params":{"$1":"40 sec"}}}],"inputs":[],"states":[{"name":"Always","id":0,"actions":[{"condition":"Smart_Fridge_Reading__e.door__c = \"closed\"","eventSource":"Smart_Fridge_Reading__e","action":[{"name":"reset","params":{"$1":"door_open_counter"},"type":"catalog"}],"description":"","id":0,"state":"","when":{"name":"always","type":"catalog"}}]},{"name":"Default","isInitial":true,"id":1,"actions":[{"condition":"door_open_counter >= DOOR_OPEN_LIMIT","eventSource":"Smart_Fridge_Reading__e","action":[{"inputFieldAssignments":[{"valueExpression":"Smart_Fridge_Reading__e.deviceId__c","field":"deviceId__c","dataType":"Text"},{"valueExpression":"\"Refrigerator Door Open\"","field":"Subject","dataType":"Text"},{"valueExpression":"\"door has been opened for too long\"","field":"Description","dataType":"Text"}],"name":"salesforceObjectCreate","isResponseIngested":false,"recordFilters":[],"responseEvent":"","label":"Create Door Open Case","id":0,"type":"syncOutput","sObjectApiName":"Case"},{"name":"changeState","id":1,"params":{"$1":2},"type":"catalog"}],"description":"","id":0,"state":"","when":{"name":"always","type":"catalog"}},{"condition":"Smart_Fridge_Reading__e.temperature__c >= TEMPERATURE_THRESHOLD","eventSource":"Smart_Fridge_Reading__e","action":[{"inputFieldAssignments":[{"valueExpression":"Smart_Fridge_Reading__e.deviceId__c","field":"deviceId__c","dataType":"Text"},{"valueExpression":"\"Temperature Over Threshold\"","field":"Subject","dataType":"Text"},{"valueExpression":"\"current temperature \" + TEXT(Smart_Fridge_Reading__e.temperature__c) + \" is over threshold\"","field":"Description","dataType":"Text"}],"name":"salesforceObjectCreate","isResponseIngested":false,"recordFilters":[],"responseEvent":"","label":"Create Temperature Case","id":0,"type":"syncOutput","sObjectApiName":"Case"},{"name":"changeState","id":1,"type":"catalog","params":{"$1":3}}],"description":"","state":"","id":1,"when":{"name":"always","type":"catalog"},"transition":""},{"condition":"Smart_Fridge_Reading__e.humidity__c >= HUMIDITY_THRESHOLD","eventSource":"Smart_Fridge_Reading__e","action":[{"inputFieldAssignments":[{"valueExpression":"Smart_Fridge_Reading__e.deviceId__c","field":"deviceId__c","dataType":"Text"},{"valueExpression":"\"Humidity Over Threshold\"","field":"Subject","dataType":"Text"},{"valueExpression":"\"current humidity \" + TEXT(Smart_Fridge_Reading__e.humidity__c) + \" is over threshold\"","field":"Description","dataType":"Text"}],"name":"salesforceObjectCreate","isResponseIngested":false,"recordFilters":[],"responseEvent":"","label":"Create Humidity Case","id":0,"type":"syncOutput","sObjectApiName":"Case"},{"name":"changeState","id":1,"type":"catalog","params":{"$1":4}}],"description":"","state":"","id":2,"when":{"name":"always","type":"catalog"},"transition":""}]},{"name":"Door Open","id":2,"actions":[{"condition":"Smart_Fridge_Reading__e.door__c = \"closed\"","eventSource":"Smart_Fridge_Reading__e","action":[{"name":"changeState","id":0,"params":{"$1":1},"type":"catalog"}],"description":"","id":0,"state":"","when":{"name":"always","type":"catalog"}}]},{"name":" Temperature Over Threshold","id":3,"actions":[{"condition":"Smart_Fridge_Reading__e.temperature__c < TEMPERATURE_THRESHOLD","eventSource":"Smart_Fridge_Reading__e","action":[{"name":"changeState","id":0,"params":{"$1":1},"type":"catalog"}],"description":"","id":0,"state":"","when":{"name":"always","type":"catalog"}}]},{"name":"Humidity Over Threshold","id":4,"actions":[{"condition":"Smart_Fridge_Reading__e.humidity__c < HUMIDITY_THRESHOLD","eventSource":"Smart_Fridge_Reading__e","action":[{"name":"changeState","id":0,"type":"catalog","params":{"$1":1}}],"description":"","state":"","id":0,"when":{"name":"always","type":"catalog"},"transition":""}]}]},"uiProperties":{},"formatVersion":"1.0","properties":{"timezone":"America/Los_Angeles"}}
{
"interaction": {
"localVariables": [
{
"condition": "",
"dataType": "Number",
"name": "TEMPERATURE_THRESHOLD",
"description": "",
"id": 0,
"initialValue": "11"
},
{
"condition": "",
"dataType": "Number",
"name": "HUMIDITY_THRESHOLD",
"description": "",
"id": 1,
"initialValue": "70"
},
{
"condition": "",
"dataType": "Number",
"name": "DOOR_OPEN_LIMIT",
"description": "",
"id": 2,
"initialValue": "3"
},
{
"condition": "Smart_Fridge_Reading__e.door__c = \"open\"",
"dataType": "Number",
"name": "door_open_counter",
"eventSource": "Smart_Fridge_Reading__e",
"description": "",
"id": 3,
"initialValue": "0",
"value": {
"name": "Count",
"type": "catalog",
"params": { "$1": "40 sec" }
}
}
],
"inputs": [],
"states": [
{
"name": "Always",
"id": 0,
"actions": [
{
"condition": "Smart_Fridge_Reading__e.door__c = \"closed\"",
"eventSource": "Smart_Fridge_Reading__e",
"action": [
{
"name": "reset",
"params": { "$1": "door_open_counter" },
"type": "catalog"
}
],
"description": "",
"id": 0,
"state": "",
"when": { "name": "always", "type": "catalog" }
}
]
},
{
"name": "Default",
"isInitial": true,
"id": 1,
"actions": [
{
"condition": "door_open_counter >= DOOR_OPEN_LIMIT",
"eventSource": "Smart_Fridge_Reading__e",
"action": [
{
"inputFieldAssignments": [
{
"valueExpression": "Smart_Fridge_Reading__e.deviceId__c",
"field": "deviceId__c",
"dataType": "Text"
},
{
"valueExpression": "\"Refrigerator Door Open\"",
"field": "Subject",
"dataType": "Text"
},
{
"valueExpression": "\"door has been opened for too long\"",
"field": "Description",
"dataType": "Text"
}
],
"name": "salesforceObjectCreate",
"isResponseIngested": false,
"recordFilters": [],
"responseEvent": "",
"label": "Create Door Open Case",
"id": 0,
"type": "syncOutput",
"sObjectApiName": "Case"
},
{
"name": "changeState",
"id": 1,
"params": { "$1": 2 },
"type": "catalog"
}
],
"description": "",
"id": 0,
"state": "",
"when": { "name": "always", "type": "catalog" }
},
{
"condition":
"Smart_Fridge_Reading__e.temperature__c >= TEMPERATURE_THRESHOLD",
"eventSource": "Smart_Fridge_Reading__e",
"action": [
{
"inputFieldAssignments": [
{
"valueExpression": "Smart_Fridge_Reading__e.deviceId__c",
"field": "deviceId__c",
"dataType": "Text"
},
{
"valueExpression": "\"Temperature Over Threshold\"",
"field": "Subject",
"dataType": "Text"
},
{
"valueExpression":
"\"current temperature \" + TEXT(Smart_Fridge_Reading__e.temperature__c) + \" is over threshold\"",
"field": "Description",
"dataType": "Text"
}
],
"name": "salesforceObjectCreate",
"isResponseIngested": false,
"recordFilters": [],
"responseEvent": "",
"label": "Create Temperature Case",
"id": 0,
"type": "syncOutput",
"sObjectApiName": "Case"
},
{
"name": "changeState",
"id": 1,
"type": "catalog",
"params": { "$1": 3 }
}
],
"description": "",
"state": "",
"id": 1,
"when": { "name": "always", "type": "catalog" },
"transition": ""
},
{
"condition":
"Smart_Fridge_Reading__e.humidity__c >= HUMIDITY_THRESHOLD",
"eventSource": "Smart_Fridge_Reading__e",
"action": [
{
"inputFieldAssignments": [
{
"valueExpression": "Smart_Fridge_Reading__e.deviceId__c",
"field": "deviceId__c",
"dataType": "Text"
},
{
"valueExpression": "\"Humidity Over Threshold\"",
"field": "Subject",
"dataType": "Text"
},
{
"valueExpression":
"\"current humidity \" + TEXT(Smart_Fridge_Reading__e.humidity__c) + \" is over threshold\"",
"field": "Description",
"dataType": "Text"
}
],
"name": "salesforceObjectCreate",
"isResponseIngested": false,
"recordFilters": [],
"responseEvent": "",
"label": "Create Humidity Case",
"id": 0,
"type": "syncOutput",
"sObjectApiName": "Case"
},
{
"name": "changeState",
"id": 1,
"type": "catalog",
"params": { "$1": 4 }
}
],
"description": "",
"state": "",
"id": 2,
"when": { "name": "always", "type": "catalog" },
"transition": ""
}
]
},
{
"name": "Door Open",
"id": 2,
"actions": [
{
"condition": "Smart_Fridge_Reading__e.door__c = \"closed\"",
"eventSource": "Smart_Fridge_Reading__e",
"action": [
{
"name": "changeState",
"id": 0,
"params": { "$1": 1 },
"type": "catalog"
}
],
"description": "",
"id": 0,
"state": "",
"when": { "name": "always", "type": "catalog" }
}
]
},
{
"name": " Temperature Over Threshold",
"id": 3,
"actions": [
{
"condition":
"Smart_Fridge_Reading__e.temperature__c < TEMPERATURE_THRESHOLD",
"eventSource": "Smart_Fridge_Reading__e",
"action": [
{
"name": "changeState",
"id": 0,
"params": { "$1": 1 },
"type": "catalog"
}
],
"description": "",
"id": 0,
"state": "",
"when": { "name": "always", "type": "catalog" }
}
]
},
{
"name": "Humidity Over Threshold",
"id": 4,
"actions": [
{
"condition":
"Smart_Fridge_Reading__e.humidity__c < HUMIDITY_THRESHOLD",
"eventSource": "Smart_Fridge_Reading__e",
"action": [
{
"name": "changeState",
"id": 0,
"type": "catalog",
"params": { "$1": 1 }
}
],
"description": "",
"state": "",
"id": 0,
"when": { "name": "always", "type": "catalog" },
"transition": ""
}
]
}
]
},
"uiProperties": {},
"formatVersion": "1.0",
"properties": { "timezone": "America/Los_Angeles" }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment