Skip to content

Instantly share code, notes, and snippets.

@sriengchhunchheang
Created September 26, 2023 03:45
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 sriengchhunchheang/5ee9cb42096e31c1c7ba4e8559ec13ea to your computer and use it in GitHub Desktop.
Save sriengchhunchheang/5ee9cb42096e31c1c7ba4e8559ec13ea to your computer and use it in GitHub Desktop.
Node for use with Button and LED
[
{
"id": "3bac108584c47a12",
"type": "tab",
"label": "NodeRed_Read_sensor_psoc6_via_mqtt",
"disabled": false,
"info": "",
"env": []
},
{
"id": "ecce1062e39d4261",
"type": "mqtt in",
"z": "3bac108584c47a12",
"name": "MQTT Subscriber",
"topic": "PSoC6Status/temperature,pressure",
"qos": "1",
"datatype": "auto-detect",
"broker": "8d5cfad5.2fc08",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
"x": 180,
"y": 580,
"wires": [
[
"654ee1a613ae82ce"
]
]
},
{
"id": "b84ece86611e84f0",
"type": "debug",
"z": "3bac108584c47a12",
"name": "debug chart Temp",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 950,
"y": 340,
"wires": []
},
{
"id": "9f1220715dcbba64",
"type": "ui_chart",
"z": "3bac108584c47a12",
"name": "Temperature",
"group": "7254d0ece3aa5932",
"order": 1,
"width": 0,
"height": 0,
"label": "Temperature( Celcius)",
"chartType": "line",
"legend": "false",
"xformat": "HH:mm:ss",
"interpolate": "linear",
"nodata": "",
"dot": false,
"ymin": "",
"ymax": "",
"removeOlder": "30",
"removeOlderPoints": "",
"removeOlderUnit": "3600",
"cutout": 0,
"useOneColor": false,
"useUTC": false,
"colors": [
"#298bd1",
"#aec7e8",
"#ff7f0e",
"#289f28",
"#98df8a",
"#d62728",
"#ff9896",
"#490e81",
"#c5b0d5"
],
"outputs": 1,
"useDifferentColor": false,
"className": "",
"x": 730,
"y": 340,
"wires": [
[
"b84ece86611e84f0"
]
]
},
{
"id": "654ee1a613ae82ce",
"type": "split",
"z": "3bac108584c47a12",
"name": "",
"splt": ",",
"spltType": "str",
"arraySplt": 1,
"arraySpltType": "len",
"stream": false,
"addname": "",
"x": 370,
"y": 540,
"wires": [
[
"24c69eaf64f94b89",
"6cedd05c6aa69b9e"
]
]
},
{
"id": "f21c84afff8e53ad",
"type": "mqtt out",
"z": "3bac108584c47a12",
"name": "",
"topic": "PSoC6Status/led",
"qos": "1",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "8d5cfad5.2fc08",
"x": 450,
"y": 220,
"wires": []
},
{
"id": "3d4a3f7d512901df",
"type": "ui_button",
"z": "3bac108584c47a12",
"name": "SW2 ON",
"group": "7533b08edc51e1dc",
"order": 1,
"width": 0,
"height": 0,
"passthru": false,
"label": "ON",
"tooltip": "",
"color": "",
"bgcolor": "",
"className": "",
"icon": "",
"payload": "TURN ON",
"payloadType": "str",
"topic": "topic",
"topicType": "msg",
"x": 200,
"y": 160,
"wires": [
[
"f21c84afff8e53ad",
"baf59a7ea46f45dc"
]
]
},
{
"id": "1e418a972e9abe8a",
"type": "ui_button",
"z": "3bac108584c47a12",
"name": "SW2 OFF",
"group": "7533b08edc51e1dc",
"order": 2,
"width": 0,
"height": 0,
"passthru": false,
"label": "OFF",
"tooltip": "",
"color": "",
"bgcolor": "",
"className": "",
"icon": "",
"payload": "TURN OFF",
"payloadType": "str",
"topic": "topic",
"topicType": "msg",
"x": 200,
"y": 100,
"wires": [
[
"f21c84afff8e53ad",
"d2cf5409280a8aea"
]
]
},
{
"id": "d2cf5409280a8aea",
"type": "debug",
"z": "3bac108584c47a12",
"name": "debug LED OFF",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 500,
"y": 60,
"wires": []
},
{
"id": "baf59a7ea46f45dc",
"type": "debug",
"z": "3bac108584c47a12",
"name": "debug LED ON",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 500,
"y": 120,
"wires": []
},
{
"id": "24c69eaf64f94b89",
"type": "function",
"z": "3bac108584c47a12",
"name": "separate data",
"func": "if (msg.parts.index==0){\n\nreturn [msg,null];}\n\nif(msg.parts.index == 1){\n \n return [null, msg];\n}\n\n",
"outputs": 2,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 540,
"y": 460,
"wires": [
[
"9f1220715dcbba64"
],
[
"b06928b589d55dd6"
]
]
},
{
"id": "6cedd05c6aa69b9e",
"type": "debug",
"z": "3bac108584c47a12",
"name": "debug split",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 670,
"y": 540,
"wires": []
},
{
"id": "b06928b589d55dd6",
"type": "ui_gauge",
"z": "3bac108584c47a12",
"name": "Pressure",
"group": "7254d0ece3aa5932",
"order": 2,
"width": 0,
"height": 0,
"gtype": "gage",
"title": " Pressure",
"label": "hPa",
"format": "{{value}}",
"min": "300",
"max": "1200",
"colors": [
"#00b500",
"#e6e600",
"#ca3838"
],
"seg1": "600",
"seg2": "1100",
"className": "",
"x": 740,
"y": 420,
"wires": []
},
{
"id": "2eef781b5b5273b2",
"type": "comment",
"z": "3bac108584c47a12",
"name": "Read data for Topic2: \"PSoC6Status/temperature,pressure\"",
"info": "",
"x": 270,
"y": 420,
"wires": []
},
{
"id": "175fc6bcefc273a9",
"type": "comment",
"z": "3bac108584c47a12",
"name": "Sending data for Topic: \"PSoC6Status/led\"",
"info": "",
"x": 200,
"y": 40,
"wires": []
},
{
"id": "8d5cfad5.2fc08",
"type": "mqtt-broker",
"name": "",
"broker": "test.mosquitto.org",
"port": "8884",
"tls": "1dc45291e8d66f6b",
"clientid": "",
"autoConnect": true,
"usetls": true,
"compatmode": false,
"protocolVersion": "4",
"keepalive": "10",
"cleansession": true,
"birthTopic": "",
"birthQos": "0",
"birthRetain": "false",
"birthPayload": "",
"birthMsg": {},
"closeTopic": "",
"closeQos": "0",
"closeRetain": "false",
"closePayload": "",
"closeMsg": {},
"willTopic": "",
"willQos": "0",
"willRetain": "false",
"willPayload": "",
"willMsg": {},
"userProps": "",
"sessionExpiry": ""
},
{
"id": "7254d0ece3aa5932",
"type": "ui_group",
"name": "SENSOR",
"tab": "f69053f849010527",
"order": 2,
"disp": true,
"width": "6",
"collapse": false,
"className": ""
},
{
"id": "7533b08edc51e1dc",
"type": "ui_group",
"name": "BUTTON ",
"tab": "f69053f849010527",
"order": 1,
"disp": true,
"width": "6",
"collapse": false,
"className": ""
},
{
"id": "1dc45291e8d66f6b",
"type": "tls-config",
"name": "",
"cert": "",
"key": "",
"ca": "",
"certname": "client.crt",
"keyname": "client.key",
"caname": "mosquitto.org.crt",
"servername": "test.mosquitto.org",
"verifyservercert": true,
"alpnprotocol": ""
},
{
"id": "f69053f849010527",
"type": "ui_tab",
"z": "3bac108584c47a12",
"name": "Infineon PSoC6",
"icon": "dashboard",
"order": 1,
"disabled": false,
"hidden": false
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment