Giter Club home page Giter Club logo

yeelight-platform's Introduction

yeelight-platform

NPM

npm npm CircleCI

Yet Another Yeelight API written in JS

Description

This package supports discovering, connecting and controlling Yeelight Devices. yeelight-platform is a zero-dependency solution for controlling Xiaomi/Yeelight Lights. There are already a number of other solutions available, but they were not exactly what I wanted, so I made another one to be better than all the others.

Competing standards

Installation

    $ npm install yeelight-platform

Usage :

Discover

    const YeeDiscovery = require('yeelight-platform').Discovery
    const discoveryService = new YeeDiscovery()

    discoveryService.on('started', () => {
        console.log('** Discovery Started **')
    })

    discoveryService.on('didDiscoverDevice', (device) => {
        console.log(device)
    })

    discoveryService.listen()
    /*
        {
            Location: 'yeelight://192.168.x.x:55443',
            id: '0x000000000xxxxx',
            model: 'bslamp1',
            support:
            'get_prop set_default set_power toggle set_bright start_cf stop_cf set_scene cron_add cron_get cron_del set_ct_abx set_rgb set_hsv set_adjust adjust_bright adjust_ct adjust_color set_music set_name',
            power: 'off',
            bright: '1',
            color_mode: '1',
            ct: '2752',
            rgb: '16750592',
            hue: '36',
            sat: '100'
        }
    */

Device

    const YeeDevice = require('yeelight-platform').Device

    const device = new YeeDevice({host: "192.168.0.190", port: 55443})

    device.connect()

    device.on('deviceUpdate', (newProps) => {
        console.log(newProps)
    })
    
    device.on('connected', () => {
        device.sendCommand({
            id: -1,
            method: 'set_power',
            params: ["on", 'smooth', 300]
        })
    })    

Compatible Devices

https://www.yeelight.com/en_US/product/wifi-led-c

https://www.yeelight.com/en_US/product/luna-mc

https://www.yeelight.com/en_US/product/luna

https://www.yeelight.com/en_US/product/mijia-lamp

https://www.yeelight.com/en_US/product/lemon-color

https://www.yeelight.com/en_US/product/lemon-ct

https://www.yeelight.com/en_US/product/pitaya-plus

https://www.yeelight.com/en_US/product/eos

https://www.yeelight.com/en_US/product/cherry1s

https://www.mi.com/us/yeelight-led-light-bulb/

https://www.mi.com/us/mi-bedside-lamp/

Lint

    $ npm run lint

API :

Yeelight Official API Documentation

https://www.yeelight.com/download/Yeelight_Inter-Operation_Spec.pdf

Author

Sahil Chaddha

[email protected]

yeelight-platform's People

Contributors

alexistm avatar sahilchaddha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

yeelight-platform's Issues

Xiaomi bedside lamp2

Great package, but cannot use with bedsdie lamp 2 (https://store.mi.com/in/item/3194300002).
Only port 80 is open (detected by ping), and cannot set "Lan control" with Xiaomi home application.

ps1: Instead of Xiaomi home I use (too) the Yeelight app (with same user+pass) and successfully enabled Lan control.

ps2: setpower command failed, but I have recognized the valid format:
device.sendCommand({
id: 1,
method: 'set_power',
params: ["on", 'smooth', '300']
})

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.