Curtain Automation

Hi,
Just noticed that near my bedroom curtain I have a 240 power supply :slight_smile: … so I now I am thinking to automate the curtains!

Any ideas from where I can start?

My curtains are installed using a rail very similar to this, ideally I use the same but if I had to replace it is not a big deal.
Regarding conectivity to HA, I use both Z-Wave and WiFi, any will do.

Have you looked at the Xiaomi Aqara Smart Curtain motor?

yes and looks what i need but the problem is that its Zigbee. Is there a wifi or z wave version?

There is a kickstarter voor something called SwitchBot. I think it’s wifi compatible

1 Like

I used this video and adapted it using esp8266 which connects thru blynk and hassio. Cost less than £15.

4 Likes

I’ve just bought a couple of these from Ali Express. A recommended supplier.
They can be controlled via remote, or switch, but I’ve got them wired up to a Fibaro Roller Shutter on Zwave, controlled via HA.

This particular model of motor has some quirks (it’s own end stop sensor clashes with the fibaro calibration), but I got it to work ok in the end.

1 Like

Did you use the advised NEMA17’s or the cheaper BYJ48 stepper motor? Are you happy with your setup?

1 Like

Initially I used the cheaper ones but it wasn’t accurate enough. I then used a nema17 and a pulley. Been working great for months.

I had a similar Curtain track need and I researched Somfy. We used a company here in the UK called Emanuel’s Interiors in Kent and ended up having Somfy Glydea Curtain track. I purchased the Tahoma hub which also links to Google Assist. Works a treat.
Plugs into the 230v socket down the side of the curtain, cables hidden by the curtain which is a bonus. Not the cheapest or most expensive track but carry our heavy curtains well.
The installer had seen lots of the stand alone motors on the market but he stressed that they are noisier and would struggle to carry more weight. Give Somfy a go.

Do you mind sharing some photos please?

I’ll take some vids and pics for you no problem.
Somfy track is white but you’ll see we had a fascia made to cover

1 Like

Hi Folks - have you considered the automated curtains by Zemismart? (Zemismart Smart Curtain)

I have a 4 meter, 5 meter, and most recently a 2 meter track installed. The track has an innovative design to adjust to the right length and looks to be good build quality, easy to construct (although the instructions take a bit of deciphering) The motor sound is barely noticeable.

One drawback is that WiFi operation is through a Tuya dongle, however they also function from the included RF remote and RF wall switch. They can also be hardwired to a wall switch using an RJ-45 cable. To escape the Tuya dependency, I’ve mine wired to a WiFi wall switch, and integrated into HA using the switch and a template cover.

If you’re happy to go with Tuya, its a 2 hours install and done. I was (am) on a budget, and these just seemed about half the price of anything else. I’ve had them installed now for 2 - 8 months. The bedroom (4m) operates multiple times daily with heavy curtains and still runs like the day I installed it. Just wanted to share my $0.02. Take care, Dave.

2 Likes

Hi Folks, Just a follow-up on this. I’ve since been able to convert the WiFi dongle to Tasmota, and have the settings working 100% correct. I am able to position the curtains from 0% (closed) to 100% (fully open) using Home Assistant, and have the position reflected in Home Assistant when the RF remote is used to move the curtain. Let me know if my Tasmota config will interest anyone and I will post a how-to guide.

3 Likes

Nice video, thanks for the link!

Watching that I assume once it’s all hooked up you are unable to operate the curtains manually, as there is too much resistance from the stepper motor?

What’s the battery life like on the AA pack - I assume the whole thing runs off that once the programming is finished via USB?

1 Like

Would love to see your config, i bought a zemismart curtain but it is the new design which has wifi dongle integrated. Still i bet the configs are same…

I’ve been looking at the new design ones (as well as the older version)… very interested to see how you go.

I have never converted a tuya device before, this will be my first… I ordered a wemos d1 and still waiting for it to arrive… As soon as i get it i will start and hopefully send a working config…

what do you mean by convert the wifi dongle to tasmota? did you replace the dongle of flash the firmware?

Im interested in your conversion too!

1 Like

Sorry for the delay is posting this. It’s amazing how many projects come up while under lockdown :wink:

@dagcant – I’m not sure if the new model is able to be converted with TuyaConvert. The three I have have Wi-Fi dongles that looks like USB sticks, and communicate with a TuyaMCU on the main board. It will be awesome if you are able to convert the new style to Tasmota, but I know the newer style Tuya roller blinds are not convertible. Please let us know. The communication between the Tasmota (ex-Tuya) Wi-Fi dongle and the TuyaMCU are key to the correct functioning of the curtains.

@bule – I flashed the Tasmota firmware to the dongle. On Theo’s site there is some basic instruction where he split it apart and soldered on some wires. I didn’t do that - I was able to flash it using the curtain motor, getting the fast flashing led, and running TuyaConvert (I think… it’s been a while :man_facepalming: )

The curtains are still working like a charm, btw.

@rexkani At least you didn’t have to wait 2 months… :wink: Apologies to @dagcant and @bule

Tasmota uses the dimmer construct to simulate the position of the curtain, and suggests that 1 is closed and 100 is fully open. The other posts I’ve seen all have issues with the curtain switching off when closed with the remote, because the curtain will go all the way to 0. I flipped it around so 100 is closed and 0 is fully open. With some rule magic as well, it stays on now.

