Yurik72 / ESPHap

ESP32/ESP8266 Arduino library for native Apple Homekit Accessory Protocol (HAP)
MIT License
265 stars 60 forks source link

Accessory 'No Response' #52

Open karl-fischer opened 3 years ago

karl-fischer commented 3 years ago

Hello :)

I am using the EspHapSwitch example. I have set the ssid and password to match my network. #define ENABLE_WIFIMANAGER is commented out.

I have successfully connected the ESP to my home WiFi and paried the switch accessory with the Home app on my iPhone.

The iPad is set to act as a Home Hub, with the intention that I will be able to access the accessories while I am away from home. The iPad will stay in the home even when I sell it, so the iPad has its own iTunes/iCloud account, which is logged in, and this is different to the iTunes/iCloud account on my iPhoneX. To get the accessories on my iPhoneX, I sent a guest invite from Home on the iPad to the iPhoneX. The guest access is configured such that guests are permitted to modify/add/remove accessories and can access while away from the home.

When I turn off WiFi on my iPhoneX, to simulate being away from home, and then place my iPhoneX on the desk with the Home app open, the switch accessory continues to show healthy for some minutes, but then shows No Response in the Home app. Note, I haven't pressed the button, just left the Home app open on the Home or Garage room. I'm looking at my iPhoneX and it's saying it right now. It shows an exclamation mark on the accessory in the Home app, and has the state ("Off") in red text. It also says, "Test Switch No Response" (I named the accessory Test Switch when I added it to the Home app.

If I minimise the Home app on my iPhoneX and then open it again, the Test Switch state changes to "Updating" and then after a few seconds, shows "Off", which is the correct status and the "No Response" message goes away.

The iPad is plugged in to power, but the screen has gone to sleep (I don't want to leave the iPad screen on 24/7 with no sleep).

I am not sure how to proceed to make it reliably stay available in the Home app, without it changing to "No Response". Are you able to help with this please? I am keen to do whatever debugging can help with the investigation :)

After some testing like this, I have changed the iPad iTunes/iCloud account, to use the same one on both the iPhoneX and iPad and re-added the accessory. Now the accessory in the iPhoneX (with WiFi turned off) seems to be working better, I have left the phone on and with the Home app open on the iPhoneX for 15 minutes and it has not come up with "no response" yet.

Could it be related to accessing the accessories as an invited guest and different iTunes/iCloud accounts? Or is there something else we can investigate?

Details:

Network equipment which may appear in the mDNS logs:

Thank you :)

Yurik72 commented 3 years ago

Hello :) Thanks for interesting of this project. Last few days I'm working on library stability, therefore version v1.07 is recomended. However theare are big improvement on this library.

  1. Take the latest version (just latest commit not labeled yet) , you can see #41 discussion and the latest acvievemt, I have met such behaviour and there are two things done, which really improves and I can't reproduce this more.
  2. Take a look #49, based on your setting you should compile with option v2 Higher Bandwidth , instead v2 Lower Memory

If you want to support and improve stability try to reproduce this behaviour again and very helpfull will be a CORE LOG (specially i need mDNS logs) at the moment when device is not responding

Then. In theory when it's stable reproducing you can try MDNS.announce() for instance every 5-10 sec in the loop. I did't implement this in the core, becasue it will kill network by garbage and I need an optimal way

Will appreciate with the comments or any pull request of sources or readme, to help to other guys, due to the big interest in the last months

Yurik72 commented 3 years ago

see latest commit https://github.com/Yurik72/ESPHap/commit/148660a97d0128aa96dfd76c4849d7af0b9fc9f1

karl-fischer commented 3 years ago

Ok, I continued to do more monitoring with the iPad and iPhoneX on the same iCloud account (iPad on WiFi and iPhoneX not on WiFi) and v1.0.7 of ESPHap. I kept the iPhoneX Home app open and watched the accessory for at least an hour, the accessory worked fine the whole time and did not display the 'No Response' message. So, it seems to work fine when they are both logged in to the same iCloud account.

I then removed the accessory, logged out of iCloud on the iPad, and then logged back in to the iPad using a different iCloud account. This is so the iPad can stay in the house when I sell the house and move out. I invited the iPhoneX to share the home (in Home app), and added the accessory again. After just a couple of minutes, the accessory on the iPhoneX Home app showed, 'No Response'. After a minute or two, the 'No Response' message cleared.

So, now to the testing you requested. I chanaged IwIP Variant from v2 Lower Memory, to v2 Higher Bandwidth, downloaded commit 148660a, compiled and downloaded to the NodeMCU. I also have the iPad and iPhoneX back on the same iCloud account and the accessory is added again. I watched the iPhoneX for a few minutes, and it is showing the 'No Response' message. This is the first time I have seen this message when the iPad and iPhoneX were logged in to the same iCloud account.

So, with 148660a it appears to be showing 'No Response' even when they iPad and iPhoneX are both on the same iCloud account (remember, I always have the iPad on WiFi in the home and the iPhoneX WiFi is turned off to simulate it being away and trying to control the accessories remotely). It has showed 'No Response' twice now, in the past 5 minutes. However, as I continue to monitor the iPhoneX, the accessory is staying healthy for the past several minutes. Oh no wait, it has gone 'No Response' again.

I'd like to get the logs you need, but I don't know how. What is a CORE LOG and how do I get it and the mDNS logs for you?

Karl :)

Yurik72 commented 3 years ago

Ok, thanks for investigation i will back some TCP option, you can see changes in the commit. CORE Log you can produce if you select Option on your Arduino: Debug Port : Serial Debug Level: CORE+WIFI+.....

karl-fischer commented 3 years ago

Ok, in the Arduino IDE, I have set:

I unpaired the accessory, redownloaded the code with these new settings, paired it with my iPhoneX while the iPhoneX and iPad were both on WiFi. Then once paired, I turned off WiFi on the iPhoneX and watched the accessory in the Home app on the iPhoneX.

Approximate timeline. Please note, the times may be out by several seconds, I tried to write it down as best I could. Also, the amount of text which remains in the COM3 monitor window is limited and it cut of some of the early text, so I copy-pasted the entire text from the COM3 monitor window in to Notepad and saved it each time.

3x debug logs attached.

Karl :)

debug log 1.txt debug log 2.txt debug log 3.txt

eford321 commented 3 years ago

I have tested and found this issue get worse from 148660a. @karl-fischer can you try running e59cab2 to see if helps you?

I have been trying different timer settings, but am still getting disconnects. It is acting like the socket keepalive isn't actually enabled. Looking to find a good place to test with iskeepaliveenabled option. @Yurik72 thoughts?

Yurik72 commented 3 years ago

Looking to find a good place to test with iskeepaliveenabled option. @Yurik72 thoughts?

Actually I need investigate, because keep Alive work to me, I have played with delays and it works, even if I put phone to fly mode and than back in the given tima-out

@karl i will investigate your logs. thanks

eford321 commented 3 years ago

Do you ever see the disconnects that I have in my logs on your devices?

My Wifi network is a Google Wifi mesh. I had compatibility problems with google/HomeKit a couple of years ago. I was able to adjust my network topology to get around previous issues. I'm interested to see if you see similar communications.

Yurik72 commented 3 years ago

Yes, I saw your log, and my understanding you have changed socket options to more fast reproduce and test memory leaks 😊

Now I understand that is your standard behavior….

Definitely I had different picture and connections are stables with keep Alive, based on setting which on the github latest commit

As well I’m using this on 3 different environment and picture always the same. Environment is very simple two of them is quite old WiFi routers…

One of them Asus mesh system. So your network environment helps to find memory leak 😊

From: eford321 notifications@github.com Sent: Friday, February 19, 2021 11:42 PM To: Yurik72/ESPHap ESPHap@noreply.github.com Cc: Yurik72 yurik.kovalenko@gmail.com; Mention mention@noreply.github.com Subject: Re: [Yurik72/ESPHap] Accessory 'No Response' (#52)

Do you ever see the disconnects that I have in my logs on your devices?

My Wifi network is a Google Wifi mesh. I had compatibility problems with google/HomeKit a couple of years ago. I was able to adjust my network topology to get around previous issues. I'm interested to see if you see similar communications.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Yurik72/ESPHap/issues/52#issuecomment-782375876 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AKDREXJZQVUSKEQOKQC3CB3S73LKXANCNFSM4XSTRICQ . https://github.com/notifications/beacon/AKDREXI7UFMQ4TFUFIXFE7DS73LKXA5CNFSM4XSTRIC2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOF2RBXRA.gif

eford321 commented 3 years ago

Interesting I can run the EspHap_Switch and EspHapLed8266 examples without disconnects (no response) allowing HOMEKIT_MAX_CLIENTS = 8.
My WindowBlind sketch is totally idle, just running the hap_homekit_loop(); and has disconnects. I can't find anything I am doing with HAP setup that the examples are not doing. Can you look to see if I missed something? This sketch should run without a button, stepper motor or FRAM chip.

BTW, the heap problem appears to be completely fixed. eford321_WindowCover.ino.zip

karl-fischer commented 3 years ago

Hi People :)

Have you tested with a remote client, via a Home Hub? That's the issue that I'm facing... the remote client shows the accessories as "No Response".

Yurik72, did you see anything helpful in my logs?

Oh, and my WiFi network is a Ubiquiti Unifi network. I have 2 WiFi access points, both are hard-wired back to the switch, but I can see the problem exists even when the clients are connected to the same WiFi access point (although it shouldn't matter).

Karl :)

eford321 commented 3 years ago

I did not try remotely. I will try that.

I do know older iPads aren’t good home hubs. That might be the problem.

Sent from my iPhone

On Feb 20, 2021, at 5:59 PM, karl-fischer notifications@github.com wrote:

 Hi People :)

Have you tested with a remote client, via a Home Hub? That's the issue that I'm facing... the remote client shows the accessories as "No Response".

Yurik72, did you see anything helpful in my logs?

Karl :)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

karl-fischer commented 3 years ago

I am using an iPad 8th generation as my Home Hub. This is the latest model and was released in 2020 :)

eford321 commented 3 years ago

Interesting findings. I am running the home app on my phone via LTE and via Wifi on my Mac (phone remote/Mac local). If I toggle the ESP-Switch from my phone, both the Mac and the phone show the change of icon. If I toggle from my Mac, the phone does not get updated. When I test my window blind sketch it works properly in the same scenario.

