Socket
Socket
Sign inDemoInstall

@semilimes/node-red-semilimes

Package Overview
Dependencies
34
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.9.11 to 0.10.1

image.png

233

examples/Connect To semilimes flow.json

@@ -14,6 +14,6 @@ [

"z": "60aa84f35b43b2ca",
"name": "Step 2: Configure 'Connector' property of the 'Intent' and 'send to semilimes' nodes to setup connection to semilimes",
"name": "Step 2: Configure 'Connector' property of the 'sender' nodes to setup connection to semilimes",
"info": "",
"x": 470,
"y": 200,
"x": 400,
"y": 260,
"wires": []

@@ -32,13 +32,19 @@ },

{
"id": "d4de6f11dccae0bc",
"id": "ef89bf5a8213f87a",
"type": "comment",
"z": "60aa84f35b43b2ca",
"name": "Step 1: Get an API key on semilimes.com",
"info": "",
"x": 240,
"y": 160,
"wires": []
},
{
"id": "bc415d83127f39d3",
"type": "inject",
"z": "60aa84f35b43b2ca",
"name": "Inject2",
"name": "START",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}

@@ -54,6 +60,6 @@ ],

"x": 130,
"y": 440,
"y": 320,
"wires": [
[
"3e039ea227cd7a5c"
"dc1f7a971bb4acd8"
]

@@ -63,25 +69,20 @@ ]

