All Projects → ChrisScheffler → Miflora

ChrisScheffler / Miflora

Licence: mit
Node.js package for the Xiaomi Plant Sensor Flower Care (Mi Flora)

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Miflora

Xiaomi Kettle
Xiaomi Kettle BLE protocol reverse-engineered
Stars: ✭ 187 (+392.11%)
Mutual labels:  xiaomi, ble
Xiaomi Flower Care Api
Xiaomi Flower Care (MiFlora) API wrapper.
Stars: ✭ 111 (+192.11%)
Mutual labels:  xiaomi, ble
mi-lamp-re
💡 Reverse Engineering Notes for the Yeelight Bedside Lamp (BLE)
Stars: ✭ 35 (-7.89%)
Mutual labels:  ble, xiaomi
Openmqttgateway
MQTT gateway for ESP8266, ESP32, Sonoff RF Bridge or Arduino with bidirectional 433mhz/315mhz/868mhz, Infrared communications, BLE, Bluetooth, beacons detection, mi flora, mi jia, LYWSD02, LYWSD03MMC, Mi Scale, TPMS, BBQ thermometer compatibility, SMS & LORA.
Stars: ✭ 2,413 (+6250%)
Mutual labels:  xiaomi, ble
Xiaomigateway3
Control Zigbee, BLE and Mesh devices from Home Assistant with Xiaomi Gateway 3 (ZNDMWG03LM) on original firmware
Stars: ✭ 617 (+1523.68%)
Mutual labels:  xiaomi, ble
ble2mqtt
Bluetooth to MQTT bridge, add your bluetooth-capable (including controllable) devices to your smart home
Stars: ✭ 46 (+21.05%)
Mutual labels:  ble, xiaomi
esphome-components
ESPHome components
Stars: ✭ 62 (+63.16%)
Mutual labels:  ble, xiaomi
Esp32 ble arduino
The library source for the ESP32 BLE support for Arduino.
Stars: ✭ 552 (+1352.63%)
Mutual labels:  ble
Open Home Automation
Open Home Automation with Home Assistant, ESP8266/ESP32 and MQTT
Stars: ✭ 820 (+2057.89%)
Mutual labels:  ble
Esp32 Ble Keyboard
Bluetooth LE Keyboard library for the ESP32 (Arduino IDE compatible)
Stars: ✭ 533 (+1302.63%)
Mutual labels:  ble
Homepwn
HomePwn - Swiss Army Knife for Pentesting of IoT Devices
Stars: ✭ 526 (+1284.21%)
Mutual labels:  ble
Xiaomi Cloud Tokens Extractor
This tool/script retrieves tokens for all devices connected to Xiaomi cloud and encryption keys for BLE devices.
Stars: ✭ 587 (+1444.74%)
Mutual labels:  xiaomi
Esp32 ble wedo
A library to control LEGO wedo 2.0 with the ESP32 through Bluetooth low energy
Stars: ✭ 16 (-57.89%)
Mutual labels:  ble
Mihome Binary Protocol
Stars: ✭ 536 (+1310.53%)
Mutual labels:  xiaomi
Make Mi Air Purifier Great Again
A smart automation alternative to Mi Home.
Stars: ✭ 32 (-15.79%)
Mutual labels:  xiaomi
Android Dfu Library
A library with DFU feature for Android 4.3+.
Stars: ✭ 532 (+1300%)
Mutual labels:  ble
Saberlight
Collection of tools to control some "smart" BLE bulbs [Mirror]
Stars: ✭ 36 (-5.26%)
Mutual labels:  ble
Zigbridge
Zigbee gateway implementation
Stars: ✭ 21 (-44.74%)
Mutual labels:  xiaomi
Shiny
A Xamarin Framework for Backgrounding & Device Hardware Services (iOS, Android, UWP, Tizen, tvOS, watchOS, & more coming soon)
Stars: ✭ 763 (+1907.89%)
Mutual labels:  ble
Node Red Contrib Generic Ble
A Node-RED node set for providing access to generic BLE peripheral GATT characteristics.
Stars: ✭ 20 (-47.37%)
Mutual labels:  ble

miflora

Node.js package for the Xiaomi Mi Flora Plant Sensor built on top of noble (maintained by abandonware).

npm language XO code style commit firmware licence

Have a look in the Wiki for more information on the sensor.


Prerequisites

Please see the Prerequisites section for noble.

Install

npm install miflora

Usage

The library uses async/await code syntax instead of Promises chaining in order to execute asynchronous code sequentially. Since all internal code is based on Promises you still can use the method().then().catch()-pattern regardless.

All examples use async/await syntax.

Discover devices

const devices = await miflora.discover();
console.log('devices discovered: ', devices.length);

In this example we listen for 10000 (default value) milliseconds (10 seconds) and print out the number of detected devices.

Discover devices (advanced)

const opts = {
  duration: 60000,
  ignoreUnknown: true,
  addresses: ['c4:7c:8d:65:d6:1d', 'c4:7c:8d:65:d5:26', 'c4:7c:8d:65:e6:20']
};
const devices = await miflora.discover(opts);
console.log('devices discovered: ', devices.length);

This time we listen for 60000 milliseconds (60 seconds) or until all devices from given opts.addresses have been discovered and print out the number of detected devices. If opt.ignoreUnknown is true, devices which are not in opt.addresses will be ignored in result.

Query device information

All query methods implicitly initiate a connection if none exists. You can call device.connect() explicitly if you like nevertheless.

The library however doesn't perform a disconnect implicitly. You can call device.disconnect() when you have finished you queries or let you disconnect automatically from the device after 10 seconds.

Firmaware & Battery

const data = await device.queryFirmwareInfo();
console.log(data);

Example output:

{ address: 'c4:7c:8d:65:e6:20',
  type: 'MiFloraMonitor',
  firmwareInfo: { battery: 100, firmware: '3.1.9' } }

Sensor values

const data = await device.querySensorValues();
console.log(data);

Example output:

{ address: 'c4:7c:8d:65:e6:20',
  type: 'MiFloraMonitor',
  sensorValues: { temperature: 21.1, lux: 104, moisture: 36, fertility: 1049 } }

Serial Number

const data = await device.querySerial();
console.log(data);

Combined query

const data = await device.query();
console.log(data);

Debugging

The library uses Debug with the logger names miflora and miflora:device. You can start your script with prefixing DEBUG=miflora* to see all debug output.

DEBUG=miflora* node yourapp.js

References

Licence

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].