FREE Shipping on orders over $49 USA $99 INTERNATIONAL

Blinds Control MQTT OpenHAB ESP8266

Blinds Control MQTT OpenHAB ESP8266 

Demo:

Hey guys Matt here from MKSmartHouse.com and in this video I am going to give you a demo of the Blinds Control we will be creating.

 
So what is this Blinds Control exactly well, it is a device that receives commands from our openhab server through MQTT and moves the blinds. This is a cool device that removes one thing to do on my list in the morning and at night as now my blinds automatically open and close at the times I set. Also, it is just really awesome being able to control your blinds from your phone from anywhere in the world with an internet connection. If I pull out a mobile device and open up the openHAB app you can see that I now have two controls in the JK Room Frame. 
 
These two controls control the same item but there are two ways you can control it. The first way is through the three buttons. Currently the blinds are in the closed position. If I press Open then the blinds go to the Open position. Then when I press the Half button the blinds go to the half position. You guessed it, if I press the close button then the blinds go to the closed position. My personal favorite control is the slider and I like it because wherever I put the slider the blinds go to that position. The positions are 1 to 100. Since we are on the topic of controlling with openHAB, I have written two rules in the rules file, one to automatically open the blinds at 7 am and one to close the Blinds at 6 pm. When we write the rules I will show you how to set your own custom times. Since we previously connected the Amazon echo to our openhab server we can also control the blinds using it. “Alexa Set JK blinds to 0” “Alexa set JK blinds to 56”. The way you tell alexa to control it is by using the item name then “set” and a number 1 to 100. The same thing goes with siri “Set JK blinds to 100.” If you would like to control your blinds and be ready for the hardware video where I show you how to make it, then you can order a kit with all the parts from my shop over at mksmarthouse.com/shop.
 
 As you may have noticed all over this video I have used the words JK Blinds, that is because those are the initials of the person whose room the blinds are in. If you called it just blinds and have many of them, Alexa and siri will get confused. When I show you how to make the Blinds control we will be using the item name MK Blinds. If we take a look at the blinds there are only two visual differences between these blinds and normal blinds. The first thing is that I have removed the original mechanism that was used to tilt the blinds by hand. It was removed because when the servo is in you really cannot move the shaft of the blinds, you will understand it better when I show you inside.
 
 The second thing is that there is a wire coming out from the blinds and into a power outlet, this is just a 5 volt power line. All the components are all nicely housed inside the blinds, so let me remove the blinds and show you inside. With these blinds the best outlet was to the left of the blinds so I kept the control box and the servo motor together, when I show you how to make this, I will do it just a little bit different and put the control box on the right side because in my room the best outlet is to the right of the blinds. Anyway going from right to left we have the servo motor with some 3D printed parts on it. The first 3D printed part is the servo to blinds adapter, what this does is allow the servo motor to attach onto the shaft of the blinds. Then the servo motor is sitting on a height adjustable mount. The reason it is height adjustable is because there are many different blinds with different heights between the shaft and the bottom of the blinds raceway. For example my blinds in my room have a different height than the ones in the office. I will provide the files so you can 3D print these parts at home. If you do not have a 3D printer than you can buy the parts from my shop at mksmarthouse.com/shop. Moving on the servo motor is then connected to the control box which is also connected to power.
 
 If we take a look inside the control box we will find the PCB with its components. I would just like to note that this blinds control will work on most blinds as long as you have a space for the servo motor in the top of them. That’s it that is the entire device! In the next video I will show you all the hardware we will need and how to put it together. If you want to be ready for the hardware video you can buy a kit, the PCB or 3D printed parts to make the device at the link in the video description. Alright thank you for watching and If you have any questions leave them in the comments section below or head over to mksmarthouse.com/forum. Good Bye!

Blinds Control MQTT OpenHAB ESP8266

Hardware: 

 

 

Hey guys Matt here from MKSmartHouse.com and in this video I am going to show you how to build the Blinds Control.
 
So, in this video we are going to go over all the parts required for the Blinds Control and then we are going to make it. To start off with the parts we are going to need 1 2 pin PCB Terminal, 1 4 pin female header, 1 3 pin male header, 1 3 pin terminal, 1 2 pin jumper, 1 esp8266, 1 5v to 3.3v regulator, 1 custom Blinds Control PCB, more on that later, 1 plastic enclosure, 10ft of 2 conductor 22 guage cable, 1 Male usb connector, 1 servo adapter plate, 1 servo motor, 4 servo to blinds adapter screws, 1 adapter plate screw, 2 servo mount screws, 6ft of servo motor cable, 1 set of servo motor connectors, 1 servo motor blinds adapter, 1 servo motor mount and a powerful 5v wall adapter. The wall adapter can be any usb 5v adapter like a phone charger just make sure it is powerfull because the servo motor takes more power than the other things we have made. You may have noticed that the servo to blinds adapter and the servo mount are not normal parts, that is because they are 3D printed. To get these parts you can either 3D print them yourself with the STL files on my website or you can buy the parts from my website. For tools we are going to need a soldering iron with ST7 tip, flux, steel wire, solder, wall tac, PCB holder, helping hands, wire strippers, small wire cutters, small flat screwdriver, phillips screwdriver, dremel and a hot glue gun. That is everything that we will need. The links to all the parts and tools will be over on my website, link is in the description. On my website you will also find the kit for this device, so instead of buying all the parts separately you can buy 1 kit and get all the parts fast and at the same time. There is even an option to get the device assembled so all you have to do is install its software and set it up. In the beginning I did say custom circuit board because to make this easier I designed a custom circuit board so that way not only will it be very stable and have strong connections with no guess work in assembling it but, also so I can make many of them really easily for my house. I have provided the gerber file on my website as well as where to get it made. You can also buy the PCB on my website, which is the easiest and fastest way to get them.
 
Since all the connections are already made on the circuit board all we have to do is solder the components on to the board. First let's take the circuit board and put it into the circuit board holder. If you look closely at the circuit board you will see that there are labels next to the component slots, when I say where to put the component that is what I will be referring to. I like to solder from the less sensitive components to to most sensitive so, let's start off with the 2 pin terminal, take the terminal and put it in J1. Then solder it in. If you want to know how to solder or how I solder then check out my guide for the door sensor because in that video I went over it in detail. Next take the 4 pin female header and put it into J2 and solder it in. If the leads get long and stick out cut them with wire cutters. Then take a strip of the male header and using the wire cutters make a header that is 3 pins long. Take that 3 pin male header and solder it into J3. After that take the 3 Pin Screw terminal and put it into J4. For slot U2 take the 5v to 3.3v regulator and match up its leads to the board and solder it in. Before we flip over the PCB we are going to put the 2 pin jumper on the 3 pin male header and above the PGM side. Great now we have one component left to solder and that is the esp8266, it is on the back of the PCB so flip it over. I recommend putting flux on every single pad of the esp8266 and of the circuit board and then solder it in. Next we are going to work on the power cable to the device. I am talking about the 5 volt power cable. First thing we have to do is take the 2 conductor 22 Gauge cable and cut it to length, I cut mine to the length of 10 feet. Then take one end of the wire and strip it to expose the 2 conductors. Strip a little of the each conductor and then take wire boot and plastic boot of the usb connector and slide it over the 2 conductors. Next take the helping hands and put the 22 gauge wire in one of them and the usb connector in the other. Then solder the black wire to the far left pin and the red wire to the far right pin. Now put some hot glue on the connector and slide over the plastic boot and the wire boot. If you want you can connect the USB to the 5v wall adapter but do not plug it into the wall. Almost done, strip the other end of the 22 gauge cable and then loosen the two screws on the 2 pin terminal above the 5v. Then take the red wire and put it into the hole parallel to where it says + and the black into the hole above the - symbol and tighten the screws. Next grab the servo motor cable and cut it to a length of 6 feet. Take the cable and separate the individual wires and strip them to expose the conductors. Next grab the pieces to the servo motor connector. Separate one of the male metal pieces and put the orange wire into it. Repeat the same steps for the other 2 wires. Once the wires are complete stick them into the black plastic piece of the connector. Now our male connector is done. Take the other end of the servo motor cable, separate the wires, strip them and fold their leads back. Then loosen the 3 pin terminal screws on the pcb. Put the brown wire into the - slot, red into the + slot and then Orange wire into the D slot. Once those are in tighten their screws down. Next grab the main part of the servo mount and place the servo motor onto it. Secure the servo motor by taking the 2 servo mount screws and screwing them in with a philips screw driver. You may need to file down some of the edges of the servo mount in order for the spacers to fit. After that grab the servo adapter plate and put the black adapter plate screw into it. Now take the servo to blinds adapter and put the side with no screw holes down onto the table. You may need to file down the square of the adapter in order for the blinds shaft to fit. Then put the adapter plate on top of that and screw it down using the 4 servo to blinds adapter screws. Grab the plastic enclosure and put the blinds control into the enclosure. Now take the the servo coupler that comes with the servo connector and put both the male servo connector and the female servo connector into the coupler. Finally, since the servo motor is really wide, it will not fit into the blinds so, grab a dremel and cut off the tabs of the other side of the servo motor. Once everything is done we should have the following things, power cable connected to the blinds control, the blinds control box with lid, servo motor cable connected to the servo motor and on the servo mount, servo mount spacers and the servo to blinds adapter connected to the servo plate. We will attach that in the final installation video. That is it for the hardware of the actual device now all it needs is some software which will be in the next video. If you need any of the parts shown in the video you can buy a kit, the PCB or 3D printed parts to make the device at the link in the video description. Alright thank you for watching and If you have any questions leave them in the comments section below or head over to mksmarthouse.com/forum. Good Bye!

Blinds Control MQTT OpenHAB ESP8266

Software: 

What is going on people of the smart house society, Matt here from MKSmartHouse.com and in this video I’m going to show you MK-BlindsControl firmware version 2 and how to set it up. You don’t want to skip this video, this is a major update.
 
[Intro]
 
Over the past few weeks I wrote new firmware for all of my MK-SmartHouse devices and the next few videos are going to be covering firmware for each device. This is not a small update. Not only is there now full support for Home Assistant but there is two way communication, setup through your mobile phone, MQTT Authentication support, a status portal and much more. I even have a feature that makes the blinds slower and quieter because some of you were complaining that is to loud for you. In this video I am going to cover how to connect the device to openhab but if you would like to connect it to home assistant I will leave the home assistant item config in the bottom of the description. I will make a complete video on it in the future. Stick around for this whole video because at some point I am going to announce a special message regarding the devices. Also, as you are watching write down what you think is new in this update and post it in the comments section, I’m curious if someone can list every single change. I will not be making two separate videos using Mac and Windows because the process is really similar the only difference is that on mac you use Terminal to ssh and on Windows you use putty.
 
Those of you that don’t know the blinds control is a device I created that like the name suggests can control your blinds through Alexa, Google, OpenHAB, Home Assistant and MQTT. Let me give you a demo Alexa set MK Blinds to close and If I open the openhab app I can open, close set it to half or even use the slider and set it to a custom number. It makes life really easy because every day they automatically open and close, one less thing I have to do. I also have a version where you can control 3 blinds from 1 control box!
 
Starting today all kits and assembled devices will come with firmware already flashed on the device. So if you buy a diy kit all you have to do is solder the components because the esp8266 will already be flashed and if you buy an assembled kit then it is ready to go just plug it in. 
To celebrate this achievement you can use the coupon code “v2” and get 10% off your entire order. So, you will be getting a device whether it be a kit or assembled that already has the firmware flashed and 10% off! If that’s not a deal I don’t know what is. I also don’t know when I am going to end this coupon so don’t wait head over to mksmarthouse.com/shop now or after the video is over! Any purchases made on the store directly help out the channel and allow me to make more devices and videos. There are a couple devices I want to make but I can’t due to funds so if you ever wanted to support me now is a very good time and I thank you in advance.
 
If your device has no firmware on it or the web updater on your device does not work, then there are some hardware things that we need besides a computer. We are going to need an arduino of some kind preferably a UNO or a MEGA equivalent with its usb cable of course and male to male dupont jumper cables. Don’t worry we won't be using the arduino IDE. The links to all the devices, parts and guides mentioned are in the video description.
 
Speaking of links in the description, follow @mksmarthouse on twitter, instagram and snapchat because those are the place where I give sneak peaks on when videos are releasing and also where I ask for your input on topics and future videos. I have also post things that only a true smart home enthusiast would appreciate.
 
 
At this point, if you have a preflashed device then you can skip to the time on the screen now.  
First we have to download the firmware from my website so go to the Links+Downloads page enter your email and press download file, I require an email so that way if I make a new firmware I will send you an email letting you know there is a new one available, then click on the link to go to the download and press the green download button. 
 
If you have version 1 firmware then simply go to that devices hostname.local/firmware or its ipaddress/firmware, it will ask you for your username and password this is the username and password you typed in the arduino IDE when you first flashed the device. This is the firmware update page. Click choose file, it will open up the file browser so navigate to your downloads folder and click on the MK-BlindsControl V2 Bin file and press the open button. Once it is loaded in the page click update. You should see the percents in the bottom left and after it is done it will say update successful! Rebooting.. Your device is now running V2. You can skip to the time on the screen now.
 
If you have no firmware on your device or want to reflash the device then you need to download PyFlasher. PyFlasher is the software we are going to use to install the firmware onto the esp8266 instead of using the arduino IDE. First we need to go to the links page and click on the link under PyFlasher to go to its latest release github page and find the latest one. At the time of recording the latest version is 3.0. If you have a mac then click on the dmg file and if you are on windows click on the exe file. It should download to your computer. Then go to your downloads folder and double click on it. Go through the installation process of the software. Once it is installed open it, if you are on mac go to launchpad and click on it. If on windows go to taskbar and search for it. This software may look a little intimidating but it is really easy. But first we need to connect the esp8266 to the computer. The first thing we are going to do is grab the arduino and put a jumper cable from RES to GND. Then grab the Blinds Control and connect all the pins to their corresponding spots so, TX to TX, RX to RX, GND to GND, and 5V to 5V. Before we continue, check to make sure the 2 pin jumper is above PGM. Now plug the usb cable from the arduino into the computer. Click on the serial port drop down and remember what devices are listed. Then click on the refresh button next to the drop down. Click on the drop down and the device that wasn't previously on the list. If your device didn’t show up then you probably have a chinese arduino and need the CH341 Driver I will leave a link to the driver on my website it is really easy to install. Anyway next we need to choose the firmware we want to flash so click the browse button in the file browser that pops up navigate to your downloads folder and click on the MK-BlindsControlV2 bin file and click open. The next section in the software is baud rate, choose 115200. After that is Flash mode, choose Dual I/O. Lastly is erase flash, make sure that is set to yes. Great the only thing left to do is press Flash NodeMCU. You should see a bunch of red text on the screen, don’t worry about it. Just wait till it says Done. Great! Disconnect the arduino from the computer, then unplug the dupont wires in between the arduino and the device. After, take the 2 pin jumper and move it over so it is above RUN. Finally plug the device into the wall.
 
If you are a smart home enthusiast like me and want to show that you are an Elite Member of the smart home community then check out smarthousesociety.com. If you want to support my channel then check out the link in the description and grab yourself a premium quality hoodie, shirt or hat.
 
Now it is time to setup the device. Plug the device in and make sure there is power going to it. Next grab a mobile device and go to wi-fi. You should see MK-BlindsControl and some numbers. Tap on that wifi network. It will bring up the device configuration portal. If it does not bring up the portal then go to your web browser on your phone and type in 192.168.4.1 There are 4 buttons, the first button is the one we want to press but I’m going to go over the other buttons first. The second button is the same thing as the first one except it does not scan for wifi network you would manually type in your SSID and Password. You would press this one if you have a hidden wifi network. The next button is info and it just shows you some information about your device. The last button just does a power cycle on the device and restarts it. But, let’s tap on the Configure WIFI button. This page contains everything you need to connect the device. The first section is where you connect to wifi so from the list select your wifi network and type in its password. The next section is the Hostname / MQTT ID and this is where you name the device I am going to call mine MK-BlindsControl1 you can call yours the same thing if you want. Remember what you name it as this is how we are going to access the device’s status page. The section after that is MQTT. In the first field type in your MQTT or openhab server’s ip address. The next field is the port which unless you use a different port you do not need to touch. In the MQTT topic field type in the topic you want the device to listen to commands to I am going to type in the same topic I did in the previous software version and you can use the same topic as well MK-SmartHouse/utilities/MK-BlindsControl1 this actually brings up a good point. If you have multiple blinds control then all you have to do is make sure they have a different hostname and mqtt topic. What I do is just increment the last number of both. The next fields in the MQTT section are regarding authentication, if you are following along with how I do things on my channel then do not worry about it and just leave it at false. But, in my last software version there were some people that had authentication on their MQTT servers in that case change the FALSE to TRUE and enter your username and password. I would like to give a shout out to Coffehedake on the MK-SmartHouse forum for figuring out how to do authentication using my previous firmware. Thank you! Web Updater is the next section and what web update does is create a webserver on the device so we can see the status of the device as well as update the firmware in the future. In the first 2 fields create a username and password to access the web server. Make sure you remember them. The field after that is the path to update the firmware, you can change it if you like I am going to keep it at /firmware. I will show you how to access all of this later. The final section is brand new to V2 and that is the option to make the blinds move slowly and quietly. What that means is if you set this to true the blinds will move slow to whatever position you want but it will be a little bit quieter than the previous firmware. Here is a demo of it set to FALSE as you can see the blinds move fast, I personally like this one. Here is a demo of it set to TRUE, the blinds move slow but is quieter. This is entirely your preference. Alright, that is it now press the save button. The device will now restart and boot using the settings you gave it. If the device restarts and shows its wifi network again that could mean you either typed in the wrong wifi password or you missed a field. If the device does not show up in your wifi network list that means it successfully connected to wifi. 
 
 
 
This step is optional and not required but, to confirm that it flashed correctly and is working you can fire up MQTT.fx, connect to the server and in the subscribe section type in # and press subscribe. If you do not have MQTT.fx then check out my Home Automation Server Setup Guide link is in the description. Then click on the publish tab. In the topic bar type in the subscribeTopic that we wrote in the blinds control device code that we flashed. Next in the message box type in any number 0 - 100 and press publish. If the servo motor moves then that is very good. Now go to the subscribe tab you should see two messages the first message is the command you sent and the second one is the current position of the servo after it executed the command. This means that now the device give feedback after they execute commands.
 
Now the device is complete and just needs to be added to OpenHAB. So ssh into your pi or whatever your server may be. If you are on mac use terminal and on windows use putty. The first thing we are going to do is create the Blinds Control item. So type in sudo nano /etc/openhab2/items/home.items and press enter, you may need to type in admin password. Then type in the comment //Blinds Controls then underneath that we are going to create the Blinds Control item. So type in Dimmer MKBlindsControl1 "MK Blinds [%s]" <rollershutter> [ "Lighting" ] {mqtt=">[broker:MK-SmartHouse/utilities/MK-BlindsControl1:command:*:default],<[broker:MK-SmartHouse/utilities/MK-BlindsControl1/state:state:default]", autoupdate="false"}
 
 
And press enter. 
 
Now open up your web browser and type in http://HOSTNAME.local I am going to type in http://mk-blindscontrol1.local it will ask you for a username and password. Type in the username and password you typed into the web updater section when you set up the device. You will now see all the settings of the device. I will go over this later in the video so don’t close the tab. But, we need the MQTT command topic so copy it. Now go back to the ssh window and if you have a different MQTT topic delete the topic in between the two colans and paste in your MQTT topic. Do the same thing for the status topic copy from the webpage and paste it in between the 2 colans. 
 
Now let me go over the item we created. It will allow us to control the Blinds Control. But let me go a little bit more in detail, the first part is Dimmer and since this device is a Blinds Control we need to control the position of the servo motor with numbers. The next part is the item name and I just used its hostname without the dash. After that is the label text and it is what shows up in the interface and how it is formatted with the name. Next to that is the icon name which is what picture shows up in the interface. After that is the item tag and what this does is allow this item to be used with home kit, amazon echo, and google home like you saw in the demo video. If you do not have either of those setup then you can check out my videos covering those topics. Then, we have the mqtt path to the device in there is the subscribeTopic we just pasted in. After that we have something new and that is the input status topic and what this does is openhab listens on this topic and uses this to change the status of the item in openhab. Let me explain with this new part if the device is unpluged and you keep sending it commands from openhab then the openhab item will not change because it is not recieving a response from the device. The next part in the item line is autoupdate false and that simply means the response from the blinds control will control the status. I have two blinds controls so I will paste it in again and change the item name, label text as well as the mqtt path to match that device’s subscribe topic. Thats it for the items file. Now press control x then y and enter. Next up is the sitemap file so we can control the device. Type in sudo nano /etc/openhab2/sitemaps/home.sitemap and press enter. It will bring up the sitemap. If you are following along with my series then we have many different frames in our sitemap. I am going to put the device in the frame called MK-Room. So go to the frame and type in:
     
Switch item=MKBlindsControl1 mappings=[0="Open", 56="Half", 100="Close"]
           Slider item=MKBlindsControl1
 
 
 and press enter, what we did is import the item into the sitemap so we can control it from the user interface. The controls it has is you can either press one of the three buttons, or use the slider. Again, since I have two I will also put the text in the JK-Room frame and change the numbers. Now press control x then y and enter. Before we go any further let's confirm that everything works so go to your web user interface and then Basic UI. You should see the Blinds Control item. If you press the buttons and move the slider you should see the servo move. Great! Now that we know the Blinds Control works let's make it automatically open and close at the times we set. In terminal type in sudo nano /etc/openhab2/rules/home.rules and press enter. At the bottom of the file type in 
//Set Blinds to half At 7 am
rule "Blinds half"
when
 Time cron "0 0 7 1/1 * ? *"
then
      sendCommand(MKBlindsControl1, 56)
end
//Set Blinds to close At 6 pm
rule "Blinds close"
when
 Time cron "0 0 18 1/1 * ? *"
then
      sendCommand(MKBlindsControl1, 100)
end
 
Let me explain what this does, the first rule sets the blinds to half everyday at 7 am the second rule closes the blinds everyday at 6 pm. If you want to change the times for the rules go watch my sprinkler system software video where I show you how to change cron expressions. Since I have two blinds I will also add those blinds to each rule. Now press control x then y and enter. That is it! The software is complete, now all we have to do is install the device in its final place which you can watch in the final installation video. But, before we close out this video I would like to show you guys more about the webpage on the device so go back to your web browser. So on this page like I mentioned before you can see all of your settings. But copy the link next to update firmware and paste it into the url bar. If in the future I release an new software this is where you would go to install it. One last thing I want to do is show you how to reset the settings on the devices. First unplug the device and plug it back in, then quickly move the jumper from RUN to PGM and wait 10 seconds, then put the jumper back to RUN and unplug the device and plug it back in. If you go back to wifi on your phone you should see the device. That concludes this complete guide to Blinds Control Software V2. In the description you will find links to all the parts and devices used in the video as well as a link to mksmarthouse.com/shop where I have a wide range of smart home kits that you can put together. Alright, if you found this video helpful click that like button and if you are a smart home enthusiast you belong on this channel so hit that subscribe button. If you have any questions leave them in the comments section below or join the community over at mksmarthouse.com/forum. Good bye!

Blinds Control MQTT OpenHAB ESP8266

Software Mac: 

Hey guys Matt here from MKSmartHouse.com and in this video I am going to show you how to setup the software for the Blinds Control using a MAC.
 
So in the last video we left off with the Blinds Control Device being fully built so all it needs is firmware and to be connected to the home automation server. So let's start off with the firmware. I recommend having my website open up so that way you have all the steps and commands ready, and so you do not have to type in everything you can just copy and paste. I know this is the software video but, there are some hardware things that we need besides a computer. We are going to need an arduino of some kind preferably a UNO or a MEGA equivalent with its usb cable of course and male to male dupont jumper cables. Links to these items will be in the description or on the website.
 
1. The first thing we are going to do is grab the arduino and put a jumper cable from RES to GND.
2. Then grab the Blinds Control and connect all the pins to their corresponding spots so, TX to TX, RX to RX, GND to GND, and 5V to 5V.
 
Before we continue, check to make sure the 2 pin jumper is above PGM. Please note that in this video I will not go over how to setup the arduino IDE and will assume that it is set up and you know how to connect an arduino to it. If you do not know how to set it up or it is not setup then go check out my Door sensor software video where I go in detail of the entire process.  
 
3. Next we are going to head over to my site, the link is in the description to the exact page and press the download Blinds Control Firmware.
4. On the new page press download.
5. Then go to your finder and downloads folder and double click on MK-BlindsControl.ino.
6. A pop up will come up asking if you want to put it in a folder, click OK.
It should bring up the code for the Blinds Control, and there are only a few things we have to change.
 
7. The first thing is the wifi settings which are the ssid and password so change those according to your network.
 
Please keep in mind that the esp8266 only works on 2.4ghz so type in your 2.4ghz wifi ssid and password not your 5ghz. Also when adding the information only change what is inside the quotation marks. Next set of parameters are the Web Updater settings. The devices I designed are great because I implemented a web user interface for each individual device so that way if you ever have to flash new firmware you just go to its web address. The web address information is found at that top of the code in the giant comment block.
 
8. The first parameter is the hostname of the device, usually I only change the last digit but since this is the first Blinds Control I will keep it as it is.
9. Next is the update path and personally I don’t change that.
10. After that is the web user interface username and password, these are the credentials you use to access the webpage because each device is protected.
 
The next set of parameters are for mqtt.
11. The first one is the subscribeTopic and this is the topic for which the device listens for commands or messages from the server.
12. The next one is the MQTT Server Ip address and this is simply the IP address of your home automation or openhab server.
13. The last one is the Unique device ID and this simply differentiates each device on the MQTT side, I usually just change the last digit for every single device.
 
That is it the code is ready to be flashed.
 
14. So go to tools and make sure the Board: is Generic ESP8266 Module and the port is /dev/cu.wchusbserialXXXX.
Sometimes the device for some reason does not like to be flashed as a Generic ESP8266 module, if the device does not respond after you flash it, then when you flash it choose the ESP-12E as the board.
15. Once those are good press the upload button, it is the one with an arrow pointing to the right.
When it is uploading you should see dots moving at the bottom and some percents. After it is done uploading you should see it say 100% and Done uploading. Let’s Test it!
16. First unplug the dupont wires in between the arduino and the device.
17. Then take the 2 pin jumper and move it over so it is above RUN.
18. Finally plug the device into the wall.
19. To confirm that it flashed correctly and is working you can fire up MQTT.fx, connect to the server and in the subscribe section type in # and press subscribe.
 
If you do not have MQTT.fx then check out my Home Automation Server Setup Guide.
 
20. Then click on the publish tab.
21. In the topic bar type in the subscribeTopic that we wrote in the blinds control device code that we flashed.
22. Next in the message box type in any number 0 - 100 and press publish.
 
If the servo motor moves then we are all set! Now the device is complete and just needs to be added to OpenHAB.
 
23. So ssh into your pi or whatever your server may be.
The first thing we are going to do is create the Blinds Control item.
 
24. So type in sudo nano /etc/openhab2/items/home.items and press enter, you may need to type in admin password.
25. Then type in the comment //Blinds Controls then underneath that we are going to create the Blinds Control item.
26. So type in Dimmer MKBlindsControl1 "MK Blinds [%s]" <rollershutter> [ "Lighting" ] {mqtt=">[broker:MK-SmartHouse/utilities/MK-BlindsControl1:command:*:default]"}
And press enter.
Now let me go over the item we created. It will allow us to control the Blinds Control. But let me go a little bit more in detail, the first part is Dimmer and since this device is a Blinds Control we need to control the position of the servo motor with numbers. The next part is the item name and I just used its hostname without the dash. After that is the label text and it is what shows up in the interface and how it is formatted with the name. Next to that is the icon name which is what picture shows up in the interface. Then lastly, we have the mqtt path to the device in there is the subscribeTopic that we coded into the device. I have two blinds controls so I will paste it in again and change the item name, label text as well as the mqtt path to match that device’s subscribe topic. Thats it for the items file.
 
27. Now press control x then y and enter.
 
Next up is the sitemap file so we can control the device.
 
28. Type in sudo nano /etc/openhab2/sitemaps/home.sitemap and press enter.
 
It will bring up the sitemap. If you are following along with my series then we have many different frames in our sitemap. I am going to put the device in the frame called MK-Room.
 
29. So go to the frame and type in:
    Switch item=MKBlindsControl1 mappings=[0="Open", 56="Half", 100="Close"]
    Slider item=MKBlindsControl1
and press enter,
 
what we did is import the item into the sitemap so we can control it from the user interface. The controls it has is you can either press one of the three buttons, or use the slider. Again, since I have two I will also put the text in the JK-Room frame and change the numbers.
 
30. Now press control x then y and enter.
31. Before we go any further let's confirm that everything works so go to your web user interface and then Basic UI.
 
You should see the Blinds Control item.
 
32. If you press the buttons and move the slider you should see the servo move.
 
Great! Now that we know the Blinds Control works let's make it automatically open and close at the times we set.
 
33. In terminal type in sudo nano /etc/openhab2/rules/home.rules and press enter.
34. At the bottom of the file type in
//Set Blinds to half At 7 am
rule "Blinds half"
when
Time cron "0 0 7 1/1 * ? *"
then
     sendCommand(MKBlindsControl1, 56)
end
 
//Set Blinds to close At 6 pm
rule "Blinds close"
when
Time cron "0 0 18 1/1 * ? *"
then
     sendCommand(MKBlindsControl1, 100)
end
 
 
Let me explain what this does, the first rule sets the blinds to half everyday at 7 am the second rule closes the blinds everyday at 6 pm. If you want to change the times for the rules go watch my sprinkler system software video where I show you how to change cron expressions. Since I have two blinds I will also add those blinds to each rule.
 
