Sonoff D1 with ESPHome

Hi

I run HA 2022.7 on proxmox (hardware a NUC).

I have Sonoff D1 Dimmer and I want to flash it with ESP Home.
I tried this script here

I have tried to flash it with my laptop, I connected a USB cable but output is 5v, so I used a Raspberry pi 4’s, GPIO’s for power my D1 with 3.3v and GND and the USB cable green/white wire
to RX/TX on Sonoff D1, to my laptop, but no USB device pops up (I have mixed green/white with RX/TX and TX/RX).

When I connect GND/3.3v with my Raspberry pi, the LED is ON and D1 is online in the app.
If I connect GND/3.3v and GND to GPIO0 on D1 at the same time, the LED is OFF and the device is offline in the app.

but still no USB device pops up.

Raspberry pi
I have manually installed esphome on a Raspberry pi 4 here.

I used the same setup as to my laptop but still no pop up device.
In terminal i run esphome run my-d1-dimmer.yaml but I only get an ERROR “error resolving IP address of my-d1-dimmer.local is it connected to wifi?”

What can I do so I can flash my D1 with ESPHome and use the GPIO pins GND/3.3v and pin 14/15 (RX/TX) on my raspberry to flash D1.

To get D1 ready to flash, do I have to put GND to GPIO0 on D1 at the same time I connect GND/3.3v or is it enough to connect GND/3.3v and RX/TX to TX/RX on my raspberry pi?

You need a USB to serial converter to connect to the laptop

I use this:

FTDI FT232RL USB to TTL Serial Converter Adapter Module 5V and 3.3V For Arduino

Keep Gpio0 at ground while you plug the usb plug into the pi.

Then run the dmesg command on the pi and it will tell you what device node is detected by the kernel. It will probably be /dev/ttyUSB0

Thank you for your replay
your USB to TTL adapter, will it just drop down the power from 5v to 3.3v or does it do something else?

Set the jumper on the USB-serial adapter to 3V3 and it can power the ESP from the USB port.
This is pretty much the same process as Tasmota, ESPhome, etc all use - Google Is Your Friend!

Example use of a FTDI USB serial from Tasmota (0V, 3V3, TX, RX may be in different places)
https://tasmota.github.io/docs/Getting-Started/

In this model you select the voltage through a jumper, 3.3v or 5v.
It is a kind of translator, the esp8266 uses serial communication, the USB does not. Or something like that, I don’t know the details.

Thank you!
When I just use 3.3v and GND my D1 boots up and the LED is fixed blue. In my app it is online.

When I connect gpio0 to GND will my D1 not boot up and then LED is off. In my app, it is offline.

Both methods, I run dmesg, no USB device.

I get this error “usb 1-1: Failed to suspend device, error -71” when I boot up with just 3.3v and GND

(I’m running ubuntu on my laptop)

Unless your laptop has a seral output, you need the adapter.
It doesn’t matter if you use windows or linux

Or you can try this:

I would buy the adapter

No schematic or connection diagram, and everyone is just guessing.

  1. Do you have an FTDI adapter?
  2. No? Stop here and get one.
  3. Yes? Don’t connect the Sonoff yet.
  4. Plug the FTDI into the computer USB port and it will present when you run dmesg.
  5. If you don’t see the FTDI on a USB port then plug the FTDI into another computer and repeat step 4. If you still don’t see it, you probably have a dead FTDI or the wrong device driver.

Now you are ready to connect the Sonoff board.

I got my TTL adapter and after a few hours of boxing with HA

When I connected the TTL to my computer, I got this error.

I connected my TTL directly to HA, I got my D1 dimmer updated. I used this script Sonoff D1 dimmer

I got an IP number.
I find my dimmer in my router
I had to add device, under integration with my ip number/key (it didn’t auto detect).
I can control my D1 dimmer with HA.

But

Under ESPhome menu, my devices are offline. I can’t update because no connection to internet.

I have reboot my HA but still no luck…

How can I get them online?

I read that esphome is running in docker in HA. I saw that somewhere that docker ip is 172.x.x.x. and not 10.x.x.x which I have.

I moved my D1 dimmer from my Vlan to my mainlan, there HA is.
and now they are online.

I had still do this via HA and not via my computer but they are up and running.