Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Security 1.0 support, and web page updates by dkerr64 #117

Merged
merged 6 commits into from
Mar 9, 2024
Merged

Security 1.0 support, and web page updates by dkerr64 #117

merged 6 commits into from
Mar 9, 2024

Conversation

mitchjs
Copy link
Contributor

@mitchjs mitchjs commented Feb 17, 2024

Security 1.0 support, and web page updates by @dkerr64 (I believe same as PR #113)

@mitchjs mitchjs changed the title Security 1.0 support, and web page updates by @dkerr64 Security 1.0 support, and web page updates by dkerr64 Feb 17, 2024
@dkerr64
Copy link
Collaborator

dkerr64 commented Feb 19, 2024

If we can undo the last commit, so reset back to 46eab47 (allow for web password to be optional) then I would like to see this merged.

@mitchjs
Copy link
Contributor Author

mitchjs commented Feb 19, 2024

@dkerr64, i made no changes... it just told me i had to push something... no idea why... there where no changes

@dkerr64
Copy link
Collaborator

dkerr64 commented Feb 20, 2024

@mitchjs ok, yes there are no changes. I had cleaned up the commit history and your last merge restored that and no more. Code/files are identical.

@jgstroud I closed my PR #113 in favor of this one. It is good to merge whether as it stands or squashed. Let me know if you want any cleanup on the commit history.

@jgstroud
Copy link
Collaborator

Does it make sense for commits bb65e0e and 5dc7201 to be separate or should they be squashed. if you think they need to remain separate, they should have unique commit messages

@jgstroud
Copy link
Collaborator

Commit 9aa4436 should just get squashed as well.

@jgstroud
Copy link
Collaborator

You should rebase the whole branch on main to get rid of the extra merge commits.

@jgstroud
Copy link
Collaborator

I did the rebase in #118 take a look at that and see what you think.

@jgstroud
Copy link
Collaborator

Oh, I just realized while testing this that the README is going to need updating since the setup has changed. Need to update the part about the default login / setting password and the new protocol setting.

@jgstroud
Copy link
Collaborator

Adding the protocol setting to the web page goes directly against @thenewwazoo's requirement of no configurables. But I am told that autodetecting the protocol isn't possible, which I take to actually mean, it's possible, but it's not worth the effort and all the extra code. I also think this is a much better option than having 2 binaries.

return secType;
}

void write_gdo_security_to_flash(const char *filename, uint8_t* secType) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is identical to write_file_to_flash. Can we use a common function?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup.... added default value to the read code

file.close();
}

uint8_t read_gdo_security_from_flash(const char* filename) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is nearly identical to read_file_from_flash. With a different default file value. Can we use a common function?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done tweaked read to allow a default value

@@ -89,12 +89,12 @@ homekit_accessory_t *accessories[] = {
NULL
}),
HOMEKIT_SERVICE(LIGHTBULB, .primary=false, .characteristics=(homekit_characteristic_t*[]){
HOMEKIT_CHARACTERISTIC(NAME, "ratgdo"),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was the reasoning behind this change? It seems unrelated to this changeset. Also, I had originally done it this way and something made me change it, but I honestly don't remember why. If the change needs to be there, lets break it out into a different commit with a comment describing why we made the change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i changed this to have it make more sense in the homekit app on my iphone
it shows a icon of a light bulb so might as well call it lights, and that's what it is
same for motion
but if needs be we can make this separate PR

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... I don't actually see this text anywhere in HomeKit. Are you suggesting it names the accessories differently based on this value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the device from your home kit, and re-add
it gets shown (at least on my iphone) when i add new device
i dont have appletv or homepod... i just use iphone
so not sure how things work in HK on those devices

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've done that numerous times and the Light shows up as "Light" and the motion detector says "Motion Sensor". I just tried to pair on another device where I don't have a hub and see the same thing. I'm not opposed to the change, but we should move it to a different commit, and I'm still very curious about it. I had it this way to begin with. Not sure my reasoning for renaming all services the same way now, but this way seems more correct.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i know i wouldnt have changed it to light and motion, if it already said that :)
it showed a lightbulb and said ratgdo and that just looked wierd
since its of HK type lightbulb it prob should say that :)
maybe i can screen shot what it did
me temp change it back and flash, and try

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ha, well course i have 1.0 and no motion, but light is saying light and i flashed it with ratgdo in there :)
ok, reverting back to ratgdo... and keeping eye on it :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tend to side with @jgstroud on this one.

There are actually two settings in HomeKit, which have evolved over the years. There is Characteristic.Name and Characteristic.ConfiguredName. Configured name is often empty/undefined and I think is a fairly recent add (like in the last 5 years). A value is written to that by Apple Home if a user enters a "name" for the device/accessory. In absence of ConfiguredName, the apps will use the Name value, but on change will save the change to ConfiguredName.

But what should the default be? Typically you do not name a light "light" or a switch "switch" as the device type is identified by what it is. Typically you name it something like "Kitchen Counter" or "Family Room Desk" (and note that in Apple Home, if the start of the name is identical to the room it is in, then that is removed from the displayed name.... so the app will only display "Desk" for the lamp that is named "Family Room Desk".

For newly installed devices normal practice seems to be to name the device something unique so that it can easily be identified when newly installed. Typically a combination of device manufacture and serial number or last 4 digits of MAC address, or something like that. It is therefore appropriate for us to set everything to "ratgdo" or better still, a combination of "ratgdo" + MAC address... similar to what we now have for the web page title.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might go back on this. For some reason starting today while trying to reproduce the pairing failures I am now seeing the door and light show up as ratgdo and ratgdo2

@@ -1,6 +1,7 @@
// Copyright 2023 Brandon Matthews <thenewwazoo@optimaltour.us>
// All rights reserved. GPLv3 License


Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

src/comms.cpp Outdated
return;
}

//
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

picky, but there are several formatting cleanups. remove this empty comment, and fixup the mixed indentations below

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI that I use Visual Studio Code to edit, and it has a C/C++ extension which will format your code (shift-opt-F on Apple keyboard). Now I'm not a fan of some of its choices (it moves open curly onto a new line for/if/while/etc statements, that I would prefer on the same line) and it is over eager to split things onto multiple lines. But it does help with consistency of formatting.

src/comms.cpp Outdated
if (key == 0x30) { RINFO("0x30 RX (door press)"); }
// wall panel is sending out 0x31 when it starts up
// but also on release of door button
else if (key == 0x31) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use an ENUM for all the different KEY values?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add them to include/ratgdo/Packet.h

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i put them in comms.cpp, Packet.h really is all about SEC2.0

lockState = !bitRead(val, 3);

// light status
static uint8_t lastLightState = 0xff;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you need this static int. Can't you just use garage_door.light? It's essentially a static last light state variable already.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment for the lock state

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe, but lock state doesn't really have a bool available (in Garagedoor) to compare for change
so for consistency I want to keep it the same,

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a garage_door.current_lock and a garage_door.target_lock. The sec+2 logic does the same thing you are doing, except it uses the variables from garage_door rather than declaring additional statics.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the vars in garage_door arnt bools for the lock status... so its compare is more complicated
i would have to convert the bool from the opener in to the enum, then look for change
i think code is simpler now with the static var, we got plenty of ram :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The web page code uses and is dependent on garage_door.current_state and current_lock so this does need to be consistent between protocols. Yes they are not bools, but we should still use them, If the 1.0 protocol does not provide the same level of detail, then just use the values that match... possibly just 0 and 1.

Door state:

  1. Open
  2. Closed
  3. Opening
  4. Closing
  5. Stopped

Lock state:

  1. Unsecured
  2. Secured
  3. Jammed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its just 1 byte... i feel it should be like this, as the code is looking for change in the response FROM the GDO, then sets the state of HK based on that

uint8_t lightState;
uint8_t lockState;

//byte secplus1States[19] = {0x35,0x35,0x35,0x35,0x33,0x33,0x53,0x53,0x38,0x3A,0x3A,0x3A,0x39,0x38,0x3A, 0x38,0x3A,0x39,0x3A};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the commented out States. Either remove or add some comments around what this one is, or maybe an ifdef. Not sure what makes sense here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i want to keep this in case its needed(for now), i have limited testing with emulation of wall plate
for those who dont have one.... i shorten the states based on my wall plate power up sequence

@mitchjs
Copy link
Contributor Author

mitchjs commented Feb 20, 2024

i pushed changed to my fork... does it sync to the PR?
IT DOES :)

@mitchjs
Copy link
Contributor Author

mitchjs commented Feb 20, 2024

i posted bunch of cleanup and such... i guess needs to be checked again

@dkerr64
Copy link
Collaborator

dkerr64 commented Feb 21, 2024

I have cleaned up all the commit history... essentially merged all commits from @mitchjs into one, and all my commits into one, except for the update to build_web_content that I left as a separate commit so I could retain attribution to @mitchjs for his contribution to that.

@mitchjs do not push into your branch without first doing a git pull --rebase in your local copy.

@jgstroud time for another code review please on this cleaned-up version.

@dkerr64
Copy link
Collaborator

dkerr64 commented Feb 23, 2024

@mitchjs and @jgstroud I have completed updates to the webpage and added them into this PR. This includes updating the webpage images and some text in the README.

Time for a solid test and code review please.

Oh... forgot to mention, my system is not setup for dark mode, so the screenshots I included don't have the dark background. Not sure how strongly you feel about that.

@mitchjs
Copy link
Contributor Author

mitchjs commented Feb 23, 2024

@dkerr64 , testing it now... web page looking good... your web programming way-way-way above my skills :)

@mitchjs
Copy link
Contributor Author

mitchjs commented Feb 26, 2024

after a weekend far as i can tell its working perfectly
i didnt use the web pages much just really once through it, but looks solid to me
i did want to disconnect my wall panel, and make sure emulation works
which to me is a strange thing not to even have a wall panel
i guess on could just have the single button (this is sec+1.0 thing)

@jgstroud
Copy link
Collaborator

I've been really busy so I haven't had a chance to review the new changes and merge, but I haven't forgotten about this.

@dkerr64
Copy link
Collaborator

dkerr64 commented Feb 26, 2024

The changes in this PR are all goodness in my opinion. However I am away from home this week and just checked on my device… it has lost its pairing with HomeKit. Web interface is still live, but no response in Apple home. Web page shows QR code and up time of 12 hours, which means it ran for about 3 days and crashed. I think all our efforts now need to focus on that. Need to capture logs from the moment of crash.

I’m suspecting a memory leak, whatever it is, is destroying record of HomeKit pairing. I’m wondering if an automatic reboot every 24 hours would be a nasty hack of a fix.

@dkerr64
Copy link
Collaborator

dkerr64 commented Feb 26, 2024

@dkerr64 , testing it now... web page looking good... your web programming way-way-way above my skills :)

The web page under-the-covers is greatly improved. It is essentially a single-page application (google it) which means no reloading when switching between pages, so the JavaScript remains always loaded, which is more goodness.

@dkerr64
Copy link
Collaborator

dkerr64 commented Mar 3, 2024

I have implemented the nasty hack... automatically reboot ratgdo every 24 hours (default) configurable between 1 and 72 hours, or disable by setting to zero. I believe that this will solve the un-pairing problem but should be considered a workaround rather than a proper fix.

@jgstroud what are your plans to merge this? There are significant updates worthwhile merging and getting more testing of.

@mitchjs
Copy link
Contributor Author

mitchjs commented Mar 3, 2024

@dkerr64 this hasn't happened to me... or my friends unit... we have not had any "unpairings"
which makes it spooky
also i could see that it had some memory leak, and reboots every once in a while
but what would cause the unpair
i

@dkerr64
Copy link
Collaborator

dkerr64 commented Mar 3, 2024

@dkerr64 this hasn't happened to me... or my friends unit... we have not had any "unpairings" which makes it spooky also i could see that it had some memory leak, and reboots every once in a while but what would cause the unpair i

Enough people are reporting the problem to suggest it is fairly common. And it is certainly "reliably" crashing and unpairing for me. If folks are uncomfortable with automatically rebooting every 24 hours, then I can change the default to never.

@mitchjs
Copy link
Contributor Author

mitchjs commented Mar 3, 2024

@dkerr64 so we can break down the subsystems and try to narrow down where its crashing
oh... im SEC1.0 and my friend has 2 of them going a SEC1 and SEC2
what is yours
we could comment out the webserver and see if it stays up
do you think one has to use it a lot to have this issue... ie if you dont acesss it for few days
ie, go back to just using native GDO opener controls...
do we have to look at the homekit lib are we using the newest

@dkerr64
Copy link
Collaborator

dkerr64 commented Mar 3, 2024

@dkerr64 so we can break down the subsystems and try to narrow down where its crashing oh... im SEC1.0 and my friend has 2 of them going a SEC1 and SEC2 what is yours we could comment out the webserver and see if it stays up do you think one has to use it a lot to have this issue... ie if you dont acesss it for few days ie, go back to just using native GDO opener controls... do we have to look at the homekit lib are we using the newest

I am sec 2.0+. I do not think it is anything to do with web server... I left for vacation and did not touch the device for 3 days, and it crashed. Being on vacation there was little to no activity (ie, no open/close requests from HomeKit or anything else), everything was idle -- and yet still it crashed.

I am going to disable auto reboot and leave it running with debug terminal open in hope I can capture something.

@brianost
Copy link

brianost commented Mar 4, 2024

As another data point, my three sec 1.0 devices now have 13 days of uptime without issue.

@mitchjs
Copy link
Contributor Author

mitchjs commented Mar 4, 2024

ok, mine must have rebooted!
it just went to 0 days 0 hours....
i have to set up a machine to see if a can capture log, im not sure how much the monitor in platformIO keeps
but i can set up a terminal with a log... so can search... and look for a reboot

@mitchjs
Copy link
Contributor Author

mitchjs commented Mar 4, 2024

so it was good all night, went to web page to look at uptime...
then closed web
and few seconds later

>>> [40394945] RATGDO: SSEheartbeat - client not listening on channel 0, remove subscription
>>> [40462506] RATGDO: get active: 1
>>> [40462511] RATGDO: get current door state: 1
>>> [40462517] RATGDO: get target door state: 1
>>> [40462524] RATGDO: get obstruction: 0
>>> [40462529] RATGDO: get current lock state: 0
>>> [40462534] RATGDO: get target lock state: 0
>>> [40462556] RATGDO: get light state: Off
>>> [40540958] RATGDO: get active: 1
>>> [40540963] RATGDO: get current door state: 1
>>> [40540968] RATGDO: get target door state: 1
>>> [40540976] RATGDO: get obstruction: 0
>>> [40540981] RATGDO: get current lock state: 0
>>> [40540986] RATGDO: get target lock state: 0
>>> [40541002] RATGDO: get light state: Off
>>> [40612458] RATGDO: get active: 1
>>> [40612463] RATGDO: get current door state: 1
>>> [40612468] RATGDO: get target door state: 1
>>> [40612476] RATGDO: get obstruction: 0
>>> [40612481] RATGDO: get current lock state: 0
>>> [40612486] RATGDO: get target lock state: 0
>>> [40612500] RATGDO: get light state: Off
>>> [40635674] RATGDO: get active: 1
>>> [40635679] RATGDO: get current door state: 1
>>> [40635684] RATGDO: get target door state: 1
>>> [40635691] RATGDO: get obstruction: 0
>>> [40635695] RATGDO: get current lock state: 0
>>> [40635701] RATGDO: get target lock state: 0

--------------- CUT HERE FOR EXCEPTION DECODER ---------------

Exception (9):
epc1=0x402284e3 epc2=0x00000000 epc3=0x00000000 excvaddr=0x624f220a depc=0x00000000

LoadStoreAlignmentCause: Load or store to an unaligned address
  epc1=0x402284e3 in homekit_client_process(_client_context_t*) at ??:?

mitch

@mitchjs
Copy link
Contributor Author

mitchjs commented Mar 5, 2024

i just changed build_type to debug, with hope to get more info out of the stack trace

@dkerr64
Copy link
Collaborator

dkerr64 commented Mar 5, 2024

i just changed build_type to debug, with hope to get more info out of the stack trace

I'd be interested in what additional information that provides.

The LoadStoreAlignment error is disconcerting! The ESP requires that memory is addressed on 32-bit boundaries for some data types. This exception occurs when a program attempts to load or store a 32-bit value at a non 32-bit aligned memory address. There are keywords (PSTR, PROGMEM) and functions specifically designed to address this. It should be easy to fix... if we can find out where the exception occurred.

I am at 26 hours and waiting for my ratgdo to crash... I expect it to take 3+ days.

@mitchjs
Copy link
Contributor Author

mitchjs commented Mar 5, 2024

ok, now a new crash... and tons more data
`--------------- CUT HERE FOR EXCEPTION DECODER ---------------

Soft WDT reset

Exception (4):
epc1=0x4021faae epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

Level1Interrupt: Level-1 interrupt as indicated by set level-1 bits in the INTERRUPT register
epc1=0x4021faae in fe_mul__distinct at .pio\libdeps\ratgdo_esp8266_hV25\HomeKit-ESP8266\src\wolfcrypt\src/fe_low_mem.c:444 (discriminator 2)

stack>>>

ctx: cont
sp: 3ffff6a0 end: 3fffffc0 offset: 0160
3ffff800: 1feee0af c64d292c ce0b1dd4 ec8613e4
3ffff810: f7383403 fc2463db 6351b489 3d860c12
3ffff820: de43b5e3 d1521dd8 913d82c6 9063f506
3ffff830: 89df332e dfe5dfcb 808e2bb7 74857c86
3ffff840: 32a84431 59c74c6d 9f8b497f 11413cc0
3ffff850: ce85e22b b7fcd6e6 782ccc2b 6da9dd95
3ffff860: 50706e36 cd52a9dc 24657672 7a013ed2
3ffff870: 914aa216 45701c18 50fe0111 6f5240a1
3ffff880: be54d534 0b04f4ac c33264f2 a3dde121
3ffff890: 92a6ff2a e3c17bef 1d3c772d 36ff7074
3ffff8a0: 1dc82a05 738b5d6f 84da2cf3 68c00211
3ffff8b0: c2c4bfeb 8d734531 d8d134e5 01a8630b
3ffff8c0: 8318b27a 2719f649 c3f0bff2 8b427b92
3ffff8d0: 5fd08441 fd6cf2ff c92acd3c 5cfc1e36
3ffff8e0: fe3296a5 979f4704 5f48a09b 7cea08eb
3ffff8f0: 81176732 dc0a43a7 e3dfe041 320b8898
3ffff900: 3ffff9f8 00000000 00188628 00000000
3ffff910: 00071c59 00000000 000e8a5b 3fff5dac
3ffff920: 3fff4d4c 3ffffaa0 3ffffb80 4020d50d
3ffff930: 324f2146 5493ce74 99ccd4b8 863d5015
3ffff940: 09025530 a7a5ba07 347a6aec 4bfd1e5d
3ffff950: 00000000 00000000 0cd761c7 c6d9b2cd
3ffff960: 98914474 ed72f20a be85930b a27f43f0
3ffff970: e922d91e 2b5df674 00000000 00000000
3ffff980: 97c232cc 82bb0e52 7fb101b8 a9eba568
3ffff990: 7db949b2 ec607f07 a74c3623 221a1c2a
3ffff9a0: 00000000 00000000 7c399229 38239629
3ffff9b0: c9bf3244 a3122bf3 9bdfbbbd 66dd3555
3ffff9c0: fdaee314 6c66d2d0 00000000 00000000
3ffff9d0: 26daeafa 65cca015 14e41ea0 b39faedf
3ffff9e0: 4645c9da 7fe70482 8f5df7f3 43027f67
3ffff9f0: 00000000 00000000 cc16f5ce 120680cf
3ffffa00: b966a536 874e01f5 d0d45f98 3215b026
3ffffa10: c2d23ea6 1664c85f 00000000 00000000
3ffffa20: 4a1d18b6 b92d7b03 e016eb09 3bd9571a
3ffffa30: 8866f152 03cbba6a f7c5f1e4 08e7cf89
3ffffa40: 00000000 00000000 e22b0d3c 83a53230
3ffffa50: 4c726335 33605a0d 2915fb40 42525342
3ffffa60: 64133205 59a21583 00000000 00000000
3ffffa70: 3ffffd10 3ffffd69 3fff4d2c 40208b35
3ffffa80: 34048428 013a12d8 4024800d 3ffe8368
3ffffa90: 00000003 00000000 3ffffbd0 3fff1ecc
3ffffaa0: c51cf42d 9c716710 0057452d e17b81a1
3ffffab0: 50fdbc0f 64d56ac3 0a6fdb63 093cf8d5
3ffffac0: 568205c2 94136ed7 f717bf5a 9f16a39e
3ffffad0: 752bdabd da7cbff7 0d6ebdb2 53acc9e7
3ffffae0: 01165b05 ffbe9eed 015b8863 ff1c9c08
3ffffaf0: 018cac9e ff8af77c fe34b125 00aaaebf
3ffffb00: fe7058a9 007ad3f6 feb8eb1d 007547ce
3ffffb10: 001b5810 00665143 ff35fb50 00c79520
3ffffb20: ff65679f 0069dfc8 fe178516 000bc09e
3ffffb30: 00000001 00000000 00000000 00000000
3ffffb40: 00000000 00000000 00000000 00000000
3ffffb50: 00000000 00000000 ffa2d5f5 ffadc1a5
3ffffb60: ff479faa 002de7ed fffedfb0 ff08d3e2
3ffffb70: fe7e3f39 00689c19 fe451aa3 000dc7e2
3ffffb80: 3916da4e 49c8a7fe 91cd4246 359e730e
3ffffb90: 239314ab b03716fa fcdb4811 a862ba32
3ffffba0: 138177a5 982bacc4 a7752034 f30cf5bb
3ffffbb0: ef10906b f5fa042c 850fa782 2bb15873
3ffffbc0: e99c8d85 a944c318 00000000 3ffffc90
3ffffbd0: 3ffffc00 00000000 00000000 00000000
3ffffbe0: 00000000 00000000 00000000 3ffffc90
3ffffbf0: 00000028 3fff5dec f3bcc908 6a09e667
3ffffc00: 84caa73b bb67ae85 fe94f82b 3c6ef372
3ffffc10: 5f1d36f1 a54ff53a ade682d1 510e527f
3ffffc20: 2b3e6c1f 9b05688c fb41bd6b 1f83d9ab
3ffffc30: 137e2179 5be0cd19 7b797949 43423233
3ffffc40: 06756c11 05002f28 a977b46f 11eefb0d
3ffffc50: 0d5e370b 3957da08 80000000 3bb7422f
3ffffc60: 00000000 00000000 00000000 00000000
3ffffc70: 00000000 00000000 00000000 00000000
3ffffc80: 00000000 00000000 00000000 00000000
3ffffc90: 00000000 00000000 00000000 00000000
3ffffca0: 00000000 00000000 00000000 00000000
3ffffcb0: 00000520 00000000 00000000 402033b0
3ffffcc0: 00000000 00000000 00000000 00000000
3ffffcd0: 00000000 43444301 30333845 35422d39
3ffffce0: 00000064 2d353944 34423941 3237462d
3ffffcf0: 00000730 00000020 3ffe8f00 3fff585c
3ffffd00: 3fff50e4 3fff5074 3fff4de4 4020344c
3ffffd10: 00000000 00000020 00000064 401017cd
3ffffd20: 3fff50e4 3fff5074 3fff4de4 40231c22
3ffffd30: 3fff5dac 3ffffe58 3ffffe94 00000000
3ffffd40: 00000000 45434443 39303338 3135422d
3ffffd50: 44342d45 412d3539 2d344239 31323746
3ffffd60: 45384535 33324243 b8eb1d00 81d51f36
3ffffd70: 2860dac0 7ed40cca c7951fcd 3ecacf3e
3ffffd80: 51634efe f0276178 00000002 00000000
3ffffd90: 00000000 00000000 00000000 00000000
3ffffda0: 00000000 00000000 00000000 00000000
3ffffdb0: 00000000 00000000 00000000 00000000
3ffffdc0: 00000000 00000000 00000000 00000001
3ffffdd0: 40230ca9 00000012 0000002b 3fff586c
3ffffde0: 00000108 bdb80dc1 00000860 00000430
3ffffdf0: 00000218 3fff5e70 00000002 3fff585c
3ffffe00: 00000012 3fff5c94 3fff586c 00000030
3ffffe10: 40004b31 3ffffe50 00000050 003fb080
3ffffe20: 4010735c 5263d48f 3ffefad0 401039d8
3ffffe30: 40100bcd 3ffffe50 3ffffec0 402033b0
3ffffe40: 00007fff 5263d48f 00000000 00000005
3ffffe50: 3fff58f7 00000020 00000068 401017cd
3ffffe60: 342d4531 00000000 3fff5c5c 40101808
3ffffe70: 3fff508c 3fff5dac 3fff575c 3fff5c5c
3ffffe80: 00000020 00000064 00000001 00000000
3ffffe90: 00000720 00000020 3ffe8f00 3fff5973
3ffffea0: 3fff5c94 00000012 3fff585c 40233574
3ffffeb0: 3fff5c94 0000003c 3fff5973 4020625c
3ffffec0: 3fff5974 3fff586c 00000000 00000108
3ffffed0: 3fff1894 00000000 00000000 00000000
3ffffee0: 3fff58f3 00000000 00000000 00000000
3ffffef0: 00000000 00000030 00000030 3fff58dc
3fffff00: 00000000 00000108 f0276178 00000002
3fffff10: 00000000 ebc6a7ef 00151782 3fff586c
3fffff20: 00000000 3fff18cc 3fff585c 40230ca9
3fffff30: 00000000 3fff234c 3fff0dec 40234e0b
3fffff40: 00000108 00000000 3fff0dec 3fff1ac4
3fffff50: 3fffdad0 3fff234c 3fffdab0 3fff1ac4
3fffff60: 3fffdad0 3fff39fc 3fff585c 402326f8
3fffff70: 00000000 00000000 3fffdab0 40233711
3fffff80: 00000000 00000000 00000001 4022247c
3fffff90: 3fffdad0 00000000 3fffdab0 402229ae
3fffffa0: feefeffe feefeffe 3fffdab0 4023bd5a
3fffffb0: feefeffe feefeffe feefeffe 40100ac9
<<<stack<<<

0x4020d50d in ge_double_scalarmult_vartime_lowmem at .pio\libdeps\ratgdo_esp8266_hV25\HomeKit-ESP8266\src\wolfcrypt\src/ge_low_mem.c:563
0x40208b35 in wc_ed25519_verify_msg at .pio\libdeps\ratgdo_esp8266_hV25\HomeKit-ESP8266\src\wolfcrypt\src/ed25519.c:274
0x4024800d in _printf_i at /workdir/repo/newlib/newlib/libc/stdio/nano-vfprintf_i.c:196 (discriminator 1)
0x402033b0 in crypto_ed25519_import_public_key at .pio\libdeps\ratgdo_esp8266_hV25\HomeKit-ESP8266\src/crypto.c:402
0x4020344c in crypto_ed25519_verify at .pio\libdeps\ratgdo_esp8266_hV25\HomeKit-ESP8266\src/crypto.c:475
0x401017cd in malloc at C:\Users\joy.platformio\packages\framework-arduinoespressif8266\cores\esp8266\umm_malloc/umm_malloc.cpp:912
0x40231c22 in homekit_server_on_pair_verify(_client_context_t*, unsigned char const*, unsigned int) at .pio\libdeps\ratgdo_esp8266_hV25\HomeKit-ESP8266\src/arduino_homekit_server.cpp:1716
0x40230ca9 in homekit_client_process(_client_context_t*) at .pio\libdeps\ratgdo_esp8266_hV25\HomeKit-ESP8266\src/arduino_homekit_server.cpp:2938
0x4010735c in spi_flash_read at ??:?
0x401039d8 in rcReachRetryLimit at ??:?
0x40100bcd in __wrap_spi_flash_read at C:\Users\joy.platformio\packages\framework-arduinoespressif8266\cores\esp8266/core_esp8266_phy.cpp:320
0x402033b0 in crypto_ed25519_import_public_key at .pio\libdeps\ratgdo_esp8266_hV25\HomeKit-ESP8266\src/crypto.c:402
0x401017cd in malloc at C:\Users\joy.platformio\packages\framework-arduinoespressif8266\cores\esp8266\umm_malloc/umm_malloc.cpp:912
0x40101808 in realloc at C:\Users\joy.platformio\packages\framework-arduinoespressif8266\cores\esp8266\umm_malloc/umm_malloc.cpp:944
0x40233574 in homekit_server_on_message_complete(http_parser*) at .pio\libdeps\ratgdo_esp8266_hV25\HomeKit-ESP8266\src/arduino_homekit_server.cpp:2796
0x4020625c in http_parser_execute at .pio\libdeps\ratgdo_esp8266_hV25\HomeKit-ESP8266\src/http_parser.c:1928 (discriminator 3)
0x40230ca9 in homekit_client_process(_client_context_t*) at .pio\libdeps\ratgdo_esp8266_hV25\HomeKit-ESP8266\src/arduino_homekit_server.cpp:2938
0x40234e0b in EspSoftwareSerial::UARTBase::rxBits() at .pio\libdeps\ratgdo_esp8266_hV25\EspSoftwareSerial\src/SoftwareSerial.cpp:490
0x402326f8 in homekit_server_process(homekit_server_t*) at .pio\libdeps\ratgdo_esp8266_hV25\HomeKit-ESP8266\src/arduino_homekit_server.cpp:3120
0x40233711 in arduino_homekit_loop at .pio\libdeps\ratgdo_esp8266_hV25\HomeKit-ESP8266\src/arduino_homekit_server.cpp:3595
0x4022247c in homekit_loop() at src/homekit.cpp:50
0x402229ae in loop at src/ratgdo.cpp:56
0x4023bd5a in loop_wrapper() at C:\Users\joy.platformio\packages\framework-arduinoespressif8266\cores\esp8266/core_esp8266_main.cpp:258
0x40100ac9 in cont_wrapper at C:\Users\joy.platformio\packages\framework-arduinoespressif8266\cores\esp8266/cont.S:81

--------------- CUT HERE FOR EXCEPTION DECODER ---------------`

@mitchjs
Copy link
Contributor Author

mitchjs commented Mar 5, 2024

ok, starting to reboot often now, same WDT Reset, got bad feeling its due to changing the build_type to debug
and losing the optimizations

confirmed back to release build... and no WDT resets

@dkerr64
Copy link
Collaborator

dkerr64 commented Mar 5, 2024

Can we move discussion on crash/reboot/no-response over to issue #94 please. I really want this PR merged and any code changes to fix the HomeKit bugs is going to take time and should be pushed separately from this PR.

@jstroud please review this PR and advise of any changes you want before merging.

@iyerusad
Copy link

iyerusad commented Mar 9, 2024

I have implemented the nasty hack... automatically reboot ratgdo every 24 hours (default) configurable between 1 and 72 hours, or disable by setting to zero. I believe that this will solve the un-pairing problem but should be considered a workaround rather than a proper fix.

@jgstroud what are your plans to merge this? There are significant updates worthwhile merging and getting more testing of.

Change default to 0/disabled please. A production build can have debug option but enabled by default is going to potentially generate alot of other issues/complaints. I'm willing to run latest builds but (knock on wood) my v.11.0 build is at 30 days up time without reboot/crash.

@dkerr64
Copy link
Collaborator

dkerr64 commented Mar 9, 2024

I have implemented the nasty hack... automatically reboot ratgdo every 24 hours (default) configurable between 1 and 72 hours, or disable by setting to zero. I believe that this will solve the un-pairing problem but should be considered a workaround rather than a proper fix.
@jgstroud what are your plans to merge this? There are significant updates worthwhile merging and getting more testing of.

Change default to 0/disabled please. A production build can have debug option but enabled by default is going to potentially generate alot of other issues/complaints. I'm willing to run latest builds but (knock on wood) my v.11.0 build is at 30 days up time without reboot/crash.

I don't consider this a debug option, rather a wise precaution to keep the board running smoothly... however, that said, we can change the default to disable the periodic reboot if that is consensus. Still waiting for @jgstroud to comment.

…24). If zero, then never reboot

Update web.cpp
@jgstroud jgstroud merged commit 54db210 into ratgdo:main Mar 9, 2024
@jgstroud
Copy link
Collaborator

jgstroud commented Mar 9, 2024

I merged with the default to disabled. Given the instabilities, I think it's fine to have this debug option, but enabling by default seems wrong to me. If people are having issues, its easy enough to enable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants