Hey,
I got some booards form aliexpress like in this picuture, they should be ESP-01 and not ESP-01S
So to the main topic, i flashed esphome to the board, connected it to wifi, adopted it in esphome and used the following code
esphome:
name: esphome-web-3faa17
friendly_name: ESPHome Web 3faa17
esp8266:
board: esp01_1m
# Enable logging
logger:
baud_rate: 0
# Enable Home Assistant API
api:
encryption:
key: "###"
ota:
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "###"
password: "###"
captive_portal:
# Enable logging
web_server:
port: 80
uart:
baud_rate: 9600
tx_pin: GPIO3
debug:
switch:
- platform: template
id: relay1
name: "relay1 switch"
turn_on_action:
- uart.write: [0xA0, 0x01, 0x01, 0xA2]
- switch.template.publish:
id: relay1
state: ON
turn_off_action:
- uart.write: [0xA0, 0x01, 0x00, 0xA1]
- switch.template.publish:
id: relay1
state: OFF
The problem is that after toggeling to on the relay switches on and back off affter a short time (not exact every time but around 0.5 to 1 sec), i tried using esp8266:
board: esp01 insted ot esp01_1m but the flash is low and cannot upload via ota, i tried using diffrent GPIO pins but to no success, using diffrent baud_rate dosent work eather, im powering it with 5v as when i use 3.3v it dosent boot (Powering it to the relay board and not the ESP itself).
Also the relay is SRD-05VDC-SL-C and on the relay board has only 4 pins to connect from left to right 5V RX TX GND
Anyone got an idea where the problem can be and how to fix it?