项目作者: paulrosania

项目描述 :
A tiny CLI tool for controlling Nanoleaf
高级语言: Go
项目地址: git://github.com/paulrosania/picoleaf.git
创建时间: 2021-05-04T03:38:14Z
项目社区:https://github.com/paulrosania/picoleaf

开源协议:MIT License

下载


Picoleaf

Picoleaf is a tiny CLI tool for controlling Nanoleaf.

Installation

macOS

picoleaf is available via a Homebrew Tap:

  1. 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:

  1. go install github.com/paulrosania/picoleaf

Getting Started

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

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

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:

  1. $ dns-sd -Z _nanoleafapi | grep -o '\w*\-.*\.local'
  2. # => 16021 Nanoleaf-Light-Panels-xx-xx-xx.local
  3. #
  4. # Use this as your `host` setting. Don't forget to append the port number.
  5. #
  6. # (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.

[macOS only] .picoleafrc creation helper script

If you are using macOS, you can use a helper script to run these commands:

  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: ./contrib/macos/create_picoleafrc > ~/.picoleafrc

Usage

  1. # Power
  2. picoleaf on # Turn Nanoleaf on
  3. picoleaf off # Turn Nanoleaf off
  4. # Colors
  5. picoleaf hsl <hue> <saturation> <lightness> # Set Nanoleaf to the provided HSL
  6. picoleaf rgb <red> <green> <blue> # Set Nanoleaf to the provided RGB
  7. picoleaf temp <temperature> # Set Nanoleaf to the provided color temperature
  8. picoleaf brightness <temperature> # Set Nanoleaf to the provided brightness
  9. # Effects
  10. picoleaf effect list # List installed effects
  11. picoleaf effect select <name> # Activate the named effect
  12. picoleaf effect custom [<panel> <red> <green> <blue> <transition time>] ...
  13. # Panel properties
  14. picoleaf panel info # Print all panel information
  15. picoleaf panel model # Print Nanoleaf model
  16. picoleaf panel name # Print Nanoleaf name
  17. picoleaf panel version # Print Nanoleaf and rhythm module versions