{
"id": "3e039ea227cd7a5c",
"type": "sme-comp-text",
"id": "cde509588ef91d55",
"type": "comment",
"z": "60aa84f35b43b2ca",
"name": "",
"text": "First message sent by NodeRED example flow!",
"textType": "str",
"x": 290,
"y": 440,
"wires": [
[
"205a9aa0495ba053"
]
]
"name": "Step 3: In your semilimes app, login with your subaccount and check the new channel and its message",
"info": "",
"x": 430,
"y": 480,
"wires": []
},
{
"id": "205a9aa0495ba053",
"type": "sme-main-intent",
"id": "dc1f7a971bb4acd8",
"type": "sender",
"z": "60aa84f35b43b2ca",
"connector": "",
"async": "0",
"name": "",
"autoName": "",
"connector": "",
"actionName": "channel_message_send",
"actionText": "Channel - Send Message",
"actionName": "channel_create",
"actionText": "Channel - Create",
"recipientId": "",

@@ -99,9 +100,12 @@ "recipientIdType": "str",

"channelIdType": "str",
"title": "",
"title": "newChannel",
"titleType": "str",
"x": 640,
"y": 440,
"saveLocation": "savedChannelId",
"saveLocationType": "msg",
"logToConsole": false,
"x": 370,
"y": 320,
"wires": [
[
"028f3c55a5df0dfe"
"141e68d68b41be19"
]

@@ -111,69 +115,36 @@ ]

{
"id": "028f3c55a5df0dfe",
"type": "sme-main-sender",
"id": "141e68d68b41be19",
"type": "message",
"z": "60aa84f35b43b2ca",
"connector": "",
"async": "0",
"x": 990,
"y": 440,
"wires": [
[]
]
},
{
"id": "ef89bf5a8213f87a",
"type": "comment",
"z": "60aa84f35b43b2ca",
"name": "Step 1: Get an API key on semilimes.com",
"info": "",
"x": 240,
"y": 160,
"wires": []
},
{
"id": "3098c1296a8f2791",
"type": "comment",
"z": "60aa84f35b43b2ca",
"name": "Step 3: Select a channel title in the 'intent' node and trigger this flow to create a new channel to start sending messages from this client",
"info": "",
"x": 530,
"y": 260,
"wires": []
},
{
"id": "056b11cb8540c85c",
"type": "comment",
"z": "60aa84f35b43b2ca",
"name": "Step 4: Configure the intent node and search for the new created channel in the list. Trigger it to send a message",
"info": "",
"x": 460,
"name": "",
"message": "text",
"text": "My first message from node-RED!",
"textType": "str",
"html": "<b>This is an html message</b>",
"htmlType": "str",
"fileIds": "",
"fileIdsType": "str",
"contactIds": "",
"contactIdsType": "str",
"locationName": "myLocation",
"locationNameType": "str",
"latitude": "",
"latitudeType": "str",
"longitude": "",
"longitudeType": "str",
"url": "",
"urlType": "str",
"enableFullScreenView": "1",
"viewSize": "1:2",
"channelId": "",
"channelIdType": "str",
"tunnelId": "",
"tunnelIdType": "str",
"formLocation": "savedForm",
"formLocationType": "flow",
"x": 130,
"y": 400,
"wires": []
},
{
"id": "bc415d83127f39d3",
"type": "inject",
"z": "60aa84f35b43b2ca",
"name": "Inject1",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 130,
"y": 320,
"wires": [
[
"e2ac93d75c372525"
"e4ac8b169e893b7a"
]

@@ -183,10 +154,10 @@ ]

{
"id": "e2ac93d75c372525",
"type": "sme-main-intent",
"id": "e4ac8b169e893b7a",
"type": "sender",
"z": "60aa84f35b43b2ca",
"connector": "",
"async": "0",
"name": "",
"autoName": "",
"connector": "",
"actionName": "channel_create",
"actionText": "Channel - Create",
"actionName": "channel_message_send",
"actionText": "Channel - Send Message",
"recipientId": "",

@@ -198,59 +169,19 @@ "recipientIdType": "str",

"limitType": "num",
"recipientIds": "f9e9d4f3-380c-49dd-b2fe-8ac2ef5c9d61",
"recipientIds": "",
"recipientIdsType": "str",
"groupChatId": "",
"groupChatIdType": "str",
"channelId": "",
"channelIdType": "str",
"title": "myNewChannel",
"channelId": "savedChannelId",
"channelIdType": "msg",
"title": "",
"titleType": "str",
"saveLocation": "savedMessageId",
"saveLocationType": "msg",
"logToConsole": false,
"x": 350,
"y": 320,
"y": 400,
"wires": [
[
"c59b28f83f5b6b80"
]
[]
]
},
{
"id": "c59b28f83f5b6b80",
"type": "sme-main-sender",
"z": "60aa84f35b43b2ca",
"connector": "",
"async": "0",
"x": 630,
"y": 320,
"wires": [
[
"43527716046f05d4"
]
]
},
{
"id": "43527716046f05d4",
"type": "debug",
"z": "60aa84f35b43b2ca",
"name": "Get Created Channel",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "_sme.responseMsgs[0].data",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 880,
"y": 320,
"wires": []
},
{
"id": "cde509588ef91d55",
"type": "comment",
"z": "60aa84f35b43b2ca",
"name": "Step 5: In your semilimes app, login with your subaccount and check the new message in the channel",
"info": "",
"x": 420,
"y": 520,
"wires": []
}
]

@@ -11,20 +11,2 @@ [

{
"id": "c96f4fe387066a5d",
"type": "group",
"z": "03f230443c464b5e",
"name": "Local processing",
"style": {
"label": true
},
"nodes": [
"e209e805b09415e8",
"bc637f7410c849d5",
"936084037c176bf7"
],
"x": 74,
"y": 659,
"w": 652,
"h": 82
},
{
"id": "956f9a128667a6f0",

@@ -40,13 +22,29 @@ "type": "comment",

{
"id": "95fea712dc60ba78",
"id": "3f090137152dcd32",
"type": "comment",
"z": "03f230443c464b5e",
"name": "Setup a form and its components",
"info": "",
"x": 210,
"y": 140,
"wires": []
},
{
"id": "e7a8a880c6b45291",
"type": "comment",
"z": "03f230443c464b5e",
"name": "Catch submission values of the form",
"info": "",
"x": 200,
"y": 360,
"wires": []
},
{
"id": "90fc77df92c915ec",
"type": "inject",
"z": "03f230443c464b5e",
"name": "Send New Form Message",
"name": "START",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}

@@ -60,8 +58,8 @@ ],

"payload": "",
"payloadType": "date",
"x": 210,
"y": 240,
"payloadType": "str",
"x": 130,
"y": 180,
"wires": [
[
"cc54de98776d42c8"
"b0457e1234daea35"
]

@@ -71,14 +69,27 @@ ]

{
"id": "bb5ce74ccf794b08",
"type": "sme-formComp-label",
"id": "b0457e1234daea35",
"type": "formSetup",
"z": "03f230443c464b5e",
"name": "Lamp Control Panel",
"reference": "myLampLabel",
"referenceType": "str",
"title": "Lamp control panel",
"x": 700,
"y": 240,
"connector": "",
"name": "",
"saveLocation": "#:(file)::savedForm",
"saveLocationType": "flow",
"submitEnabled": "0",
"retainStatus": "1",
"submitText": "Submit",
"submitTextType": "str",
"recipientId": "",
"recipientIdType": "str",
"groupChatId": "",
"groupChatIdType": "str",
"channelId": "",
"channelIdType": "str",
"receiverType": "none",
"refName": "myLampForm",
"refNameType": "str",
"x": 390,
"y": 180,
"wires": [
[
"b1a1442954404377"
"e7ceccba1f668321"
]

@@ -88,17 +99,39 @@ ]

{
"id": "b1a1442954404377",
"type": "sme-formComp-switch",
"id": "e7ceccba1f668321",
"type": "formComponent",
"z": "03f230443c464b5e",
"name": "Lamp Switch",
"reference": "myLampSwitch",
"name": "",
"reference": "lampLabel",
"referenceType": "str",
"title": "Switch",
"component": "label",
"title": "Lamp Control Panel",
"titleType": "str",
"value": "lampSwitchValue",
"valueType": "msg",
"x": 670,
"y": 280,
"required": "false",
"requiredType": "bool",
"text": "",
"textType": "str",
"verticalList": "true",
"verticalListType": "bool",
"buttons": [],
"choices": [],
"switchValue": "false",
"switchValueType": "bool",
"sliderMin": 0,
"sliderMinType": "num",
"sliderMax": 10,
"sliderMaxType": "num",
"sliderStep": 0,
"sliderStepType": "num",
"sliderValue": 0,
"sliderValueType": "num",
"actionButtonTitle": "Select",
"actionButtonTitleType": "str",
"multiSelection": "false",
"multiSelectionType": "bool",
"bucketFilter": "all",
"x": 440,
"y": 220,
"wires": [
[
"9ad0a71ac177ad94"
"5c67027a550b710a"
]

@@ -108,24 +141,39 @@ ]

{
"id": "9ad0a71ac177ad94",
"type": "sme-formComp-slider",
"id": "5c67027a550b710a",
"type": "formComponent",
"z": "03f230443c464b5e",
"name": "Lamp Dimmer",
"reference": "myLampDimmer",
"name": "",
"reference": "lampSwitch",
"referenceType": "str",
"title": "Dimmer",
"component": "switch",
"title": "On/Off",
"titleType": "str",
"required": "0",
"value": "lampDimmerValue",
"valueType": "msg",
"min": "0",
"minType": "num",
"max": 10,
"maxType": "num",
"step": "1",
"stepType": "num",
"x": 680,
"y": 320,
"required": "false",
"requiredType": "bool",
"text": "",
"textType": "str",
"verticalList": "true",
"verticalListType": "bool",
"buttons": [],
"choices": [],
"switchValue": "false",
"switchValueType": "bool",
"sliderMin": 0,
"sliderMinType": "num",
"sliderMax": 10,
"sliderMaxType": "num",
"sliderStep": 0,
"sliderStepType": "num",
"sliderValue": 0,
"sliderValueType": "num",
"actionButtonTitle": "Select",
"actionButtonTitleType": "str",
"multiSelection": "false",
"multiSelectionType": "bool",
"bucketFilter": "all",
"x": 430,
"y": 260,
"wires": [
[
"0b2bb1bf856bf412"
"dbaf74245d994ed9"
]

@@ -135,20 +183,39 @@ ]

{
"id": "a56f9ae41e78f648",
"type": "sme-comp-form",
"id": "dbaf74245d994ed9",
"type": "formComponent",
"z": "03f230443c464b5e",
"name": "Lamp Form",
"submitEnabled": "0",
"retainStatus": "1",
"submitText": "Submit",
"submitTextType": "str",
"receiverId": "",
"receiverIdType": "str",
"receiverType": "none",
"refName": "formReference",
"refNameType": "msg",
"x": 490,
"y": 240,
"name": "",
"reference": "lampDimmer",
"referenceType": "str",
"component": "slider",
"title": "Brightness",
"titleType": "str",
"required": "false",
"requiredType": "bool",
"text": "",
"textType": "str",
"verticalList": "true",
"verticalListType": "bool",
"buttons": [],
"choices": [],
"switchValue": "false",
"switchValueType": "bool",
"sliderMin": 0,
"sliderMinType": "num",
"sliderMax": 10,
"sliderMaxType": "num",
"sliderStep": "1",
"sliderStepType": "num",
"sliderValue": 0,
"sliderValueType": "num",
"actionButtonTitle": "Select",
"actionButtonTitleType": "str",
"multiSelection": "false",
"multiSelectionType": "bool",
"bucketFilter": "all",
"x": 430,
"y": 300,
"wires": [
[
"bb5ce74ccf794b08"
"c09de169b9f32be1"
]

@@ -158,6 +225,10 @@ ]

{
"id": "6cc5dfcca8f2f468",
"type": "sme-main-intent",
"id": "f2e6da331084d27b",
"type": "sender",
"z": "03f230443c464b5e",
"actionName": "channel_message_send",
"connector": "",
"async": "0",
"name": "",
"actionName": "channel_create",
"actionText": "Channel - Create",
"recipientId": "",

@@ -175,7 +246,12 @@ "recipientIdType": "str",

"channelIdType": "str",
"x": 1090,
"y": 320,
"title": "lampChannel",
"titleType": "str",
"saveLocation": "#:(file)::savedChannelId",
"saveLocationType": "flow",
"logToConsole": false,
"x": 950,
"y": 180,
"wires": [
[
"7ec6477b8ee0a3e8"
"7989acea16e68a4f"
]

@@ -185,63 +261,27 @@ ]

{
"id": "f70dfda88b877f69",
"type": "debug",
"id": "c09de169b9f32be1",
"type": "switch",
"z": "03f230443c464b5e",
"name": "debug 50",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1240,
"y": 400,
"wires": []
},
{
"id": "7ec6477b8ee0a3e8",
"type": "sme-main-sender",
"z": "03f230443c464b5e",
"connector": "",
"async": "0",
"x": 1170,
"y": 360,
"wires": [
[
"f70dfda88b877f69"
]
]
},
{
"id": "cc54de98776d42c8",
"type": "change",
"z": "03f230443c464b5e",
"name": "Set default form values",
"name": "First run?",
"property": "#:(file)::savedChannelId",
"propertyType": "flow",
"rules": [
{
"t": "set",
"p": "lampSwitchValue",
"pt": "msg",
"to": "true",
"tot": "bool"
"t": "null"
},
{
"t": "set",
"p": "lampDimmerValue",
"pt": "msg",
"to": "5",
"tot": "num"
"t": "else"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 200,
"y": 300,
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 700,
"y": 180,
"wires": [
[
"91ca047551d8ae8a"
"f2e6da331084d27b"
],
[
"7989acea16e68a4f"
]

@@ -251,52 +291,88 @@ ]

{
"id": "3f090137152dcd32",
"type": "comment",
"id": "7989acea16e68a4f",
"type": "message",
"z": "03f230443c464b5e",
"name": "Step 1: Send a control form to a channel and save its form and the message Id for further updates",
"info": "",
"x": 410,
"y": 140,
"wires": []
"name": "",
"message": "form",
"text": "This is a text message.",
"textType": "str",
"html": "<b>This is an html message</b>",
"htmlType": "str",
"fileIds": "",
"fileIdsType": "str",
"contactIds": "",
"contactIdsType": "str",
"locationName": "myLocation",
"locationNameType": "str",
"latitude": "",
"latitudeType": "str",
"longitude": "",
"longitudeType": "str",
"url": "",
"urlType": "str",
"enableFullScreenView": "1",
"viewSize": "1:2",
"channelId": "",
"channelIdType": "str",
"tunnelId": "",
"tunnelIdType": "str",
"formLocation": "#:(file)::savedForm",
"formLocationType": "flow",
"x": 710,
"y": 280,
"wires": [
[
"be5c0dec26e0218c"
]
]
},
{
"id": "4fd3a1174e716f48",
"type": "comment",
"id": "be5c0dec26e0218c",
"type": "sender",
"z": "03f230443c464b5e",
"name": "In the lamp form, submit is disabled and Retain Status is YES to allow the form to send commands on each edit and to maintain its current status on the messenger app",
"info": "",
"x": 630,
"y": 180,
"wires": []
},
{
"id": "2d1bed82447ff22f",
"type": "sme-main-listener",
"z": "03f230443c464b5e",
"connector": "",
"x": 170,
"y": 520,
"async": "0",
"name": "",
"actionName": "channel_message_send",
"actionText": "Channel - Send Message",
"recipientId": "",
"recipientIdType": "str",
"messageId": "",
"messageIdType": "str",
"limit": 0,
"limitType": "num",
"recipientIds": "",
"recipientIdsType": "str",
"groupChatId": "",
"groupChatIdType": "str",
"channelId": "#:(file)::savedChannelId",
"channelIdType": "flow",
"title": "",
"titleType": "str",
"saveLocation": "#:(file)::savedMessageId",
"saveLocationType": "flow",
"logToConsole": false,
"x": 910,
"y": 280,
"wires": [
[
"3a2497f836e72e1e"
]
[]
]
},
{
"id": "e209e805b09415e8",
"type": "function",
"id": "bbaca621aa7988a2",
"type": "filterSubmission",
"z": "03f230443c464b5e",
"g": "c96f4fe387066a5d",
"name": "Send values to lamp",
"func": "var valuesArr = msg.savedSubmission.submission.formComponents;\n\nmsg.payload = {};\nvar lampSwitch = valuesArr.find(o => o.refName == \"myLampSwitch\");\nvar lampDimmer = valuesArr.find(o => o.refName == \"myLampDimmer\");\n\nmsg.payload.lampSwitch = {\n refName: lampSwitch.refName,\n value: lampSwitch.value\n};\n\nmsg.payload.lampDimmer = {\n refName: lampDimmer.refName,\n value: lampDimmer.value\n};\n\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 200,
"y": 700,
"name": "",
"reference": "myLampForm",
"referenceType": "str",
"messageId": "#:(file)::savedMessageId",
"messageIdType": "flow",
"saveLocation": "savedSubmission",
"saveLocationType": "msg",
"extractValues": true,
"x": 400,
"y": 420,
"wires": [
[
"bc637f7410c849d5"
"8ae9ea17937ebc91"
]

@@ -306,17 +382,18 @@ ]

{
"id": "91ca047551d8ae8a",
"id": "6b2b5babc8813314",
"type": "function",
"z": "03f230443c464b5e",
"name": "Random Form Id",
"func": "msg.formReference = \"form\"+Date.now();\n\nreturn msg;",
"name": "Lamp HW Simulator",
"func": "if (msg.payload.on === true) {\n node.status({fill:\"green\",shape:\"dot\",text:`on - brightness: ${msg.payload.brightness}`});\n} else if (msg.payload.on === false) {\n node.status({fill:\"red\",shape:\"ring\",text:\"off\"});\n}\n\nmsg = {\n payload: {\n on: msg.payload.on,\n brightness: msg.payload.brightness\n }\n}\n\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"initialize": "// Code added here will be run once\n// whenever the node is started.\nnode.status({ fill: \"grey\", shape: \"dot\", text: \"unknown\" });",
"finalize": "",
"libs": [],
"x": 270,
"y": 340,
"x": 400,
"y": 520,
"wires": [
[
"a56f9ae41e78f648"
"bed0529f732b3dad"
]

@@ -326,24 +403,39 @@ ]

{
"id": "e7a8a880c6b45291",
"type": "comment",
"id": "8ae9ea17937ebc91",
"type": "change",
"z": "03f230443c464b5e",
"name": "Listen to submission for the saved form, extract values and send to lamp, update and send the form to achieve statefulness",
"info": "",
"x": 490,
"y": 420,
"wires": []
},
{
"id": "3a2497f836e72e1e",
"type": "sme-filter-formSubmission",
"z": "03f230443c464b5e",
"reference": "mySavedForm.refName",
"referenceType": "flow",
"saveLocation": "savedSubmission",
"saveLocationType": "msg",
"x": 450,
"name": "Set values to payload",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "{}",
"tot": "json"
},
{
"t": "set",
"p": "payload.on",
"pt": "msg",
"to": "lampSwitch",
"tot": "msg"
},
{
"t": "set",
"p": "payload.brightness",
"pt": "msg",
"to": "lampDimmer",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 160,
"y": 520,
"wires": [
[
"e209e805b09415e8"
"6b2b5babc8813314"
]

@@ -353,12 +445,17 @@ ]

{
"id": "0b2bb1bf856bf412",
"type": "sme-main-formSaver",
"id": "bed0529f732b3dad",
"type": "formUpdater",
"z": "03f230443c464b5e",
"location": "mySavedForm",
"name": "Update Lamp Switch",
"location": "#:(file)::savedForm",
"locationType": "flow",
"x": 870,
"y": 320,
"compRefName": "lampSwitch",
"compRefNameType": "str",
"compValue": "payload.on",
"compValueType": "msg",
"x": 660,
"y": 520,
"wires": [
[
"6cc5dfcca8f2f468"
"fc0d1374928ff214"
]

@@ -368,12 +465,17 @@ ]

{
"id": "3bf47a245e003ea3",
"type": "sme-main-formLoader",
"id": "fc0d1374928ff214",
"type": "formUpdater",
"z": "03f230443c464b5e",
"location": "mySavedForm",
"name": "Update Lamp Dimmer",
"location": "#:(file)::savedForm",
"locationType": "flow",
"x": 1050,
"compRefName": "lampDimmer",
"compRefNameType": "str",
"compValue": "payload.brightness",
"compValueType": "msg",
"x": 660,
"y": 560,
"wires": [
[
"98ad87a92732964b"
"528c6ddbf42a3395"
]

@@ -383,55 +485,58 @@ ]

{
"id": "bc637f7410c849d5",
"type": "delay",
"id": "afdc102d04f52a44",
"type": "comment",
"z": "03f230443c464b5e",
"g": "c96f4fe387066a5d",
"name": "Simulate hw delay",
"pauseType": "delay",
"timeout": "1",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 430,
"y": 700,
"wires": [
[
"936084037c176bf7"
]
]
"name": "Create/Reuse a channel and send the form",
"info": "",
"x": 800,
"y": 140,
"wires": []
},
{
"id": "b29fe19a8f16fa99",
"id": "97706d3dcf3e9fda",
"type": "comment",
"z": "03f230443c464b5e",
"name": "In this example, a dimmer set to 0 will bring the lamp switch to off",
"name": "Send values to the lamp",
"info": "",
"x": 310,
"y": 460,
"x": 260,
"y": 480,
"wires": []
},
{
"id": "936084037c176bf7",
"type": "function",
"id": "4f00f533490c63f7",
"type": "comment",
"z": "03f230443c464b5e",
"g": "c96f4fe387066a5d",
"name": "Lamp logic",
"func": "//Dimmer is 0, force switch to 0 (off)\nif (msg.payload.lampSwitch.value == 1 &&\n msg.payload.lampDimmer.value == 0) {\n msg.payload.lampSwitch.value = 0;\n}\n\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 630,
"y": 700,
"name": "Update the online form to get statefulness",
"info": "",
"x": 660,
"y": 600,
"wires": []
},
{
"id": "5493b5d456e400ff",
"type": "inject",
"z": "03f230443c464b5e",
"name": "Manual Lamp ON",
"props": [
{
"p": "payload.on",
"v": "true",
"vt": "bool"
},
{
"p": "payload.brightness",
"v": "5",
"vt": "num"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 140,
"y": 620,
"wires": [
[
"396030b411e16a98"
"6b2b5babc8813314"
]

@@ -441,17 +546,28 @@ ]

{
"id": "396030b411e16a98",
"type": "sme-main-formUpdater",
"id": "d1f9db30710ef961",
"type": "inject",
"z": "03f230443c464b5e",
"name": "Update Switch Value",
"location": "mySavedForm",
"locationType": "flow",
"compRefName": "payload.lampSwitch.refName",
"compRefNameType": "msg",
"compValue": "payload.lampSwitch.value",
"compValueType": "msg",
"x": 820,
"y": 520,
"name": "Manual Lamp OFF",
"props": [
{
"p": "payload.on",
"v": "false",
"vt": "bool"
},
{
"p": "payload.brightness",
"v": "0",
"vt": "num"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 130,
"y": 660,
"wires": [
[
"a33b65627d65a086"
"6b2b5babc8813314"
]

@@ -461,17 +577,46 @@ ]

{
"id": "a33b65627d65a086",
"type": "sme-main-formUpdater",
"id": "ffcfc919413e0f08",
"type": "comment",
"z": "03f230443c464b5e",
"name": "Update Dimmer Value",
"location": "mySavedForm",
"locationType": "flow",
"compRefName": "payload.lampDimmer.refName",
"compRefNameType": "msg",
"compValue": "payload.lampDimmer.value",
"compValueType": "msg",
"x": 840,
"y": 580,
"name": "Simulate external control of the lamp",
"info": "",
"x": 140,
"y": 700,
"wires": []
},
{
"id": "528c6ddbf42a3395",
"type": "message",
"z": "03f230443c464b5e",
"name": "",
"message": "form",
"text": "This is a text message.",
"textType": "str",
"html": "<b>This is an html message</b>",
"htmlType": "str",
"fileIds": "",
"fileIdsType": "str",
"contactIds": "",
"contactIdsType": "str",
"locationName": "myLocation",
"locationNameType": "str",
"latitude": "",
"latitudeType": "str",
"longitude": "",
"longitudeType": "str",
"url": "",
"urlType": "str",
"enableFullScreenView": "1",
"viewSize": "1:2",
"channelId": "",
"channelIdType": "str",
"tunnelId": "",
"tunnelIdType": "str",
"formLocation": "#:(file)::savedForm",
"formLocationType": "flow",
"x": 870,
"y": 560,
"wires": [
[
"3bf47a245e003ea3"
"cb4e117529aeb0be"
]

@@ -481,10 +626,14 @@ ]

{
"id": "98ad87a92732964b",
"type": "sme-main-intent",
"id": "cb4e117529aeb0be",
"type": "sender",
"z": "03f230443c464b5e",
"connector": "",
"async": "0",
"name": "",
"actionName": "channel_message_update",
"actionText": "Channel - Update Message",
"recipientId": "",
"recipientIdType": "str",
"messageId": "savedSubmission.submission.replyTo.messageId",
"messageIdType": "msg",
"messageId": "#:(file)::savedMessageId",
"messageIdType": "flow",
"limit": 0,

@@ -496,53 +645,28 @@ "limitType": "num",

"groupChatIdType": "str",
"channelId": "52cd6010-4d7d-46f3-9d7c-4286b5cf1600",
"channelIdType": "str",
"x": 1180,
"y": 620,
"channelId": "#:(file)::savedChannelId",
"channelIdType": "flow",
"title": "",
"titleType": "str",
"saveLocation": "#:(file)::savedMessageId",
"saveLocationType": "flow",
"logToConsole": false,
"x": 1060,
"y": 560,
"wires": [
[
"1c1da4e77b720db5"
]
[]
]
},
{
"id": "1c1da4e77b720db5",
"type": "sme-main-sender",
"id": "13a515ff602a4e29",
"type": "listener",
"z": "03f230443c464b5e",
"connector": "",
"async": "0",
"x": 1270,
"y": 680,
"x": 150,
"y": 420,
"wires": [
[
"7e4b042ba957e9ab"
"bbaca621aa7988a2"
]
]
},
{
"id": "7e4b042ba957e9ab",
"type": "debug",
"z": "03f230443c464b5e",
"name": "debug 51",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1360,
"y": 740,
"wires": []
},
{
"id": "92d232876967a4d7",
"type": "comment",
"z": "03f230443c464b5e",
"name": "Read this",
"info": "The filter submission node saves:\n\n1. The messageId of the original form message.\nThis is useful to update a message with updated form values\n\n2. The refName of the form to identify which form has been filtered\n\n3. the formComponents of the submitted form, containing the actual settings and values of each component.\nThis is then extracted for local processing.\nLocal values can be reentered in an existing form and sent back to semilimes, using the original messageId",
"x": 420,
"y": 560,
"wires": []
}
]

@@ -11,21 +11,2 @@ [

{
"id": "0524510749435a86",
"type": "sme-main-sshTunnel",
"z": "9c78f3e70aecce9f",
"connector": "",
"name": "myNewTunnel",
"host": "localhost",
"port": "1880",
"path": "/",
"retryInterval": 10,
"retryTimeout": "1",
"x": 400,
"y": 180,
"wires": [
[
"2aea3326917ec6cb"
]
]
},
{
"id": "a885d8cb39f347e8",

@@ -56,3 +37,3 @@ "type": "inject",

[
"0524510749435a86"
"5500db432a6c7fd2"
]

@@ -81,6 +62,6 @@ ]

"topic": "",
"payload": "",
"payloadType": "date",
"x": 110,
"y": 400,
"payload": "{}",
"payloadType": "json",
"x": 90,
"y": 300,
"wires": [

@@ -112,9 +93,9 @@ [

"topic": "",
"payload": "",
"payloadType": "date",
"x": 120,
"y": 480,
"payload": "{}",
"payloadType": "json",
"x": 100,
"y": 380,
"wires": [
[
"8eb3b73956d04d6c"
"6266c0f735293094"
]

@@ -143,6 +124,6 @@ ]

"topic": "",
"payload": "",
"payloadType": "date",
"x": 110,
"y": 440,
"payload": "{}",
"payloadType": "json",
"x": 90,
"y": 340,
"wires": [

@@ -158,4 +139,4 @@ [

"z": "9c78f3e70aecce9f",
"name": "Check Tunnel Id",
"active": true,
"name": "Check Tunnel Info",
"active": false,
"tosidebar": true,

@@ -168,3 +149,3 @@ "console": false,

"statusType": "auto",
"x": 820,
"x": 1050,
"y": 180,

@@ -189,3 +170,3 @@ "wires": []

"info": "",
"x": 340,
"x": 400,
"y": 140,

@@ -198,3 +179,3 @@ "wires": []

"z": "9c78f3e70aecce9f",
"name": "",
"name": "Load Tunnel Info",
"rules": [

@@ -205,4 +186,5 @@ {

"pt": "msg",
"to": "",
"tot": "str"
"to": "#:(file)::myTunnel.id",
"tot": "flow",
"dc": true
}

@@ -215,7 +197,7 @@ ],

"reg": false,
"x": 390,
"y": 280,
"x": 330,
"y": 320,
"wires": [
[
"0524510749435a86"
"5500db432a6c7fd2"
]

@@ -225,31 +207,128 @@ ]

{
"id": "9803fb758cb28abb",
"id": "2cb9309145681335",
"type": "comment",
"z": "9c78f3e70aecce9f",
"name": "2. Copy the TunnelId generated in the response",
"name": "2. Control the Tunnel with the saved tunnel info",
"info": "",
"x": 840,
"y": 140,
"x": 200,
"y": 260,
"wires": []
},
{
"id": "cdbb1ecff8288482",
"type": "comment",
"id": "381cdfd071b0e4bb",
"type": "change",
"z": "9c78f3e70aecce9f",
"name": "3. Paste the TunnelId here for persistency",
"info": "",
"name": "Save Tunnel info",
"rules": [
{
"t": "set",
"p": "#:(file)::myTunnel",
"pt": "flow",
"to": "{}",
"tot": "json"
},
{
"t": "set",
"p": "#:(file)::myTunnel.id",
"pt": "flow",
"to": "TunnelId",
"tot": "msg"
},
{
"t": "set",
"p": "#:(file)::myTunnel.name",
"pt": "flow",
"to": "TunnelName",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 850,
"y": 200,
"wires": [
[]
]
},
{
"id": "d553f6071fac06e8",
"type": "switch",
"z": "9c78f3e70aecce9f",
"name": "Success?",
"property": "TunnelStatus",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "created",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 680,
"y": 200,
"wires": [
[
"381cdfd071b0e4bb"
]
]
},
{
"id": "5500db432a6c7fd2",
"type": "tunnel",
"z": "9c78f3e70aecce9f",
"connector": "",
"name": "myNewTunnel",
"host": "localhost",
"port": "1880",
"path": "/",
"retryInterval": 10,
"retryTimeout": 0,
"x": 420,
"y": 240,
"wires": []
"y": 180,
"wires": [
[
"d553f6071fac06e8",
"2aea3326917ec6cb"
]
]
},
{
"id": "2cb9309145681335",
"type": "comment",
"id": "6266c0f735293094",
"type": "change",
"z": "9c78f3e70aecce9f",
"name": "4. Control the Tunnel with the configured Id",
"info": "",
"x": 200,
"y": 360,
"wires": []
"name": "Load and Delete Tunnel Info",
"rules": [
{
"t": "set",
"p": "TunnelId",
"pt": "msg",
"to": "#:(file)::myTunnel.id",
"tot": "flow",
"dc": true
},
{
"t": "delete",
"p": "#:(file)::myTunnel",
"pt": "flow"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 360,
"y": 380,
"wires": [
[
"5500db432a6c7fd2"
]
]
}
]

@@ -11,17 +11,2 @@ [

{
"id": "70c0dfe52c7b7577",
"type": "sme-comp-text",
"z": "4f55a344bb541810",
"name": "",
"text": "payload",
"textType": "msg",
"x": 970,
"y": 180,
"wires": [
[
"8ff75643ae632989"
]
]
},
{
"id": "36aeab613c4299d9",

@@ -31,10 +16,10 @@ "type": "function",

"name": "Random Value 18-25",
"func": "function getRandomFloatInclusive(min, max) {\n min = Math.ceil(min);\n max = Math.floor(max);\n var rawNumber = (Math.random() * (max - min + 1) + min); // The maximum is inclusive and the minimum is inclusive\n return Math.round((rawNumber + Number.EPSILON) * 10) / 10;\n\n}\n\nmsg.payload = `${getRandomFloatInclusive(18, 25)}`;\nreturn msg;",
"func": "function getRandomFloatInclusive(min, max) {\n min = Math.ceil(min);\n max = Math.floor(max);\n var rawNumber = (Math.random() * (max - min + 1) + min); // The maximum is inclusive and the minimum is inclusive\n return Math.round((rawNumber + Number.EPSILON) * 10) / 10;\n\n}\n\nmsg.payload = `${getRandomFloatInclusive(18, 25)}`;\nnode.status({fill: \"green\", shape: \"dot\", text: msg.payload});\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"initialize": "// Code added here will be run once\n// whenever the node is started.\nnode.status({ fill: \"grey\", shape: \"dot\", text: \"off\" });",
"finalize": "",
"libs": [],
"x": 320,
"x": 640,
"y": 180,

@@ -48,10 +33,84 @@ "wires": [

{
"id": "8ff75643ae632989",
"type": "sme-main-intent",
"id": "517e54e1797828ec",
"type": "switch",
"z": "4f55a344bb541810",
"name": "Send to Channel",
"autoName": "",
"name": "First Run?",
"property": "#:(file)::savedChannelId",
"propertyType": "flow",
"rules": [
{
"t": "null"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 890,
"y": 180,
"wires": [
[
"43ba545769c6ceca"
],
[
"62d9071598d16562"
]
]
},
{
"id": "f25be305b3e17085",
"type": "comment",
"z": "4f55a344bb541810",
"name": "Simulates a sensor periodically sending a value for 2 minutes to a new channel, then the flow is stopped",
"info": "",
"x": 410,
"y": 60,
"wires": []
},
{
"id": "07b8748966175b2e",
"type": "inject",
"z": "4f55a344bb541810",
"name": "Start",
"props": [
{
"p": "payload"
}
],
"repeat": "10",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "str",
"x": 130,
"y": 180,
"wires": [
[
"15406208bd3d60c6"
]
]
},
{
"id": "fd215e6f5af9f432",
"type": "comment",
"z": "4f55a344bb541810",
"name": "Simulate Sensor value",
"info": "",
"x": 640,
"y": 140,
"wires": []
},
{
"id": "43ba545769c6ceca",
"type": "sender",
"z": "4f55a344bb541810",
"connector": "",
"actionName": "channel_message_send",
"actionText": "Channel - Send Message",
"async": "0",
"name": "",
"actionName": "channel_create",
"actionText": "Channel - Create",
"recipientId": "",

@@ -67,11 +126,14 @@ "recipientIdType": "str",

"groupChatIdType": "str",
"channelId": "channelId",
"channelIdType": "flow",
"title": "TG-Temp",
"channelId": "",
"channelIdType": "str",
"title": "sensorChannel",
"titleType": "str",
"x": 1190,
"saveLocation": "#:(file)::savedChannelId",
"saveLocationType": "flow",
"logToConsole": false,
"x": 1220,
"y": 180,
"wires": [
[
"9a3398d46bb88e4b"
"62d9071598d16562"
]

@@ -81,9 +143,67 @@ ]

{
"id": "9a3398d46bb88e4b",
"type": "sme-main-sender",
"id": "62d9071598d16562",
"type": "message",
"z": "4f55a344bb541810",
"name": "Text Message",
"message": "text",
"text": "payload",
"textType": "msg",
"html": "<b>This is an html message</b>",
"htmlType": "str",
"fileIds": "",
"fileIdsType": "str",
"contactIds": "",
"contactIdsType": "str",
"locationName": "myLocation",
"locationNameType": "str",
"latitude": "",
"latitudeType": "str",
"longitude": "",
"longitudeType": "str",
"url": "",
"urlType": "str",
"enableFullScreenView": "1",
"viewSize": "1:2",
"channelId": "",
"channelIdType": "str",
"tunnelId": "",
"tunnelIdType": "str",
"formLocation": "savedForm",
"formLocationType": "flow",
"x": 660,
"y": 300,
"wires": [
[
"265c9edf54a182fc"
]
]
},
{
"id": "2abd7828d5866352",
"type": "sender",
"z": "4f55a344bb541810",
"connector": "",
"async": "0",
"x": 1410,
"y": 180,
"name": "",
"actionName": "channel_message_send",
"actionText": "Channel - Send Message",
"recipientId": "",
"recipientIdType": "str",
"messageId": "",
"messageIdType": "str",
"limit": 0,
"limitType": "num",
"recipientIds": "",
"recipientIdsType": "str",
"groupChatId": "",
"groupChatIdType": "str",
"channelId": "#:(file)::savedChannelId",
"channelIdType": "flow",
"title": "",
"titleType": "str",
"saveLocation": "#:(file)::savedMessageId",
"saveLocationType": "flow",
"logToConsole": true,
"x": 1250,
"y": 280,
"wires": [

@@ -94,11 +214,11 @@ []

{
"id": "517e54e1797828ec",
"id": "265c9edf54a182fc",
"type": "switch",
"z": "4f55a344bb541810",
"name": "",
"property": "channelId",
"name": "First Message?",
"property": "#:(file)::savedMessageId",
"propertyType": "flow",
"rules": [
{
"t": "nempty"
"t": "null"
},

@@ -112,10 +232,10 @@ {

"outputs": 2,
"x": 590,
"y": 260,
"x": 920,
"y": 300,
"wires": [
[
"70c0dfe52c7b7577"
"2abd7828d5866352"
],
[
"47c2587f703b6942"
"7c1a323d6a5eaac5"
]

@@ -125,14 +245,14 @@ ]

{
"id": "312d8db38ea94b6e",
"type": "sme-main-intent",
"id": "7c1a323d6a5eaac5",
"type": "sender",
"z": "4f55a344bb541810",
"connector": "",
"async": "0",
"name": "",
"autoName": "",
"connector": "",
"actionName": "channel_create",
"actionText": "Channel - Create",
"actionName": "channel_message_update",
"actionText": "Channel - Update Message",
"recipientId": "",
"recipientIdType": "str",
"messageId": "",
"messageIdType": "str",
"messageId": "#:(file)::savedMessageId",
"messageIdType": "flow",
"limit": 0,

@@ -146,23 +266,35 @@ "limitType": "num",

"channelIdType": "str",
"title": "channelName",
"titleType": "msg",
"x": 1190,
"y": 300,
"title": "",
"titleType": "str",
"saveLocation": "savedEntityId",
"saveLocationType": "msg",
"logToConsole": true,
"x": 1240,
"y": 320,
"wires": [
[
"e5c0d8e014507453"
]
[]
]
},
{
"id": "e5c0d8e014507453",
"type": "sme-main-sender",
"id": "2b88d93c2806e70d",
"type": "delay",
"z": "4f55a344bb541810",
"connector": "",
"async": "0",
"x": 1430,
"y": 300,
"name": "Stop timer 2 mins",
"pauseType": "delay",
"timeout": "2",
"timeoutUnits": "minutes",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 230,
"y": 280,
"wires": [
[
"b8c62456e4ab5a70"
"271e876468ea1578"
]

@@ -172,47 +304,21 @@ ]

{
"id": "fe3c92c44f4fbdbd",
"type": "inject",
"id": "15406208bd3d60c6",
"type": "switch",
"z": "4f55a344bb541810",
"name": "Test Trigger",
"props": [
"name": "Timer running?",
"property": "#:(file)::stop",
"propertyType": "flow",
"rules": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
"t": "null"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "test value",
"payloadType": "str",
"x": 150,
"y": 300,
"wires": [
[
"517e54e1797828ec"
]
]
},
{
"id": "b8c62456e4ab5a70",
"type": "function",
"z": "4f55a344bb541810",
"name": "Save/Reset ChannelId",
"func": "if (msg.reset == true) {\n flow.set('channelId', undefined);\n} else {\n var channelId = msg._sme?.responseMsgs[0]?.data?.createdChannel?.channelId;\n if (!channelId) {\n node.error(\"Error in getting created channel Id. Please try again!\");\n return null;\n }\n flow.set('channelId', channelId);\n return msg;\n}",
"checkall": "false",
"repair": false,
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1680,
"y": 300,
"x": 400,
"y": 180,
"wires": [
[
"70c0dfe52c7b7577"
"36aeab613c4299d9"
]

@@ -222,11 +328,9 @@ ]

{
"id": "63151dbe403de7f4",
"id": "312a93283d56f658",
"type": "inject",
"z": "4f55a344bb541810",
"name": "Reset ChannelId",
"name": "Auto Stop",
"props": [
{
"p": "reset",
"v": "true",
"vt": "bool"
"p": "payload"
}

@@ -236,10 +340,12 @@ ],

"crontab": "",
"once": false,
"once": true,
"onceDelay": 0.1,
"topic": "",
"x": 160,
"y": 400,
"payload": "",
"payloadType": "str",
"x": 140,
"y": 240,
"wires": [
[
"ef050f205e88d489"
"2b88d93c2806e70d"
]

@@ -249,64 +355,31 @@ ]

{
"id": "47c2587f703b6942",
"type": "function",
"id": "271e876468ea1578",
"type": "change",
"z": "4f55a344bb541810",
"name": "Set Random Channel Name",
"func": "function getRandomIntInclusive(min, max) {\n min = Math.ceil(min);\n max = Math.floor(max);\n return Math.floor(Math.random() * (max - min + 1) + min); // The maximum is inclusive and the minimum is inclusive\n}\n\nvar randomInt = getRandomIntInclusive(10000, 99999);\n\nmsg.channelName = \"myAutoChannel\" + randomInt;\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 920,
"y": 300,
"wires": [
[
"312d8db38ea94b6e"
]
]
},
{
"id": "ef050f205e88d489",
"type": "link out",
"z": "4f55a344bb541810",
"name": "out_resetChannelId",
"mode": "link",
"links": [
"42aeab5144e334f3"
"name": "Set Stop flag",
"rules": [
{
"t": "set",
"p": "#:(file)::stop",
"pt": "flow",
"to": "true",
"tot": "bool"
}
],
"x": 285,
"y": 400,
"wires": []
},
{
"id": "42aeab5144e334f3",
"type": "link in",
"z": "4f55a344bb541810",
"name": "in_resetChannelId",
"links": [
"ef050f205e88d489"
],
"x": 1505,
"y": 340,
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 290,
"y": 320,
"wires": [
[
"b8c62456e4ab5a70"
]
[]
]
},
{
"id": "f25be305b3e17085",
"type": "comment",
"z": "4f55a344bb541810",
"name": "Creates a random-named channel and send values to it until it is reset by the appropriate command or the server is restarted",
"info": "",
"x": 480,
"y": 60,
"wires": []
},
{
"id": "07b8748966175b2e",
"id": "2d2585c6354ab466",
"type": "inject",
"z": "4f55a344bb541810",
"name": "Start",
"name": "Restart",
"props": [

@@ -325,6 +398,6 @@ {

"x": 130,
"y": 180,
"y": 380,
"wires": [
[
"36aeab613c4299d9"
"b0c8157f9f55fa9d"
]

@@ -334,71 +407,24 @@ ]

{
"id": "fd215e6f5af9f432",
"type": "comment",
"id": "b0c8157f9f55fa9d",
"type": "change",
"z": "4f55a344bb541810",
"name": "Generate input value",
"info": "",
"x": 310,
"y": 140,
"wires": []
},
{
"id": "11a3c5feb1424274",
"type": "comment",
"z": "4f55a344bb541810",
"name": "Send a fixed test value",
"info": "",
"x": 160,
"y": 260,
"wires": []
},
{
"id": "867ad805444514d3",
"type": "comment",
"z": "4f55a344bb541810",
"name": "Reset the saved channel. At the next \"start\", a new channel will be created.",
"info": "",
"x": 320,
"y": 360,
"wires": []
},
{
"id": "efb2d7132d11805e",
"type": "comment",
"z": "4f55a344bb541810",
"name": "Check if channel exists",
"info": "",
"x": 600,
"y": 220,
"wires": []
},
{
"id": "d49c668e2f0924f0",
"type": "comment",
"z": "4f55a344bb541810",
"name": "Save created channel in flow context",
"info": "",
"x": 1720,
"y": 340,
"wires": []
},
{
"id": "c7f35f3fb0c3777a",
"type": "comment",
"z": "4f55a344bb541810",
"name": "Sending branch",
"info": "",
"x": 1000,
"y": 140,
"wires": []
},
{
"id": "b68b79a1b3289635",
"type": "comment",
"z": "4f55a344bb541810",
"name": "Creating branch",
"info": "",
"x": 880,
"y": 260,
"wires": []
"name": "Reset Stop flag",
"rules": [
{
"t": "delete",
"p": "#:(file)::stop",
"pt": "flow"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 300,
"y": 380,
"wires": [
[]
]
}
]
[
{
"id": "4c42249f853d2aef",
"id": "3e3db0cb9714db14",
"type": "tab",

@@ -11,14 +11,23 @@ "label": "Upload and send a file",

{
"id": "2b4f96c3f2797ae1",
"type": "sme-main-uploader",
"z": "4c42249f853d2aef",
"id": "b7d9d631191e5bb5",
"type": "comment",
"z": "3e3db0cb9714db14",
"name": "Uploads a file to the semilimes cloud and send this file in a message",
"info": "",
"x": 320,
"y": 100,
"wires": []
},
{
"id": "a1a9b3f8f6090685",
"type": "uploader",
"z": "3e3db0cb9714db14",
"connector": "",
"filePath": "",
"filePath": "myFilePath",
"filePathType": "str",
"x": 340,
"y": 160,
"y": 220,
"wires": [
[
"ef84e22a7af3eda3",
"c13c2cc4794c25d6"
"c66ef509e8901470"
]

@@ -28,22 +37,5 @@ ]

{
"id": "ef84e22a7af3eda3",
"type": "debug",
"z": "4c42249f853d2aef",
"name": "debug 52",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 540,
"y": 160,
"wires": []
},
{
"id": "6b9c98122cdcebc0",
"id": "f4c4ab3fe8a34a95",
"type": "inject",
"z": "4c42249f853d2aef",
"z": "3e3db0cb9714db14",
"name": "",

@@ -67,6 +59,6 @@ "props": [

"x": 140,
"y": 160,
"y": 220,
"wires": [
[
"2b4f96c3f2797ae1"
"a1a9b3f8f6090685"
]

@@ -76,20 +68,5 @@ ]

{
"id": "b4317d115bd4fd3d",
"type": "sme-comp-file",
"z": "4c42249f853d2aef",
"name": "",
"fileIds": "fileToSend",
"fileIdsType": "msg",
"x": 310,
"y": 280,
"wires": [
[
"8903cd528fdcdf82"
]
]
},
{
"id": "c13c2cc4794c25d6",
"id": "c66ef509e8901470",
"type": "change",
"z": "4c42249f853d2aef",
"z": "3e3db0cb9714db14",
"name": "",

@@ -110,7 +87,7 @@ "rules": [

"reg": false,
"x": 150,
"x": 170,
"y": 280,
"wires": [
[
"b4317d115bd4fd3d"
"e41400b39835f5b6"
]

@@ -120,6 +97,58 @@ ]

{
"id": "8903cd528fdcdf82",
"type": "sme-main-intent",
"z": "4c42249f853d2aef",
"id": "e41400b39835f5b6",
"type": "message",
"z": "3e3db0cb9714db14",
"name": "",
"message": "file",
"text": "This is a text message.",
"textType": "str",
"html": "<b>This is an html message</b>",
"htmlType": "str",
"fileIds": "fileToSend",
"fileIdsType": "msg",
"contactIds": "",
"contactIdsType": "str",
"locationName": "myLocation",
"locationNameType": "str",
"latitude": "",
"latitudeType": "str",
"longitude": "",
"longitudeType": "str",
"url": "",
"urlType": "str",
"enableFullScreenView": "1",
"viewSize": "1:2",
"channelId": "",
"channelIdType": "str",
"tunnelId": "",
"tunnelIdType": "str",
"formLocation": "savedForm",
"formLocationType": "flow",
"x": 350,
"y": 280,
"wires": [
[
"6bd4f2eabf37f0d3"
]
]
},
{
"id": "c0b4e2d9bffbe5d1",
"type": "comment",
"z": "3e3db0cb9714db14",
"name": "1. Set the file path in the uploader",
"info": "",
"x": 350,
"y": 180,
"wires": []
},
{
"id": "6bd4f2eabf37f0d3",
"type": "sender",
"z": "3e3db0cb9714db14",
"connector": "",
"async": "0",
"name": "",
"actionName": "channel_message_send",
"actionText": "Channel - Send Message",
"recipientId": "",

@@ -137,61 +166,23 @@ "recipientIdType": "str",

"channelIdType": "str",
"x": 510,
"title": "",
"titleType": "str",
"saveLocation": "savedMessageId",
"saveLocationType": "msg",
"logToConsole": false,
"x": 670,
"y": 280,
"wires": [
[
"40f97102c0a6a008"
]
[]
]
},
{
"id": "40f97102c0a6a008",
"type": "sme-main-sender",
"z": "4c42249f853d2aef",
"connector": "",
"async": "0",
"x": 770,
"y": 280,
"wires": [
[
"3e01f01435f480a8"
]
]
},
{
"id": "3e01f01435f480a8",
"type": "debug",
"z": "4c42249f853d2aef",
"name": "debug 53",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 960,
"y": 280,
"wires": []
},
{
"id": "eec0cd2fb162aa17",
"id": "c0b6d6ae21fb6b5d",
"type": "comment",
"z": "4c42249f853d2aef",
"name": "1. Setup the uploader node with a connector and select the file you want to upload",
"z": "3e3db0cb9714db14",
"name": "2. Set the destination you want to send the file to",
"info": "",
"x": 360,
"y": 100,
"x": 700,
"y": 240,
"wires": []
},
{
"id": "14b5764d1e32e1a9",
"type": "comment",
"z": "4c42249f853d2aef",
"name": "Set the destination of the action selector node. This part of the flow will send a file message to the selected destination",
"info": "",
"x": 480,
"y": 220,
"wires": []
}
]
{
"name": "@semilimes/node-red-semilimes",
"version": "0.9.11",
"version": "0.10.1",
"description": "The new semilimes connector which integrates with the public API",

@@ -13,2 +13,11 @@ "scripts": {

"nodes": {
"message": "src/message.js",
"formSetup": "src/formSetup.js",
"formComponent": "src/formComponent.js",
"formUpdater": "src/formUpdater.js",
"sender": "src/sender.js",
"listener": "src/listener.js",
"uploader": "src/uploader.js",
"filterSubmission": "src/filters/filterSubmission.js",
"tunnel": "src/tunnel.js",
"sme-main-core": "src/sme-main-core.js",

@@ -15,0 +24,0 @@ "sme-main-connector": "src/sme-main-connector.js",

@@ -6,2 +6,5 @@ # Node-RED semilimes connector

> **Important Note**: the current version (0.10.1) contains a new set of nodes (semilimesAPI section), while leaving the old nodes for backwards compatibility (semilimesAPI_deprecated section), to let current users transition their existing flows to the new node set.
> The next release (1.0.0) will permanently remove all the deprecated nodes, so make sure you have completed the transition before further update this package.
[Github project](https://github.com/semilimes/nodered-publicapi-connector)

@@ -23,3 +26,18 @@

## Setup Node-RED persistent context
Some of the use cases of this node work more reliably when saving the necessary variables in a persistent storage.
To ease this behaviour without adding complexity to the built flows, it is recommended to enable multiple context stores in your NodeRED configuration, so that you can use in-memory flow/global variables (deleted upon restart), or file variables, surviving a restart.
To enable the default implementation of multiple context store, add this configuration chunk in node-red's settings.js file.
![multicontextstore](resources/images/nodered_multicontextstore.png)
To use the multiple-context in your flow, you can select the storage whenever you are dealing with a flow or global variable, like the example below:
![multicontextvars](resources/images/nodered_usemulticontextvars.png)
> **Note**: The default implementation of the file context in NodeRED makes sure that values are cached in memory and flushed to disk every 30 seconds, to preserve SD cards health in systems that make use of them (e.g. RaspberryPI). You can tweak this value to your liking by setting the appropriate variable in the configuration itself.
Learn more on the [multiple context stores](https://nodered.org/docs/user-guide/context#using-multiple-context-stores) section in NodeRED documentation.
## Setup your developer environment

@@ -48,26 +66,22 @@

1. Add a new `Text` node and configure it with your preferred message
1. Add a standard `inject` node
2. Add an `Intent` node and config its `Connector` property to create a `connector` configuration. Configure the node by selecting the `Channel - Create` intent and entering a title for the new channel.
2. Add and connect a `Sender` node, select `Channel - Create` and give it a title. This will be your new channel name. Make sure you give a value to the `Save ChannelId` property, you will reuse this later.
3. In the same node, configure its `Connector` property to create a connection configuration, and enter your API key.
![Config connector node](resources/images/connector_node_properties.jpg)
1. Add a `sender` node then config its `Connector` property by selecting the previously created connector.
2. ![Property editor of sender node](resources/images/sender_node_properties.jpg)
4. Add and connect a `Message` node and select the `Text` message option, then enter a message in the Text field.
5. Add and connect another `Sender` node, this time for actually sending the message. Select `Channel - Send` and configure its `ChannelId` property with the one you previously saved in step 2.
3. Run the flow to create the new channel.
6. Make sure you select the previously created `Connector` in this node as well.
![Property editor of sender node](resources/images/sender_node_properties.jpg)
4. In another flow, add a `Text` node with a message
7. Run the flow and access your semilimes app with the subaccount corresponding to your API key. You will find a new channel containing your first message!
5. Add an `Intent` node and select `Channel - Send Message` and configure the channel
For reference, your completed flow should look like this
![example](/resources/images/connecttosemilimesflow.png)
6. Add a `sender` node and run.
The flow should look like this [example](https://github.com/semilimes/nodered-publicapi-connector/blob/main/examples/Connect%20To%20semilimes%20flow.json)
![connect to semilimes flow example](resources/images/connecttosemilimesflow.png)
You have sent your first message!
# Examples

@@ -74,0 +88,0 @@

@@ -25,82 +25,2 @@ "use strict";

//Get my P2P Chats (Contacts)
RED.httpAdmin.get('/sme/recipients', function(req,res,next)
{
var connector = smeConnector;
node.log("Node connector: " + smeConnector);
var endpoint = "/account/contacts";
var httpMethod = "GET";
var data = {
parameters: {}
};
connector.callApi(endpoint, httpMethod, data)
.then(
value => {
res.json(value);
},
error => {
res.sendStatus(500).send(error);
}
)
.catch(error => {
res.sendStatus(500).send(error);
})
});
//Get my groupChats
RED.httpAdmin.get('/sme/groupChats', function(req,res,next)
{
var connector = smeConnector;
node.log("Node connector: " + smeConnector);
var endpoint = "/communication/groupChat";
var httpMethod = "GET";
var data = {
parameters: {}
};
connector.callApi(endpoint, httpMethod, data)
.then(
value => {
res.json(value);
},
error => {
res.sendStatus(500).send(error);
}
)
.catch(error => {
res.sendStatus(500).send(error);
})
});
//Get my channels
RED.httpAdmin.get('/sme/channels', function(req,res,next)
{
var connector = smeConnector;
node.log("Node connector: " + smeConnector);
var endpoint = "/communication/channel/my";
var httpMethod = "GET";
var data = {
parameters: {
owner: true,
editor: true,
subscriber: true
}
};
connector.callApi(endpoint, httpMethod, data)
.then(
value => {
res.json(value);
},
error => {
res.sendStatus(500).send(error);
}
)
.catch(error => {
res.sendStatus(500).send(error);
})
});
node.on('input', function (msg, send, done) {

@@ -107,0 +27,0 @@ send = send || function () { node.send.apply(node, arguments) }

@@ -32,2 +32,3 @@ "use strict";

var xAccount = this.credentials.xAccount;
var connectorId = this.id;

@@ -72,16 +73,16 @@ var serverApiURL = `https://${server}`;

function sendWebSocketMessage(msg) {
function sendWebSocketMessage(msg, logEnabled = false) {
msg = validateMessage(msg);
webSocket.send(msg);
webSocket.send(msg, logEnabled);
}
function sendApiMessage(msg) {
function sendApiMessage(msg, logEnabled = false) {
msg = validateMessage(msg);
var endpoint = msg.endpoint || "NoEndpointSet";
var method = msg.httpMethod || "NoHttpMethodSet";
return apiClient.callApi(endpoint, method, msg);
return apiClient.callApi(endpoint, method, msg, logEnabled);
}
function callApi(endpoint, method, data) {
return apiClient.callApi(endpoint, method, data);
function callApi(endpoint, method, data, logEnabled = false) {
return apiClient.callApi(endpoint, method, data, logEnabled);
}

@@ -108,2 +109,73 @@

this.addStatusListener = addStatusListener;
//Get my P2P Chats (Contacts)
RED.httpAdmin.get(`/${connectorId}/sme/recipients`, function (req, res, next) {
var endpoint = "/account/contacts";
var httpMethod = "GET";
var data = {
parameters: {}
};
callApi(endpoint, httpMethod, data)
.then(
value => {
res.json(value);
},
error => {
res.sendStatus(500).send(error);
}
)
.catch(error => {
res.sendStatus(500).send(error);
})
});
//Get my groupChats
RED.httpAdmin.get(`/${connectorId}/sme/groupChats`, function (req, res, next) {
var endpoint = "/communication/groupChat";
var httpMethod = "GET";
var data = {
parameters: {}
};
callApi(endpoint, httpMethod, data)
.then(
value => {
res.json(value);
},
error => {
res.sendStatus(500).send(error);
}
)
.catch(error => {
res.sendStatus(500).send(error);
})
});
//Get my channels
RED.httpAdmin.get(`/${connectorId}/sme/channels`, function (req, res, next) {
var endpoint = "/communication/channel/my";
var httpMethod = "GET";
var data = {
parameters: {
owner: true,
editor: true,
subscriber: true
}
};
callApi(endpoint, httpMethod, data)
.then(
value => {
res.json(value);
},
error => {
res.sendStatus(500).send(error);
}
)
.catch(error => {
res.sendStatus(500).send(error);
})
});
};

@@ -110,0 +182,0 @@

@@ -144,3 +144,3 @@ "use strict";

if (selectionType && selectionValue) {
if (selectionType && selectionValue !== undefined) {
//Function to make nested properties work in UI

@@ -199,2 +199,4 @@ const leaf = (obj, path) => {

return false;
if (obj === true)
return true;
if (isNaN(obj))

@@ -268,7 +270,5 @@ return ['TRUE', 'YES'].indexOf(('' + obj).toUpperCase()) >= 0;

options.headers.Authorization = `Bearer ${apiKey}`;
//console.log(`...with apiKey = ${apiKey}`);
}
if (xAccount) {
options.headers['X-Account'] = `${xAccount}`;
//console.log(`...with xAccount = ${xAccount}`);
}

@@ -312,3 +312,2 @@

socket.send(buffer[i]);
console.log('ws sent ', buffer.length, ' buffered messages.');
buffer.length = 0;

@@ -336,3 +335,3 @@ }

socket.on('error', function (err) {
console.log('ws error!' + err);
console.error('ws error!' + err);
reconnect();

@@ -342,3 +341,3 @@ });

function send(msg) {
function send(msg, logEnabled = false) {
if (msg) {

@@ -352,3 +351,3 @@ if (typeof (msg) === 'object')

buffer.push(msg);
console.log('buffered: ', msg);
if (logEnabled) console.log('buffered: ', msg);
}

@@ -383,3 +382,3 @@ }

function callApi(endpoint, method, data) {
function callApi(endpoint, method, data, logEnabled = false) {
if (endpoint == "/service/file/upload") {

@@ -405,7 +404,7 @@

.then((response) => {
console.log(JSON.stringify(response.data));
if(logEnabled) console.log(JSON.stringify(response.data));
resolve(response.data);
})
.catch((error) => {
console.log('Error when calling uploader API: ', error);
console.error('Error when calling uploader API: ', error);
reject(error);

@@ -453,9 +452,18 @@ })

}
if (logEnabled &&
options.headers.Authorization &&
options.headers.Authorization.length > 20) {
var optionsMasked = JSON.parse(JSON.stringify(options));
var authText = optionsMasked.headers.Authorization;
var firstChunk = authText.substring(0,12);
var lastChunk = authText.substring(authText.length - 5, authText.length);
var authMasked = `${firstChunk}*****${lastChunk}`;
optionsMasked.headers.Authorization = authMasked;
console.log('Attempt to send call to:', optionsMasked);
console.log('With data: ', body);
}
console.log('Attempt to send call to:', options);
console.log('With data: ', body);
var req = https.request(options, (res) => {
console.log("Status Code: ", res.statusCode);
if(logEnabled) console.log("Status Code: ", res.statusCode);
let totalBuffer = "";

@@ -471,14 +479,14 @@ res.on('data', (buffer) => {

if (jsonData) {
console.log('Call API resolved a JSON: ', jsonData);
if(logEnabled) console.log('Call API resolved a JSON: ', jsonData);
resolve(jsonData);
return;
} else {
console.log('Response raw data: ', totalBuffer);
if(logEnabled) console.log('Response raw data: ', totalBuffer);
}
}
catch (ex) {
console.debug('Error parsing API JSON result: ', ex);
console.error('Error parsing API JSON result: ', ex);
}
}
console.log('Call API resolved: ', totalBuffer);
if(logEnabled) console.log('Call API resolved: ', totalBuffer);
resolve(totalBuffer);

@@ -490,3 +498,3 @@ });

req.on('timeout', () => {
console.log('API call timeout. Call aborted.')
console.error('API call timeout. Call aborted.')
req.destroy();

@@ -496,3 +504,3 @@ });

req.on('error', (e) => {
console.log('Call API rejected: ', e);
console.error('Call API rejected: ', e);
reject(e);

@@ -499,0 +507,0 @@ });

@@ -50,81 +50,2 @@ "use strict";

//Get my P2P Chats (Contacts)
RED.httpAdmin.get('/sme/recipients', function(req,res,next)
{
var connector = smeConnector;
node.log("Node connector: " + smeConnector);
var endpoint = "/account/contacts";
var httpMethod = "GET";
var data = {
parameters: {}
};
connector.callApi(endpoint, httpMethod, data)
.then(
value => {
res.json(value);
},
error => {
res.sendStatus(500).send(error);
}
)
.catch(error => {
res.sendStatus(500).send(error);
})
});
//Get my groupChats
RED.httpAdmin.get('/sme/groupChats', function(req,res,next)
{
var connector = smeConnector;
node.log("Node connector: " + smeConnector);
var endpoint = "/communication/groupChat";
var httpMethod = "GET";
var data = {
parameters: {}
};
connector.callApi(endpoint, httpMethod, data)
.then(
value => {
res.json(value);
},
error => {
res.sendStatus(500).send(error);
}
)
.catch(error => {
res.sendStatus(500).send(error);
})
});
//Get my channels
RED.httpAdmin.get('/sme/channels', function(req,res,next)
{
var connector = smeConnector;
node.log("Node connector: " + smeConnector);
var endpoint = "/communication/channel/my";
var httpMethod = "GET";
var data = {
parameters: {
owner: true,
editor: true,
subscriber: true
}
};
connector.callApi(endpoint, httpMethod, data)
.then(
value => {
res.json(value);
},
error => {
res.sendStatus(500).send(error);
}
)
.catch(error => {
res.sendStatus(500).send(error);
})
});
node.on('input', function (msg, send, done) {

@@ -131,0 +52,0 @@ send = send || function () { node.send.apply(node, arguments) };

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc