Skip to content

Instantly share code, notes, and snippets.

@infosmick
Created December 29, 2016 14:49
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 infosmick/57740bf61b090551a7fe17b036a414cf to your computer and use it in GitHub Desktop.
Save infosmick/57740bf61b090551a7fe17b036a414cf to your computer and use it in GitHub Desktop.
Smick_05_digital_input

Digital input example

[
{
"id": "e82eefd6.a4c5e",
"type": "tab",
"label": "digital_input"
},
{
"id": "9a0095c7.dde578",
"type": "trigger",
"z": "e82eefd6.a4c5e",
"op1": "LED=1",
"op2": "LED=0",
"op1type": "str",
"op2type": "str",
"duration": "5",
"extend": false,
"units": "s",
"reset": "",
"name": "led on 5sec",
"x": 570,
"y": 280,
"wires": [
[]
]
},
{
"id": "6f854012.79d",
"type": "ui_gauge",
"z": "e82eefd6.a4c5e",
"name": "Button",
"group": "65a1418e.b6f28",
"order": 2,
"width": "2",
"height": "2",
"gtype": "donut",
"title": "",
"label": "click",
"format": "{{value}}",
"min": 0,
"max": "1",
"colors": [
"#00b500",
"#e6e600",
"#ca3838"
],
"x": 790,
"y": 380,
"wires": []
},
{
"id": "7606ed9f.9465e4",
"type": "ui_chart",
"z": "e82eefd6.a4c5e",
"name": "click",
"group": "65a1418e.b6f28",
"order": 3,
"width": 0,
"height": 0,
"label": "",
"chartType": "line",
"legend": "false",
"xformat": "%H:%M:%S",
"interpolate": "step-after",
"nodata": "push switch",
"ymin": "0",
"ymax": "1",
"removeOlder": "10",
"removeOlderUnit": "60",
"x": 790,
"y": 440,
"wires": [
[],
[]
]
},
{
"id": "e90e5c40.f2d55",
"type": "trigger",
"z": "e82eefd6.a4c5e",
"op1": "1",
"op2": "0",
"op1type": "str",
"op2type": "str",
"duration": "1",
"extend": true,
"units": "s",
"reset": "",
"name": "",
"x": 560,
"y": 400,
"wires": [
[
"6f854012.79d",
"7606ed9f.9465e4"
]
]
},
{
"id": "ae183781.d756f8",
"type": "comment",
"z": "e82eefd6.a4c5e",
"name": "actions on actuators",
"info": "",
"x": 590,
"y": 220,
"wires": []
},
{
"id": "b21099e2.9a96e8",
"type": "comment",
"z": "e82eefd6.a4c5e",
"name": "actions on dashboard",
"info": "",
"x": 600,
"y": 340,
"wires": []
},
{
"id": "a034daed.66a2d8",
"type": "e-mail",
"z": "e82eefd6.a4c5e",
"server": "smtp.gmail.com",
"port": "465",
"name": "infosmick@gmail.com",
"dname": "mail",
"x": 790,
"y": 620,
"wires": []
},
{
"id": "ba590459.035108",
"type": "twitter out",
"z": "e82eefd6.a4c5e",
"twitter": "",
"name": "tweet",
"x": 790,
"y": 680,
"wires": []
},
{
"id": "725a97ae.623098",
"type": "comment",
"z": "e82eefd6.a4c5e",
"name": "actions on social",
"info": "",
"x": 580,
"y": 500,
"wires": []
},
{
"id": "28dc48d8.22fd78",
"type": "function",
"z": "e82eefd6.a4c5e",
"name": "alarm msg",
"func": "function timeDate(tz) {\n var d = new Date(Date.now()+tz*3600000);\n\n return d.getUTCHours() + \":\" +\n d.getUTCMinutes() + \":\" +\n d.getUTCSeconds() + \" \" +\n d.getUTCDate()\t+\"/\" +\n (d.getUTCMonth()+1) + \"/\" +\n d.getUTCFullYear();\n}\n\nmsg.payload=\"alarm from Smick at \" +\n timeDate(1);\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 570,
"y": 560,
"wires": [
[
"a95720da.1d86"
]
]
},
{
"id": "a95720da.1d86",
"type": "debug",
"z": "e82eefd6.a4c5e",
"name": "",
"active": true,
"console": "false",
"complete": "false",
"x": 810,
"y": 560,
"wires": []
},
{
"id": "4ce92a8b.692514",
"type": "comment",
"z": "e82eefd6.a4c5e",
"name": "enable/disable",
"info": "",
"x": 580,
"y": 60,
"wires": []
},
{
"id": "eb233c89.538f4",
"type": "ui_switch",
"z": "e82eefd6.a4c5e",
"name": "",
"label": "D3 button enable",
"group": "65a1418e.b6f28",
"order": 1,
"width": 0,
"height": 0,
"passthru": true,
"topic": "",
"style": "",
"onvalue": "click==d3=0",
"onvalueType": "str",
"onicon": "",
"oncolor": "",
"offvalue": "click==null",
"offvalueType": "str",
"officon": "",
"offcolor": "",
"x": 830,
"y": 160,
"wires": [
[
"e4526f09.eb336"
]
]
},
{
"id": "b87d5235.0fe9",
"type": "switch",
"z": "e82eefd6.a4c5e",
"name": "parse",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "cont",
"v": "CONN",
"vt": "str"
},
{
"t": "cont",
"v": "CLICK",
"vt": "str"
}
],
"checkall": "false",
"outputs": 2,
"x": 270,
"y": 400,
"wires": [
[
"9733586c.818348"
],
[
"9a0095c7.dde578",
"e90e5c40.f2d55",
"28dc48d8.22fd78"
]
]
},
{
"id": "e8410a86.195ec8",
"type": "link in",
"z": "e82eefd6.a4c5e",
"name": "event",
"links": [
"ca2d688.4211598"
],
"x": 135,
"y": 400,
"wires": [
[
"b87d5235.0fe9"
]
]
},
{
"id": "e4526f09.eb336",
"type": "link out",
"z": "e82eefd6.a4c5e",
"name": "command",
"links": [
"1096456f.bfc93b"
],
"x": 995,
"y": 120,
"wires": []
},
{
"id": "9733586c.818348",
"type": "change",
"z": "e82eefd6.a4c5e",
"name": "setup",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "click==d3=0",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 550,
"y": 120,
"wires": [
[
"e4526f09.eb336"
]
]
},
{
"id": "7489d66f.7e3db8",
"type": "comment",
"z": "e82eefd6.a4c5e",
"name": "connect here --->",
"info": "",
"x": 620,
"y": 660,
"wires": []
},
{
"id": "738599c0.741078",
"type": "comment",
"z": "e82eefd6.a4c5e",
"name": "Description",
"info": "Smick_05_digital_input\n_______________________________________________________________________________\nPackage : Smick v.1\nModule : console\nAuthor : Curci\nLicence : (CC) BY-NC-SA\n\nThis work is licensed under a Creative Commons \nAttribution-NonCommercial-ShareAlike \n4.0 International License.\n\nHistory\n\nDate Author Description\n2016.12.17 Curci genesis\n_______________________________________________________________________________\n\nDescription\n\ntodo\n_______________________________________________________________________________\n\nBill Of Material\n\nHardware:\n\n 1 Human internet terminal (PC, tablet or smartphone) connected to the internet\n 1 Smick Wi-Fi connected to the internet\n 1 Button connected to smick \n\nHW Connections:\n\n Device pin Smick pin\n Button 1 D3\n Button 2 GND\n\nFlow Connections:\n\n console\n\nAccount:\n\n Wi-Fi credentials\n MQTT broker\n FRED\n",
"x": 180,
"y": 60,
"wires": []
},
{
"id": "65a1418e.b6f28",
"type": "ui_group",
"z": "",
"name": "digital",
"tab": "22823145.22de6e",
"order": 1,
"disp": true,
"width": "6"
},
{
"id": "22823145.22de6e",
"type": "ui_tab",
"z": "",
"name": "Input",
"icon": "dashboard",
"order": 3
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment