Flashing device to ESPHome and wifi failing to connect

Hi all,

I'm trying to flash the ESP chip on my EV charger so that I can get local control... I got it for free with the purchase of a car and it supports Smarts overseas but the ones supplied OEM have been altered.

I tried to intercept the web-socket first, made some progress, but after spending quite a bit of time hit a dead end and it seemed it would be easier to flash to ESPHome.

Now though I'm trying to get the basics down, and failing to get a wifi connection.

It's a Geely branded Jueclat charger (manufactured by Lotus Flash Charge under the Geely umbrella corps)

The chip is an ESP8684-WROOM-02C

Connecting via command line replies:

Connected to ESP32-C2 on COM5:
Chip type: ESP8684H (revision v1.2)
Features: Wi-Fi, BT 5 (LE), Single Core, 120MHz, Embedded Flash 4MB (GD)
Crystal frequency: 26MHz

I've cut down to basics just to try to isolate for wifi failures as that's where I'm getting hung up atm.

esphome:
  name: jueclat-ev-charger
  friendly_name: EV Charger

esp32:
  board: esp32-c2-devkitm-1
  variant: esp32c2

  framework:
    type: esp-idf
    version: recommended

wifi:
  ssid: "MYSSID"
  password: "Password"

logger:
  level: DEBUG
  baud_rate: 115200

ota:
  - platform: esphome
[V][wifi_esp32:819]: Scan done: status=0 number=0 scan_id=128    
[W][wifi:1444]: No networks found      
[D][wifi:1838]: Retry phase: INITIAL_CONNECT → SCAN_CONNECTING  
[D][wifi:1289]: Starting scan  
[V][wifi_esp32:819]: Scan done: status=0 number=0 scan_id=129  
[W][wifi:1444]: No networks found  
[D][wifi:1838]: Retry phase: SCAN_CONNECTING → RETRY_HIDDEN   
[D][wifi:561]: Hidden candidate 'MYSSID' at index 0 
[I][wifi:1088]: Connecting to 'MYSSID' (any) (priority 0, attempt 1/1 in phase RETRY_HIDDEN)...
[V][wifi:1094]: Connection Params: SSID: 'MYSSID'
[V][wifi:1101]:   BSSID: Not Set
[V][wifi:1138]:   Channel not set
[V][wifi:1155]:   Using DHCP IP
[V][wifi:1157]:   Hidden: NO  
[W][wifi_esp32:772]: Disconnected ssid='MYSSID' reason='Probe Request Unsuccessful'
[W][wifi:1659]: Connecting to network failed (callback)
[D][wifi:1838]: Retry phase : RETRY_HIDDEN → RESTARTING 
[W][wifi:722]: Restarting adapter
[V][wifi_esp32:227]: Disabling STA
[V][wifi_esp32:740]: STA stop
[W][wifi:1670]: Network no longer found
[D][wifi:1838]: Retry phase: RESTARTING → SCAN_CONNECTING
[D][wifi:12 89]: Starting scan
~REPEAT~

If I reinstall the original firmware, I can connect immediately to my wifi, so I'd say that that rules out anything hardware/physical and makes it purely software. I missed that compiling my yaml wasnt creating a bootloader which I got stuck at for a while and have used the original bootloader and partitians bin files from the oem. Could there be something in there, or something wifi related that I'm missing?

I'm really just a hobbyist with only a basic understanding and this has thrown me for a few days now.

I didn't find a pre-defined solution for your charger. What are you planning on using once you solve the current problem?

EV chargers are really not things to be messed with when one has little to no knowledge of how they work and what they do.

Getting back to your problem of Wi-Fi, what is your network?

The log indicates it didn't see any networks. Is your router/AP broadcasting the SSID?

The log then says it tried connecting anyway, but was not successful (since it got no response).

It looks like this project is going to be much harder than you originally imagined. If you want to figure out esphome, do that with an esp32 dev board. They are fairly cheap. You can then get some experience using esphome.

It might have the same Wi-Fi issue, since many people solved their similar issues by getting a new/different board.

To run esphome (and do anything remotely useful) on your charger, you are going to need to find out what the current FW does and what each connected pin is for. I was unable to find a schematic or anyone who has documented any reverse engineering they have done on that charger. That means the learning curve is very steep. It doesn't look like the firmware is trivial.

1 Like

Have you tried

captive_portal:

I don't understand the error in that if I roll back to the oem firmware the connection is immediate to my network. Without changing any settings. signal strength, router settings, everything - the same chip connects to the same router from the same physical location - which is why I'm wondering whether there is something I'm missing in compiling the ESPHome FW.

I already have a few ESP projects using C3/C6 chips which is why I felt somewhat comfortable to attempt it with this product. I honestly thought I could just flash it and get started. I didn't expect to get hung up here.

Typo in ssid?

I would love it to be the case.

On the connection though the wifi scan isn't even finding anything?

There are a lot of settings in the firmware. esphome might be settings up in a way that doesn't work with the hardware you have. They might not have a standard configuration for the antenna and perhaps some GPIO needs to be set to get it to work. I don't know why they would do that, but that is one possiblity.

Another possibility is that you have the SSID spelled incorrectly.

You didn't answer the question about if your AP broadcasts the SSID. For some reason people still think this is a good idea. Most people who know much about security will tell you there is NO reason to NOT broadcast it. It also makes troubleshooting Wi-Fi issues easier. Do use strong security, but hiding the SSID is not that.

If you are broadcasting the SSID, the log indicates the esp32 is not seeing it. That is a classic (lack of) signal problem. Since the factory FW can, that means it is doing some magic that you don't know and will need to figure out before you can continue.

1 Like

[I][wifi:820]: Starting fallback AP
[C][wifi:947]: Setting up AP: AP SSID: 'EV Charger' AP Password: 'admin1234' IP Address: 192.168.4.1
[W][component:520]: wifi took a long time for an operation (165 ms), max is 30 ms
[W][wifi:1444]: No networks found

Not sure if that is the failed message specifically to the captive portal. But it's definitely not broadcasting an AP

The SSID I'm trying to connect to was hidden but that was one of my first changes in troubleshooting.

The chip is one of the antenna integrated... Pretty sure it's exactly this one...

Sigh why cant things ever just be simple :smiley:

A strong word of caution.
You are flashing the controller chip for a device that switches kilowatts (thousands of watts) of power, and having fundamental problems with connecting to WiFi?

I'd suggest you are deeply out of your depth.

What if the startup process of the vendor firmware places switching circuitry in a safe position that your slowly evolving code has not got to yet?

I see lots of smoke in your future, unless you get detailed source code support from the Chinese vendor, or try again with snooping on traffic instead of reinventing the charger, a process probably done by many engineers, and refined by lots of changes, cups of coffee, and release of lots of smoke.

At best you may blow a fuse. At worst you may destroy your vehicle and BMS and set fire to your house.

Maybe get a spare ESP8684 and check your code on that before flashing it on your charger and risking so much?

You mentioned the OEM software has been customised. By whom? You may get some ideas from them if they release their source code, or even their API documentation. Of course, be prepared for it to be in Chinese.

Please check in from time to time with progress, as I will worry you have eliminated the problem by kinetic/thermal means if you do not do so.

2 Likes

There is an Arduino‑IDE ESP32 example sketch (WiFiScan) that scans and lists every Wi‑Fi network the chip can see. WiFiScan comes bundled with the ESP32 Arduino core.

An L2 EVSE draws about 14A and is no more risk than switching on your fan with a Shelly.

Yes, and how many watts is 14AMPS (and up) in your neck of the woods, at 110V, 250V, or even three phase at 400 odd volts?
Your Shelly is toast if you are using one rated for fan operations.
Please brush up on Ohms law before you kill yourself.

A fan is generally no more than a few hundred watts. It can also generally take that power forever.

An EVSE is responsible for safety and communication (probably so the BMS doesn't try to draw more power than can safely flow through the system).

From the docs for the actual device in question:

Residual Current Device (RCD)
The charger includes built-in DC leakage detection (6 mA). However, an external residual current device (RCD) is still required upstream. The RCD should be Type B or Type A with the following ratings:

  • 7kW/22kW: 40 A

There is another one that is lower current but operates at 400V.

There are strict requirements for what the firmware must do to safely charge a EV. You might be able to find those by searching here https://www.openevse.com/

You can pay to access the standard here: https://saemobilus.sae.org/standards/j1772_202401-sae-electric-vehicle-plug-hybrid-electric-vehicle-conductive-charge-coupler

High current at high voltage is much less forgiving of even slight errors. It is possible the BMS in the vehicle will help keep things safe, but I haven't read the spec to know for sure. I wouldn't risk my EV or domicile for this project give the very little information available. I would consider getting an openevse, since you should be able to get all the info you want from it.

There is talk of no longer allowing plug in chargers, since there have been fires from cheap sockets and poor installation. This project seems like it could encounter a similar fate.

1 Like

Can we brush up on Darwin's Law too? A potential candidate...

Especially since the charger is under the hood of the car.

Stick to the original question and stop pontificating about EVSE safety. The EVSE standards are there to protect the car and moron users from themselves. They are little more than fancy extension cords with built-in GFCI and overcurrent protection. Some also have a processor inside for WiFi connection to monitor charge level and possibly control the start/stop charging cycle for users who have time-of-use billing from their electric provider.

The original question was about flashing an ESP device.

Isn't that what the Internet is for? :wink:

Might not be the answer but according to the documentation the SSID and Password should be without the quote marks. Most people put them in their secrets file but worth a try.

No, it has to be if sent as a string of characters. Even if you use a secrets file. Question: Is HA instance and the ESPHome devices all on the same subnet IP address range and maybe vLAN? HA likes everything on the same IP range and SSID