MQTT Particle photon window blinds


#1

This is my first post here. I am just cutting over to Home Assistant. I am not new to home automation though and have been a developer on SmartThings for quite some time.

I developed code for automated window blinds using the spark core/particle photon. Here is the project on SmartThings. https://community.smartthings.com/t/automated-window-blinds-spark-core/5681?u=jjhtpc
And here is my github page: https://github.com/jjhtpc

I on cutting the code over to MQTT as my main reason for coming to HA was for local control. That being said that photon code could be used with just test calls, so I figured I would post this as I had seen several posts about window blinds.


#2

Here are my bay of Windows working with Alexa on a fire tv.

Currently I don’t interact with the blinds much as I use a fibaro motion sensor to capture lux and based on lux I close the blinds starting 4 hours before sunset.


#3

Ok this is complete. The code is in an early version but is fully functional for the blinds.

Things you will need:
A Particle Photon
A servo (preferably analog) I use futaba S3003 https://www.servocity.com/s3003-servo
A servo shaft coupler with set pin https://www.servocity.com/25t-futaba-set-screw-shaft-coupler
Standard horizontal slat window blinds (plantation style will work too)
DIY mentality :wink:

Steps

  1. Wire up your Particle Photon with the servo(in the sketch I use pin A4)

  2. Load your Particle with the .ino, .cpp and .h from the github code (adjusting ip address of your MQTT server and all of your topics) https://github.com/jjhtpc/ParticleMQTTblinds

  3. You will need to configure a device using MQTT in configuration.yaml (I will provide an example below)

  4. After you restart your HASS service you should be able to test that everything is working

  5. Put on your DIY hat finally and with your wife’s/significant other’s permission dissect and determine a way to hook this up to your window blinds

**Things of note… You have to use a borker other than the embedded broker. I could not get the protocol on particle to work with the embedded broker.
you will have to remove the manual pull string. I know, but don’t worry you won’t use it anymore… you will use the google home or amazon echo to open all of your blinds. Besides the whole point of home automation is to automate. Set this thing up with a light sensor and 4 hours before sunset close or partially close those blinds… keep tracking the sun every hour and continue to close them a little more until about 10 minutes before sunset and then open them up and enjoy that beautiful sunset.
OH and there is a 3d printed servo mount I created so that the servo sits nicely in the 2" blind tray.

My configuration.yaml

light:
platform: mqtt
name: "Window Bottom Left"
state_topic: "blind/bl/state"
command_topic: "blind/bl/command"
brightness_state_topic: "blind/bl/state"
brightness_command_topic: "blind/bl/level"
brightness_scale: 100
qos: 0
payload_on: "ON"
payload_off: "OFF"
optimistic: false
retain: true

** this will show up as a light, but functionally it should work great. You will need to adjust all of your topics to match your need

I do want to put a request out to change the light for MQTT, currently HASS sets the level and then also sends an ON command.
So a subscribe to level and command looks like this.

78
ON
This caused me to code around this and set a trap so that after level is set I set a flag “itsatrap” to 1 then conditionally my ON statement requires that itsatrap = 0. If HASS would just send the level I would not have to have some ugly extra code. Let me know any thoughts on this. I know I am not using the device the way it is intended(as a light), but I have another use for Particle Photons that I will be cutting over shortly that controls RGB lights and this will impact that code as well.


#4

Looks pretty cool, thanks for posting this. I am currently in the process of designing my smart blinds based on an Arduino Pro Mini and an RFM69. I opted not to use WiFi, as my plans are to run each blind off of AA batteries and still have at least 6 months, preferably 1 year of battery life.

Anyways, question on your setup. I see that it run on WiFi, how are you powering each blind?


#5

Ok so I will be taking a different direction on this. I had some troubles with the particle photon, and decided to cut this project over to esp8266 chips. I had thought about this for awhile, but pulled the trigger last week. I have the code working, and am testing the product. I will post more on this tomorrow with a similar rundown on setup. It is actually fairly similar to what I had done with the Particle.


#6

I’ve been going down the ESP8266 route. They are so easy to work with and inexpensive.

I would be interested in knowing how you are physically interacting with them. Did you 3D print something? I’ve been somewhat following Bruh Automation’s trials and tribulations making automated blinds.


#7

I ended up going this route. Esp8266 Window Blinds MQTT