Code Monkey home page Code Monkey logo

blea2mqtt's Introduction

blea2mqtt

build

Send BLE sensors data to MQTT

Why transmit this to mqtt?

  • We may need several bluetooth radios to get decent coverage, as BLE is not a mesh network.
  • We decode the data locally, to save on data sent to mqtt. There are a lot more devices that may broadcast BLE signals and this is a problem if you live in an apartment.

A service to read Bluetooth low energy sensors in nodejs.

Requirements

  • nodejs v12+ (brew install node or using nvm)
  • yarn (npm i -g yarn)
  • a Bluetooth modem capable of BLE

Devices tested & working with this project

  • LYWSDCGQ Mi Thermohygrometer, powered by 1xAAA
  • HHCCJCY01 Mi Flora, also available from a lot of other brands, powered by 1xCR2032
  • CGDK2, a newer version of the Mi Thermohygrometer, powered by 1xCR2430
    • For this device to broadcast useful data, a pair to the official Qingping+ app was needed

Getting started

Before running this, keep in mind that this was tested with ubuntu and macOS in mind.

To run this in macOS (Prior to Monterey):

Go to System Preferences > Security & Privacy > Privacy (tab) > Bluetooth and add your terminal of choice to the list of allowed apps.

To run this in ubuntu/other gnu/linux distro:

./setup.sh

First, configure your mqtt server

cp .env.example .env
vim .env

There are a few things to configure in the .env file:

Variable Description
MQTT_HOSTNAME Mqtt server location
MQTT_USERNAME Mqtt server user
MQTT_PASSWORD Mqtt server password for the given user
MQTT_TOPIC Mqtt topic to publish information
MACHINE_NAME Name your data collection node
BLE_DEBUG Shows extra data (all ble broadcasts)

To install dependencies run the service, just:

yarn && yarn start

Project wishlist

  • Docker image

  • Docker Compose with full example

  • Prometheus exporter

blea2mqtt's People

Contributors

bitkill avatar dependabot[bot] avatar snyk-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

flobul

blea2mqtt's Issues

Is it possible work with node ver 14.16.1 ?

yarn install v1.22.17
[1/4] Resolving packages...
[2/4] Fetching packages...
error [email protected]: The engine "node" is incompatible with this module. Expected version "^12.22.0 || ^14.17.0 || >=16.0.0". Got "14.16.1"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

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.