35. Now press control x then y and enter.
 
That is it! The software is complete, now all we have to do is install the device in its final place which will be completed in the next final installation video. Alright thank you for watching and If you have any questions leave them in the comments section below or head over to mksmarthouse.com/forum. Good Bye!

Blinds Control MQTT OpenHAB ESP8266

Software Windows: 

Hey guys Matt here from MKSmartHouse.com and in this video I am going to show you how to setup the software for the Blinds Control using Windows.
 
So in the last video we left off with the Blinds Control Device being fully built so all it needs is firmware and to be connected to the home automation server. So let's start off with the firmware. I recommend having my website open up so that way you have all the steps and commands ready, and so you do not have to type in everything you can just copy and paste. I know this is the software video but, there are some hardware things that we need besides a computer. We are going to need an arduino of some kind preferably a UNO or a MEGA equivalent with its usb cable of course and male to male dupont jumper cables. Links to these items will be in the description or on the website.
 
1. The first thing we are going to do is grab the arduino and put a jumper cable from RES to GND.
2. Then grab the Blinds Control and connect all the pins to their corresponding spots so, TX to TX, RX to RX, GND to GND, and 5V to 5V.
 
Before we continue, check to make sure the 2 pin jumper is above PGM. Please note that in this video I will not go over how to setup the arduino IDE and will assume that it is set up and you know how to connect an arduino to it. If you do not know how to set it up or it is not setup then go check out my Door sensor software video where I go in detail of the entire process.  
 
3. Next we are going to head over to my site, the link is in the description to the exact page and press the download Blinds Control Firmware.
4. On the new page press download.
5. Then go to your file explorer and downloads folder and double click on MK-BlindsControl.ino.
6. A pop up will come up asking if you want to put it in a folder, click OK.
It should bring up the code for the Blinds Control, and there are only a few things we have to change.
 
7. The first thing is the wifi settings which are the ssid and password so change those according to your network.
 
Please keep in mind that the esp8266 only works on 2.4ghz so type in your 2.4ghz wifi ssid and password not your 5ghz. Also when adding the information only change what is inside the quotation marks. Next set of parameters are the Web Updater settings. The devices I designed are great because I implemented a web user interface for each individual device so that way if you ever have to flash new firmware you just go to its web address. The web address information is found at that top of the code in the giant comment block.
 
8. The first parameter is the hostname of the device, usually I only change the last digit but since this is the first Blinds Control I will keep it as it is.
9. Next is the update path and personally I don’t change that.
10. After that is the web user interface username and password, these are the credentials you use to access the webpage because each device is protected.
 
The next set of parameters are for mqtt.
11. The first one is the subscribeTopic and this is the topic for which the device listens for commands or messages from the server.
12. The next one is the MQTT Server Ip address and this is simply the IP address of your home automation or openhab server.
13. The last one is the Unique device ID and this simply differentiates each device on the MQTT side, I usually just change the last digit for every single device.
 
That is it the code is ready to be flashed.
 
14. So go to tools and make sure the Board: is Generic ESP8266 Module and the port is COM and a number.
Sometimes the device for some reason does not like to be flashed as a Generic ESP8266 module, if the device does not respond after you flash it, then when you flash it choose the ESP-12E as the board.
15. Once those are good press the upload button, it is the one with an arrow pointing to the right.
When it is uploading you should see dots moving at the bottom and some percents. After it is done uploading you should see it say 100% and Done uploading. Let’s Test it!
16. First unplug the dupont wires in between the arduino and the device.
17. Then take the 2 pin jumper and move it over so it is above RUN.
18. Finally plug the device into the wall.
19. To confirm that it flashed correctly and is working you can fire up MQTT.fx, connect to the server and in the subscribe section type in # and press subscribe.
 
If you do not have MQTT.fx then check out my Home Automation Server Setup Guide.
 
20. Then click on the publish tab.
21. In the topic bar type in the subscribeTopic that we wrote in the blinds control device code that we flashed.
22. Next in the message box type in any number 0 - 100 and press publish.
 
If the servo motor moves then we are all set! Now the device is complete and just needs to be added to OpenHAB.
 
23. So ssh into your pi or whatever your server may be.
The first thing we are going to do is create the Blinds Control item.
 
24. So type in sudo nano /etc/openhab2/items/home.items and press enter, you may need to type in admin password.
25. Then type in the comment //Blinds Controls then underneath that we are going to create the Blinds Control item.
26. So type in Dimmer MKBlindsControl1 "MK Blinds [%s]" <rollershutter> [ "Lighting" ] {mqtt=">[broker:MK-SmartHouse/utilities/MK-BlindsControl1:command:*:default]"}
And press enter.
Now let me go over the item we created. It will allow us to control the Blinds Control. But let me go a little bit more in detail, the first part is Dimmer and since this device is a Blinds Control we need to control the position of the servo motor with numbers. The next part is the item name and I just used its hostname without the dash. After that is the label text and it is what shows up in the interface and how it is formatted with the name. Next to that is the icon name which is what picture shows up in the interface. Then lastly, we have the mqtt path to the device in there is the subscribeTopic that we coded into the device. I have two blinds controls so I will paste it in again and change the item name, label text as well as the mqtt path to match that device’s subscribe topic. Thats it for the items file.
 
