Hello everyone,
so I have an issues with my winch garage door controller. The original winch controller has up/down push button and a capacitor in the remote for changing the direction of the motor. That is why there are 6 wires.
I have ESP8266 and 2 2channel relays.
I use 2 channel relay for opening, and 2 channel relay for closing garage doors, the issues is that sometimes relay starts letting current and randomly starts to open or close my garage doors. I have somewhat temporary fixed the issues by installing a smart plug with which the winch is powered. The winch only gets power when I press up or down button and turns off after the closing/opening is done.
Can someone give me some pointers for my code if I am doing something wrong or something? Because when the relay start letting current on by itself, it does not burn, after few hours of not having power it starts to work normally again.
I have included a picture and code I currently use.
The is
esphome:
name: garaza_mercedes
friendly_name: garaza_mercedes
platform: ESP8266
board: nodemcu
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "xxx"
ota:
password: "xxx"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
manual_ip:
static_ip: 192.168.20.15
gateway: 192.168.20.1
subnet: 255.255.255.0
dns1: 1.1.1.1
dns2: 8.8.8.8
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Garaza Fallback Hotspot"
password: "01zaWI0BOiNF"
captive_portal:
sensor:
- platform: ultrasonic
trigger_pin: D5
echo_pin: D6
id: topSensor
name: topSensor
update_interval: '0.1s'
on_value_range:
- above: 4
then:
- below: 0.22
then:
- switch.turn_on: open_switch
- platform: ultrasonic
trigger_pin: D7
echo_pin: D8
id: bottomSensor
name: bottomSensor
update_interval: '0.1s'
timeout: 10m
on_value_range:
- above: 4 # You must have a below and an above part.
then:
- below: 0.22 # You must have a below and an above part.
then:
- switch.turn_on: close_switch
switch:
- platform: gpio
pin: D2
name: "Garage Door Open Switch"
id: open_switch
restore_mode: ALWAYS_ON
- platform: gpio
pin: D1
name: "Garage Door Close Switch"
id: close_switch
restore_mode: ALWAYS_ON
cover:
- platform: template
device_class: garage
id: cover_garage
name: Mercedes
has_position: true
lambda: |-
if(id(bottomSensor).state = 'unknown' ) {
return 0.5;
}
else if(id(bottomSensor).state < 0.25) {
return 0.0; //return COVER_CLOSED;
}
else if(id(topSensor).state < 0.25) {
return 1.0; //return COVER_OPEN;
}
else {
return 0.5;
}
open_action:
- homeassistant.service:
service: switch.turn_on
data: {entity_id: switch.chuangmi_hmi206_3708_switch}
- switch.turn_on: close_switch
- delay: 0.2s
- switch.turn_off: open_switch
- delay: 25s
- homeassistant.service:
service: switch.turn_off
data: {entity_id: switch.chuangmi_hmi206_3708_switch}
close_action:
- homeassistant.service:
service: switch.turn_on
data: {entity_id: switch.chuangmi_hmi206_3708_switch}
- switch.turn_on: open_switch
- delay: 0.2s
- switch.turn_off: close_switch
- delay: 25s
- homeassistant.service:
service: switch.turn_off
data: {entity_id: switch.chuangmi_hmi206_3708_switch}
stop_action:
- switch.turn_on: close_switch
- switch.turn_on: open_switch
- homeassistant.service:
service: switch.turn_off
data: {entity_id: switch.chuangmi_hmi206_3708_switch}