Git Product home page Git Product logo

lywsd03mmcsensor's Introduction

LYWSD03MMCSensor

LYWSD03MMCSensor is a Javascript class to connect and get measurements from LYWSD03MMC (Xiaomi Mijia Bluetooth Thermometer 2) sensors using Bluetooth Web API.

This code has been tested in a computer with Windows 11 beta 21H2 and Edge 93.

Take in count:

  • At the time of writing (24th September 2021) Bluetooth Web API is in development stage. API may change and the code may stop working in any moment.
  • To enable Bluetooth Web API on Microsoft Edge you have to go to edge://flags/ and set the flag experimental-web-platform-features to true

Code samples

See file index.html

How to use

  1. Include a reference to the script file LYWSD03MMCSensor.js in your HTML page.
  2. Use Bluetooth Web API to select the device you want to connect to.
  3. Create a new instance of LYWSD03MMCSensor and pass the device in the constructor.
  4. Add event listener for onMeasurement to get temperature and humidity measurements.
  5. Optional: Add event listener for onLogMessage to get debug messages.
  6. Call method startMonitor() to start the periodic measurements.

Advanced

  • Measurement interval is set to 60000 milliseconds. To change the interval open the file LYWSD03MMCSensor.js and change the value of the variable measurementInterval

lywsd03mmcsensor's People

Contributors

branyac avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

lidonglei1

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.