Group Covers ESPHome

Hi All,

I really hope you can help me out here.
I have setup 2 esp8266’s to use with 3 Somfy IO remote and to control my 3 screens
This is actually working well. but when i try to group them, NOTHING is working and i start to doubt my initial setup. to give you an idea these are my two configs:

esphome:
  name: screen-3

esp8266:
  board: d1_mini

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: "xxxxxxxxxxxxxxxxxxxxx"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Screen-3 Fallback Hotspot"
    password: "XXXXXXXXXXXXXX"

captive_portal:

#Webportal
web_server:
  port: 80

switch:
#Restart 
  - platform: restart
    name: "Somfy Screen-3 restart"
    
#Somfy Screen 3
  - platform: gpio
    pin: D1
    id: relay8
    name: "Somfy 3 remote Up"
    inverted: true

  - platform: gpio
    pin: D2
    id: relay9
    name: "Somfy 3 remote Stop"
    inverted: true

  - platform: gpio
    pin: D3
    id: relay10
    name: "Somfy 3 remote Down"
    inverted: true

cover:
  - platform: template
    name: Screen-3
    device_class: shutter
    close_action:
      - switch.turn_on: relay10
      - delay: 500ms
      - switch.turn_off: relay10
    stop_action:
      - switch.turn_on: relay9
      - delay: 500ms
      - switch.turn_off: relay9
    open_action:
      - switch.turn_on: relay8
      - delay: 500ms
      - switch.turn_off: relay8      
    assumed_state: true
    optimistic: true

and

esphome:
  name: screens-1-2

esp8266:
  board: d1_mini

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: "xxxxxxxxxxxxxxx"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Screens-1-2 Fallback Hotspot"
    password: "xxxxxxxxxxx"

captive_portal:

#Webportal
web_server:
  port: 80

switch:
#Restart 
  - platform: restart
    name: "Somfy restart"
    
#Somfy Screen 1
  - platform: gpio
    pin: D1
    id: relay1
    name: "Somfy 1 remote Up"
    inverted: true

  - platform: gpio
    pin: D2
    id: relay2
    name: "Somfy 1 remote Stop"
    inverted: true

  - platform: gpio
    pin: D3
    id: relay3
    name: "Somfy 1 remote Down"
    inverted: true

  - platform: gpio
    pin: D4
    id: relay4
    name: "Somfy 1 remote Selector"
    inverted: true

#Somfy Screen 2
  - platform: gpio
    pin: D6
    id: relay5
    name: "Somfy 2 remote Down"
    inverted: true

  - platform: gpio
    pin: D7
    id: relay6
    name: "Somfy 2 remote Stop"
    inverted: true

  - platform: gpio
    pin: D8
    id: relay7
    name: "Somfy 2 remote Up"
    inverted: true

cover:
  - platform: template
    name: Screen-1
    device_class: shutter
    close_action:
      - switch.turn_on: relay3
      - delay: 500ms
      - switch.turn_off: relay3
    stop_action:
      - switch.turn_on: relay2
      - delay: 500ms
      - switch.turn_off: relay2
    open_action:
      - switch.turn_on: relay1
      - delay: 500ms
      - switch.turn_off: relay1      
    assumed_state: true
    optimistic: true
    
  - platform: template
    name: Screen-2
    device_class: shutter
    close_action:
      - switch.turn_on: relay5
      - delay: 500ms
      - switch.turn_off: relay5
    stop_action:
      - switch.turn_on: relay6
      - delay: 500ms
      - switch.turn_off: relay6
    open_action:
      - switch.turn_on: relay7
      - delay: 500ms
      - switch.turn_off: relay7     
    assumed_state: true
    optimistic: true

there should be a way to make it possible to control all screens to go up, stop or go down?

hope you can help me out here.

thnx in advance!

I i understand correct you’d like to move both with one click? in this case add group in configuration.yaml:

cover: # ----------------------------------------------------------------------- COVER's
  - platform: group
    name: all-covers
    entities:
      - cover.screen-3
      - cover.screen-1
      - cover.screen-2

After restart you’ll have “cover.all-covers” which will trigger all of them at once.

Thank you for your reply!
unfortunately i’ve already done but nothing happens.

What do you mean by that? If you call service it doesn’t run? Try this in developer tools -->services:

service: cover.open_cover
data: {}
target:
  entity_id: cover.all-covers

or:

service: cover.close_cover
data: {}
target:
  entity_id: cover.all-covers

What I did, I created a group via the settings → Helper way.
this results in only one screen responding.

via the developers section it acts the same

I hope that you used only small letters when adding covers?
How about if you delete group in helpers and create it manually like i wrote above? Enter needed data, restart HA and try.
Also…i’m not sure how “picky” system is when using “-” sign. I tend to avoid it. As a last resort you could change names in esphome…

I’ll definitely try, thank you! will keep you posted.

I really don’t understand why it is not working.
there is nothing in the log files.
when I remove cover.screen2 from the config, only screen3 reacts.
i also deleted the “-” sign.
when all covers are in the group, nothning happens, except the icons change.

totally lost here.

Then i’m lost too…
as an alternative you could create a script instead of group. Maybe that way it will work.
something like this below (not tested, it could need some tweaking!). Then just run script and all covers should move.

script:
  all_covers_open:
    sequence:
      - service: cover.open_cover
        data:
          entity_id: cover.screen-3
      - service: cover.open_cover
        data:
          entity_id: cover.screen-1
      - service: cover.open_cover
        data:
          entity_id: cover.screen-2

  all_covers_close:
    sequence:
      - service: cover.close_cover
        data:
          entity_id: cover.screen-3
      - service: cover.close_cover
        data:
          entity_id: cover.screen-1
      - service: cover.close_cover
        data:
          entity_id: cover.screen-2    

  all_covers_stop:
    sequence:
      - service: cover.stop_cover
        data:
          entity_id: cover.screen-3
      - service: cover.stop_cover
        data:
          entity_id: cover.screen-1
      - service: cover.stop_cover
        data:
          entity_id: cover.screen-2    

yess, lets try this.

on the otherhand, I do receive some esphome api errors in the past when activating the screen, this might be a reason as well?
perhaps using MQTT might work? but I have no experience in setting this up in ESPhome.

let try the script first :slight_smile:

again, thank you very much for your help in this matter!

hmm… unfortunately no luck :frowning:

Perhaps any idea how to setup mqtt in esphome?
I have the feeling the esphome api causes some trouble.

thanks againg!

That’s strange… i’m out of my knowledge…
i have no experience with mqtt in esphome, sorry.

Thank you for your help!

If I found a solution, ill post it here.

I found somehow a workaround.
when using an automation, I set it on Queued.

This seems to be workinf exactly how I wanted.
I am not sure why though…