Skip to content

Instantly share code, notes, and snippets.

@leofonic
Created December 18, 2018 00:34
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 leofonic/380269ec90ff1178e569915ce1883ee5 to your computer and use it in GitHub Desktop.
Save leofonic/380269ec90ff1178e569915ce1883ee5 to your computer and use it in GitHub Desktop.
Node Red Sample Filter
[
{
"id": "a9fcc936.da11c8",
"type": "tab",
"label": "Sample Filter",
"disabled": false,
"info": ""
},
{
"id": "416ae017.b9f9c",
"type": "debug",
"z": "a9fcc936.da11c8",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 590,
"y": 180,
"wires": []
},
{
"id": "1c36f37e.53c1fd",
"type": "mqtt in",
"z": "a9fcc936.da11c8",
"name": "",
"topic": "NodeESP/807D3ADC5D94/out",
"qos": "2",
"broker": "c37cacc6.b0763",
"x": 170,
"y": 40,
"wires": [
[
"cf039d24.f03e2"
]
]
},
{
"id": "cf039d24.f03e2",
"type": "json",
"z": "a9fcc936.da11c8",
"name": "convert to object",
"property": "payload",
"action": "",
"pretty": false,
"x": 140,
"y": 120,
"wires": [
[
"ed150cc.6287df"
]
]
},
{
"id": "a46a54ef.1a3bd8",
"type": "split",
"z": "a9fcc936.da11c8",
"name": "",
"splt": "",
"spltType": "str",
"arraySplt": 1,
"arraySpltType": "len",
"stream": false,
"addname": "",
"x": 110,
"y": 200,
"wires": [
[
"56fbb5f2.8b544c"
]
]
},
{
"id": "ed150cc.6287df",
"type": "switch",
"z": "a9fcc936.da11c8",
"name": "filter pwm state",
"property": "payload.cmd",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "get_pwm_state",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 340,
"y": 120,
"wires": [
[
"a0db9a15.20bb38"
]
]
},
{
"id": "a0db9a15.20bb38",
"type": "change",
"z": "a9fcc936.da11c8",
"name": "get value",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "payload.value",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 520,
"y": 120,
"wires": [
[
"a46a54ef.1a3bd8"
]
]
},
{
"id": "56fbb5f2.8b544c",
"type": "switch",
"z": "a9fcc936.da11c8",
"name": "",
"property": "payload.pin_name",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "LED1",
"vt": "str"
},
{
"t": "eq",
"v": "LED2",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 250,
"y": 200,
"wires": [
[
"7992b91f.ec4938"
],
[
"2d617ba2.6caf34"
]
]
},
{
"id": "7992b91f.ec4938",
"type": "template",
"z": "a9fcc936.da11c8",
"name": "",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "{{payload.pin_state}}",
"output": "json",
"x": 420,
"y": 180,
"wires": [
[
"416ae017.b9f9c"
]
]
},
{
"id": "f060a125.61694",
"type": "debug",
"z": "a9fcc936.da11c8",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 590,
"y": 240,
"wires": []
},
{
"id": "2d617ba2.6caf34",
"type": "template",
"z": "a9fcc936.da11c8",
"name": "",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "{{payload.pin_state}}",
"output": "json",
"x": 420,
"y": 240,
"wires": [
[
"f060a125.61694"
]
]
},
{
"id": "c37cacc6.b0763",
"type": "mqtt-broker",
"z": "",
"name": "fkainka.de",
"broker": "broker.fkainka.de",
"port": "1883",
"clientid": "",
"usetls": false,
"compatmode": true,
"keepalive": "60",
"cleansession": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"willTopic": "",
"willQos": "0",
"willPayload": ""
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment