Giter Site home page Giter Site logo

xiaomi-sensor's Introduction

xiaomi-sensor

python library to interact with Xiaomi Smart Home gateway and sensors (currently includes magnet sensor, motion sensor, temperature and humidity sensor).

  • sensor.py : interaction with Xiaomi Smart Home

  • automation.py: automation example code (the settings.py is not uploaded) to control devices like fan, humidifier, air purifier, light based on the sensors values via ifttt and gethook.

Trying to keep the code size minimal and simple to use, the sensor.py has about 300 lines of code, and automation.py has about 160 lines of code, and hopefully self-explained.

    automation = Automation()
    rules = {
        # subdevice_id : callback
        'f0b429b442b1': automation.onGatewayEvent,
        '158d000119f5c2': automation.onSensorHtEvent,
        '158d00010def50': automation.onSwitchEvent,
        '158d00010f3694': automation.onMotionEvent,
    }

    runLoop(rules, automation.onTimer)

xiaomi-sensor's People

Contributors

fuji246 avatar

Stargazers

 avatar  avatar  avatar YunXi avatar  avatar rchk avatar  avatar  avatar panfu avatar Enpeng Yao avatar  avatar  avatar Lujango avatar LYon avatar  avatar zjzhang avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

xiaomi-sensor's Issues

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.