Sonoff Dual Window Cover with set position

Hi, were you able to solve your problem? I used your automation as the basis for mine but it reports an error in the position part. Could you help me? good day

HI Asino, I suggest you to direct use the custom_component Timedcover, this platform can make what they need without any additional set.

Hi and thanks for the advice, I implemented the component. I just have a question to you does set_position work? good evening

1 Like

Yes Asino,off course work, this platform work like a timer, you need to set the time need for full open and for full close the cover, than when you for example set position to 20% your cover will be in open function for 20% time of your full open time (eg. full open time 30s - set 20% position: 30/100*20= 6s in open function).
Let me know if you need some help for properly set this platform, just for your info, the tilt position work only for suncover with motorized tilt function.

1 Like

Thank you for your support, you are right after several attempts the component works on the gray scale. All that remains is a problem not related to the component. I control the device through a double relay of the quino that I also control with two physical buttons. It happens that if I control the blinds with the physical buttons the component does not detect the displacement. Now I’m trying to create the automations associated with the relays closing but for now without success. good day.

HI Asino123, one solution for your issue is using a timer that’s both activated by your switch and the Home Assistant (set position or switch). I’ve used the solution provided below along with timedcover:

Nice work thx for sharing

Could you please post one of automatization scripts?
Not sure what you meant, but also have a problem when i operate physical buttons it doesnt update position.

Also, have you found a way to disable tilt position slider ? I guess most of us dont need tilt…

Thanks

Same by me, the physical buttons do not work.

Does someone has an fix?

Hi, I have read all the topic and applied the custom timer component to my configuration. Now I can control my ride shutter from hassio, Google assistant and switches without problems.
The only thing I can’t adjust is about different position shutter reach depending if i’m closing or opening it.
For instance, if shutter is closed and I set to open it 50% the reached position is correct but it is not the same when the shutter is all open and I want to close it 50%. In this case the shutter stops far from 50%…near to completely close. I suppose it is a different speed of the engine opening or closing the shutter. Is there a way to solve it?
Thanks to everyone will give advices.

Hi, do you think it’s possible to adapt your code to ESPHome? Thanks

It’s already there - https://esphome.io/components/cover/time_based.html
I’m using sonoff touch to operate my roller shutters. I can set position and open/close them from HomeAssistant and Google Assistant

Dear all thank you so much for the code and continuous improvement. I have one problem with this code… I’m not able to get the position sliders to be updated when I press the arrows or when I use the physical buttons. In the past (one year ago maybe) I was able to get this working but now it does not work.

Any advice?

You will have to check that the topic stat/window_1/POWER1 is sent correctly to mosquitto server which is defined on the automations.yaml file.

Thank you so much!!! I had a issue with topics definition overall and MQTT that was causing this behaviour and not the code itself. After setting up the devices correctly everything worked as expected!!! Great code!

Best regards

Hi, Thanks for sharing the project. I am using my shutters with your esphome code on an Olimex esp32 platform. However, I would like to have set position and Windows position control in the home assistant. This seems possible only with the mqtt protocol. I, however, would like to avoid mqtt because when the server is off I would like to be able to close the blinds from the physical buttons. In your opinion, would it be possible to set simple buttons and relays in esphome without using the cover and then arrange the cover in the Home assistant? can you help me?

For controlling the cover with physical buttons you will have to change the pin number from the binary_sensor (GPIO09 & GPIO00). This way the server can be off and still be able to control the cover.

Though, if you want to set the position I believe that this might help: set_position(0.5), but I don’t know exactly how to use it so you might want to try it out.

Edit: This might also work by replacing it on on_press and on_release:

    - cover.control:
        id: cover_1
        position: 50%

Now my code is

binary_sensor:

  • platform: gpio
    pin:
    number: GPIO02
    mode: INPUT_PULLUP
    inverted: True
    id: ph_button3
    on_press:

    • cover.open: my_cover
      on_release:
    • cover.stop: my_cover
  • platform: gpio
    pin:
    number: GPIO03
    mode: INPUT_PULLUP
    inverted: True
    id: ph_button4
    on_press:

    • cover.close: my_cover
      on_release:
    • cover.stop: my_cover

switch:

  • platform: gpio
    pin: GPIO04
    interlock: &interlock [open_cover, close_cover]
    id: open_cover
  • platform: gpio
    pin: GPIO05
    interlock: *interlock
    id: close_cover

cover:

  • platform: time_based
    name: “myroom_window”
    id: my_cover
    open_action:

    • switch.turn_on: open_cover
      open_duration: 18s

    close_action:

    • switch.turn_on: close_cover
      close_duration: 18s

    stop_action:

    • switch.turn_off: open_cover
    • switch.turn_off: close_cover

… but i don’t see the slider position

in HA i see only
31

Hi, could you tell me exactly where to write

- cover.control:
    id: cover_1
    position: 50%

???

Hi Pierre, can you help me?
I would like to add to my cover in esphome a slider that marks the position of the curtain. My code is currently:

binary_sensor:

- platform: gpio
  pin:
    number: GPIO02
    mode: INPUT_PULLUP
    inverted: True
  id: ph_button3
  on_press:
  - cover.open: my_cover
  on_release:
  - cover.stop: my_cover
  
- platform: gpio
  pin: 
    number: GPIO03
    mode: INPUT_PULLUP
    inverted: True
  id: ph_button4
  on_press:
  - cover.close: my_cover
  on_release:
  - cover.stop: my_cover

switch:
- platform: gpio
  pin: GPIO04
  interlock: &interlock [open_cover, close_cover]
  id: open_cover
- platform: gpio
  pin: GPIO05
  interlock: *interlock
  id: close_cover

      
cover:

- platform: time_based
  name: "myroom_window"
  id: my_cover
  open_action:
    - switch.turn_on: open_cover
  open_duration: 4s

  close_action:
    - switch.turn_on: close_cover
  close_duration: 4s

  stop_action:
    - switch.turn_off: open_cover
    - switch.turn_off: close_cover

what do I have to add to see also the position slider besides the forward, back and stop buttons?
Thank you!!!