HomeSpan icon indicating copy to clipboard operation
HomeSpan copied to clipboard

Homespan.poll(); gets stuck without Serial communication

Open arnaudonate opened this issue 2 years ago • 2 comments

Hello, I have a esp32 on a custom PCB which integrates some indoor air quality sensors. I'm using it as a standalone, meaning that is powered from a wall plug directly through a microUSB, so not connected to my computer. When I execute a Homespan code on the device and it is connected to my laptop through the Serial it works well, I can see the values on Serial and Apple Home, but if I power it from the wall plug it gets stuck.

I've tried several codes, even the ones from the example in the library, and including some light feedback I've seen the device connects well to the wi-fi and setup is ok, but it gets stuck during the homespan.poll(); and is unable to continue (thus not sending data to Apple Home.

I've tried several different power sources, as well as batteries, but the effect is the same. As I have a custom PCB I use a USB Serial Adapter, so I have four pins between the PCB and the PC, two for power (GND and 5V) and two for communication (Rx and Tx). When the device is connected to the PC and working well it gets stuck if I just disconnect the two serial cables but keep the power, something that doesn't happen with other codes.

My assumption is that at some point in the code it waits for a response from Serial, a serial.begin or something like that, but I am no expert and couldn't figure it out how to modify the code so it works as a standalone. I hope you have a better idea of what could it be, thank you so much in advance for your time.

Arnau.

arnaudonate avatar Jul 26 '22 14:07 arnaudonate

See #131 for a discussion of this issue and a few different solutions.

HomeSpan avatar Jul 26 '22 14:07 HomeSpan

I missed that entry, thank you so much for your quick reply. Really appreciate the time you put into this, it's a great library.

arnaudonate avatar Jul 26 '22 15:07 arnaudonate