HeimdallMidgard / ESP-32-BLE-Scanner

ESP 32 BLE Scanner for Home Assistant to report Room Presence
GNU General Public License v3.0
38 stars 7 forks source link

New UI and settings #7

Closed nashant closed 3 years ago

nashant commented 3 years ago

Mostly changes based around UI.

Adds MiniCSS for css and AlpineJS as a minimal javascript framework, new devices and settings pages. New settings format to allow for this and easy extension to settings, migrations from old settings format included. Allow adding of unlimited devices.

nashant commented 3 years ago

Hold up, not quite ready I've realised

nashant commented 3 years ago

Ok, now it's ready

HeimdallMidgard commented 3 years ago

Hey nashant. I tried to build your fork but when I connect the core is panic'ing and the ESP32 restarts. Andriensis also added some bugfixes so I created branch 0.2 so we can work there together on the next version. What I could see from the new design and changes it looks really awesome. Thanks for adding it.

nashant commented 3 years ago

I think I might be leaking memory somewhere. When reading pointers from the json doc the data is corrupted and the memory addresses are, I think, fairly close to the end of the address space. I think. But again, this is the first c++ I've ever touched.

On Wed, 25 Aug 2021, 21:09 HeimdallMidgard, @.***> wrote:

Hey nashant. I tried to build your fork but when I connect the core is panic'ing and the ESP32 restarts. Andriensis also added some bugfixes so I created branch 0.2 so we can work there together on the next version. What I could see from the new design and changes it looks really awesome. Thanks for adding it.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/HeimdallMidgard/ESP-32-BLE-Scanner/pull/7#issuecomment-905838292, or unsubscribe https://github.com/notifications/unsubscribe-auth/AATNTOF34KQJOS5UMTRIOJLT6VEV3ANCNFSM5CZALCRQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

HeimdallMidgard commented 3 years ago

Issue was the delay. I increased the delay time. Issue is gone now. I also changed some little things after reading your code updates. I would like to work in 0.2 branch and close this pull request so we can work together on it. Is this okay for you?

nashant commented 3 years ago

Absolutely, sounds like a great idea. I found increasing the interval and window sorted things out. I think that by the time the devices were being processed they had already been replaced in the scan (with duplicates set to be filtered out).

Just done another large push splitting things out and having a better way of initialising settings. Still need to sort out migration of devices a bit more.

HeimdallMidgard commented 3 years ago

Tbh I don't think this needs migration. Settings can just be done new. I don't think so many ppl are using this right now. Main problem I see at the moment is that the scanner doesn't work (didnt check your update right now). Can you please push updates inside the 0.2 than I don't need to do this handy. Thanks.

nashant commented 3 years ago

I've re-targeted to 0.2, feel free to merge into 0.2 and test

nashant commented 3 years ago

Adding the telemetry has been useful. Using a global mqtt_msg is leaking memory. It takes ~20mins for the heap to drop to ~50k free. I've switched it to using a local scoped char instead and the heap is holding strong at ~150k. Need to solve the problem of reporting to the webpage though, I'm thinking maybe an async websocket

nashant commented 3 years ago

Currently { "results_last_scan": "3", "free_heap": "147216", "uptime": "29243" }

nashant commented 3 years ago

Websocket done

andriensis commented 3 years ago

settings.json doesn't seem to contain bluetooth key for bluetooth settings (scan_time, scan_interval)

nashant commented 3 years ago

Doesn't need to. If you check all the initSettingsBlah functions you'll see how they get created. In fact you don't need settings.json or devices.json at all, they'll both get initialised on first boot. Also means that one doesn't need to re-flash the data if new settings are added

HeimdallMidgard commented 3 years ago

At the moment the scanner function is broken. Core is panicing.