Add option to CLI "esphome run/logs" to keep serial port open when ESP32 goes into deep_sleep #3259
Replies: 3 comments 2 replies
-
It's not esphome closing the serial port. The serial port goes away when the ESP you're using goes to sleep. It depends on which type of ESP you have and which USB port you're using. You need to use the UART or COM port instead of the USB port if the board has two USB ports. |
Beta Was this translation helpful? Give feedback.
-
Ahhh... I have certainly noticed on my ubuntu linux system that there is no USB port until it is active - I can't start minicom until after the ESP has booted :-( Similarly that I can't use my PC's USB TX/RX/GND if powering the ESP32 from a different 5V source. Minicom does pop up a "Cannot open /dev/ttyACM0!" window while the ESP32 is asleep ... but it resumes when the ESP32 wakes. It sounds like this is some fancy programming to re-open the port when/if it becomes available again ? Currently I'm testing with an ESP32-S3-mini, so only one USB socket. |
Beta Was this translation helpful? Give feedback.
-
Yes, it seems that minicom has missed my on_boot: debug logging :-( Not very helpful :-( I think I got one of those USB UART thingies for my Raspberry Pi v1, back in the day. Maybe I should try that. More to the point, if it's linux removing the USB device when ESP32 goes to sleep - that's out of ESPHome's control ... so thanks for taking the time to explain. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe your core improvement
I am hoping that it would be fairly easy to add a command line option to keep the log open, until I press ^C.
Current limitations
Debugging YAML code in the on-shutdown and on_boot routines requires use of USB connection from my desktop PC, for which I can use
sudo minicom -D /dev/ttyACM0
. Minicom remains running while the ESP32 is asleep, and just resumes the log when ESP32 wakes up.However Wi-fi at my workbench is poor quality, so I have to use ESPHome's upload via USB feature. The linux CLI
esphome run
andesphome logs
commands work fine to upload and display the logs ... but they close the serial port whenever the ESP32 goes into deep-sleep (ie powers off). Thus I loose the next power on / on_boot: sequence.I currently have to use esphome run to upload the YAML code and check it started OK; then swap to minicom (which doesn't have the nice colour highlighting) to view the debug log.
Technical benefits
Nothing major ... just make it a bit easier for esphome to debug the periods before wi-fi is connected, and after wi-fi is disconnected - particularly relevant for deep_sleep
Additional context
No response
Beta Was this translation helpful? Give feedback.
All reactions