Giter Club home page Giter Club logo

miplant's Introduction

MiPlant

A Python-library for reading cheap plant monitoring sensors manufactured by Xiaomi.

Installation

# There's a issue with bluepy-helper not being built in v1.0.5 in PyPi
#   -> install bluepy from github
pip install git+https://github.com/IanHarvey/bluepy.git
pip install miplant

Usage

Scripts using the library need to be run as root, as using BLE typically requires it.

from miplant import MiPlant

for plant in MiPlant.discover():
    print(plant.temperature)

Overview

The sensors read 4 values:

  • temperature in degrees Celsius (float, with 1 decimal precision)
  • light level in lux (integer)
  • moisture level in percent (integer)
  • conductivity in µS/cm (integer)
    • presented as "fertility" in many places, even the official app

The values are only read when the MiPlant.read() -function is called, or when one of the values is requested for the first time.

Notes

  • The scripts using this library need to be (at least typically) run as root, as gattlib requires setting up some options for Bluetooth Low Energy.
  • Currently only tested with Python 2.7, but should work if gattlib works...
  • The sensors seem to have some kind of internal cache, so don't even bother reading them too frequently.

Thanks

Big thanks goes to Reverse engineering the Mi flora plant sensor! I wouldn't have bothered with reverese engineering the messages myself :P

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.