Hi,
the last few days I spent on dealing with this cheap, but good shutter switch. Because I did not wanted to register and deal with Tuya, I desided to change it to ESPHome.
Now I would like to share my knowledge and .yaml.
first of all the unit:
-get shure to buy the version V1 with the Tuya ESP8285
-it works with a Remote Control on 868MHz, WiFi and you can connect normal wall-buttons
-its small enought to fit in a standard 68mm wallbox
After simple opening the case, it is needed to solder the contacts or cables for the flash process.
Here is a very good tutorial allready and was as well my base to do the hole change. thanks to @zry98
my testunit with flash and reset buttons:
YAML:
-Because I do not need this working in three different ways, I desided to deactivate WiFi and have it only as a backup for ota changings of the .yaml. As well I dont want in every corner of my house a wifi client.
-There is a delay of 1sec.between quick up and down changes to protect the motor. A interlock is not needed, because there is always a stop command before changing up or down direction.
-Wall-push-buttons: press once the push-button and the curtain opens/closes completely, to stop press during the open/close action more then 1sec. and keep it pressed until you reach the position you like, after release the button, the curtain will stop.
-There are some other settings you can include, exclude or change like you need.
esphome:
name: "curtain-test"
friendly_name: "curtain-test"
###turn wifi off, also set (api: --> reboot_timeout: 0s) to prevent bootloop
on_boot:
then:
- delay: 300s
- wifi.disable:
#esp8266 1MB flash
esp8266:
board: esp8285
restore_from_flash: false
# Enable logging
logger:
# Enable Home Assistant API
api:
###turn wifi off, set (api: --> reboot_timeout: 0s) to prevent bootloop
reboot_timeout: 0s
encryption:
key: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
ota:
password: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
wifi:
#wifi powersafe mode: NONE,LIGHT,HIGH
power_save_mode: HIGH
# fast_connect: true
ssid: !secret wifi_ssid
password: !secret wifi_password
manual_ip:
static_ip: 192.168.1.00
gateway: 192.168.1.0
subnet: 255.255.255.0
dns1: 192.168.1.0
# Enable fallback hotspot (captive portal) in case wifi connection fails, http:192.168.4.1
ap:
ssid: "Esphome-Web-22xx22"
password: "xxxxxx"
captive_portal:
# reduce write frequency to flash to avoid wearing it out, adjust it as needed
preferences:
flash_write_interval: 1h
substitutions:
device_name: 'shutter 1'
# for hard restart
button:
- platform: restart
id: restart_button
name: 'Restart ${device_name}'
entity_category: diagnostic
status_led: # onboard LED
pin:
number: 3
inverted: true
# external switches
binary_sensor:
- platform: gpio
id: switch_open
pin:
number: 4
inverted: true
on_click:
- min_length: 50ms # Short press
max_length: 500ms
then:
- cover.open: shutter
- min_length: 1000ms # Medium press / long
max_length: 5000ms
then:
- cover.stop: shutter
- platform: gpio
id: switch_close
pin:
number: 5
inverted: true
on_click:
- min_length: 50ms # Short press
max_length: 500ms
then:
- cover.close: shutter
- min_length: 1000ms # Medium press / long
max_length: 5000ms
then:
- cover.stop: shutter
- platform: gpio
id: stop_button
pin:
number: 13
inverted: true
on_click:
then:
- cover.stop: shutter
# relays
output:
- platform: gpio
id: relay_open
pin: 12
- platform: gpio
id: relay_close
pin: 14
# cover with 1000ms delay inbetween change of directions
cover:
- platform: time_based
id: shutter
name: '${device_name}'
device_class: shutter
open_action:
- output.turn_off: relay_close
- delay: 1000ms # additional delay
- output.turn_on: relay_open
open_duration: 40s # adjust it to the actual duration to fully open
close_action:
- output.turn_off: relay_open
- delay: 1000ms # additional delay
- output.turn_on: relay_close
close_duration: 40s # adjust it to the actual duration to fully close
stop_action:
- output.turn_off: relay_open
- output.turn_off: relay_close
assumed_state: true
#optional
#sensor:
# - platform: wifi_signal
# name: "WiFi Signal Strength"
# update_interval: 60s
# - platform: wifi_signal # Reports the WiFi signal strength/RSSI in dB
# name: "WiFi Signal dB"
# id: wifi_signal_db
# update_interval: 60s
# entity_category: "diagnostic"
# - platform: copy # Reports the WiFi signal strength in %
# source_id: wifi_signal_db
# name: "WiFi Signal Percent"
# filters:
# - lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
# unit_of_measurement: "Signal %"
# entity_category: "diagnostic"
# - platform: uptime
# name: Uptime Sensor
# update_interval: 60s
###on_click: standard timings
# - min_length: 50ms # Short press
# max_length: 500ms
# then:
# # Some action
# - min_length: 500ms # Medium press
# max_length: 3000ms
# then:
# # Some other action
# - min_length: 3000ms # Long press
# max_length: 10000ms
# then:
# # Some other action
enjoy