Curtain Automation

Unfortunately i was unable to flash new version and after 3-4 days i gave up… Instead for now i decided to use a time based cover component which works almost ok… I probably will buy zigbee version instead of tuya version next time…

Just want to say thank you for the detailed guide. I have 4 of these motors at home and had already made peace with the fact that I couldn’t reliably know whether they had been closed via the remotes, or how to get the stop button in HA to work as it should, and you just solved both of these issues. Thank you!

1 Like

The timing on this thread couldn’t be more perfect as I have two Zemi curtains I just pulled out of Tuya and into HA. Thank you for posting this. I have most of it working, but my HA doesn’t seem to be using the telemetry sent by either curtain (either the 5 minute recurring, when i run the automation script on boot-up, or manually publish in mosquito). I’m new at this, so it’s totally possible I’m doing something wrong. I receive valid telemetry back when I publish, but it doesn’t seem HA does anything with it (like update the position).

cover:
- platform: mqtt
  name: "livingroom-curtains"
  unique_id: livingroom-curtains
  device_class: curtain
  command_topic: "cmnd/livingroom/curtains/EVENT"
  position_topic: "stat/livingroom/curtains/RESULT"
  set_position_template: "{{ ((-100 + position)|int)|abs }}"
  set_position_topic: "cmnd/livingroom/curtains/DIMMER"
  availability_topic: "tele/livingroom/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.livingroom-curtains', 'position') }}"
- platform: mqtt
  name: "kitchen-curtains"
  unique_id: kitchen-curtains
  device_class: curtain
  command_topic: "cmnd/kitchen/curtains/EVENT"
  position_topic: "stat/kitchen/curtains/RESULT"
  set_position_template: "{{ ((-100 + position)|int)|abs }}"
  set_position_topic: "cmnd/kitchen/curtains/DIMMER"
  availability_topic: "tele/kitchen/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.kitchen-curtains', 'position') }}"
automation:
- alias: Update State of Tasmotas on HA Restart
  trigger:
    platform: homeassistant
    event: start
  action:
  - service: mqtt.publish
    data:
      topic: cmnd/kitchen/curtains/state
      payload: ''
  - service: mqtt.publish
    data:
      topic: cmnd/livingroom/curtains/state
      payload: ''

Hi folk - FYI I received a configuration.yaml error regarding my Tuya covers after having updated HA to 2021.6. After doing some research, I was able to fix the error by replacing “value-template” text with “position_template”.

1 Like

Hi Peter - thanks for this recommendation. They look good value. I’d be interested to know what these are like a year on and how exactly you resolved the ‘quirks’. Are they as ‘silent’ as the vendor claims?
Cheers

I use this type. Ewelink support. RF control, wifi, telephone and RJ11 connector for manual switching. Home assistant automation. Very quiet operation.