Code Monkey home page Code Monkey logo

bluetooth_longrange_smarthome's Introduction

Bluetooth Long Range smart home

This allows building and using devices on top of Bluetooth Long Range.

The core of this is the app central which can be flashed on a nrf52840 USB dongle. The dongle provides two interfaces through USB:

  • USB-UART(ttyACM) with a zephyr shell
  • USB ethernet with a MQTT client

The dongle acts as a MQTT client so you have to start a broker on your computer.

The dongle will automatically connect to all bonded devices. You can create bondings using the bt connect ... and bt security 2 on the USB shell.

Additional shell commands

  • main stop: Cancel starting main app within 5s. Required for bonding devices using bt.

MQTT topics

All communication is done using hex strings. The dongle converts those from/to binary.

The dongle also subscribes to all subscribable characteristics.

Placeholders:

  • MAC: (random, not public) bluetooth MAC address.
  • HANDLE: 16bit GATT database handle. must always be 4 bytes.

Supported topics:

  • bluetooth/MAC/HANDLE/set: write to this to change the characteristic value
  • bluetooth/MAC/HANDLE/state: subscribe to this to receive characteristic notifications
  • bluetooth/MAC/connected: subscribe to this to receive connected/disconnected events. 00: disconnected, 01: connected.

Home-Assistant config samples

CO2-sensor

sensor:
- platform: mqtt
  unique_id: "00:11:22:33:44:55"
  state_topic: "bluetooth/00:11:22:33:44:55/001b/state"
  unit_of_measurement: "ppm"
  value_template: "{{ (value[2:4] | int('', 16) * 256) + (value[0:2] | int('', 16)) }}"
  device_class: "carbon_dioxide"
  availability:
  - payload_available: "01"
    payload_not_available: "00"
    topic: "bluetooth/00:11:22:33:44:55/connected"

Apps included in this repository

  • central: The USB dongle firmware
  • co2sensor: A S8 LP CO2 sensor connected to a nrf52840-dongle
  • dehumidifier: I replaced the MCU of a Comfee DG-30 dehumidifier with a nrf52840-mdk. This firmware can control the relays and read the waterbox status.

bluetooth_longrange_smarthome's People

Contributors

m1cha avatar

Watchers

 avatar  avatar

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.