Monday, May 15, 2017

Automated blinds with Home Assistant, MQTT and NodeMCU

I came across this post on the Home Assistant community forums and decided to give it a try:

I made some updates to the original code by jjhtpc, adding OTA updates. The new code will also retain your previous position when turning off and turning on the blinds if you want it.

Since I have a 3d printer I decided to sketch a quick coupler for the blinds. It can be found on Thingiverse here

The blinds I used are from Home Depot and come in a wide variety of sizes.

Connect the red wire to the Vin pin and the black wire to the GND pin next to it. The white wire is connected to D3.

Parts list:
Cut-to-Width blinds from Home Depot
Futaba S3003 servo
White micro USB Cable (no longer used, replaced with longer cable for direct power)
16.5ft white USB cable
NodeMCU Module
5000mAh Solar Power Bank

Remove blind gears.

With the servo mount still on the servo would sit off-center.

Cut off servo mount.

The servo should now sit dead center to the shaft.

Print and attach the adapter to the servo. 

Cut off the ends of the screws.

Feed the USB cable through the hole left by the gears that were removed.

Attach the NodeMCU inside the blind channel with double sided tape.

Connect the USB cable and install the blinds.


  1. This is a great example.
    I got this working in my setup but i have a few questions.
    My blinds only go closed or almost 90 degrees open.
    I would like to have them opening a little more. What value should i change, or can't is be done.

    Other thing is that i would like to change the operation because at one blind i can mount t left and on another it needs to be on the right side. so it should operate mirrored from the other.

    In home assist there is an "cover" command to use for tilt but i cant seem to get that working right. it does operate the blinds but there is no state. Plus in the app the tilt function does not show up.

    I hope you can point me in the right direction,
    Thanks, Arnold

    1. Hi Arnold, sorry for the delay.

      There is a variable in the code for this:
      int max_angle = 133;
      Change 133 to 90. Come to think of it I should have added the variable min_angle... I will add that actually as that will fix the second issue you are having. I will respond again once the new version is up.

    2. Hi Arnold, I have made an update to the code at

      In my code I have:
      int open_angle = 0;
      int closed_angle = 133;

      In your case you would reverse the values:
      int open_angle = 90;
      int closed_angle = 0;

      I didn't have time to test it so please let me know if that works for you.

    3. Thank you for your updated code, i am able to adjust the angle but i can not seem to get the servo to work in reverse when i switch values for the open and closed angle.

    4. Hi Arnold, looks like there needed to be more work to get this working in reverse. I have added a new version of the ino file. I renamed the existing ino to mqtt_blinds_reverse.ino since technically that was reversed anyway. The file named mqtt_blinds.ino is now customized for your reversed blinds, if that makes sense. Hopefully that works for you now.

    5. Ryan, Thank you very much for your code, and your help to make it work like is does now.

      It is really perfect and i like it works right now.

      I am still learning the code, I see and understand what you changed.

      You also use HA for your blinds, have you tried the "cover" function?
      I did, and it does work, only thing is that in the app, no slider comes up for the tilt.

  2. I really like the way you state the information related to automated blinds. Keep posting. Thanks !!!

  3. You wrote this post very carefully.Cheap Venetian Blinds The amount of information is stunning and also a gainful article for us. Keep sharing this kind of articles, Thank you.

  4. I would like to thank you for sharing such a great post. The post is really informative, as it contains some instructive knowledge about Automated blinds. Thanks for sharing it. Keep Posting. beautiful blinds

  5. Nice article, which you have shared about red and grey curtains for living room. Your article is very informative and useful. Thanks for sharing this article here.

  6. I generally want quality content and I found that in your post. The information you have shared about measuring for beneficial and significant for us. Keep sharing these kinds of articles here. Thank you.

  7. I will share it with my other friends as the information is really very useful. Keep sharing your excellent work. Read more info about light blue roman shades

  8. Thanks for publishing such best knowledge with us. You are doing such a great job. This info is very helpful for everyone. Keep it up. Thanks.Read more info about shade sails

  9. I appreciate your efforts which you have put into this article. Genuinely it is a useful article to increase our knowledge. Thanks for share an article like this.Roller Shades Canada

  10. I generally check this kind of article and I found your article which is related to my interest.Blind Curtain Window Benissa Genuinely it is good and instructive information. Thankful to you for sharing an article like this.

  11. Excellent knowledge, You are providing important knowledge. It is really helpful and factual information for us and everyone to increase knowledge. Continue sharing your data. Thank you. Read more info about Bunnings custom blinds

  12. I read your article and after I read got beneficial information about the automated blinds. Your article contains excellent information and knowledge. It is beneficial for all. .Blinds For the Property IndustryKeep sharing.