Giter Club home page Giter Club logo

picoleaf's Introduction

Picoleaf

Picoleaf is a tiny CLI tool for controlling Nanoleaf.

Installation

macOS

picoleaf is available via a Homebrew Tap:

brew install paulrosania/command-home/picoleaf

You can also download a precompiled binary from the releases page.

Source

Make sure Go is installed, and that $GOPATH/bin is on your $PATH. Then run:

go install github.com/paulrosania/picoleaf

Getting Started

Picoleaf expects a .picoleafrc file in your home directory, with the following settings:

host=<hostname or ip address>:<port>
access_token=<token>

Manual creation of .picoleafrc

You can find your Nanoleaf's IP address via your router console. Your Nanoleaf's port is probably 16021.

Alternatively, you may be able to use mDNS service discovery. For example, on macOS you can do the following:

$ dns-sd -Z _nanoleafapi | grep -o '\w*\-.*\.local'

# => 16021 Nanoleaf-Light-Panels-xx-xx-xx.local
#
# Use this as your `host` setting. Don't forget to append the port number.
#
# (You'll need to Ctrl-C to wrap up, since `dns-sd` listens indefinitely.)

To create an access token, you'll need to do the following:

  1. On your Nanoleaf controller, hold the on-off button for 5-7 seconds until the LED starts flashing in a pattern.
  2. Within 30 seconds, run: curl -iLX POST http://<ip address>:<port>/api/v1/new

This should print a token to your console.

Create and edit ~/.picoleafrc with the values you have discovered.

Use of the create picoleafrc helper

This tiny script will put together your .picoleafrc file for you.

  1. On your Nanoleaf controller, hold the on-off button for 5-7 seconds until the LED starts flashing in a pattern.
  2. Within 30 seconds, run: ./create_picoleafrc > ~/.picoleafrc

Usage

# Power
picoleaf on   # Turn Nanoleaf on
picoleaf off  # Turn Nanoleaf off

# Colors
picoleaf hsl <hue> <saturation> <lightness>  # Set Nanoleaf to the provided HSL
picoleaf rgb <red> <green> <blue>            # Set Nanoleaf to the provided RGB
picoleaf temp <temperature>                  # Set Nanoleaf to the provided color temperature
picoleaf brightness <temperature>            # Set Nanoleaf to the provided brightness

# Effects
picoleaf effect list           # List installed effects
picoleaf effect select <name>  # Activate the named effect
picoleaf effect custom [<panel> <red> <green> <blue> <transition time>] ...

# Panel properties
picoleaf panel info     # Print all panel information
picoleaf panel model    # Print Nanoleaf model
picoleaf panel name     # Print Nanoleaf name
picoleaf panel version  # Print Nanoleaf and rhythm module versions

picoleaf's People

Contributors

jcdietrich avatar jdietrich-tc avatar tessro 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.