Sonoff Dual Window Cover with set position

Hi, how I can change the button order, because if I press button up the shutter go down and vice versa if I click down.
But if I select one position, then the shutter goes up or down ok.
Another question is how I can create an automation that at the morning the shutter goes up to X position and in the evening the shutter goes down to X position.
Thanks

Hi, after shutdown and restart Hassio, all is OK! :smiley:

Switch wires on your relays

Hi all,
I updated to 6.4.0 and now the buttons don’t work.

In the docs there are no info on such changes.

Does anyone can support me to make them work again?

Hi Laptoc
I’m also trying to use stefanbode tasmota fork on the Sonoff Dual

Have you been able to put a slider on the cover so that the position can be set/viewed without having to click on the cover icon to open a slider window
(Note - I’m very new to HA)
Cover setup below

cover:

  • platform: mqtt
    name: “Test Blinds”
    availability_topic: “house/shutter1/tele/LWT”
    payload_available: “Online”
    payload_not_available: “Offline”
    position_topic: house/shutter1/stat/SHUTTER1
    position_open: 100
    position_closed: 0
    set_position_topic: “house/shutter1/cmnd/backlog/shutterposition”
    command_topic: “house/shutter1/cmnd/backlog”
    payload_open: “SHUTTEROPEN”
    payload_close: “SHUTTERCLOSE”
    payload_stop: “SHUTTERSTOP”
    retain: false
    optimistic: false
    qos: 1

Thanks
Leigh

By default it’s not possible. You have to use some custom UI element. The easiest way to use custom card for lovelace (it going to be default UI staring next release) from @thomasloven

Hi all,

sorry but can someone help me?

This is my config:

  - platform: mqtt
    name: “Tapparella Studio”
   # availability_topic: "tele/TapparellaStudio/LWT"
   # payload_available: "Online"
   # payload_not_available: "Offline"
    position_topic: stat/TapparellaStudio/SHUTTER1
    position_open: 100
    position_closed: 0
    set_position_topic: "cmnd/TapparellaStudio/shutterposition"
    command_topic: "cmnd/TapparellaStudio/backlog"
    payload_open: "SHUTTEROPEN"
    payload_close: "SHUTTERCLOSE"
    payload_stop: "SHUTTERSTOP"
    retain: false
    optimistic: false
    qos: 1

I had to comment availabitly because makes the shutter unavailable.

Moreover I do not see any slider to set position within HA .

This is a direct paste from stefanbode’s information I doubt you have the same setup.
Have a look at the cover: that I posted above and see where I’ve changed the settings due to my topic (shutter1) and the arrangement of the full topic (house/%topic%/%prefix%) - Checking the LWT sets payload if its available or not.
To get a slider click on the cover Icon or text and you should see the slider with stats.
It took me hours to work out what was going on as the last example in stefanbodes does not have the cover: at the beginning
check with the tasmota wiki for various options/stats/info as stefanbode is based on it, just has a few extras.
Going to look into Lovelace to set up a better looking control page.
Leigh

Jokerigno - Which Tasmota are you using - std or stefans - if stefans you can’t update, as it will overwrite stefans with the std tasmota. (I think anyway)

I do have Stefan Bode fork.

And this was my current setup.

Hi, first of all thanks to the OP for this :smiley:

But I have a proble, ever time I press the button Up/Down it does nothing don’t know why.

Is there a way to see log’s or something to try to see where is the problem ?!

Using the code that the OP put here at Oct 17, '18

Thanks for the help

New version of Home-Asssitant 0.86.1 breaks the automations.
You need to do a change on the automations

  • 411 (Window - Position UP)
  • 412 (Window - Position Down).

Change the platform: time to platform: time_pattern on both of these automations and you are ready to go.

1 Like

You are awesome! Thank you!
I was getting mad after updating to 0.86.1 :wink:

Have you done cover with sonoff?
Can you give me automation to chek where I have done mistake???

Hello, congratulations on your project. A question, how can I integrate the comand:
availability_topic command: “tele / sonoff / LWT”
so that when the sonoff does not receive power, on the home assistant server the commands are not available?
Thank’s!

H, first of all, thanks for your awesome work!

I tried to modify your code @bkbilly, but using a double wall mounted Aqara wall switch.

Cover seems to work, but positioner doesn’t.

Here I post the code I used:

configuration.yaml

timer:

  window_up:
   name: Persiana arriba
   duration: '00:00:18'
  window_down:
   name: Persiana abajo
   duration: '00:00:18'

input_number:
  window_position:
    name: "Posicion"
    initial: 5
    min: 0
    max: 18
  window_set_position:
    name: "Posicionar"
    initial: 5
    min: 0
    max: 100 

cover:
  - platform: template
    covers:
      window_cover:
        friendly_name: "Salón"
        position_template: "{{ (((states.input_number.window_position.state | int) * 100)/18 | int) }}"
        open_cover:
          - service: switch.turn_off
            data:
              entity_id: switch.wall_switch_right_158d00014axxxx
          - service: switch.turn_on
            data:
              entity_id: switch.wall_switch_left_158d00014axxxx
        close_cover:
          - service: switch.turn_off
            data:
              entity_id: switch.wall_switch_left_158d00014axxxx
          - service: switch.turn_on
            data:
              entity_id: switch.wall_switch_right_158d00014axxxx
        stop_cover:
          - service: switch.turn_off
            data:
              entity_id: switch.wall_switch_left_158d00014axxxx
          - service: switch.turn_off
            data:
              entity_id: switch.wall_switch_right_158d00014axxxx

automations.yaml

  - id: '301'
    alias: Window - MQTT Button1 OFF (up)
    trigger:
    - platform: state
      entity_id: switch.wall_switch_left_158d00014axxxx
      from: 'on'
      to: 'off'
    action:
    - service: timer.cancel
      entity_id: timer.window_up

  - id: '302'
    alias: Window - MQTT Button2 OFF (down)
    trigger:
    - platform: state
      entity_id: switch.wall_switch_right_158d00014axxxx
      from: 'on'
      to: 'off'
    action:
    - service: timer.cancel
      entity_id: timer.window_down

  - id: '303'
    alias: Window - Timer stopped
    trigger:
    - platform: event
      event_type: timer.finished
      event_data:
        entity_id: timer.window_up
    - platform: event
      event_type: timer.finished
      event_data:
        entity_id: timer.window_down
    action:
    - service: cover.stop_cover
      data:
        entity_id: cover.window_cover

  - id: '311'
    alias: Window - MQTT Button1 ON (up)
    trigger:
    - platform: state
      entity_id: switch.wall_switch_left_158d00014axxxx
      from: 'off'
      to: 'on'
    condition:
      condition: template
      value_template: '{{ as_timestamp(now()) - as_timestamp(states.input_number.window_set_position.last_updated) > 3 }}'
    action:
    - service: timer.start
      data:
        duration: 00:00:18
      entity_id: timer.window_up

  - id: '312'
    alias: Window - MQTT Button2 ON (down)
    trigger:
    - platform: state
      entity_id: switch.wall_switch_right_158d00014axxxx
      from: 'off'
      to: 'on'
    condition:
      condition: template
      value_template: '{{ as_timestamp(now()) - as_timestamp(states.input_number.window_set_position.last_updated) > 3 }}'
    action:
    - service: timer.start
      data:
        duration: 00:00:18
      entity_id: timer.window_down

  - id: '411'
    alias: Window - Position UP
    trigger:
      platform: time_pattern
      seconds: '/1'
    condition:
      condition: state
      entity_id: 'timer.window_up'
      state: 'active'
    action:
    - service: input_number.set_value
      data_template:
        entity_id: input_number.window_position
        value: "{{ (states.input_number.window_position.state | int) + 1 }}"

  - id: '412'
    alias: Window - Position Down
    trigger:
      platform: time_pattern
      seconds: '/1'
    condition:
      condition: state
      entity_id: 'timer.window_down'
      state: 'active'
    action:
    - service: input_number.set_value
      data_template:
        entity_id: input_number.window_position
        value: "{{ (states.input_number.window_position.state | int) - 1 }}"

  - id: '511'
    alias: Window - Set Position Down
    trigger:
      platform: state
      entity_id: input_number.window_set_position
    condition:
      condition: template
      value_template: "{{ (states.input_number.window_position.state | int) > ((((states.input_number.window_set_position.state | int ) * 18 )/100) | int) }}"
    action:
    - service: timer.start
      data_template:
        entity_id: timer.window_down
        duration: "{{ '00:00:%02d' | format( ((states.input_number.window_position.state | int) - ((((states.input_number.window_set_position.state | int ) * 18 )/100) | int) ) | abs ) }}"
    - service: cover.close_cover
      data:
        entity_id: cover.window_cover

  - id: '512'
    alias: Window - Set Position UP
    trigger:
      platform: state
      entity_id: input_number.window_set_position
    condition:
      condition: template
      value_template: "{{ (states.input_number.window_position.state | int) < ((((states.input_number.window_set_position.state | int ) * 18 )/100) | int) }}"
    action:
    - service: timer.start
      data_template:
        entity_id: timer.window_up
        duration: "{{ '00:00:%02d' | format( ((states.input_number.window_position.state | int) - ((((states.input_number.window_set_position.state | int ) * 18 )/100) | int) ) | abs ) }}"
    - service: cover.open_cover
      data:
        entity_id: cover.window_cover

groups.yaml

window_cover:
  name: Window Cover
  entities:
  - cover.window_cover
  - input_number.window_set_position
  - input_number.window_position
  - timer.window_up
  - timer.window_down

I checked code, but I can’t find what it’s wrong.

Would it be possible to use aqara double wall socket instead of sonoff dual ?

Thanks for sharing!

Hi Pierre, a question for you:
I would like that when a dual sonoff is off, the cover appears (not available).
I would like to insert the following command:
availability_topic: “tele / sonoff / LWT”.
In which sector of .yaml can I insert it?
Thank’s!

I guess it should go in the cover definition:

1 Like

Thank’s for your answer.
I inserted availability_topic in the cover, without result. Its positioning is right?
He doesn’t work!

Just realised.
MQTT Cover has availability. Template cover does not