4 channel Relay ESP8266 Wifi board WORKING with esphome

Why not use esphome to flash? Am I missing something?

IT would be great if you contribute this to the cookbook section of esphome.io docs

4 Likes

True, and then I first need some time to setup a esphome-docs environment and understand how git works :slight_smile:
So will come to that sooner or later, since I have more projects which I want to do with esphome, but probably not in the short run

because the relay board comes with it’s own firmware which is not OTA flashable / esphome compatible.
So as a first (or final) step you at least need one USB flash operation to get the esphome firmware on it. After that you can flash OTA from esphome.

Docs is easy with vs studio code remote and docker.

I guess flashing should work from esphome usb too.

Thanks for the help but I ended with a bit of a nicer solution. You can use a switch template to have this uart thing act like a real single switch in HomeAssistant:

  - platform: template
    name: "Relay2"
    id: "Relay2"
    optimistic: true
    turn_on_action:
      - uart.write: [0xA0, 0x02, 0x01, 0xA3] # turn on Relay2
    turn_off_action:
      - uart.write: [0xA0, 0x02, 0x00, 0xA2]
3 Likes

Yes, figured that out also, and yours looks more compact then mine, so I’ll update.

Tried to share this asap, so hence the barebones setup.

Thanks

I take it by your use of the above statement that there is no state feedback for the relay states on this board?

I thought this could be ideal to control my garden irrigation valves but that would be a deal breaker.

True, there probably is a state feedback from the second IC to the ESP but I’m still figuring it out. For now I use the optimistic option, haven’t had any issues with that.

1 Like

Don’t be confused by the optimistic setting there.
All this kind of devices work the same way at the end, eg. this is very much how the sonoff basic works.
You’re never getting a positive feedback con relay latched

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