Here's the log of ESP-Switch. Client 1073698796 is my Mac, Client 1073698836 is my remote iPhone. ... 10:36:03.952 -> >>> Home Integration: homekit_is_paired 1 10:36:03.952 -> >>> HomeKit: Free heap: 31512 10:36:03.952 -> >>> HomeKit: Starting server 10:36:03.989 -> >>> HomeKit: storage init 0 10:36:03.989 -> >>> HomeKit: Using existing accessory ID: 3E:3A:0A:5E:12:9D 10:36:03.989 -> >>> HomeKit: find pairings 10:36:03.989 -> >>> HomeKit: Found admin pairing with 6FDD5BE0-78E1-4A4C-B5D7-98277EEFA239, disabling pair setup 10:36:03.989 -> >>> HomeKit: Configuring mDNS 10:36:03.989 -> >>> HomeKit: MDNS.begin: host-3E3A, IP: 192.168.1.56 10:36:03.989 -> >>> HomeKit: Init server over 10:36:03.989 -> Setting web server 10:36:04.156 -> Web site http://192.168.1.56 10:36:04.156 -> File system http://192.168.1.56/browse 10:36:04.191 -> Update http://192.168.1.56/update 10:36:13.493 -> pm open,type:2 0 10:36:29.043 -> >>> HomeKit: WiFiServer receives a new client (current 0, max 8) 10:36:29.043 -> >>> HomeKit: Got new client connection: local 192.168.1.56:5556, remote 192.168.1.13:50885 10:36:29.043 -> >>> HomeKit: [Client 1073698796] Got client content from the cache 0 10:36:29.112 -> >>> HomeKit: [Client 1073698796] new client accepted 10:36:29.112 -> >>> HomeKit: [Client 1073698796] Pair Verify Step 1/2 10:36:29.393 -> >>> HomeKit: Free heap: 22024 10:36:29.393 -> >>> HomeKit: [Client 1073698796] Pair Verify Step 2/2 10:36:29.393 -> >>> HomeKit: [Client 1073698796] Found pairing with 6FDD5BE0-78E1-4A4C-B5D7-98277EEFA239 10:36:30.187 -> >>> HomeKit: [Client 1073698796] Verification successful, secure session established 10:36:30.187 -> >>> HomeKit: Free heap: 22176 10:36:30.220 -> >>> HomeKit: [Client 1073698796] Get Accessories 10:36:30.220 -> >>> HomeKit: [Client 1073698796] Update Characteristics 10:36:30.259 -> >>> HomeKit: Free heap: 22224 10:36:30.259 -> switch_callback 10:36:30.259 -> set_switch:False 10:36:30.259 -> notify hap 10:36:30.259 -> >>> HomeKit: [Client 1073698796] Update Characteristics 10:36:30.259 -> >>> HomeKit: Free heap: 22224 10:36:43.160 -> >>> HomeKit: [Client 1073698796] Update Characteristics 10:36:43.160 -> >>> HomeKit: Free heap: 22416 10:36:43.160 -> switch_callback 10:36:43.257 -> set_switch:True 10:36:43.257 -> notify hap 10:36:44.311 -> >>> HomeKit: [Client 1073698796] Update Characteristics 10:36:44.311 -> >>> HomeKit: Free heap: 22416 10:36:44.311 -> switch_callback 10:36:44.345 -> set_switch:False 10:36:44.345 -> notify hap 10:36:48.224 -> >>> HomeKit: [Client 1073698796] Update Characteristics 10:36:48.224 -> >>> HomeKit: Free heap: 22416 10:36:48.224 -> switch_callback 10:36:48.224 -> set_switch:True 10:36:48.224 -> notify hap 10:36:49.262 -> >>> HomeKit: [Client 1073698796] Update Characteristics 10:36:49.262 -> >>> HomeKit: Free heap: 21920 10:36:49.262 -> switch_callback 10:36:49.262 -> set_switch:False 10:36:49.262 -> notify hap 10:36:52.805 -> >>> HomeKit: [Client 1073698796] Update Characteristics 10:36:52.839 -> >>> HomeKit: Free heap: 22416 10:36:52.839 -> switch_callback 10:36:52.839 -> set_switch:True 10:36:52.839 -> notify hap 10:36:54.057 -> >>> HomeKit: [Client 1073698796] Update Characteristics 10:36:54.057 -> >>> HomeKit: Free heap: 22416 10:36:54.057 -> switch_callback 10:36:54.057 -> set_switch:False 10:36:54.057 -> notify hap 10:37:09.130 -> >>> HomeKit: WiFiServer receives a new client (current 1, max 8) 10:37:09.130 -> >>> HomeKit: Got new client connection: local 192.168.1.56:5556, remote 192.168.1.28:49861 10:37:09.130 -> >>> HomeKit: [Client 1073698836] Got client content from the cache 1 10:37:09.130 -> >>> HomeKit: [Client 1073698836] new client accepted 10:37:09.130 -> >>> HomeKit: [Client 1073698836] Pair Verify Step 1/2 10:37:09.467 -> >>> HomeKit: Free heap: 21928 10:37:09.529 -> >>> HomeKit: [Client 1073698836] Pair Verify Step 2/2 10:37:09.529 -> >>> HomeKit: [Client 1073698836] Found pairing with 6FDD5BE0-78E1-4A4C-B5D7-98277EEFA239 10:37:10.288 -> >>> HomeKit: [Client 1073698836] Verification successful, secure session established 10:37:10.288 -> >>> HomeKit: Free heap: 22080 10:37:10.288 -> >>> HomeKit: [Client 1073698836] Get Accessories 10:37:10.326 -> >>> HomeKit: [Client 1073698836] Update Characteristics 10:37:10.358 -> >>> HomeKit: Free heap: 22128 10:37:10.358 -> switch_callback 10:37:10.358 -> set_switch:False 10:37:10.358 -> notify hap 10:37:10.429 -> >>> HomeKit: [Client 1073698836] Update Characteristics 10:37:10.429 -> >>> HomeKit: Free heap: 22128 10:37:16.723 -> >>> HomeKit: [Client 1073698836] Update Characteristics 10:37:16.723 -> >>> HomeKit: Free heap: 22096 10:37:16.723 -> switch_callback 10:37:16.723 -> set_switch:True 10:37:16.723 -> notify hap 10:37:39.462 -> >>> HomeKit: [Client 1073698796] Update Characteristics 10:37:39.496 -> >>> HomeKit: Free heap: 21928 10:37:39.496 -> switch_callback 10:37:39.496 -> set_switch:False 10:37:39.496 -> notify hap 10:38:56.807 -> >>> HomeKit: [Client 1073698796] Get Characteristics 10:38:56.807 -> >>> HomeKit: [Client 1073698836] Update Characteristics 10:38:56.807 -> >>> HomeKit: Free heap: 22096 10:38:56.807 -> switch_callback 10:38:56.807 -> set_switch:False 10:38:56.807 -> notify hap 10:38:56.807 -> >>> HomeKit: [Client 1073698836] Update Characteristics 10:38:56.807 -> >>> HomeKit: Free heap: 22096 10:38:56.807 -> switch_callback 10:38:56.807 -> set_switch:True 10:38:56.807 -> notify hap 10:39:09.926 -> >>> HomeKit: [Client 1073698796] Update Characteristics 10:39:09.926 -> >>> HomeKit: Free heap: 22096 10:39:09.926 -> switch_callback 10:39:09.926 -> set_switch:False 10:39:09.926 -> notify hap 10:44:51.759 -> >>> HomeKit: [Client 1073698836] Update Characteristics 10:44:51.759 -> >>> HomeKit: Free heap: 21968 10:44:51.759 -> switch_callback 10:44:51.759 -> set_switch:False 10:44:51.759 -> notify hap 10:44:55.654 -> >>> HomeKit: [Client 1073698836] Update Characteristics 10:44:55.654 -> >>> HomeKit: Free heap: 22096 10:44:55.654 -> switch_callback 10:44:55.654 -> set_switch:True 10:44:55.654 -> notify hap 10:45:01.075 -> >>> HomeKit: [Client 1073698796] Update Characteristics 10:45:01.075 -> >>> HomeKit: Free heap: 22096 10:45:01.075 -> switch_callback 10:45:01.075 -> set_switch:False 10:45:01.075 -> notify hap 10:45:07.214 -> >>> HomeKit: [Client 1073698836] Update Characteristics 10:45:07.214 -> >>> HomeKit: Free heap: 22096 10:45:07.214 -> switch_callback 10:45:07.271 -> set_switch:False 10:45:07.271 -> notify hap 10:45:09.073 -> >>> HomeKit: [Client 1073698836] Update Characteristics 10:45:09.073 -> >>> HomeKit: Free heap: 21928 10:45:09.073 -> switch_callback 10:45:09.073 -> set_switch:True 10:45:09.073 -> notify hap 10:45:12.511 -> >>> HomeKit: [Client 1073698836] Update Characteristics 10:45:12.511 -> >>> HomeKit: Free heap: 22096 10:45:12.511 -> switch_callback 10:45:12.511 -> set_switch:False 10:45:12.511 -> notify hap 10:46:49.801 -> >>> HomeKit: [Client 1073698836] Update Characteristics 10:46:49.801 -> >>> HomeKit: Free heap: 22096 10:46:49.801 -> switch_callback 10:46:49.801 -> set_switch:True 10:46:49.801 -> notify hap 10:46:55.880 -> >>> HomeKit: [Client 1073698796] Update Characteristics 10:46:55.880 -> >>> HomeKit: Free heap: 22096 10:46:55.880 -> switch_callback 10:46:55.880 -> set_switch:False 10:46:55.880 -> notify hap 10:49:56.419 -> >>> HomeKit: [Client 1073698796] Update Characteristics 10:49:56.419 -> >>> HomeKit: Free heap: 21904 10:49:56.419 -> switch_callback 10:49:56.419 -> set_switch:True 10:49:56.419 -> notify hap

