项目作者: ryan1432

项目描述 :
NanoLeaf Local API
高级语言:
项目地址: git://github.com/ryan1432/nanoleaf-api.git
创建时间: 2020-08-02T19:40:19Z
项目社区:https://github.com/ryan1432/nanoleaf-api

开源协议:MIT License

下载


NanoLeaf <Local API>

Table of Contents

  1. Getting Started
  2. Setting your Environment
  3. File Content
  1. .
  2. ├── ...
  3. ├── NanoLeaf Getting Started # Folder
  4. ├── Add an API user # POST | Create an API user
  5. ├── Basic # Folder
  6. └── Get controller info # GET | Get controller info
  7. └── Turn on # PUT | Turn NanoLeaf on
  8. └── Turn off # PUT | Turn NanoLeaf off
  9. └── List Effects # GET | List installed effects
  10. └── Activte Effect # PUT | Activate an effect
  11. └── Identify # PUT | Identify your NanoLeaf
  12. ├── Auth # Folder
  13. └── Delete user # DEL | Remove API user
  14. └── Add an API user # POST | Create an API user
  15. ├── State # Folder
  16. └── On/Off # GET | Get current state (On/Off)
  17. └── On/Off - update # PUT | Update state (On/Off)
  18. └── Brightness # GET | Get the current brightness
  19. └── Brightness - update # PUT | Update the brightness
  20. └── Hue # GET | Get the current Hue
  21. └── Hue - update # PUT | Update the hue
  22. └── Saturation # GET | Get the current Saturation
  23. └── Saturation - update # PUT | Update the Saturation
  24. └── Color Temperature # GET | Get the current Color Temperature
  25. └── Color Temperature - update # PUT | Update the Color Temperature
  26. └── Color Mode # GET | Get the current Color Mode
  27. ├── Effects # Folder
  28. └── Select # GET | Get current effect
  29. └── Select - update # PUT | Update effect
  30. └── List # GET | Get the list of installed effects
  31. └── Write # PUT | write effect to NanoLeaf
  32. ├── Layout # Folder
  33. └── Global Orientation # GET | Get orientation info
  34. └── Global Orientation - update # PUT | Update orientation info
  35. └── Layout # GET | Get the current layout
  36. ├── Rhythm # Folder
  37. └── Rhythm connected # GET | Get the rhythm connection info
  38. └── Rhythm active # GET | Get the rhythm active status
  39. └── Rhythm id # GET | Get the rhythm id
  40. └── Hardware version # GET | Get the hardware information
  41. └── Firmware version # GET | Get the firmware information
  42. └── Aux available # GET | Get the aux status
  43. └── Rhythm mode # GET | Get the rhythm mode
  44. └── Rhythm mode - update # GET | Update the rhythm mode
  45. └── Rhythm position # GET | Get the x,y position of the rhythm controller
  46. └── ...

Getting Started

  • Import NanoLeaf JSON file
  • Find the IP address of your NanoLeaf (MAC Address will always start with 00:55:da ) and update your environment.
  • Add an api user

    Add an API User

    A user is authorized to access the OpenAPI if they can demonstrate physical access of the Light Panels.

    Generate an authorization token

    1. On the Nanoleaf controller, hold the on-off button for 5-7 seconds until the LED starts flashing in a pattern.
    2. From the Postman app or your own app, send a POST request to the authorization endpoint within 30 seconds of activating pairing, like this (substituting the IP address and port for your central controller):

      http://xx.xx.xx.xx:16021/api/v1/new

      Finding your IP: The IP address of your Nanoleaf can be found using your router (MAC Address will always start with 00:55:da ). Once you have the Nanoleaf connected to your WiFi, go to your router webpage and browse the devices connected to your network. Once you find your Nanoleaf, you can see the IP assigned to the device.

      Remember if you’re accessing the Nanoleaf at a local IP address, like when your router assigns a local IP address to the connected devices, both the Nanoleaf device and the client accessing the Nanoleaf (Postman) must be on the same local network. For example, both the Nanoleaf and laptop with Postman should be connected to the same WiFi network.

      The result returned will be a 32-character authorization token that you will use in all of your subsequent calls.

  1. **Note:** In this request's test script, the auth token value will be set as an environment variable called `authToken`. If you already have an authorization token that you'd like to use, update your environment with the token.

Setting your Environment

  • These examples will be from Insomnia API
  • Base Environment {"ipAddress":"xx.xx.xx.xxL18021","authToken":"XXXXX"}

More updates coming soon