{"id":51622,"date":"2018-02-03T10:41:04","date_gmt":"2018-02-03T10:41:04","guid":{"rendered":"http:\/\/randomnerdtutorials.com\/?p=51622"},"modified":"2020-03-05T01:30:16","modified_gmt":"2020-03-05T01:30:16","slug":"node-red-with-xiaomi-mijia-bedside-lamp","status":"publish","type":"post","link":"https:\/\/randomnerdtutorials.com\/node-red-with-xiaomi-mijia-bedside-lamp\/","title":{"rendered":"Node-RED with Xiaomi Mijia Bedside Lamp (Wi-Fi and Bluetooth)"},"content":{"rendered":"<p>In this tutorial we&#8217;ll show you how you can integrate the Xiaomi Mijia Bedside Lamp with Node-RED. The Xiaomi Mijia Bedside Lamp is a smart lamp with built-in Bluetooth and Wi-Fi. It can be controlled with touch, using the Yeelight app, or using an home automation platform like Node-RED.<!--more--><\/p>\n<p><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter size-full wp-image-51658\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/bedside-lamp-node-red-thumbnail.jpg?resize=1200%2C677&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"1200\" height=\"677\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/bedside-lamp-node-red-thumbnail.jpg?w=1280&amp;quality=100&amp;strip=all&amp;ssl=1 1280w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/bedside-lamp-node-red-thumbnail.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/bedside-lamp-node-red-thumbnail.jpg?resize=768%2C433&amp;quality=100&amp;strip=all&amp;ssl=1 768w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/bedside-lamp-node-red-thumbnail.jpg?resize=1024%2C578&amp;quality=100&amp;strip=all&amp;ssl=1 1024w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/p>\n<p>To learn more about the Xiaomi Mijia Bedside Lamp, you can read <a href=\"https:\/\/makeradvisor.com\/xiaomi-mijia-bedside-lamp-review\/\" target=\"_blank\" rel=\"noopener noreferrer\">our review here.<\/a><\/p>\n<p><strong>Note:<\/strong> this tutorial is also compatible with the&nbsp;<a href=\"https:\/\/randomnerdtutorials.com\/node-red-with-xiaomi-yeelight-rgbw-smart-bulb\/\" rel=\"noopener nofollow\">Xiaomi Yeelight Smart Bulb<\/a>.<\/p>\n<h2>Watch the video demonstration<\/h2>\n<p style=\"text-align:center\"><iframe width=\"720\" height=\"405\" src=\"https:\/\/www.youtube.com\/embed\/B5KOwBxvKnA?rel=0\" frameborder=\"0\" allowfullscreen><\/iframe><\/p>\n<h2>Prerequisites<\/h2>\n<ul>\n<li>You should be familiar with the Raspberry Pi \u2013&nbsp;<a href=\"https:\/\/randomnerdtutorials.com\/getting-started-with-raspberry-pi\/\" target=\"_blank\" rel=\"noopener noreferrer\">read Getting Started with Raspberry Pi<\/a>.<\/li>\n<li>You should have the Raspbian operating system installed in your Raspberry Pi \u2013&nbsp;<a href=\"https:\/\/randomnerdtutorials.com\/installing-raspbian-lite-enabling-and-connecting-with-ssh\/\">read Installing Raspbian Lite, Enabling and Connecting with SSH<\/a>.<\/li>\n<li>You need&nbsp;<a href=\"https:\/\/randomnerdtutorials.com\/getting-started-with-node-red-on-raspberry-pi\/\">Node-RED installed on your Pi<\/a>&nbsp;and&nbsp;<a href=\"https:\/\/randomnerdtutorials.com\/getting-started-with-node-red-dashboard\/\">Node-RED Dashboard<\/a>.<\/li>\n<\/ul>\n<p>If you like home automation and you want to learn more about Node-RED, Raspberry Pi, ESP8266 and Arduino. I recommend that you download my course:&nbsp;<a href=\"https:\/\/randomnerdtutorials.com\/build-a-home-automation-system-for-100\/\" target=\"_blank\" rel=\"noopener noreferrer\">Build a Home Automation System with Node-RED, ESP8266 and Arduino<\/a>.<\/p>\n<h2>Project Overview<\/h2>\n<p>In this tutorial we&#8217;ll build a Node-RED application that can control your Xiaomi Mijia Bedside lamp. Here are the features of the app you&#8217;re going to build:<\/p>\n<ul>\n<li>The app contains a color picker, and a drop-down menu with preset colors;<\/li>\n<li>You can change the color brightness, saturation, temperature, and hue with sliders;<\/li>\n<li>There is a toggle switch to turn the lamp on and off;<\/li>\n<li>You can set a 15 minute timer &#8211; this will turn off the lamp after 15 minutes.<\/li>\n<\/ul>\n<h2>Parts Required<\/h2>\n<p><img data-recalc-dims=\"1\" decoding=\"async\" class=\"aligncenter size-full wp-image-51660\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/unpackage-bedside-lamp.jpg?resize=700%2C448&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"700\" height=\"448\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/unpackage-bedside-lamp.jpg?w=700&amp;quality=100&amp;strip=all&amp;ssl=1 700w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/unpackage-bedside-lamp.jpg?resize=300%2C192&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/p>\n<p>For this project you need the following parts:<\/p>\n<ul>\n<li><a href=\"https:\/\/makeradvisor.com\/raspberry-pi-board\/\" target=\"_blank\" rel=\"noopener noreferrer\">Raspberry Pi Board<\/a> &#8211; read <a href=\"https:\/\/makeradvisor.com\/best-raspberry-pi-3-starter-kits\/\" target=\"_blank\" rel=\"noopener noreferrer\">Best Raspberry Pi Starter Kits<\/a><\/li>\n<li><strong><a href=\"https:\/\/www.gearbest.com\/smart-lighting\/pp_1032313.html?lkid=12788266\" target=\"_blank\" rel=\"noopener nofollow noreferrer\">Xiaomi Mijia Bedside Lamp<\/a><\/strong> &#8211; read <a href=\"https:\/\/makeradvisor.com\/xiaomi-mijia-bedside-lamp-review\/\" target=\"_blank\" rel=\"noopener noreferrer\">full review<\/a><\/li>\n<\/ul>\n<p>This is also compatible with:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.gearbest.com\/smart-lighting\/pp_361555.html?lkid=11957492\" target=\"_blank\" rel=\"noopener nofollow noreferrer\">Xiaomi Yeelight Smart Bulb RGBW \u2013 E27 AC220V<\/a>&nbsp;\u2013&nbsp;read <a href=\"https:\/\/makeradvisor.com\/xiaomi-yeelight-rgbw-smart-bulb-review\/\" target=\"_blank\" rel=\"noopener noreferrer\">full review<\/a><\/li>\n<\/ul>\n<p>You can use the preceding links or go directly to <a href=\"https:\/\/makeradvisor.com\/tools\/?utm_source=rnt&utm_medium=post&utm_campaign=post\" target=\"_blank\">MakerAdvisor.com\/tools<\/a> to find all the parts for your projects at the best price!<\/p><p style=\"text-align:center;\"><a href=\"https:\/\/makeradvisor.com\/tools\/?utm_source=rnt&utm_medium=post&utm_campaign=post\" target=\"_blank\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/header-200.png?w=1200&#038;quality=100&#038;strip=all&#038;ssl=1\"><\/a><\/p>\n<h2>Enabling LAN Control<\/h2>\n<p><span style=\"font-weight: 400;\">Having the Bedside Lamp connected to your router, you have to go to your Yeelight app and enable the LAN Control. <\/span><\/p>\n<p><span style=\"font-weight: 400;\">1) Select the Bedside Lamp (or the Yeelight, if you&#8217;re using that instead)<\/span><\/p>\n<p><img data-recalc-dims=\"1\" decoding=\"async\" class=\"aligncenter wp-image-51641\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/bedside-lamp-lan-control.jpg?resize=462%2C319&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"462\" height=\"319\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/bedside-lamp-lan-control.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/bedside-lamp-lan-control.jpg?resize=300%2C207&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 462px) 100vw, 462px\" \/><\/p>\n<p>2) Open the bottom right menu and choose the LAN Control option:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-46131\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/11\/Screenshot_20171116-155844.jpg?resize=528%2C650&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"528\" height=\"650\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/11\/Screenshot_20171116-155844.jpg?w=528&amp;quality=100&amp;strip=all&amp;ssl=1 528w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/11\/Screenshot_20171116-155844.jpg?resize=244%2C300&amp;quality=100&amp;strip=all&amp;ssl=1 244w\" sizes=\"(max-width: 528px) 100vw, 528px\" \/><\/p>\n<p>3) Tap the enable button:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-46132\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/11\/Screenshot_20171116-155854.jpg?resize=550%2C692&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"550\" height=\"692\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/11\/Screenshot_20171116-155854.jpg?w=550&amp;quality=100&amp;strip=all&amp;ssl=1 550w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/11\/Screenshot_20171116-155854.jpg?resize=238%2C300&amp;quality=100&amp;strip=all&amp;ssl=1 238w\" sizes=\"(max-width: 550px) 100vw, 550px\" \/><\/p>\n<p>After this configuration, Node-RED can communicate with the Bedside Lamp. You can find the documentation of the Yeelight app <a href=\"https:\/\/www.yeelight.com\/en_US\/developer\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>.<\/p>\n<h2>Installing the&nbsp;node-red-contrib-yeelight-compat-hue Node<\/h2>\n<p>To control the Bedside Lamp with Node-RED, first you need to install <strong>node-red-contrib-yeelight-compat-hue<\/strong> node &#8211; you can take a look at the node documentation <a href=\"https:\/\/flows.nodered.org\/node\/node-red-contrib-yeelight-compat-hue\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>. In the Terminal window type the following (this may take a few seconds to complete):<\/p>\n<pre>pi@raspberrypi:~ $ <strong>node-red-stop<\/strong>\npi@raspberrypi:~ $ <strong>cd ~\/.node-red<\/strong>\npi@raspberrypi:~\/.node-red $ <strong>npm install node-red-contrib-yeelight-compat-hue<\/strong><\/pre>\n<h2>Starting Node-RED<\/h2>\n<p>To start Node-RED, enter the following in the Terminal window:<\/p>\n<pre>pi@raspberrypi:~ $ <strong>node-red-start<\/strong><\/pre>\n<p>To access Node-RED, open a tab in any browser on the local network and type the following:<\/p>\n<pre>http:\/\/<span style=\"color: #ff0000;\"><strong>Your_RPi_IP_address<\/strong><\/span>:1880<\/pre>\n<p>You should replace&nbsp;<strong>Your_RPi_IP_address<\/strong>&nbsp;with your Raspberry Pi IP address. If you don\u2019t know your Raspberry Pi IP address, in the Terminal enter:<\/p>\n<pre>pi@raspberrypi:~ $ <strong>hostname -I<\/strong><\/pre>\n<h2>Creating the Node-RED Flow<\/h2>\n<p>Before creating the flow, make sure you have the required node, as show in the figure below. If you don\u2019t have the node, check that you\u2019ve followed the previous instructions.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-51642\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/1-yeelight-nodes.png?resize=159%2C128&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"159\" height=\"128\"><\/p>\n<p>Here\u2019s the flow to control the Bedside Lamp.<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/main-flow.png?quality=100&#038;strip=all&#038;ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-51643\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/main-flow.png?resize=749%2C456&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"749\" height=\"456\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/main-flow.png?w=749&amp;quality=100&amp;strip=all&amp;ssl=1 749w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/main-flow.png?resize=300%2C183&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 749px) 100vw, 749px\" \/><\/a><\/p>\n<p>As this flow is a bit complex, we recommend importing the flow we provide instead of building it from scratch. Then, you can make modifications to the flow, if necessary.<\/p>\n<h3>Importing the Node-RED flow<\/h3>\n<p>To import the Node-RED flow provided, go to the<span style=\"color: #000000;\">&nbsp;<a href=\"https:\/\/raw.githubusercontent.com\/RuiSantosdotme\/Random-Nerd-Tutorials\/master\/Projects\/node_red_flow_xiaomi_bedside_lamp.txt\" target=\"_blank\" rel=\"noopener noreferrer\">GitHub repository<\/a><\/span>&nbsp;or click the figure below to see the raw file, and copy the code provided.<\/p>\n<p><a href=\"https:\/\/raw.githubusercontent.com\/RuiSantosdotme\/Random-Nerd-Tutorials\/master\/Projects\/node_red_flow_xiaomi_bedside_lamp.txt\" target=\"_blank\" rel=\"noopener noreferrer\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-51644 size-full\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/node-red-flow-copy-github.png?resize=984%2C85&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"984\" height=\"85\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/node-red-flow-copy-github.png?w=984&amp;quality=100&amp;strip=all&amp;ssl=1 984w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/node-red-flow-copy-github.png?resize=300%2C26&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/node-red-flow-copy-github.png?resize=768%2C66&amp;quality=100&amp;strip=all&amp;ssl=1 768w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/node-red-flow-copy-github.png?resize=975%2C85&amp;quality=100&amp;strip=all&amp;ssl=1 975w\" sizes=\"(max-width: 984px) 100vw, 984px\" \/><\/a><\/p>\n<p>Next, in the Node-RED window, at the top right corner, select the menu, and go to&nbsp;<strong>Import&nbsp;<\/strong>&nbsp;&gt;&nbsp;<strong>Clipboard<\/strong>.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-45987\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/11\/import-nodes.png?resize=523%2C291&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"523\" height=\"291\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/11\/import-nodes.png?w=523&amp;quality=100&amp;strip=all&amp;ssl=1 523w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/11\/import-nodes.png?resize=300%2C167&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 523px) 100vw, 523px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-45987\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/11\/import-nodes.png?resize=523%2C291&amp;ssl=1\" sizes=\"(max-width: 523px) 100vw, 523px\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/11\/import-nodes.png?w=523 523w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/11\/import-nodes.png?resize=300%2C167 300w\" alt=\"\" width=\"523\" height=\"291\"><\/p>\n<p>Then, paste the code provided and click&nbsp;<strong>Import<\/strong>.<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/node-red-import-flow.png?quality=100&#038;strip=all&#038;ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-51645\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/node-red-import-flow.png?resize=503%2C337&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"503\" height=\"337\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/node-red-import-flow.png?w=503&amp;quality=100&amp;strip=all&amp;ssl=1 503w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/node-red-import-flow.png?resize=300%2C201&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 503px) 100vw, 503px\" \/><\/a><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-45988\" src=\"https:\/\/i2.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/11\/import-nodes-2.png?resize=500%2C337&amp;ssl=1\" sizes=\"(max-width: 500px) 100vw, 500px\" srcset=\"https:\/\/i2.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/11\/import-nodes-2.png?w=500 500w, https:\/\/i2.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/11\/import-nodes-2.png?resize=300%2C202 300w\" alt=\"\" width=\"500\" height=\"337\"><\/p>\n<h2>Adding your Bedside Lamp IP address<\/h2>\n<p>You need to add the IP address of your Bedside Lamp to the node-RED flow.&nbsp;In order to retrieve the beside lamp IP address, you can use the an IP scanner like&nbsp;<a href=\"http:\/\/angryip.org\/download\/\" target=\"_blank\" rel=\"noopener noreferrer\">Angry IP Scanner<\/a>.<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/ip-scanner.png?quality=100&#038;strip=all&#038;ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-51646\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/ip-scanner.png?resize=750%2C381&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"750\" height=\"381\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/ip-scanner.png?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/ip-scanner.png?resize=300%2C152&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/a><\/p>\n<p>In my case, the Bedside Lamp IP address is 192.168.1.133.<\/p>\n<p>Double-click the Bedside Lamp node:<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/node-red-flow-yeelight-node-needs-hostname.png?quality=100&#038;strip=all&#038;ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-51647\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/node-red-flow-yeelight-node-needs-hostname.png?resize=700%2C436&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"700\" height=\"436\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/node-red-flow-yeelight-node-needs-hostname.png?w=700&amp;quality=100&amp;strip=all&amp;ssl=1 700w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/node-red-flow-yeelight-node-needs-hostname.png?resize=300%2C187&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>Add your Bedside Lamp to the node by clicking the icon highlighted in red in the figure below:<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/3-yeelight-node-add-new-config.png?quality=100&#038;strip=all&#038;ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-51648\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/3-yeelight-node-add-new-config.png?resize=497%2C224&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"497\" height=\"224\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/3-yeelight-node-add-new-config.png?w=497&amp;quality=100&amp;strip=all&amp;ssl=1 497w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/3-yeelight-node-add-new-config.png?resize=300%2C135&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 497px) 100vw, 497px\" \/><\/a><\/p>\n<p>A new window opens.&nbsp;<a href=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/4-yeelight-config.png?quality=100&#038;strip=all&#038;ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-51649\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/4-yeelight-config.png?resize=493%2C240&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"493\" height=\"240\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/4-yeelight-config.png?w=493&amp;quality=100&amp;strip=all&amp;ssl=1 493w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/4-yeelight-config.png?resize=300%2C146&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 493px) 100vw, 493px\" \/><\/a><\/p>\n<p>Type the Bedside Lamp IP address in the Hostname\/IP field. The port is set by default.<\/p>\n<h2>Node-RED UI<\/h2>\n<p>After making all the necessary changes, click the&nbsp;<strong>Deploy<\/strong>&nbsp;button to save all the changes.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-40013\" src=\"https:\/\/i2.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/06\/11_deploy_button.png?resize=138%2C40&amp;ssl=1\" alt=\"\" width=\"138\" height=\"40\"><\/p>\n<p>Now, your Node-RED application is ready. To access Node-RED UI and see how your application looks, access any browser in your local networks and type:<\/p>\n<pre>http:\/\/<span style=\"color: #ff0000;\"><strong>Your_RPi_IP_address:1880<\/strong><\/span>\/ui<\/pre>\n<p>Your application should look as in the following figure.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-51654\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/bedsidelamp-node-red-app.jpg?resize=421%2C750&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"421\" height=\"750\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/bedsidelamp-node-red-app.jpg?w=421&amp;quality=100&amp;strip=all&amp;ssl=1 421w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/bedsidelamp-node-red-app.jpg?resize=168%2C300&amp;quality=100&amp;strip=all&amp;ssl=1 168w\" sizes=\"(max-width: 421px) 100vw, 421px\" \/><\/p>\n<p>Here&#8217;s how the app looks on my <a href=\"https:\/\/makeradvisor.com\/oneplus-5-review-best-value-smartphone\/\" target=\"_blank\" rel=\"noopener noreferrer\">OnePlus 5 smartphone<\/a> (for the full demonstration see the video at the beginning of the post):<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-51657\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/bedside-lamp-app.jpg?resize=750%2C422&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"750\" height=\"422\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/bedside-lamp-app.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/bedside-lamp-app.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/p>\n<h2>Wrapping Up<\/h2>\n<p>In this project we\u2019ve built a Node-RED application to control the Xiaomi Mijia Bedside Lamp. The method used is also able to control other Xiaomi smart lights.<\/p>\n<p>We hope you\u2019ve liked this project, and have fun controlling your LED lamp.&nbsp;If you like this project, you may also like:<\/p>\n<ul>\n<li><a href=\"https:\/\/makeradvisor.com\/xiaomi-mijia-bedside-lamp-review\/\" target=\"_blank\" rel=\"noopener noreferrer\">Xiaomi Mijia Bedside Lamp Review<\/a><\/li>\n<li><a href=\"https:\/\/randomnerdtutorials.com\/node-red-with-xiaomi-yeelight-rgbw-smart-bulb\/\" target=\"_blank\" rel=\"noopener noreferrer\">Node-RED with Xiaomi Yeelight RGBW Smart Bulb<\/a><\/li>\n<li><a href=\"https:\/\/randomnerdtutorials.com\/node-red-with-ws2812b-addressable-rgb-led-strip\/\">Node-RED with WS2812B Addressable RGB LED Strip<\/a><\/li>\n<li><a href=\"https:\/\/randomnerdtutorials.com\/build-a-home-automation-system-for-100\/\" target=\"_blank\" rel=\"noopener noreferrer\">Build a Home Automation System with Node-RED<\/a><\/li>\n<\/ul>\n<p>Thanks for reading.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial we&#8217;ll show you how you can integrate the Xiaomi Mijia Bedside Lamp with Node-RED. The Xiaomi Mijia Bedside Lamp is a smart lamp with built-in Bluetooth and &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"Node-RED with Xiaomi Mijia Bedside Lamp (Wi-Fi and Bluetooth)\" class=\"read-more button\" href=\"https:\/\/randomnerdtutorials.com\/node-red-with-xiaomi-mijia-bedside-lamp\/#more-51622\" aria-label=\"Read more about Node-RED with Xiaomi Mijia Bedside Lamp (Wi-Fi and Bluetooth)\">CONTINUE READING \u00bb<\/a><\/p>\n","protected":false},"author":5,"featured_media":51658,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[304,225,273,264,268],"tags":[],"class_list":["post-51622","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-0-home-automation","category-home-automation","category-node-red","category-project","category-raspberry-pi-project"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/01\/bedside-lamp-node-red-thumbnail.jpg?fit=1280%2C722&quality=100&strip=all&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/51622","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/comments?post=51622"}],"version-history":[{"count":0,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/51622\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media\/51658"}],"wp:attachment":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media?parent=51622"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/categories?post=51622"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/tags?post=51622"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}