OK – Config:

Flash Tasmota on the Wi-Fi dongle using the curtain motor to place it in paring mode (fast flash) - I am using Tasmota firmware: 8.1.0.2

I have the following settings - not sure about all of them, they are a little hard to export so I’ve tried to remember as much as I can, and verified the status of the commands in the console. It should be pretty much complete.

Once the Tasmota firmware is flashed to the dongle, apply the following settings in the console:


template {"NAME":"Zemismart_Curt","GPIO":[0,0,0,0,0,0,0,0,0,108,0,107,0],"FLAG":0,"BASE":54} #You can do through the module editor as welll

tuyaMCU 1,11
tuyaMCU 21,101

dimmerrange 1,100
fade 0
speed 1
power1 1
poweronstate 4
powerretain 1
setoption4 0
topic guest_bedroom_curtains
grouptopic curtains
teleperiod 300

Next, add the Rules and switch them on. All the rules in a set go on one line, separated with spaces, so join all Rule1 and paste into the console, and do the same for Rule2:


Rule1 on Event#OPEN do TuyaSend4 102,01 endon
      on Event#STOP do TuyaSend4 102,02 endon
      on Event#CLOSE do TuyaSend4 102,00 endon
      on TuyaReceived#Data=55AA00070008650200040000000079 do publish stat/guest_bedroom_curtains/RESULT {"Dimmer":0} endon
      on POWER1#state!=1 do backlog DIMMER 0; POWER1 1 endon
Rule1 1

Rule2 on dimmer#state=0 do backlog event open; publish stat/guest_bedroom_curtains/RESULT {"Dimmer":0} endon
Rule2 1

The part that’s missing from Thoe’s page are the commands in Rule 1 that mimic the RF remote control: TuyaSend4 102, 01 / 02 / 00
Because the device will switch off when it reaches 0, the device will never send out the MQTT message when it reaches 0, so the fourth line in Rule1 listens for the Tuya event that indices the cover as reached the end stop, and issues the MQTT message. I used this document to decipher the information that the TuyaMCU sends back to Tasmota device - it makes for some fun reading :roll_eyes:

The last line in Rule 1 ensures that regardless of whether the device switches off or not, it will switch right back on again. On my devices, the power never switches off with this rule.

Rule 2 caters for notifying Home Assistant that the cover is fully open. The MQTT message is never sent due to the device thinking it should switch off at 0. Without this, the curtain will never show as fully open in Home Assistant.

Expect to see a lot of this in the console once setup - it’s the TuyaMCU sending a heartbeat to the Wi-Fi dongle


00:00:00 TYA: Send "55aa00000000ff"
00:00:00 {"TuyaReceived":{"Data":"55AA000000010101","Cmnd":0,"CmndData":"01"}}
00:00:00 TYA: Heartbeat

Okay, so now to setup the cover in Home Assistant:


cover:
- platform: mqtt
  name: "Guest Bedroom Curtains"
  unique_id: guest_bedroom_curtains
  device_class: curtain
  command_topic: "cmnd/guest_bedroom_curtains/EVENT"
  position_topic: "stat/guest_bedroom_curtains/RESULT"
  set_position_template: "{{ ((-100 + position)|int)|abs }}"
  set_position_topic: "cmnd/guest_bedroom_curtains/DIMMER"
  availability_topic: "tele/guest_bedroom_curtains/LWT"
  qos: 1
  payload_open: "OPEN"
  payload_close: "CLOSE"
  payload_stop: "STOP"
  position_open: 100
  position_closed: 0
  payload_available: "Online"
  payload_not_available: "Offline"
  value_template: "{{ ((-100 + value_json.Dimmer)|int)|abs if value_json.Dimmer is 
defined else state_attr('cover.guest_bedrooom_curtains', 'position') }}"

The last line above switches the open/close around so that 100 is closed and 0 is open. I realized afterwards that holding the middle button on the remote for about 5 seconds will switch the direction of the curtain as well. That’s much simpler ;o)

I also found that when Home Assistant is restarted, the position of the curtain goes missing, so I added this automation - it’s good practice to do this for all your MQTT devices:

automation:
- alias: Update State of Tasmotas on HA Restart
  trigger:
    platform: homeassistant
    event: start
  action:
  - service: mqtt.publish
    data:
      topic: cmnd/curtains/state
      payload: ''
  - service: mqtt.publish
    data:
      topic: cmnd/tasmotas/state
      payload: ''
  - service: mqtt.publish
    data:
      topic: cmnd/curtains/state
      payload: ''
  - service: mqtt.publish
    data:
      topic: cmnd/shellys/state
      payload: ''
  - service: mqtt.publish
    data:
      topic: cmnd/lights/state
      payload: ''

Something strange with the quotes in the preformatted text above - just follow regular convention, please. Aaaaannnd, you’re done! Go to Home Assistant and open up your curtains :raised_hands:

Hope this is useful for someone. Good Luck - would love some feedback how it goes. Feel free to ask questions and I will try to answer them quicker than than I did these. :flushed:

UPDATE: My config uses Tasmota 8.1.0.2 and the closed status publishes fine. There may be some updates in later versions that cause issues with publishing the Tuya closed status - thanks :+1: @TonyB for the solution. See here for details…

6 Likes