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