Git Product home page Git Product logo

itag-mqtt-bridge's Introduction

ITag MQTT Brigde

This project scans, automatically connects for nearby ITag devices and bridges their events to mqtt.

This BLE to MQTT bridge enables you to use you smart BLE tags with any smart home solution which uses MQTT either your own custom one or e.g. HomeAssistant

ITag is cheap <2โ‚ฌ BLE device equipped with button and piezzo buzzer.

Usage

sudo is needed to build noble dependencies

sudo yarn install 
yarn start

Running without sudo

See this link

MQTT

  • itag/<tag uuid>/presence emits values 1 or 0 if the device is connected or not
  • itag/<tag uuid>/button/click emits 1 on button click and 2 on button double-clic
  • itag/<tag uuid>/rssi emits the RSSI signal at a configured frecuency
  • itag/<tag uuid>/battery/level emits the RSSI battery level at a configured frecuency
  • itag/<tag uuid>/alert/continuous on payload: < miliseconds > will perform a continuous piezzo aler for ms duration
  • itag/<tag uuid>/alert/beep on payload: < miliseconds > will perform a beeping piezzo aler for ms duration

Configuration

Is done using environment variales.

  • BEEP_ON_ITAG_CONNECT default: true -> tag will beep after connecting to your computer
  • LOG_LEVEL default: debug (see: winston log levels)
  • rssi_update_interval default:15000 -> Value in ms at which the iTag's RSSI will be updated
  • double_click_interval default:800 -> Value in ms that sets the threshold for the second click to be read as a double-click action
  • home_assistant default:1 -> Enables or disables HomeAssistant MQTT auto-discovery
  • MQTT_BASE_TOPIC default:itag
  • MQTT_URL default: mqtt://localhost:1883 (see:mqtt.js format)
  • MQTT_USERNAME default: null
  • MQTT_PASSWORD default: null

ITag BLE

ITag i bought on e-bay

Note: ITag has some other services and characteristics available, below are listed only interesting ones

Services

  • 1802 -> Immediate Alert [ Alert Level ]
  • 1803 -> Link Loss [ Alert Level ]
  • ffe0 -> Button [ Click ]

Characteristics

  • ffe1 -> Click [ notify ]
  • 2a06 -> Alert Level [ read write ]
    • 0x00 -> no alert
    • 0x01 -> mild alert (continuous)
    • 0x02 -> high alert (beeping)

Challenges

At leat with current hardware (there are different iTag hardware iterations) there is a scenario where NOBLE connects with the TAG but fails to discover and subscribe to characteristics. Currently there is a rough approach to solve this by the UpdateRSSI function, but is a dirty one. If anyone could help refining this failsafe prodcedure, it would be great.

Inspired by

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.