4 channel Relay ESP8266 Wifi board WORKING with esphome

This is very much not the case with Tasmota or ESPhome.

HA sends a command to the ESP module and a command is sent back confirming the ESP output has been turned on.

Well… yes, in the case of this implementation the feedback is sent back confirming the ESP has sent the uart.data requested.

And this is the actual difference, which in practice turns to be no problem, in case the ESP is rebooted the switches will retain their value using the RTC memory and as the underlay board does not lose power the relay will keep their current state too.

So again, the optimistic here is not giving any better feedback than a sonoff like device will give you.

If that were the case it could be used in a value template that could be interrogated at any time by HA (e.g. after a restart) instead of using optimistic mode. As can be done with Tasmota or ESPhome.

Looks like you are saying: “this is different than a sonoff ha side” and I’m saying “this is the same than a sonoff ha side” so I’ll let it there

I don’t see why it could not be used in a value template in ha.

The switch state is preserved in the esp, in fact a gpio switch and a optimistic true (and every other switch) are retained by the same bool variable in memory.

Can confirm the same works for the 2 channel ‘lctech relay x2’.

switch:
  - platform: template
    name: 'Relay 1'
    id: relay1
    turn_on_action:
      - uart.write: [0xA0, 0x01, 0x01, 0xA2]
    turn_off_action:
      - uart.write: [0xA0, 0x01, 0x00, 0xA1]
    optimistic: true
  - platform: template
    name: 'Relay 2'
    id: relay2
    turn_on_action:
      - uart.write: [0xA0, 0x02, 0x01, 0xA3]
    turn_off_action:
      - uart.write: [0xA0, 0x02, 0x00, 0xA2]
    optimistic: true
1 Like

Cool, next step is to see if there is any way to get the current status from the uart back I think :slight_smile:

Sorry for being a bit slow :slight_smile: but I couldn’t fully understand the Tasmota references here…

Has anyone got these 4-channel units to work with Tasmota?

I’ve personally never got the serial-commands to work in Tasmota (with a single relay LCtech unit)

Cheers
Matt

Hi Erwin

Just wanted to know if you did something special to flash it?
I’ve taken the little 8266 daughterboard and I’ve connected the tx/rx/gnd/3.3v to it,but espeasy flasher won’t connect through my FTDI? It does see the COM port, just not a connection when starting the flash.

What chipset is you FTDI using? I have had better luck with CP2102 based devices than - whatever the other common one is.

Also did you ground GPIO0?

1 Like

Hi @nickrout
Mine says FT232RL.
Yes, when I powered on I put the I00 on GND, it’s just to be done during boot right, like when I flash all the other 8266 stuff.

Hi @fribse,

No, I didn’t do anything special. It is just an ESP-01. You can find a lot tutorials about it online.

It might be a broken board, sometimes it happens. Do you have another ESP-01 you can try?
I’ve had some boards that won’t flash, and try the same on another board without problems.

1 Like

Yes, I’ve gotten four, I’ve tried two without success (that was why I thought there might be a special trick to this one :slight_smile:) , I’ll whip out two more and try them.

If all 4 of them aren’t working, maybe you are doing something wrong. Try another tutorial, and start from the beginning.

Try another FTDI adapter, or try programming a known working board.
I didn’t do anything special for this.

Try holding it to ground until flashing is finished.

EDIT: although searching seems to indicate it shouldn’t be necessary to ground GPIO0 once it is in bootloader mode.

You aren’t accidentally pulling CH_PD low are you? It needs to be high to flash.

Thank you! I’d just gotten my relays in and discovered they had the other cpu controlling the relays when you posted your results. Here is my front yard sprinkler system - thanks to you.

3 Likes

I’m pullin I00 low, but I’ve orderedthis one, and are waiting for the delivery.
I hope that will make it work.
I’ll mount a momentary switch to the GND/I00, so that I can press that easily.
Now I just hope I haven’t fried them all :smiley:
I’ve flashed a ton of these until now, though so far only ESP8266, so I usually get this working without problems.

Ok, I finally got the usb programmer instead of the ftdi, and now I can program the esp-01 without problems…

Hey all,

Thanks for your work on this!

I just got a single channel relay:

but don’t seem to be able to get this working :confused:

esphome config below. Have I done something wrong? Feels like the GPIO might not be correct as nothing happens when toggling the switch in HA, I’m expecting the relay to ‘click’ but no luck.

Thanks!

esphome:
  name: relay2
  platform: ESP8266
  board: esp01_1m

wifi:
  ssid: "SSID"
  password: "PASSWORD"

# Enable logging
logger:
  baud_rate: 0 #need this to free up UART pins

# Enable Home Assistant API
api:

ota:

uart:
  baud_rate: 115200 # speed to STC15L101EW
  tx_pin: GPIO1
  rx_pin: GPIO3
  
switch:
  - platform: template
    name: "R1"
    id: "R1"
    turn_on_action:
      - uart.write: [0xA0, 0x01, 0x01, 0xA2]
    turn_off_action:
      - uart.write: [0xA0, 0x01, 0x00, 0xA1]
    optimistic: true
1 Like

theres a tasmota fork called wespota that supports these boards right out of the gate.
obviously not ideal if you want everything ESPhome but still worth considering.
the version i’m running on my 4 channel has a bug where it fills the console with failed DNS errors but its rock solid in in its actual function so i’ve been giving this bug a damn good ignoring.