Code Monkey home page Code Monkey logo

yeety's Introduction

Yeety

Buy Me a Coffee at ko-fi.com

Yeelight (Xiaomi Mi Light) RGB ambience controller for GNU/Linux. Works by taking a screenshot (of a specified monitor) 2-3 times per second, and setting the light bulb's color to the dominant color on the screenshot. You can enable rate limiting so that your client does not get blocked.

Status

STABLE, NO SOLID FUTURE - You can use it I guess.

Features

  • ๐Ÿ–ฅ Single Monitor support
  • ๐Ÿ’ก Single RGB Bulb support
  • ๐ŸŒ Blazing Slow response time
  • It works tho :D

Requirements

  • Python 3+
  • git
  • pip
  • os
  • mss (for screenshots)
  • time
  • readchar
  • yeelight
  • colorthief
  • Dev mode/LAN control enabled for the light bulb

Setup & Usage

  1. Clone this repository:

    git clone https://github.com/recoskyler/yeety.git; cd yeety; chmod +x yeety.py
  2. Install the required packages:

    pip3 install -U mss colorthief yeelight readchar
  3. Set the necessary vars in the yeety.py file:

    nano ./yeety.py
    # ./yeety.py
    
    # ...
    
    #*###########################
    #* SET UP THE VARIABLES BELOW
    #*###########################
    
    ##! REQUIRED
    screenshot_path = "/tmp/yeety/screenshot.png"
    
    ##! REQUIRED (min 0)
    monitor = 2
    
    ##! REQUIRED (min 1)
    max_per_second = 55
    
    ##! REQUIRED (min 1, max 10. 1 Highest quality, takes the longest time...)
    quality = 10
    
    ##? Optional
    light_ip = "192.168.1.23"
    
    ##* REQUIRED-ish ("sudden"/"smooth", can be None, will default to "smooth")
    effect = "smooth"
    
    ##* REQUIRED-ish (can be None, will default to False)
    auto_on = True
    
    ##* REQUIRED-ish (min 30, can be None, will default to 300ms)
    duration = 300
    
    #*###########################
    
    # ...
  4. Run the file using the command:

    ./yeety.py

    Press Ctrl+c to stop the program

Running in the background

nohup ./yeety.py &

nohup COMMAND & allows the command to detach and run in the background, so that you can close the terminal.

Stopping the background app

  1. Type the following command in the terminal:

    โฏ ps -x | grep yeety.py
  2. Take a look at the command's output. If you see a line similar to 350017 ? RN 4:47 /usr/bin/python3 ./yeety/yeety.py. If you don't see a line similar to this one, then the background app is not running. The following is an example of a full output:

    350017 ?        RN     4:47 /usr/bin/python3 ./yeety/yeety.py
    352201 pts/1    S+     0:00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn --exclude-dir=.idea --exclude-dir=.tox yeety.py

    You should ignore the part with grep --color=auto .....

    The thing we are interested in is the first number on the interesting line: 350017, which will be different in your case. Copy that number to your clipboard.

  3. Type the following command to exterminate the background app:

    kill 350017
    kill THE_NUMBER_YOU_JUST_COPIED

yeety's People

Contributors

recoskyler avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

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.