I added BLE to my second device, and it looks like that broke it that one I flashed using serial with ESPFlasher. Let’s hope I can restore it using serial.
Sadly it looks dead, can’t flash it or get the logs from it
Edit: After checking all my connections and trying again, its alive, but I don’t dare flash it with BT again.
Looks like I’m giving up on this one. I managed to get it open, there was a screw that could be removed and then it was easily opened so I do not seem to have the newest unopenable version at least.
Got it hooked up via USB-TTL (CP2102) and using minicom I get the following output over and over again:
ELF file SHA256: c7decda0617db6a0
Rebooting...
ets Jul 29 2019 12:21:46
rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 188777542, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:7076
load:0x40078000,len:15584
ho 0 tail 12 room 4
load:0x40080400,len:4
load:0x40080404,len:3876
entry 0x4008064c
I (31) boot: ESP-IDF 5.1.1 2nd stage bootloader
I (31) boot: compile time Dec 5 2023 23:57:40
I (32) boot: Multicore bootloader
I (36) boot: chip revision: v3.0
I (40) boot.esp32: SPI Speed : 40MHz
I (44) boot.esp32: SPI Mode : DIO
I (49) boot.esp32: SPI Flash Size : 4MB
I (53) boot: Enabling RNG early entropy source...
I (59) boot: Partition Table:
I (62) boot: ## Label Usage Type ST Offset Length
I (70) boot: 0 otadata OTA data 01 00 00009000 00002000
I (77) boot: 1 phy_init RF data 01 01 0000b000 00001000
I (85) boot: 2 app0 OTA app 00 10 00010000 001c0000
I (92) boot: 3 app1 OTA app 00 11 001d0000 001c0000
I (100) boot: 4 nvs WiFi data 01 02 00390000 0006d000
I (107) boot: End of partition table
I (112) esp_image: segment 0: paddr=001d0020 vaddr=3f400020 size=33468h (210024p
I (196) esp_image: segment 1: paddr=00203490 vaddr=3ffb0000 size=04c1ch ( 19484d
I (204) esp_image: segment 2: paddr=002080b4 vaddr=40080000 size=07f64h ( 32612d
I (218) esp_image: segment 3: paddr=00210020 vaddr=400d0020 size=f2bd4h (994260p
I (577) esp_image: segment 4: paddr=00302bfc vaddr=40087f64 size=15a04h ( 88580d
I (629) boot: Loaded app from partition at offset 0x1d0000
I (629) boot: Disabling RNG early entropy source...
I (640) cpu_start: Pro cpu up.
I (641) cpu_start: Starting app cpu, entry point is 0x4008288c
I (625) cpu_start: App cpu up.
I (657) cpu_start: Pro cpu start user code
I (657) cpu_start: cpu freq: 160000000
I (657) cpu_start: Application information:
I (662) cpu_start: Project name: shelly-esphome-frysen
I (668) cpu_start: App version: 2023.11.6
I (673) cpu_start: Compile time: Dec 6 2023 16:22:48
I (679) cpu_start: ELF file SHA256: c7decda0617db6a0...
I (685) cpu_start: ESP-IDF: 4.4.5
I (690) cpu_start: Min chip rev: v0.0
I (694) cpu_start: Max chip rev: v3.99
I (699) cpu_start: Chip rev: v3.0
assert failed: s_prepare_reserved_regions memory_layout_utils.c:100 (reserved[i)
Backtrace: 0x400831da:0x3ffe3390 0x40091d41:0x3ffe33b0 0x40097dd1:0x3ffe33d0 0xD
and it just keeps going and going. Shorting GPI0 gives varying results. Sometimes I do get into “download mode” but any flashing attempt (using esphome CLI) errors out with “A fatal error occurred: Failed to connect to ESP32: No serial data received.” or “A fatal error occurred: Failed to connect to ESP32: Invalid head of packet (0xFF): Possible serial noise or corruption.”
At some point I managed to get it to upload like 5 % but then it errored out.
Weird thing is that using minicom I can keep it running for a long time without any issues at all so I am recieving data in normal boot mode (as far a it gets anyway).
I’ve tried various baud settings but no go.
If anyone wants me to pack it up in an envelope and send it somewhere for further study, please let me know.
Would you mind checking if you plugs are the v1 or v2 version? I beleve the v1 has a philips screw in the earthpin hole in the bottom, v2 seems to be sealed with no screw.
I’m going to give mine one last chance of life. I’m going to head over to Kjell and get some real breadboard cables, maybe even some cables to solder if it keeps giving me problems.
I’m probably going to give it a try on a Windows machine if my Ubuntu machine keeps failing (just to be on the safe side).
I’m looking at getting some real breadboard cables.
What are you using for grounding GPI0? I used a needle connected to ground and watched what happened in minicom as I did so.
Could you give some hints on what other equipment you have that you’re using?
And if you find the energy a step by step of your procedure so I can mimic it as much as possible.
Just to be clear, GPIO0 needs to be grounded while you reset it. Just connecting it to ground while it’s running won’t do anything. You can then leave it grounded while flashing or release it, it doesn’t matter.
Here’s what I do:
Run esphome run foo.yaml. Watch it fail to connect, then take a copy of the esptool command line that it gives you, and replace the --before option with --before no_reset
Connect up the USB adapter with GPIO0 grounded.
Start minicom/miniterm
Disconnect and re-connect 3.3V
Download mode banner should appear in minicom.
Disconnect minicom
Run the modified esptool command from step 1.
It doesn’t look like that USB adapter can auto reset the device, which is why you need to reset it yourself, and then use the no_reset option.
On the high temperature topic. I’ve now checked my plug with stock fw and it’s still at aprox 60c with no load. Very strage that you get so much lover temps.
Shelly states that 55-60c should be normal and 95c is the thermal protection limit
Silly question, but are we definitely talking about the same temperature sensor? 60°C sounds about right for the ESP32’s internal temperature sensor, whereas the plug also has a separate NTC which I’d expect to be reading much closer to room temperature. The NTC is probably a good measure of the air temperature inside the plug, so if it’s really at at 60°C I’d expect the plug to feel very hot to the touch.
My Shelly Plus UK is currently reading 60.3°C chip temperature, and 23.7°C NTC.
After a bit (hours…) of back and forth, changing cables, tweaking the setup etc. I got it working. It’s alive!
My main mistake the other day was thinking that which ground to touch during boot would not matter. Now that I have some more cables I could test a bit more and bridged GPIO0 with the correct ground.
Moreover minicom did not display anything after I managed to get it into flash/download mode. So I took a chance in ESPHome and it worked (using the modification you mentioned). Flashed with the alternative script first, everything lit up and minicom actually did output real data luckily. The log feedback in esphome did not give anything though but after a reboot minicom displayed output.
I then did flash it again using the regular esphome command without issues. And then once again using OTA for good measure. All successful!
Thanks again for the pointers and making me rethink some of the assumptions I made.
~~I added this conf on my last flash. The Shelly reports that Bluetooth proxy is active when I check logs using ESPHome in HA.
However HA does not pick up any BT proxies. Did you have to do any extra configuration for it to be picked up as a proxy?~~
Nvm… I misunderstood how it works. Was expecting a BT Proxy device to appear in HA. But it just works. Tested with my (very few) Plejd devices that are BT-controlled and it picked them up and was able to control the ones in range as well.
Not a silly question and I doublechecked if I have been chasing the wrong sensor, but from what I can tell it’s the NTC.
If running the default esphome config for the plug (Shelly Plus Plug S | devices.esphome.io) an from what I can tell it the NTC termisistor on GPIO33 the puts out the value.
I flashed one of my plugs back to stock fw and ran the status command (http://x.x.x.x/rpc/Shelly.GetStatus) and it still outputs a high temp when idle:
I guess the next question is whether it’s really running at 60°C or if there’s a problem with the sensor/configuration. Is it hot if you touch the case of the plug? If you turn it off for an hour or so, what temperature does it read immediately after turning it back on?
Not sure if you’ve got a plug that can be easily opened, but if so I’d try and find the NTC and check its resistance at room temperature, and also the resistance of the other resistor in the divider.
Also, might be interesting to know what the ESP32 temperature is. Just add:
Temperature can be also higher if power consumption is big. Device measures AC current through a shunt resistor and when currents are big it can become warm/hot.
But, as said above, esphome by default has no wifi saving enabled (always runs at max), thus bigger temperature, which can be changed. I’d guess that original shelly do have some sort of wifi management…
Compiling .pioenvs/shelly-plus-plug-s-3/src/main.o
Linking .pioenvs/shelly-plus-plug-s-3/firmware.elf
.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pioenvs/shelly-plus-plug-s-3/src/main.o:(.literal._Z5setupv+0x2c0): undefined reference to `vtable for esphome::internal_temperature::InternalTemperatureSensor'
.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pioenvs/shelly-plus-plug-s-3/src/main.o:(.literal._Z5setupv+0x2c4): undefined reference to `vtable for esphome::internal_temperature::InternalTemperatureSensor'
collect2: error: ld returned 1 exit status
Edit: Now I am trying to compile dev branch (it compiled succesfully), but I am getting:
Failed config
ota: [source <unicode string>:34]
password: my_ota_password
[unprotected_writes] is an invalid option for [ota]. Please check the indentation.
unprotected_writes: True
IIRC unprotected_writes was needed (there is info in this thread). I now commented it out and it compiled successfully, but will I be able to use OTA in the future after I flash this build?
I think the link error probably just needed the build files cleaning.
I am pretty certain that unprotected_writes is only needed to do the repartitioning when you first switch to esphome. Once that’s done, it’s no longer needed.