Somfy RTS awning - D1 mini homebrew solution

I have a friend who has a Somfy awning and didnt want to spend the couple hundred dollars or so to make it smart.
So I thought a D1 Mini piggy-backed to the remote would come in handy and do the job, and it did!
This is by no means an expert solution, and I’m sure there are better ways to write the code, but it works well. He’s hidden the remote in a cupboard anyway, and controls it via the companion app and automations.

esphome:
  name: somfy-remote

esp8266:
  board: d1_mini

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "blablabla"

ota:
  password: "blablabla"

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

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

captive_portal:

web_server:
  port: 80    

switch:
  - platform: gpio
    pin: 5
    inverted: True
    id: awning_close
    name: "AwningClose"
    icon: "mdi:awning"
    on_turn_on:
    - delay: 1000ms
    - switch.turn_off: awning_close
    
  - platform: gpio
    pin: 4
    inverted: True
    id: awning_open
    name: "AwningOpen"
    icon: "mdi:awning"
    on_turn_on:
    - delay: 1000ms
    - switch.turn_off: awning_open

  - platform: gpio
    pin: 14
    inverted: True
    id: awning_stop
    name: "AwningStop"
    icon: "mdi:awning"
    on_turn_on:
    - delay: 1000ms
    - switch.turn_off: awning_stop


cover:
  - platform: template
    name: "Awning Cover"
#    lambda: |-
#      if (id(top_end_stop).state) {
#        return COVER_OPEN;
#      } else {
#        return COVER_CLOSED;
#      }
    open_action:
      - switch.turn_on: awning_open
    close_action:
      - switch.turn_on: awning_close
    stop_action:
      - switch.turn_on: awning_stop
    optimistic: true
1 Like

Awesome thank you!!!
Can you give pinouts, paint on the picture?

I can’t remember.
You really just need to know which one is the ground wire (marked) and then you can short the other 3 wires one at a time to the ground wire to figure out which is open, stop, close.

1 Like

Neat, Ive been using this which has been working great for multiple Somfy RTS shuitters
rstrouse/ESPSomfy-RTS: A controller for Somfy RTS shades and blinds (github.com)

1 Like

That’s awesome, thanks

Hi Simon, it’s interesting what you’ve done!

Maybe it’s better suited for the Share your Projects! category instead of configuration…