Closed jpasqua closed 2 years ago
Were you able to resolve this? Connection issues like this are unfortunately very difficult to debug since the symptom is usually that the iPhone (or iMac, etc.) appears not to be trying to connect to HomeSpan at all, as opposed to HomeSpan failing upon receiving a connection.
Others with this type of issue have reported various solutions that usually involve settings on their router, or an update to their router logic. This includes router configurations to ensure cross-communication between 2.4GHz and 5GHz bands (if you have a dual-band router) since the ESP32 operates on 2.4GHz only, and the iPhone can operate on both. Do you have any other commercial HomeKit devices?
Also, can you also try one of the other examples (such as the lightbulb). Stateless Programmable Switches are unique services since there are no controls on the iPhone to operate the devices. It's the device that triggers operations in HomeKit (this may require having an Apple device that can be used as a HomeKit Hub).
Hey, I have the same problem - after work for some time - "The device does not answer" - in the Home application. I do not know if it can somehow save logs? My device works without connecting to USB. I can not deal with it, the code is not complicated. Other original devices do not have these problems
Can you try the following test. When the device is no longer responding, open your browser and try to connect. You should be able to simple enter the full name of the host (with the .local suffix) reported in the Serial Monitor when the device first connects to WiFi. If you've not changed any of the defaults, the host name should look something like this: HomeSpan-83BA5A1FFBA0.local:80, where the 6-byte code is randomly generated and will be specific to your device.
If the browser can connect it should immediately return with a blank page. If the device is also connected via USB and you set the log level to L2 in the Serial Monitor you should be able to see the connection attempt, along with an error message indicating the URL was not found (which is fine - we are only testing the availability of a connection)
If the browser can't connect, the browser should hang while waiting for a connection, though may time-out after some period of time (maybe a minute or more). Also. the Serial monitor will not show any activity since HomeSpan will not have received an inbound connection.
If a connection is possible with the browser even though the Home App won't connect, this indicates there is a problem specific to the interaction between HomeSpan and the Home App. If a connection cannot be made with the browser, then the issue is not necessarily HomeKit-related, but is more a general WiFi/connectivity issue.
I think I may have stumbled onto the potential issue. Some of my devices occasionally drop out, but always come back after 30 seconds or so. Recently, I noticed that when one drops out, others do as well. This is rather odd since the devices are all running different versions of the software and were started at different times.
The common cause seems to MDNS broadcasting. When I see a device drop out, I can still connect to it via the web using its IP address (per above). But it does not appear in a discovery of MDNS broadcast which HomeKit requires. In other words, if the Home App does not see an MDNS broadcast, it does not even try to connect the device. Since HomeKit uses a variety of custom tags in the MDNS broadcast, this is not simply a matter of resolving the hostname - all the MDNS tags need to be broadcast for HomeKit to operate.
The fact that multi devices drop out for brief periods at the same time suggests that my router is either not caching the MDNS info correctly, or it is blocking new MDNS requests, or something like that. Also, all devices seems to come back on line together after 30 seconds (MDNS broadcasts all start working again).
Some Googling shows this is not an uncommon issue - others have reported similar behavior with MDNS that is unrelated to HomeKit. I will continue researching to see if there is a solution.
Sorry for the late response - for some reason I didn’t get a notification that there were responses to the issue. I will check the mdns vs. direct IP connection later today and report back. Thank you for investigating.
UPDATE: Of course now I can't get it to fail! It has been running since yesterday and when I tried connecting to it again this morning, it was still visible. Needless to say, I can also connect via the web. It's not immediately obvious to me that there is anything different in my network. I will continue to investigate.
a little pity that we have such a problem - I wanted to do with this library a controller for underfloor heating but in this case I have to pause :(
@jpasqua, sorry for not noticing this before, but according to the log file you posted, though you are using the latest version of HomeSpan (1.4.2), you have a very outdated version of the Arduino-ESP32 board manager (1.0.5-rc4). The latest version is 2.0.2 and there have been a number of improvements related to connectivity (including MDNS). You may want to update to the latest version of the board manager and see if that helps address some of the connectivity issues.
@homespan, I am planning to do so, but once I cut over to the newer version i have a lot of retesting of other projects to do to ensure that nothing breaks. As a result I've been procrastinating, but I will do it this week.
OK, it stopped responding again today and as you requested, I tried hitting the web interface directly. It did respond to that as you can see below. I checked status, hit web interface, and then checked status again twice.
I will upgrade to ESP32 v2.0.2 and try again. However, given that it is intermittent I may not be able to report back with any clarity for a while (unless it drops right away).
*** HomeSpan Status ***
IP Address: 192.168.1.122
Accessory ID: 02:4F:69:91:59:C2 LTPK: 28BE7F68DACC96DB4AE828ECA8308E29E3F36EE5221D216305DF9F06D4ACCBB4
Paired Controller: 2E198672-45E8-4CFA-83BD-73D0E3353799 (admin) LTPK: DF1327319731F9DB2EF2E6CB42EB867D83A8BF7041AB334F7C4521502CF44C2A
Connection #0 (unconnected)
Connection #1 (unconnected)
Connection #2 (unconnected)
Connection #3 (unconnected)
Connection #4 (unconnected)
Connection #5 (unconnected)
Connection #6 (unconnected)
Connection #7 (unconnected)
*** End Status ***
*** ERROR: Bad GET request - URL not found
*** HomeSpan Status ***
IP Address: 192.168.1.122
Accessory ID: 02:4F:69:91:59:C2 LTPK: 28BE7F68DACC96DB4AE828ECA8308E29E3F36EE5221D216305DF9F06D4ACCBB4
Paired Controller: 2E198672-45E8-4CFA-83BD-73D0E3353799 (admin) LTPK: DF1327319731F9DB2EF2E6CB42EB867D83A8BF7041AB334F7C4521502CF44C2A
Connection #0 (unconnected)
Connection #1 (unconnected)
Connection #2 (unconnected)
Connection #3 (unconnected)
Connection #4 (unconnected)
Connection #5 (unconnected)
Connection #6 (unconnected)
Connection #7 (unconnected)
*** End Status ***
*** HomeSpan Status ***
IP Address: 192.168.1.122
Accessory ID: 02:4F:69:91:59:C2 LTPK: 28BE7F68DACC96DB4AE828ECA8308E29E3F36EE5221D216305DF9F06D4ACCBB4
Paired Controller: 2E198672-45E8-4CFA-83BD-73D0E3353799 (admin) LTPK: DF1327319731F9DB2EF2E6CB42EB867D83A8BF7041AB334F7C4521502CF44C2A
Connection #0 (unconnected)
Connection #1 (unconnected)
Connection #2 (unconnected)
Connection #3 (unconnected)
Connection #4 (unconnected)
Connection #5 (unconnected)
Connection #6 (unconnected)
Connection #7 (unconnected)
*** End Status ***
I've been running on version ESP32 v2.0.2 for a bit over a day now and it is still responding. I will update the status again after another 24 hours.
Thanks - that's good news (at least for now).
In my case, it seems that after upgrading to Arduino-ESP Ver .: 2.0.2 the problem has been resolved. Throughout the day, the connection has not been broken
Update 2: After another 18 hours the device is still connected. I will update the status again tomorrow and if everything looks good, I'll close the issue.
In the mean time I'll get a simple PCB ready for fab.
After another 26 hours my unit is still online, so I'm going to close this issue.
hey @jpasqua how did you update Arduino-ESP Ver ? Are you using platformIO on VS code by any chance?
My Serial output:
Message Logs: Level 0
Status LED: Pin - *** WARNING: Status LED Pin is UNDEFINED
Device Control: Pin - *** WARNING: Device Control Pin is UNDEFINED
Sketch Version: n/a
HomeSpan Version: 1.5.0
Arduino-ESP Ver.: 1.0.6
ESP-IDF Version: 3.3.5
ESP32 Chip: ESP32-D0WDQ6 Rev 1 dual-core 4MB Flash
ESP32 Board: doitESP32devkitV1
PWM Resources: 16 channels, 8 timers, max 20-bit duty resolution
Sodium Version: 1.0.12-idf Lib 9.4
MbedTLS Version: mbed TLS 2.16.7
Sketch Compiled: Mar 4 2022 10:08:43
its outdated but I'm not sure how to update it. This is the Espressif32 plaftorm installed framework-arduinoespressif32
version:
it looks like platform IO hasn't updated arduino-esp32
aka:
framework-arduinoespressif32 | framework | | ~3.10006.0 | 3.10006.210326 (1.0.6) https://registry.platformio.org/tools/platformio/framework-arduinoespressif32/versions
to the latest version updated december 2021:
https://github.com/espressif/arduino-esp32
EDIT (SOLUTION):
Leaving a link to this issue here in case anyone comes looking:
https://github.com/platformio/platform-espressif32/issues/619
An easy way to update arduino-esp32 is adding a platform_package
like so on the configuration file in case you're using platformIO:
platform = espressif32
platform_packages =
framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#2.0.2
First of all, this library looks great and I really appreciate your efforts on it.
I've just started using the library and I am having problems that are very similar to those described in #22, but that issue is closed and I don't see a resolution.
I am using example 16 (Stateless Programmable Switches) with no modification. Hardware is an ESP32 D1 Mini. It boots, connects and works properly for a while, but eventually I see "No Response" from both the iPhone (iPhone 11 Pro Max, iOS 15.1) and Mac (27" iMac running Monterey).
I have appended an annotated log below in which I query status (s command) with various combinations of the Home app running/not running on the iPhone and Mac. Search for "[[ " to see my comments.