27. Now press control x then y and enter.
 
Next up is the sitemap file so we can control the device.
 
28. Type in sudo nano /etc/openhab2/sitemaps/home.sitemap and press enter.
 
It will bring up the sitemap. If you are following along with my series then we have many different frames in our sitemap. I am going to put the device in the frame called MK-Room.
 
29. So go to the frame and type in:
    Switch item=MKBlindsControl1 mappings=[0="Open", 56="Half", 100="Close"]
    Slider item=MKBlindsControl1
and press enter,
 
what we did is import the item into the sitemap so we can control it from the user interface. The controls it has is you can either press one of the three buttons, or use the slider. Again, since I have two I will also put the text in the JK-Room frame and change the numbers.
 
30. Now press control x then y and enter.
31. Before we go any further let's confirm that everything works so go to your web user interface and then Basic UI.
 
You should see the Blinds Control item.
 
32. If you press the buttons and move the slider you should see the servo move.
 
Great! Now that we know the Blinds Control works let's make it automatically open and close at the times we set.
 
33. In ssh type in sudo nano /etc/openhab2/rules/home.rules and press enter.
34. At the bottom of the file type in
//Set Blinds to half At 7 am
rule "Blinds half"
when
Time cron "0 0 7 1/1 * ? *"
then
     sendCommand(MKBlindsControl1, 56)
end
 
//Set Blinds to close At 6 pm
rule "Blinds close"
when
Time cron "0 0 18 1/1 * ? *"
then
     sendCommand(MKBlindsControl1, 100)
end
 
 
Let me explain what this does, the first rule sets the blinds to half everyday at 7 am the second rule closes the blinds everyday at 6 pm. If you want to change the times for the rules go watch my sprinkler system software video where I show you how to change cron expressions. Since I have two blinds I will also add those blinds to each rule.
 
35. Now press control x then y and enter.
 
That is it! The software is complete, now all we have to do is install the device in its final place which will be completed in the next final installation video. Alright thank you for watching and If you have any questions leave them in the comments section below or head over to mksmarthouse.com/forum. Good Bye!
Hey guys Matt here from MKSmartHouse.com and in this video I am going to show you how to install the Blinds Control in your house.
 
[Intro]
 
First up let's go over the tools we need to install this Blinds Control. For tools we are just going to need a small phillips screwdriver, and a small flat screwdriver. The links to all the materials, tools and parts are over on my website, the link is in the description.
 
The first thing we have to do is take the blinds off of the window. But before you pull the blinds off make sure the tilt is in the open position. Right now the way the blinds are suppose to be tilted are using these two strings, but that is all going to change. To pull my blinds off I had to remove this white plastic trim pieces from the plastic mounts and then I had to open these metal pieces on ends of the blinds and then I could just slide the blinds out.
 
 Next remove the mechanism that tilts the blinds. Mine was a wheel with two strings so I also had to untie the ends with the little plastic pulling pieces and then I pulled the mechanism up and then to the side. Now plug the blinds control into the power outlet and using either the web user interface or the app press the open button to put the servo motor in the open position. Then unplug the blinds control from the power outlet and disconnect the servo motor cable. Next take the blinds to servo adapter and put it on the shaft of the blinds. Be careful not to move the shaft, or else it will mess up the positioning.
 
 Then take the servo motor and adjust its height to fit in the blinds raceway, by adding or removing the spacers. Now slide the servo motor in right into the blinds to servo adapter. Once it is slid on, remove the servo motor with the adapter attached. The reason we do this is so the position of the blinds is calibrated with the servo motor. Take the small phillips screwdriver and tighten the adapter onto the servo motor. Once it is tightened put the servo motor’s cable in the groove on the side of the servo mount and slide the servo motor in and onto the blinds shaft. Now we are going to move onto the blinds control box. Take the box to the right side of the blinds and run the servo motor cable through the side of the raceway to the servo motor and connect the servo motor to the cable. Now open the control box using the small flat screw driver and tuck all the remaining servo motor cable into it.
 
 Next close up the control box and place it into the raceway with the power cable hanging out to the side. Then take the blinds and slide it back into the Brackets. Now close the brackets and put the white trim piece back into the plastic mounts. Next we have to deal with the power cable, on my window there is no trim installed around the windows so I just tucked my wire into the hole and plugged it into the outlet, on the other window it did have trim so I just ran the wire on the side of the trim and used wall tac to keep it in place.
 
 That’s it the device is installed. As you can see I can control it with no problem from a mobile device using the openhab app! And if you remember from the software video these blinds will also open and close automatically at that times we set in the rules. If you need any of the parts shown in the video you can buy a kit, the PCB or 3D printed parts to make this device as well as other devices at the link in the video description. Alright thank you for watching and If you have any questions leave them in the comments section below or head over to mksmarthouse.com/forum. Good Bye! 

Blinds Control MQTT OpenHAB ESP8266

Links: