Giter VIP home page Giter VIP logo

Comments (14)

shogunxam avatar shogunxam commented on July 19, 2024

Hi @hismastersvoice, I am glad you appreciate my work.
I don't see any technical problems implementing your request, other than the code would get a little bigger, but I honestly don't see the benefit.
Could you explain in more detail why a continuous scan isn't right for you?
This would help me understand if this is a change that other users might need as well.

from esp32_bletracker.

hismastersvoice avatar hismastersvoice commented on July 19, 2024

Good moring @shogunxam,

thanks for you fast response.

The continuous scan is good as it is.

My need is...

  • I start different action by entering the house or garage, defined to the right person.
  • For battery saving reason, I don't what to do scanning <10 sec.
  • If I open the door, in worst case it takes 10 sec. before the action is starting.
  • For me this is sometimes to long

Now I want to start scanning by opening the door contact or when NFC access is granted.
Then I got in 1-2 sec. the right person, and can start action(s).

At the moment I only can do not personalized actions.

Thanks.

from esp32_bletracker.

shogunxam avatar shogunxam commented on July 19, 2024

I have created the branch Manual_start_stop_scan. I haven't tested it yet, just wrote a first draft of the code.
I think I'll have time to work on it this weekend.
If you want give it a try, change the line 106 of the settings.cpp
from
manualScan = eManualSCanMode::eManualSCanModeDisabled;
to
manualScan = eManualSCanMode::eManualSCanModeOff

Than you should be able to start and stop the scan using the api

GET  http://<device_ip>/scan?on=1
GET  http://<device_ip>/scan?off=1

I think also

GET  http://<device_ip>/scan?on
GET  http://<device_ip>/scan?off

should be enough.

But I don't guaratee it works 😃

from esp32_bletracker.

hismastersvoice avatar hismastersvoice commented on July 19, 2024

Thanks !
Will try it, and come back.

from esp32_bletracker.

hismastersvoice avatar hismastersvoice commented on July 19, 2024

on=1 turned on the scan
off=1 turn off, but than starts spamming MQTT with a lot of messages.

Will have a closer look this days.

from esp32_bletracker.

shogunxam avatar shogunxam commented on July 19, 2024

I have updated the branch adding a new check box in the configuration page to enable/disable the manual scan (by default is disabled) and than when the scan is off the device state is published only every two minutes.
Could you please give a try and let me know what do you think?

from esp32_bletracker.

hismastersvoice avatar hismastersvoice commented on July 19, 2024

Thanks for changing...
I'm on a business trip until Friday morning, test on Friday afternoon.

from esp32_bletracker.

hismastersvoice avatar hismastersvoice commented on July 19, 2024

@shogunxam
Thanks for working on a solution!

Works like you describe...
But the result of the scan is also submitted after e.g. 10 sec., so if I scan automatically or manual is the same timing.
Or do I understand the function wrong?

from esp32_bletracker.

shogunxam avatar shogunxam commented on July 19, 2024

When the scan is enabled in auto or manual mode the timing of the publication is the same.
When the scan is set to manual but it's off, to avoid to spam on MQTT (because there is no more the delay of the scan), the publication of the state is sent every 2 minutes. Obviously when scan is off the BLE device will be considered non present.
If this is sufficient for your needs I'll merge the changes in the master branch.

from esp32_bletracker.

hismastersvoice avatar hismastersvoice commented on July 19, 2024

"If this is sufficient for your needs I'll merge the changes in the master branch."
Yes an no... ;)

My idea was to get faster Information about presence, now I had in both situations the 10 sec. or however the scan time is set.
When I look with my little knowledge to the code, the scan result are submitted after the full scan-period e.g. 10 sec., and not after new device was found. I'm not sure, but it looks like that I only can set down the scantime, and start / stop by a logic to get faster results.

Is it possible the the manual scan stops after every loop automatically?.
So I don't have to set two commands.
Also it is more reliable if the scan?off=1 not reach the controller.

from esp32_bletracker.

shogunxam avatar shogunxam commented on July 19, 2024

I don't have full control over the BLEScan library, it's a 3rd party library.
This library take in input a time for the scan and a callback. In this callback I get the advertised devices but I don't have control on the main loop of the library where it waits until the scan period is ended.
You can reduce the scan period, but I cannot stop the manual scan when the scan ends, because in that period the device could not be advertised. You should stop the scan when you are informed about the presence of the new device.
Also, reducing the scan period could cause you to lose a second device.

from esp32_bletracker.

hismastersvoice avatar hismastersvoice commented on July 19, 2024

Thanks for explanation...
I habe installed today an additional motion detector, so the scan starts some second before the user reach the door.
So together with the door contact it fits now perfect with the manual scan an the 10 sec scan time.

Thanks again for do the changes special for me.
Now I have the perfect solution!!!!!!! ;)

from esp32_bletracker.

hismastersvoice avatar hismastersvoice commented on July 19, 2024

Please take the changes to the master branch, so everybody can use it.

from esp32_bletracker.

hismastersvoice avatar hismastersvoice commented on July 19, 2024

Also I have change the Hardware today to XIAO ESP32-C3 with external Antenna and the scan radius is amazing.
I only need only 2 instead of 4 devices to cover the house and garage.

from esp32_bletracker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.