Yurik72 commented 3 years ago

Interesting, I will be able to check next few days, but this gives an answer of disconnection, I suppose not a problem to fix

Sent from my iPhone

On 20 Feb 2021, at 23:34, eford321 notifications@github.com wrote:

 Interesting I can run the EspHap_Switch and EspHapLed8266 examples without disconnects (no response) allowing HOMEKIT_MAX_CLIENTS = 8. My WindowBlind sketch is totally idle, just running the hap_homekit_loop(); and has disconnects. I can't find anything I am doing with HAP setup that the examples are not doing. Can you look to see if I missed something? This sketch should run without a button, stepper motor or FRAM chip.

BTW, the heap problem appears to be completely fixed. eford321_WindowCover.ino.zip

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

Yurik72 commented 3 years ago

I did’t find nothing special in the logs, mDNS works well

Sent from my iPhone

On 21 Feb 2021, at 00:59, karl-fischer notifications@github.com wrote:

 Hi People :)

Have you tested with a remote client, via a Home Hub? That's the issue that I'm facing... the remote client shows the accessories as "No Response".

Yurik72, did you see anything helpful in my logs?

Karl :)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

Yurik72 commented 3 years ago

One question which is not clear completely, if memory leak problems still appear on the latest commit

Sent from my iPhone

On 20 Feb 2021, at 23:34, eford321 notifications@github.com wrote:

 Interesting I can run the EspHap_Switch and EspHapLed8266 examples without disconnects (no response) allowing HOMEKIT_MAX_CLIENTS = 8. My WindowBlind sketch is totally idle, just running the hap_homekit_loop(); and has disconnects. I can't find anything I am doing with HAP setup that the examples are not doing. Can you look to see if I missed something? This sketch should run without a button, stepper motor or FRAM chip.

BTW, the heap problem appears to be completely fixed. eford321_WindowCover.ino.zip

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

eford321 commented 3 years ago

Tried again after waiting more than 1 hour and it is now working normally. strange. Appears to have been an apple issue.

Yurik72 commented 3 years ago

iOS 14.4 ?

Sent from my iPhone

On 21 Feb 2021, at 19:06, eford321 notifications@github.com wrote:

 Tried again after waiting more than 1 hour and it is now working normally. strange. Appears to have been an apple issue.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

eford321 commented 3 years ago

yes iOS 14.4 and Mac OS 11.2.1.

eford321 commented 3 years ago

Yes, I saw your log, and my understanding you have changed socket options to more fast reproduce and test memory leaks 😊 Now I understand that is your standard behavior….

FYI, My blind sketch runs fine on a ESP32 I don't see any disconnects and I don't see "No Response"

Here's a 1 hour log for comparison ... ap_services added chararacteristic 0: 00000023-0000-1000-8000-0026BB765291 14:11:31.737 -> >>> Home Integration: hap_services added chararacteristic 1: 0000006D-0000-1000-8000-0026BB765291 14:11:31.737 -> >>> Home Integration: hap_services added chararacteristic 2: 0000007C-0000-1000-8000-0026BB765291 14:11:31.737 -> >>> Home Integration: hap_services added chararacteristic 3: 00000072-0000-1000-8000-0026BB765291 14:11:31.737 -> >>> Home Integration: homekit_is_paired 0 14:11:31.737 -> >>> HomeKit: Starting server 14:11:31.737 -> >>> HomeKit: Using existing accessory ID: FA:75:F6:63:03:43 14:11:31.737 -> >>> HomeKit: Configuring mDNS 14:11:53.547 -> >>> HomeKit: Got new client connection: 56 14:11:53.547 -> >>> HomeKit: [Client 56] Pair Setup 14:11:53.547 -> >>> HomeKit: [Client 56] Pair Setup Step 1/3 14:11:53.547 -> >>> HomeKit: [Client 56] new pairing content 14:11:53.547 -> >>> HomeKit: started crypto 14:11:53.580 -> >>> HomeKit: Free heap: 170644 14:11:55.010 -> >>> HomeKit: Calculating public key len=384 14:11:55.769 -> >>> HomeKit: Calculating public key result 0 14:11:55.769 -> >>> HomeKit: [Client 56] send_tlv_response 14:11:55.769 -> >>> HomeKit: [Client 56] send_tlv_response done 14:11:59.309 -> >>> HomeKit: [Client 56] Pair Setup 14:11:59.309 -> >>> HomeKit: [Client 56] Pair Setup Step 2/3 14:12:01.805 -> >>> HomeKit: [Client 56] Pair Setup 14:12:01.805 -> >>> HomeKit: [Client 56] Pair Setup Step 3/3 14:12:02.083 -> >>> HomeKit: Added pairing with 6FDD5BE0-78E1-4A4C-B5D7-98277EEFA239 14:12:02.116 -> >>> HomeKit: Configuring mDNS 14:12:02.116 -> >>> HomeKit: [Client 56] Successfully paired 14:12:02.192 -> >>> HomeKit: [Client 56] Closing client connection 14:12:03.413 -> >>> HomeKit: Got new client connection: 57 14:12:03.413 -> >>> HomeKit: [Client 57] Pair Verify Step 1/2 14:12:03.479 -> >>> HomeKit: [Client 57] Pair Verify Step 2/2 14:12:03.479 -> >>> HomeKit: [Client 57] Found pairing with 6FDD5BE0-78E1-4A4C-B5D7-98277EEFA239 14:12:03.514 -> >>> HomeKit: [Client 57] Verification successful, secure session established 14:12:03.514 -> >>> HomeKit: [Client 57] Get Accessories 14:12:03.689 -> >>> HomeKit: [Client 57] Update Characteristics 14:12:03.723 -> >>> HomeKit: [Client 57] Update Characteristics 14:12:03.723 -> >>> HomeKit: [Client 57] Update Characteristics 14:12:03.824 -> >>> HomeKit: [Client 57] Add Pairing 14:12:04.104 -> >>> HomeKit: Added pairing with 0F8927F8-0F84-44E7-8181-8714ED73BD51 14:12:05.336 -> >>> HomeKit: Got new client connection: 58 14:12:05.336 -> >>> HomeKit: [Client 58] Pair Verify Step 1/2 14:12:05.369 -> >>> HomeKit: Got new client connection: 59 14:12:05.369 -> >>> HomeKit: [Client 59] Pair Verify Step 1/2 14:12:05.435 -> >>> HomeKit: [Client 58] Pair Verify Step 2/2 14:12:05.435 -> >>> HomeKit: [Client 58] Found pairing with 6FDD5BE0-78E1-4A4C-B5D7-98277EEFA239 14:12:05.435 -> >>> HomeKit: [Client 58] Verification successful, secure session established 14:12:05.469 -> >>> HomeKit: Got new client connection: 60 14:12:05.469 -> >>> HomeKit: [Client 59] Pair Verify Step 2/2 14:12:05.469 -> >>> HomeKit: [Client 59] Found pairing with 6FDD5BE0-78E1-4A4C-B5D7-98277EEFA239 14:12:05.469 -> >>> HomeKit: [Client 59] Verification successful, secure session established 14:12:05.502 -> >>> HomeKit: Got new client connection: 61 14:12:05.502 -> >>> HomeKit: [Client 60] Pair Verify Step 1/2 14:12:05.535 -> >>> HomeKit: [Client 58] Get Accessories 14:12:05.535 -> >>> HomeKit: [Client 61] Pair Verify Step 1/2 14:12:05.601 -> >>> HomeKit: [Client 59] Get Accessories 14:12:05.601 -> >>> HomeKit: [Client 60] Pair Verify Step 2/2 14:12:05.601 -> >>> HomeKit: [Client 60] Found pairing with 6FDD5BE0-78E1-4A4C-B5D7-98277EEFA239 14:12:05.639 -> >>> HomeKit: [Client 60] Verification successful, secure session established 14:12:05.639 -> >>> HomeKit: [Client 61] Pair Verify Step 2/2 14:12:05.639 -> >>> HomeKit: [Client 61] Found pairing with 6FDD5BE0-78E1-4A4C-B5D7-98277EEFA239 14:12:05.672 -> >>> HomeKit: [Client 61] Verification successful, secure session established 14:12:05.672 -> >>> HomeKit: [Client 60] Get Accessories 14:12:05.672 -> >>> HomeKit: [Client 61] Get Accessories 14:12:05.706 -> >>> HomeKit: [Client 60] Update Characteristics 14:12:05.706 -> >>> HomeKit: [Client 60] Get Characteristics 14:12:05.807 -> >>> HomeKit: [Client 59] Update Characteristics 14:12:05.807 -> >>> HomeKit: [Client 58] Get Characteristics 14:12:05.807 -> >>> HomeKit: [Client 59] Get Characteristics 14:12:05.807 -> >>> HomeKit: [Client 58] Update Characteristics 14:12:05.976 -> >>> HomeKit: [Client 61] Update Characteristics 14:12:06.014 -> >>> HomeKit: [Client 61] Get Characteristics 14:12:33.855 -> >>> HomeKit: [Client 57] Get Characteristics 14:12:36.205 -> >>> HomeKit: Got new client connection: 62 14:12:36.205 -> >>> HomeKit: [Client 62] Pair Verify Step 1/2 14:12:36.309 -> >>> HomeKit: [Client 62] Pair Verify Step 2/2 14:12:36.309 -> >>> HomeKit: [Client 62] Found pairing with 0F8927F8-0F84-44E7-8181-8714ED73BD51 14:12:36.309 -> >>> HomeKit: [Client 62] Verification successful, secure session established 14:12:36.309 -> >>> HomeKit: [Client 57] Update Characteristics 14:12:36.309 -> >>> HomeKit: [Client 62] Get Accessories 14:12:36.380 -> >>> HomeKit: [Client 62] Get Characteristics 14:12:36.483 -> >>> HomeKit: [Client 62] Update Characteristics 14:13:33.115 -> >>> HomeKit: [Client 60] Update Characteristics 14:13:33.915 -> >>> HomeKit: [Client 60] Get Characteristics 14:13:43.817 -> >>> HomeKit: [Client 58] Update Characteristics 14:13:55.264 -> >>> HomeKit: [Client 59] Update Characteristics 14:13:55.408 -> >>> HomeKit: [Client 61] Update Characteristics 14:13:57.466 -> >>> HomeKit: [Client 60] Update Characteristics 14:14:00.427 -> >>> HomeKit: [Client 60] Update Characteristics 14:14:06.784 -> >>> HomeKit: [Client 58] Update Characteristics 14:14:06.818 -> >>> HomeKit: [Client 58] Update Characteristics 14:14:07.866 -> >>> HomeKit: [Client 60] Update Characteristics 14:14:08.144 -> >>> HomeKit: [Client 60] Update Characteristics 14:14:08.393 -> >>> HomeKit: [Client 60] Update Characteristics 14:14:19.138 -> >>> HomeKit: [Client 57] Get Characteristics 14:18:10.334 -> >>> HomeKit: [Client 57] Update Characteristics 14:27:29.891 -> >>> HomeKit: [Client 60] Update Characteristics 14:27:29.926 -> >>> HomeKit: [Client 57] Update Characteristics 14:27:42.992 -> >>> HomeKit: [Client 60] Update Characteristics 14:36:09.564 -> >>> HomeKit: [Client 57] Closing client connection 14:36:16.078 -> >>> HomeKit: Got new client connection: 63 14:36:16.078 -> >>> HomeKit: [Client 63] Pair Verify Step 1/2 14:36:16.146 -> >>> HomeKit: [Client 63] Pair Verify Step 2/2 14:36:16.146 -> >>> HomeKit: [Client 63] Found pairing with 6FDD5BE0-78E1-4A4C-B5D7-98277EEFA239 14:36:16.181 -> >>> HomeKit: [Client 63] Verification successful, secure session established 14:36:16.181 -> >>> HomeKit: [Client 63] Get Accessories 14:36:16.335 -> >>> HomeKit: [Client 63] Get Characteristics 14:47:35.578 -> >>> HomeKit: [Client 60] Closing client connection 14:51:24.480 -> >>> HomeKit: Got new client connection: 56 14:51:24.480 -> >>> HomeKit: [Client 56] Pair Verify Step 1/2 14:51:24.616 -> >>> HomeKit: [Client 56] Pair Verify Step 2/2 14:51:24.616 -> >>> HomeKit: [Client 56] Found pairing with 6FDD5BE0-78E1-4A4C-B5D7-98277EEFA239 14:51:24.616 -> >>> HomeKit: [Client 56] Verification successful, secure session established 14:51:24.616 -> >>> HomeKit: [Client 56] Get Accessories 14:51:24.616 -> >>> HomeKit: [Client 56] Update Characteristics 15:04:49.234 -> >>> HomeKit: [Client 56] Update Characteristics 15:10:43.333 -> >>> HomeKit: [Client 63] Closing client connection 15:10:47.475 -> >>> HomeKit: Got new client connection: 57 15:10:47.475 -> >>> HomeKit: [Client 57] Pair Verify Step 1/2 15:10:47.581 -> >>> HomeKit: [Client 57] Pair Verify Step 2/2 15:10:47.581 -> >>> HomeKit: [Client 57] Found pairing with 6FDD5BE0-78E1-4A4C-B5D7-98277EEFA239 15:10:47.581 -> >>> HomeKit: [Client 57] Verification successful, secure session established 15:10:47.628 -> >>> HomeKit: [Client 57] Get Accessories 15:11:27.514 -> >>> HomeKit: [Client 58] Closing client connection 15:11:27.960 -> >>> HomeKit: Got new client connection: 60 15:11:27.960 -> >>> HomeKit: [Client 60] Pair Verify Step 1/2 15:11:28.061 -> >>> HomeKit: [Client 60] Pair Verify Step 2/2 15:11:28.061 -> >>> HomeKit: [Client 60] Found pairing with 6FDD5BE0-78E1-4A4C-B5D7-98277EEFA239 15:11:28.096 -> >>> HomeKit: [Client 60] Verification successful, secure session established 15:11:28.096 -> >>> HomeKit: [Client 60] Get Accessories 15:11:28.149 -> >>> HomeKit: [Client 60] Update Characteristics 15:11:58.930 -> >>> HomeKit: [Client 56] Update Characteristics 15:11:59.219 -> >>> HomeKit: [Client 56] Update Characteristics 15:12:16.613 -> >>> HomeKit: [Client 57] Update Characteristics 15:12:16.682 -> >>> HomeKit: [Client 57] Get Characteristics 15:12:33.789 -> >>> HomeKit: [Client 60] Update Characteristics

karl-fischer commented 3 years ago

So, do you think it is an ESP8266 issue? And that it works fine on the ESP32?

Did you see any "No Response" when running your iPhone on LTE?

eford321 commented 3 years ago

So, do you think it is an ESP8266 issue? And that it works fine on the ESP32?

Did you see any "No Response" when running your iPhone on LTE?

Hard to tell so far. There is definitely an issue with the code on an ESP8266, but I don't see it with a smaller sketch like the switch. Could also be the iPad. There are several reports on reddit saying the iPad's wifi sleep causes issues. Do you have an appletv or HomePod you can try as a hub?

eford321 commented 3 years ago

ESP-32 went into no response after 2+ hours. Debug isn't as detailed, but here's the log. Worked until 17:19. ESP32 log.txt.zip ...

karl-fischer commented 3 years ago

Hmm, originally I was using an iPad Air, and it was several years old so I thought maybe that was the issue. So I bought a brand new iPad 8th gen, but still causes the issue (as discussed).

My preference is to use the iPad as the Home Hub, because it is fixed to the wall and designed to remain in the house when I sell, but yes, I do have an AppleTV 4k. I will set that up as the Home Hub and test.

I'll do that now...

karl-fischer commented 3 years ago

Ok, I have set up my Apple TV 4k as a Home Hub, re-added the Accessory and tried to operate the accessory from my iPhone with WiFi turned off.

The accessory still shows as "No Response". When I click on the switch to turn it on/off, it does work, but it still shows as "No Response" the whole time.

I closed the Home app on my iPhone and opened it again, the Accessory is now showing as healthy. I'll sit and watch it for a few minutes....

Has been going for 30mins and seems to be working ok. The accessory on the iPhone has not said, "No Response".

Yurik72 commented 3 years ago

Hi for Esp32 I have to port several bug fixes which is found on esp8266, I will keep you informed. Do you have any other Apple devices an what is their behavior . For instance I’m comparing with Eve elgato and would say that behavior the same ( reboot router, phone to fly mode, etc)

Sent from my iPhone

On 24 Feb 2021, at 02:52, eford321 notifications@github.com wrote:

 ESP-32 went into no response after 2+ hours. Debug isn't a detailed, but here's the log. Worked until 17:19 in the attached log ESP32 log.txt.zip ...

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

eford321 commented 3 years ago

No worries on the ESP32. I am still focused on ESP8266 as I have 8 blinds running on them that I want to convert to ESP-HAP from MQTT/Homebridge. I loaded my sketch on a ESP32 to see if there was any difference. Are you asking about my devices or @karl-fischer ? I have 29 homekit devices in my network. All have been very reliable.

Yurik72 commented 3 years ago

Asked, both. Ok clear seams some bug still present, however I do not see ‘no response’ on esp32 in my home managed by Apple TV, they always healthy.

Sent from my iPhone

On 24 Feb 2021, at 17:02, eford321 notifications@github.com wrote:

 No worries on the ESP32. I am still focused on ESP8266 as I have 8 blinds running on them that I want to convert to ESP-HAP from MQTT/Homebridge. I loaded my sketch on a ESP32 to see if there was any difference. Are you asking about my devices or @karl-fischer ? I have 29 homekit devices in my network. All have been very reliable.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

eford321 commented 3 years ago

The ESP32 definitely performs better than the 8266, but it still fails after some time. I am not able to compile with debug on the ESP32 for more information. See #52

Do you have an ESP8266 to test with?

On Wed, Feb 24, 2021 at 11:05 AM Yurik72 notifications@github.com wrote:

Asked, both. Ok clear seams some bug still present, however I do not see ‘no response’ on esp32 in my home managed by Apple TV, they always healthy.

Sent from my iPhone

On 24 Feb 2021, at 17:02, eford321 notifications@github.com wrote:

 No worries on the ESP32. I am still focused on ESP8266 as I have 8 blinds running on them that I want to convert to ESP-HAP from MQTT/Homebridge. I loaded my sketch on a ESP32 to see if there was any difference. Are you asking about my devices or @karl-fischer ? I have 29 homekit devices in my network. All have been very reliable.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Yurik72/ESPHap/issues/52#issuecomment-785183492, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABNX7J6RAS5H3U3TI56WHA3TAUPUXANCNFSM4XSTRICQ .

Yurik72 commented 3 years ago

Yes , sure I’m testing both ESP8266, and ESP32 in parallel, there are my initial target to have one sketch running similar on both platform, I will fix issue with compiling and deeply check no response, in the next few days, today and tomorrow not able due to other things, but target is to finish that and get it running well...

Sent from my iPhone

On 24 Feb 2021, at 18:19, eford321 notifications@github.com wrote:

 The ESP32 definitely performs better than the 8266, but it still fails after some time. I am not able to compile with debug on the ESP32 for more information. See #52

Do you have an ESP8266 to test with?

On Wed, Feb 24, 2021 at 11:05 AM Yurik72 notifications@github.com wrote:

Asked, both. Ok clear seams some bug still present, however I do not see ‘no response’ on esp32 in my home managed by Apple TV, they always healthy.

Sent from my iPhone

On 24 Feb 2021, at 17:02, eford321 notifications@github.com wrote:

 No worries on the ESP32. I am still focused on ESP8266 as I have 8 blinds running on them that I want to convert to ESP-HAP from MQTT/Homebridge. I loaded my sketch on a ESP32 to see if there was any difference. Are you asking about my devices or @karl-fischer ? I have 29 homekit devices in my network. All have been very reliable.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Yurik72/ESPHap/issues/52#issuecomment-785183492, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABNX7J6RAS5H3U3TI56WHA3TAUPUXANCNFSM4XSTRICQ .

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

eford321 commented 3 years ago

Great. I appreciate your work on this code!!

It would be interesting to understand the reason for the "Disconnected!" message on the ESP8266. I have not been able to understand that from reading the code.

On Wed, Feb 24, 2021 at 11:27 AM Yurik72 notifications@github.com wrote:

Yes , sure I’m testing both ESP8266, and ESP32 in parallel, there are my initial target to have one sketch running similar on both platform, I will fix issue with compiling and deeply check no response, in the next few days, today and tomorrow not able due to other things, but target is to finish that and get it running well...

Sent from my iPhone

On 24 Feb 2021, at 18:19, eford321 notifications@github.com wrote:

 The ESP32 definitely performs better than the 8266, but it still fails after some time. I am not able to compile with debug on the ESP32 for more information. See #52

Do you have an ESP8266 to test with?

On Wed, Feb 24, 2021 at 11:05 AM Yurik72 notifications@github.com wrote:

Asked, both. Ok clear seams some bug still present, however I do not see ‘no response’ on esp32 in my home managed by Apple TV, they always healthy.

Sent from my iPhone

On 24 Feb 2021, at 17:02, eford321 notifications@github.com wrote:

 No worries on the ESP32. I am still focused on ESP8266 as I have 8 blinds running on them that I want to convert to ESP-HAP from MQTT/Homebridge. I loaded my sketch on a ESP32 to see if there was any difference. Are you asking about my devices or @karl-fischer ? I have 29 homekit devices in my network. All have been very reliable.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Yurik72/ESPHap/issues/52#issuecomment-785183492, or unsubscribe < https://github.com/notifications/unsubscribe-auth/ABNX7J6RAS5H3U3TI56WHA3TAUPUXANCNFSM4XSTRICQ

.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Yurik72/ESPHap/issues/52#issuecomment-785198737, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABNX7JZT7K27U7PI7HNFB23TAUSGBANCNFSM4XSTRICQ .

karl-fischer commented 3 years ago

Hello Yurik72 & eford321 :)

I checked mine periodically over night and this morning when I was legitimately out of the house, the accessory was fine the whole time, it did not show as "No Response".

Perhaps my issue was the fact that I was using an iPad as a Home Hub. I have only found a few random comments around the place saying that iPads don't make good Hubs, but I have not read this consistently. It is really hard to find comment on this.

I wrote my code based on a different library (HomeKit-ESP8266 (by Mixiaoxiao)), unfortunately when I add the accessory back in to my Home app using that library and set my iPhone to LTE, it was showing 'No Response' and also it missed status updates from the accessory, so I'm going to start porting my code to ESPHap. Up until this point, I have just been using the examples provided directly. I have 2 ESP8266's (NodeMCU), which I will program, one is a switch to open the front gate, and the other is a switch to open the garage door, with a sensor to report when the door is open/closed.

I will likely need more than 4 clients able to connect to an Accessory, and it looks like this library is limited to 4 clients for the ESP8266; can this be increased? I understand there may be a memory limitation; I will disable the wifi manager and webserver, because I do not need them, will this help?

Karl :)

eford321 commented 3 years ago

Karl,

Good to hear your connections are stable. Hopefully Apple will fix the ipad hub issue.

You can increase the number of sessions in arduino_homekit_server.cpp by changing these values.

define HOMEKIT_MAX_CLIENTS 4

define CLIENT_CONTEXT_CACHE_SIZE 4

The Apple spec calls for supporting 8 clients, but it uses more heap for each session. I regularly see 7 connections active in my network.

Evan

Sent from my iPhone

On Feb 24, 2021, at 6:19 PM, karl-fischer notifications@github.com wrote:

 Hello Yurik72 & eford321 :)

I checked mine periodically over night and this morning when I was legitimately out of the house, the accessory was fine the whole time, it did not show as "No Response".

Perhaps my issue was the fact that I was using an iPad as a Home Hub. I have only found a few random comments around the place saying that iPads don't make good Hubs, but I have not read this consistently. It is really hard to find comment on this.

I wrote my code based on a different library (HomeKit-ESP8266 (by Mixiaoxiao)), unfortunately when I add the accessory back in to my Home app using that library and set my iPhone to LTE, it was showing 'No Response' and also it missed status updates from the accessory, so I'm going to start porting my code to ESPHap. Up until this point, I have just been using the examples provided directly. I have 2 ESP8266's (NodeMCU), which I will program, one is a switch to open the front gate, and the other is a switch to open the garage door, with a sensor to report when the door is open/closed.

I will likely need more than 4 clients able to connect to an Accessory, and it looks like this library is limited to 4 clients for the ESP8266; can this be increased? I understand there may be a memory limitation; I will disable the wifi manager and webserver, because I do not need them, will this help?

Karl :)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

karl-fischer commented 3 years ago

Thanks Evan :)

Do you set yours to 8? Have you had any memory issues on the ESP8266?

Oh, and do you know if there is an example with this ESPHap library, which has 2 accessories? For my garage door, I'm not using the "garage door" example, I was going to use a switch to open/close the door and a status for door open/closed status.

Karl :)

eford321 commented 3 years ago

I have been using 8, but have been having problems with disconnects. Yurik72 has made great progress on memory leaks and is looking at the disconnect problem now. Hopefully he can figure it out soon. It’s not useable for me yet.

Sent from my iPhone

On Feb 24, 2021, at 10:13 PM, karl-fischer notifications@github.com wrote:

 Thanks Evan :)

Do you set yours to 8? Have you had any memory issues on the ESP8266?

Karl :)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

Yurik72 commented 3 years ago

Hi Karl , in addition to Eford123 answer, yes you may use 8 clients and memory is enough for them, my understanding that you do not have disconnection problem, this I will discover and my understanding is specific for his sketch.

Sent from my iPhone

On 25 Feb 2021, at 05:13, karl-fischer notifications@github.com wrote:

 Thanks Evan :)

Do you set yours to 8? Have you had any memory issues on the ESP8266?

Karl :)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

karl-fischer commented 3 years ago

Ok, thanks :)

Do you have an example with this ESPHap library, which has 2 accessories? For my garage door, I'm not using the "garage door" example, I was going to use a switch to open/close the door and a status for door open/closed status.

Karl :)

eford321 commented 3 years ago

, this I will discover and my understanding is specific for his sketch.

@Yurik72 I think I may have figured it out. I believe it is my button logic causing enough delay that HAP keepalives fail when I have several Homekit clients connected to my ESP. I removed button support and have been running reliably for more than 2.5 hours. I will work to optimize the button function. I am out of digital IO so I have to work with the analog input on the Wemos D1 mini.

Also, I am not seeing any memory leak.

Yurik72 commented 3 years ago

Do you have an example with this ESPHap library, which has 2 accessories? For my garage door, I'm not using the "garage door" example, I was going to use a switch to open/close the door and a status for door open/closed status.

Karl :)

Hi Karl,
Yes we can do what we want and acceptable for apple:) So, I think you can get garage door as basis, at least contains Current Door State Charachteristic and add additional accessories, in your request Switch

This can be easilly done by calling:

hap_new_switch_service_as_accessory(const char* szname, hap_callback cb, void* context); 

function just before hap_init_homekit_server();

Check if this is OK, otherwise we can find other scenario , which you want

Yurik72 commented 3 years ago

@Yurik72 I think I may have figured it out. I believe it is my button logic causing enough delay that HAP keepalives fail when I have several Homekit clients connected to my ESP. I removed button support and have been running reliably for more than 2.5 hours. I will work to optimize the button function. I am out of digital IO so I have to work with the analog input on the Wemos D1 mini.

Hi, good news, anyhow it's interesting to me therefore please send me the latest your sketch. As weel i can help you with button handling , i have several implementation of that including queue handling (like PC keyboard) which is not usual for any arduino library

eford321 commented 3 years ago

I think I have it working after several steps.

First I moved some pins around to recover a usable digital pin for my button. That eliminated analog. Unfortunately, I was still getting disconnects. Note: It doesn't matter if the button is used or not.

Next, I tried with stepper motor code and library removed with no change. It still failed, so it's not the motor.

Then, I commented out my button function and the function call and it worked for 18 hours with no disconnects. Odd thing is, if I only commented out the function call, it would still fail. Made me think the code was causing the compiler to do something odd.

Finally, I think I might have figured it out. I had several timing variables using the millis() function and had them defined as long. I changed them to unsigned long and it has been running for >60 minutes with the motor and button working as expected.

Also good news, heap is very solid around 20000.

I'll monitor and let you know.

Yurik72 commented 3 years ago

Ok, will be interesting. Any how I’d like to see your sketch, could be interesting.

From: eford321 notifications@github.com Sent: Saturday, February 27, 2021 7:28 PM To: Yurik72/ESPHap ESPHap@noreply.github.com Cc: Yurik72 yurik.kovalenko@gmail.com; Mention mention@noreply.github.com Subject: Re: [Yurik72/ESPHap] Accessory 'No Response' (#52)

I think I have it working after several steps.

First I moved some pins around to recover a usable digital pin for my button. That eliminated analog. Unfortunately, I was still getting disconnects. Note: It doesn't matter if the button is used or not.

Next, I tried with stepper motor code and library removed with no change. It still failed, so it's not the motor.

Then, I commented out my button function and the function call and it worked for 18 hours with no disconnects. Odd thing is, if I only commented out the function call, it would still fail. Made me think the code was causing the compiler to do something odd.

Finally, I think I might have figured it out. I had several timing variables using the millis() function and had them defined as long. I changed them to unsigned long and it has been running for >60 minutes with the motor and button working as expected.

Also good news, heap is very solid around 20000.

I'll monitor and let you know.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Yurik72/ESPHap/issues/52#issuecomment-787106524 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AKDREXJKARNBXM6JZ54W6CTTBETTNANCNFSM4XSTRICQ . https://github.com/notifications/beacon/AKDREXMTDBSZQYPTYUTWKNTTBETTNA5CNFSM4XSTRIC2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOF3VEVXA.gif

eford321 commented 3 years ago

Sketch ran for 24 hours on 4 separate window blinds without disconnects! Also heap is still above 20000.

Unfortunately, I found another problem. I will open a separate issue for that after I gather more data.

Here is my working sketch. Thanks again for your help! WindowCover_ESPHap.ino.zip

Yurik72 commented 3 years ago

Ok, I will check new issue and your sketch

From: eford321 notifications@github.com Sent: Sunday, February 28, 2021 8:30 PM To: Yurik72/ESPHap ESPHap@noreply.github.com Cc: Yurik72 yurik.kovalenko@gmail.com; Mention mention@noreply.github.com Subject: Re: [Yurik72/ESPHap] Accessory 'No Response' (#52)

Sketch ran for 24 hours on 4 separate window blinds without disconnects! Also heap is still above 20000.

Unfortunately, I found another problem. I will open a separate issue for that after I gather more data.

Here is my working sketch. Thanks again for your help! WindowCover_ESPHap.ino.zip https://github.com/Yurik72/ESPHap/files/6057544/WindowCover_ESPHap.ino.zip

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Yurik72/ESPHap/issues/52#issuecomment-787498446 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AKDREXIBRZ57NM36F3VYDT3TBKDTTANCNFSM4XSTRICQ . https://github.com/notifications/beacon/AKDREXIUWIYSQDOW6Q5TLQ3TBKDTTA5CNFSM4XSTRIC2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOF3YELTQ.gif