[
{
"id": "ad110fd5.2b872",
"type": "tab",
"label": "Day14_MQTTleds",
"disabled": true,
"info": ""
},
{
"id": "dc59d33f.22463",
"type": "mqtt in",
"z": "ad110fd5.2b872",
"name": "",
"topic": "NodeESP/[PID]/button/state/get/out",
"qos": "2",
"broker": "3c53c9b8.8965a6",
"x": 180,
"y": 40,
"wires": [
[
"d69bf738.9ff4e8"
]
]
},
{
"id": "d69bf738.9ff4e8",
"type": "json",
"z": "ad110fd5.2b872",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 130,
"y": 120,
"wires": [
[
"251f081f.160c48"
]
]
},
{
"id": "2657742a.533d3c",
"type": "ui_switch",
"z": "ad110fd5.2b872",
"name": "",
"label": "LED1 (on/off)",
"group": "a260dabf.f82928",
"order": 1,
"width": 0,
"height": 0,
"passthru": true,
"decouple": "false",
"topic": "",
"style": "",
"onvalue": "true",
"onvalueType": "bool",
"onicon": "",
"oncolor": "",
"offvalue": "false",
"offvalueType": "bool",
"officon": "",
"offcolor": "",
"x": 730,
"y": 80,
"wires": [
[
"27fd7e43.e67682"
]
]
},
{
"id": "5f77942a.6625ec",
"type": "ui_switch",
"z": "ad110fd5.2b872",
"name": "",
"label": "LED2 (on/off)",
"group": "d920fbc5.d14b98",
"order": 1,
"width": 0,
"height": 0,
"passthru": true,
"decouple": "false",
"topic": "",
"style": "",
"onvalue": "true",
"onvalueType": "bool",
"onicon": "",
"oncolor": "",
"offvalue": "false",
"offvalueType": "bool",
"officon": "",
"offcolor": "",
"x": 730,
"y": 160,
"wires": [
[
"e1d416a4.6da1e8"
]
]
},
{
"id": "7491f696.23d928",
"type": "switch",
"z": "ad110fd5.2b872",
"name": "",
"property": "payload.pin_name",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "Button1",
"vt": "str"
},
{
"t": "eq",
"v": "Button2",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 370,
"y": 120,
"wires": [
[
"e665d550.f34448"
],
[
"b580269.9f192d8"
]
]
},
{
"id": "251f081f.160c48",
"type": "split",
"z": "ad110fd5.2b872",
"name": "",
"splt": ",",
"spltType": "str",
"arraySplt": 1,
"arraySpltType": "len",
"stream": false,
"addname": "",
"x": 250,
"y": 120,
"wires": [
[
"7491f696.23d928"
]
]
},
{
"id": "e06b3bd.5302ec8",
"type": "mqtt in",
"z": "ad110fd5.2b872",
"name": "",
"topic": "NodeESP/[PID]/touch/state/get/out",
"qos": "2",
"broker": "3c53c9b8.8965a6",
"x": 180,
"y": 200,
"wires": [
[
"bbf89f6e.acd56"
]
]
},
{
"id": "bbf89f6e.acd56",
"type": "json",
"z": "ad110fd5.2b872",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 130,
"y": 280,
"wires": [
[
"9eab9c92.0d863"
]
]
},
{
"id": "f842531d.75e3a",
"type": "switch",
"z": "ad110fd5.2b872",
"name": "",
"property": "payload.pin_name",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "Touch2",
"vt": "str"
},
{
"t": "eq",
"v": "Touch1",
"vt": "str"
},
{
"t": "eq",
"v": "Touch4",
"vt": "str"
},
{
"t": "eq",
"v": "Touch3",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 4,
"x": 370,
"y": 280,
"wires": [
[
"1dd26a55.13f9f6"
],
[
"7eef3792.60ce58"
],
[
"575e2948.bf4f08"
],
[
"4c8f3565.fcb08c"
]
]
},
{
"id": "9eab9c92.0d863",
"type": "split",
"z": "ad110fd5.2b872",
"name": "",
"splt": ",",
"spltType": "str",
"arraySplt": 1,
"arraySpltType": "len",
"stream": false,
"addname": "",
"x": 250,
"y": 280,
"wires": [
[
"f842531d.75e3a"
]
]
},
{
"id": "93392f19.f449c",
"type": "ui_slider",
"z": "ad110fd5.2b872",
"name": "",
"label": "LED1",
"group": "a260dabf.f82928",
"order": 2,
"width": 0,
"height": 0,
"passthru": false,
"topic": "",
"min": 0,
"max": "255",
"step": 1,
"x": 710,
"y": 400,
"wires": [
[
"166a163d.d9bd1a"
]
]
},
{
"id": "c38feb7.d0d4e18",
"type": "template",
"z": "ad110fd5.2b872",
"name": "set_pwm_state",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": " {\"cmd\":\"set_pwm_state\",\"LED1\":{{payload}}}",
"output": "str",
"x": 1080,
"y": 400,
"wires": [
[
"469db61e.946d18"
]
]
},
{
"id": "6cc2042.008bffc",
"type": "ui_slider",
"z": "ad110fd5.2b872",
"name": "",
"label": "LED2",
"group": "d920fbc5.d14b98",
"order": 2,
"width": 0,
"height": 0,
"passthru": false,
"topic": "",
"min": 0,
"max": "255",
"step": 1,
"x": 710,
"y": 480,
"wires": [
[
"e48d762f.a5cba8"
]
]
},
{
"id": "469db61e.946d18",
"type": "mqtt out",
"z": "ad110fd5.2b872",
"name": "",
"topic": "NodeESP/[PID]/pwm/state/set",
"qos": "",
"retain": "",
"broker": "3c53c9b8.8965a6",
"x": 1350,
"y": 440,
"wires": []
},
{
"id": "dd0cbdbd.20761",
"type": "template",
"z": "ad110fd5.2b872",
"name": "set_pwm_state",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": " {\"cmd\":\"set_pwm_state\",\"LED2\":{{payload}}}",
"output": "str",
"x": 1080,
"y": 480,
"wires": [
[
"469db61e.946d18"
]
]
},
{
"id": "1554350e.833c3b",
"type": "mqtt in",
"z": "ad110fd5.2b872",
"name": "",
"topic": "NodeESP/[PID]/pwm/state/get/out",
"qos": "2",
"broker": "3c53c9b8.8965a6",
"x": 180,
"y": 360,
"wires": [
[
"978eaee1.2b657"
]
]
},
{
"id": "978eaee1.2b657",
"type": "json",
"z": "ad110fd5.2b872",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 130,
"y": 440,
"wires": [
[
"9ea5f924.7d5428"
]
]
},
{
"id": "70726158.d92cc",
"type": "switch",
"z": "ad110fd5.2b872",
"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": 370,
"y": 440,
"wires": [
[
"6b07982c.ddc798"
],
[
"dfe7f2b5.9e67"
]
]
},
{
"id": "ad2052f2.a589b",
"type": "mqtt out",
"z": "ad110fd5.2b872",
"name": "",
"topic": "NodeESP/[PID]/pwm/state/set",
"qos": "",
"retain": "",
"broker": "3c53c9b8.8965a6",
"x": 1510,
"y": 280,
"wires": []
},
{
"id": "dc956d0f.caf44",
"type": "function",
"z": "ad110fd5.2b872",
"name": "led1_pin_value",
"func": "var pin_value =global.get('led1_pin_value') || 0;\npin_value += msg.payload;\nif (pin_value > 255) pin_value = 255;\nif (pin_value < 0) pin_value = 0;\n\nglobal.set('led1_pin_value', pin_value);\nmsg.payload = pin_value;\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"x": 1080,
"y": 240,
"wires": [
[
"5f7400b3.5976"
]
]
},
{
"id": "bd23c579.711088",
"type": "mqtt out",
"z": "ad110fd5.2b872",
"name": "",
"topic": "NodeESP/[PID]/pwm/state/set",
"qos": "",
"retain": "",
"broker": "3c53c9b8.8965a6",
"x": 1190,
"y": 120,
"wires": []
},
{
"id": "27fd7e43.e67682",
"type": "template",
"z": "ad110fd5.2b872",
"name": "set_pwm_state",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": " {\"cmd\":\"set_pwm_state\",\"LED1\":{{payload}}}",
"output": "str",
"x": 920,
"y": 80,
"wires": [
[
"bd23c579.711088"
]
]
},
{
"id": "e1d416a4.6da1e8",
"type": "template",
"z": "ad110fd5.2b872",
"name": "set_pwm_state",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": " {\"cmd\":\"set_pwm_state\",\"LED2\":{{payload}}}",
"output": "str",
"x": 920,
"y": 160,
"wires": [
[
"bd23c579.711088"
]
]
},
{
"id": "e665d550.f34448",
"type": "function",
"z": "ad110fd5.2b872",
"name": "led1_pin_state",
"func": "var pin_state=global.get('led1_pin_state') || false;\n\nif (!msg.payload.pin_state){\n (pin_state===false) ? (pin_state= true) : (pin_state= false);\n global.set('led1_pin_state', pin_state);\n msg.payload = pin_state;\n return msg;\n}\n",
"outputs": 1,
"noerr": 0,
"x": 540,
"y": 80,
"wires": [
[
"2657742a.533d3c"
]
]
},
{
"id": "b580269.9f192d8",
"type": "function",
"z": "ad110fd5.2b872",
"name": "led2_pin_state",
"func": "var pin_state=global.get('led2_pin_state') || false;\n\nif (!msg.payload.pin_state){\n (pin_state===false) ? (pin_state= true) : (pin_state= false);\n global.set('led2_pin_state', pin_state);\n msg.payload = pin_state;\n return msg;\n}\n\n",
"outputs": 1,
"noerr": 0,
"x": 540,
"y": 160,
"wires": [
[
"5f77942a.6625ec"
]
]
},
{
"id": "6b07982c.ddc798",
"type": "function",
"z": "ad110fd5.2b872",
"name": "led1_pin_value",
"func": "var pin_value = msg.payload.pin_value;\nif (pin_value > 255) pin_value = 255;\nif (pin_value < 0) pin_value = 0;\n\nglobal.set('led1_pin_value', pin_value);\nmsg.payload = pin_value;\n\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"x": 540,
"y": 400,
"wires": [
[
"93392f19.f449c"
]
]
},
{
"id": "dfe7f2b5.9e67",
"type": "function",
"z": "ad110fd5.2b872",
"name": "led2_pin_value",
"func": "var pin_value = msg.payload.pin_value;\nif (pin_value > 255) pin_value = 255;\nif (pin_value < 0) pin_value = 0;\n\nglobal.set('led2_pin_value', pin_value);\nmsg.payload = pin_value;\n\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"x": 540,
"y": 480,
"wires": [
[
"6cc2042.008bffc"
]
]
},
{
"id": "24327401.7c850c",
"type": "ui_button",
"z": "ad110fd5.2b872",
"name": "",
"group": "a260dabf.f82928",
"order": 3,
"width": 0,
"height": 0,
"passthru": true,
"label": "LED1 (+10)",
"color": "",
"bgcolor": "",
"icon": "",
"payload": "+10",
"payloadType": "num",
"topic": "",
"x": 890,
"y": 220,
"wires": [
[
"dc956d0f.caf44"
]
]
},
{
"id": "1e8afca0.331de3",
"type": "ui_button",
"z": "ad110fd5.2b872",
"name": "",
"group": "a260dabf.f82928",
"order": 4,
"width": 0,
"height": 0,
"passthru": true,
"label": "LED1 (-10)",
"color": "",
"bgcolor": "",
"icon": "",
"payload": "-10",
"payloadType": "num",
"topic": "",
"x": 890,
"y": 260,
"wires": [
[
"dc956d0f.caf44"
]
]
},
{
"id": "5f7400b3.5976",
"type": "template",
"z": "ad110fd5.2b872",
"name": "set_pwm_state",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": " {\"cmd\":\"set_pwm_state\",\"LED1\":{{payload}}}",
"output": "str",
"x": 1260,
"y": 240,
"wires": [
[
"ad2052f2.a589b"
]
]
},
{
"id": "ea600f45.5ed77",
"type": "function",
"z": "ad110fd5.2b872",
"name": "led2_pin_value",
"func": "var pin_value =global.get('led2_pin_value') || 0;\npin_value += msg.payload;\nif (pin_value > 255) pin_value = 255;\nif (pin_value < 0) pin_value = 0;\n\nglobal.set('led2_pin_value', pin_value);\nmsg.payload = pin_value;\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"x": 1080,
"y": 320,
"wires": [
[
"45b375df.fac18c"
]
]
},
{
"id": "7e354639.029668",
"type": "ui_button",
"z": "ad110fd5.2b872",
"name": "",
"group": "d920fbc5.d14b98",
"order": 3,
"width": 0,
"height": 0,
"passthru": true,
"label": "LED2 (+10)",
"color": "",
"bgcolor": "",
"icon": "",
"payload": "+10",
"payloadType": "num",
"topic": "",
"x": 890,
"y": 300,
"wires": [
[
"ea600f45.5ed77"
]
]
},
{
"id": "b9d07baa.91bd88",
"type": "ui_button",
"z": "ad110fd5.2b872",
"name": "",
"group": "d920fbc5.d14b98",
"order": 4,
"width": 0,
"height": 0,
"passthru": true,
"label": "LED2 (-10)",
"color": "",
"bgcolor": "",
"icon": "",
"payload": "-10",
"payloadType": "num",
"topic": "",
"x": 890,
"y": 340,
"wires": [
[
"ea600f45.5ed77"
]
]
},
{
"id": "45b375df.fac18c",
"type": "template",
"z": "ad110fd5.2b872",
"name": "set_pwm_state",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": " {\"cmd\":\"set_pwm_state\",\"LED2\":{{payload}}}",
"output": "str",
"x": 1260,
"y": 320,
"wires": [
[
"ad2052f2.a589b"
]
]
},
{
"id": "166a163d.d9bd1a",
"type": "function",
"z": "ad110fd5.2b872",
"name": "led1_pin_value",
"func": "global.set('led1_pin_value', msg.payload);\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"x": 880,
"y": 400,
"wires": [
[
"c38feb7.d0d4e18"
]
]
},
{
"id": "e48d762f.a5cba8",
"type": "function",
"z": "ad110fd5.2b872",
"name": "led2_pin_value",
"func": "global.set('led2_pin_value', msg.payload);\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"x": 880,
"y": 480,
"wires": [
[
"dd0cbdbd.20761"
]
]
},
{
"id": "9ea5f924.7d5428",
"type": "split",
"z": "ad110fd5.2b872",
"name": "",
"splt": ",",
"spltType": "str",
"arraySplt": 1,
"arraySpltType": "len",
"stream": false,
"addname": "",
"x": 250,
"y": 440,
"wires": [
[
"70726158.d92cc"
]
]
},
{
"id": "fdbf375a.6c6328",
"type": "trigger",
"z": "ad110fd5.2b872",
"op1": "1",
"op2": "0",
"op1type": "str",
"op2type": "str",
"duration": "-250",
"extend": false,
"units": "ms",
"reset": "false",
"bytopic": "all",
"name": "",
"x": 700,
"y": 220,
"wires": [
[
"24327401.7c850c"
]
]
},
{
"id": "1dd26a55.13f9f6",
"type": "template",
"z": "ad110fd5.2b872",
"name": "pin_state",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "{{payload.pin_state}}",
"output": "str",
"x": 520,
"y": 220,
"wires": [
[
"fdbf375a.6c6328"
]
]
},
{
"id": "7eef3792.60ce58",
"type": "template",
"z": "ad110fd5.2b872",
"name": "pin_state",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "{{payload.pin_state}}",
"output": "str",
"x": 520,
"y": 260,
"wires": [
[
"85c5103f.d3124"
]
]
},
{
"id": "85c5103f.d3124",
"type": "trigger",
"z": "ad110fd5.2b872",
"op1": "1",
"op2": "0",
"op1type": "str",
"op2type": "str",
"duration": "-250",
"extend": false,
"units": "ms",
"reset": "false",
"bytopic": "all",
"name": "",
"x": 700,
"y": 260,
"wires": [
[
"1e8afca0.331de3"
]
]
},
{
"id": "bc5ab1d0.5259d",
"type": "trigger",
"z": "ad110fd5.2b872",
"op1": "1",
"op2": "0",
"op1type": "str",
"op2type": "str",
"duration": "-250",
"extend": false,
"units": "ms",
"reset": "false",
"bytopic": "all",
"name": "",
"x": 700,
"y": 300,
"wires": [
[
"7e354639.029668"
]
]
},
{
"id": "575e2948.bf4f08",
"type": "template",
"z": "ad110fd5.2b872",
"name": "pin_state",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "{{payload.pin_state}}",
"output": "str",
"x": 520,
"y": 300,
"wires": [
[
"bc5ab1d0.5259d"
]
]
},
{
"id": "4c8f3565.fcb08c",
"type": "template",
"z": "ad110fd5.2b872",
"name": "pin_state",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "{{payload.pin_state}}",
"output": "str",
"x": 520,
"y": 340,
"wires": [
[
"c870a07.f76d46"
]
]
},
{
"id": "c870a07.f76d46",
"type": "trigger",
"z": "ad110fd5.2b872",
"op1": "1",
"op2": "0",
"op1type": "str",
"op2type": "str",
"duration": "-250",
"extend": false,
"units": "ms",
"reset": "false",
"bytopic": "all",
"name": "",
"x": 700,
"y": 340,
"wires": [
[
"b9d07baa.91bd88"
]
]
},
{
"id": "3c53c9b8.8965a6",
"type": "mqtt-broker",
"z": "",
"name": "fkainka.de",
"broker": "broker.fkainka.de",
"port": "1883",
"clientid": "",
"usetls": false,
"compatmode": true,
"keepalive": "60",
"cleansession": true,
"willTopic": "",
"willQos": "0",
"willPayload": "",
"birthTopic": "",
"birthQos": "0",
"birthPayload": ""
},
{
"id": "a260dabf.f82928",
"type": "ui_group",
"z": "",
"name": "LED1",
"tab": "a36589e4.c55a28",
"order": 1,
"disp": true,
"width": "6",
"collapse": false
},
{
"id": "d920fbc5.d14b98",
"type": "ui_group",
"z": "",
"name": "LED2",
"tab": "a36589e4.c55a28",
"order": 2,
"disp": true,
"width": "6",
"collapse": false
},
{
"id": "a36589e4.c55a28",
"type": "ui_tab",
"z": "",
"name": "Day14",
"icon": "dashboard",
"order": 9
}
]