Control Your Home Lighting with Samsung Smart Watches

Make use of Samsung Gear Blynk widget to control LED strip that can light up your room. Thanks to HARDWARIO IoT kit it's easy to make.

IntermediateFull instructions provided1.5 hours1,841
Control Your Home Lighting with Samsung Smart Watches

Things used in this project

Story

Read more

Code

Node-RED flow

JSON
[{"id":"136bfe10.aec9f2","type":"tab","label":"Smart LED strip Controls","disabled":false,"info":""},{"id":"272722ee.c051ae","type":"mqtt out","z":"136bfe10.aec9f2","name":"","topic":"node/power-controller:0/led-strip/-/effect/set","qos":"","retain":"","broker":"e2d0f892.929d08","x":1050,"y":280,"wires":[]},{"id":"ef4994f6.e61c08","type":"change","z":"136bfe10.aec9f2","name":"Effects without specific color","rules":[{"t":"change","p":"payload","pt":"msg","from":"0","fromt":"num","to":"{\"type\":\"color-wipe\", \"wait\": 0, \"color\": \"#000000(00)\"}","tot":"json"},{"t":"change","p":"payload","pt":"msg","from":"1","fromt":"num","to":"{\"type\":\"rainbow\", \"wait\":50}","tot":"json"},{"t":"change","p":"payload","pt":"msg","from":"2","fromt":"num","to":"{\"type\":\"rainbow-cycle\",\"wait\":50}","tot":"json"},{"t":"change","p":"payload","pt":"msg","from":"3","fromt":"num","to":"{\"type\":\"theater-chase-rainbow\",\"wait\":50}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":320,"wires":[["272722ee.c051ae"]]},{"id":"20d32bd2.5b2054","type":"function","z":"136bfe10.aec9f2","name":"Brightness adjust","func":"var brightness = flow.get(\"brightness\") || 0;\nbrightness += 10;\nif(brightness > 100)\n{\n    brightness = 0;\n    flow.set(\"brightness\", 0);\n}\nmsg.payload = brightness;\nflow.set(\"brightness\", brightness);\nreturn msg;","outputs":1,"noerr":0,"x":490,"y":620,"wires":[["d7518e31.bf5c1"]]},{"id":"d7518e31.bf5c1","type":"mqtt out","z":"136bfe10.aec9f2","name":"","topic":"node/power-controller:0/led-strip/-/brightness/set","qos":"","retain":"","broker":"e2d0f892.929d08","x":820,"y":620,"wires":[]},{"id":"1ebf45d3.5c783a","type":"function","z":"136bfe10.aec9f2","name":"Color swap","func":"const colors = [\n    \"#0000ff\", \n    \"#ff0000\", \n    \"#ffff00\", \n    \"#00ff00\", \n    \"#ff1493\", \n    \"#ffffff\", \n    \"#ff4500\", \n    \"#800080\", \n    \"#8B4513\"\n];\n\nconst index = Math.floor(Math.random() * colors.length);\nconst color = colors[index];\n\nflow.set(\"color\", color);\n\nmsg.payload = color;\n\nreturn msg;","outputs":1,"noerr":0,"x":350,"y":520,"wires":[["8253d79c.bf74b8"]]},{"id":"f55d4e79.72658","type":"mqtt out","z":"136bfe10.aec9f2","name":"","topic":"node/power-controller:0/led-strip/-/color/set","qos":"","retain":"","broker":"e2d0f892.929d08","x":1030,"y":400,"wires":[]},{"id":"877374d9.9aa1f8","type":"switch","z":"136bfe10.aec9f2","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"str"},{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"2","vt":"num"},{"t":"eq","v":"3","vt":"num"},{"t":"eq","v":"4","vt":"num"},{"t":"eq","v":"5","vt":"num"},{"t":"eq","v":"6","vt":"num"}],"checkall":"false","repair":false,"outputs":7,"x":370,"y":320,"wires":[["5d12c478.345bec"],["ef4994f6.e61c08"],["ef4994f6.e61c08"],["ef4994f6.e61c08"],["17d0a8bb.9be427"],["17d0a8bb.9be427"],["f1b4f882.ab6878"]]},{"id":"cdfa237f.da47b","type":"function","z":"136bfe10.aec9f2","name":"set color","func":"msg.payload.color = flow.get(\"color\") || 0xff0000;\nreturn msg;","outputs":1,"noerr":0,"x":780,"y":340,"wires":[["272722ee.c051ae"]]},{"id":"17d0a8bb.9be427","type":"change","z":"136bfe10.aec9f2","name":"Effects with specific color","rules":[{"t":"change","p":"payload","pt":"msg","from":"4","fromt":"num","to":"{\"type\":\"icicle\", \"wait\":80, \"color\":\"\"}","tot":"json"},{"t":"change","p":"payload","pt":"msg","from":"5","fromt":"num","to":"{\"type\":\"pulse-color\", \"wait\":80, \"color\":\"\"}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":570,"y":360,"wires":[["cdfa237f.da47b"]]},{"id":"c9be7c27.5f776","type":"blynk-ws-in-write","z":"136bfe10.aec9f2","name":"Next Effect V1","pin":"1","pin_all":0,"client":"b3044ed1.abc36","x":150,"y":180,"wires":[["bdc7ed57.9cbbe"]]},{"id":"89f7d2af.a8da9","type":"blynk-ws-in-write","z":"136bfe10.aec9f2","name":"Prev Effect V2","pin":"2","pin_all":0,"client":"b3044ed1.abc36","x":150,"y":240,"wires":[["bdc7ed57.9cbbe"]]},{"id":"1b5764b7.227d0b","type":"blynk-ws-in-write","z":"136bfe10.aec9f2","name":"Brightness V3","pin":"3","pin_all":0,"client":"b3044ed1.abc36","x":250,"y":620,"wires":[["20d32bd2.5b2054"]]},{"id":"d3dc340.2d3b1d","type":"blynk-ws-in-write","z":"136bfe10.aec9f2","name":"Color Swap V4","pin":"4","pin_all":0,"client":"b3044ed1.abc36","x":180,"y":520,"wires":[["1ebf45d3.5c783a"]]},{"id":"bdc7ed57.9cbbe","type":"function","z":"136bfe10.aec9f2","name":"Effect Swap","func":"var effect = flow.get(\"effect\") || 0;\nconst num_effects = 6;\n\nif (msg.pin === \"1\") {\n    effect++;\n} else {\n    effect--;\n}\n\nif(effect > num_effects)\n{\n    effect = 0;\n}\n\nif(effect < 0)\n{\n    effect = num_effects;\n}\n\nmsg.payload = effect;\nflow.set(\"effect\", effect);\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":220,"wires":[["877374d9.9aa1f8"]]},{"id":"f1b4f882.ab6878","type":"change","z":"136bfe10.aec9f2","name":"load color","rules":[{"t":"set","p":"payload","pt":"msg","to":"color","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":520,"y":400,"wires":[["aec8b5ba.b07e28"]]},{"id":"8253d79c.bf74b8","type":"change","z":"136bfe10.aec9f2","name":"load effect","rules":[{"t":"set","p":"payload","pt":"msg","to":"effect","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":510,"y":520,"wires":[["877374d9.9aa1f8"]]},{"id":"aec8b5ba.b07e28","type":"function","z":"136bfe10.aec9f2","name":"json","func":"return {payload: '\"' + msg.payload + '\"'};","outputs":1,"noerr":0,"x":790,"y":400,"wires":[["f55d4e79.72658"]]},{"id":"5d12c478.345bec","type":"change","z":"136bfe10.aec9f2","name":"Off","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"type\":\"color-wipe\", \"wait\": 0, \"color\": \"#000000(00)\"}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":510,"y":280,"wires":[["272722ee.c051ae"]]},{"id":"e2d0f892.929d08","type":"mqtt-broker","z":"","name":"","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"b3044ed1.abc36","type":"blynk-ws-client","z":"","name":"","path":"ws://blynk-cloud.com/websockets","key":"Ne77h6xKmF9V7gm5KyfEpiSkgUwbLSA5","dbg_all":false,"dbg_read":false,"dbg_write":false,"dbg_notify":false,"dbg_mail":false,"dbg_prop":false,"dbg_sync":false,"dbg_bridge":false,"dbg_low":false,"dbg_pins":"","multi_cmd":false,"proxy_type":"no","proxy_url":""}]

Credits

Jakub Smejkal

Jakub Smejkal

79 projects • 13 followers
Karel Blavka

Karel Blavka

9 projects • 8 followers
Martin Hubáček

Martin Hubáček

65 projects • 56 followers
Lukáš Fabik

Lukáš Fabik

43 projects • 12 followers
Alan Fabik

Alan Fabik

43 projects • 11 followers

Comments