GithubHelp home page GithubHelp logo

esp_ble_tracker's Introduction

esp_ble_tracker

Track the device according to the preset IRK by scanning the MAC address of the BLE device, and send status change notifications via MQTT

How to use

  • Burn the "get_irk" to the ESP32, use the phone's Bluetooth to pair with the ESP32, and print the IRK of the phone's Bluetooth in the console.

    (If you have multiple devices, please repeat the above steps)

  • Modify the macro definition in the "tracker/TrackerI.ino".

    eg:WiFiSSID,WiFiPWD,MQTT_SERVER,MQTT_USER,MQTT_PWD

  • Enter your device's IRK and username in the "tracker/TrackerI.ino"

    uint8_t irk[][ESP_BT_OCTET16_LEN] = {
      //your irks
      //eg:
      //{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
      //{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
    };
    String users[] = {
      //users
      //eg:
      "Jack", 
      "LeeMing"
    };
  • Compile and burn "tracker/TrackerI.ino" to ESP32 and power up

  • Subscribe to the MQTT topic "v1/trackeri/state" and you will receive status messages

    eg:

    {
        "Jacky": {
            "currentState": 1,
            "originalState": 1
        },
        "Danson": {
            "currentState": 1,
            "originalState": 1
        },
        "Neely": {
            "currentState": 1,
            "originalState": 1
        }
    }

    state code -1:Init

    state code 0:Not Found

    state code 1:Found

Integrated

Because the MQTT message queue is used, it can theoretically be integrated into all platforms that support MQTT

  • Home Assistant

    sensor:
     - platform:  mqtt
       name:  "Danson"
       state_topic:  "v1/trackeri/state"
       value_template:  "{{value_json['danson']['currentState'] | replace('1','At home') | replace('0','Leave home')}}"
     - platform:  mqtt
       name:  "DansonII"
       state_topic:  "v1/trackeri/state"
       value_template:  "{{value_json['dansonII']['currentState'] | replace('1','At home') | replace('0','Leave home')}}"
     - platform:  mqtt
       name:  "Neely"
       state_topic:  "v1/trackeri/state"
       value_template:  "{{value_json['Neely']['currentState'] | replace('1','At home') | replace('0','Leave home')}}"
  • Other

esp_ble_tracker's People

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.