Nanoleaf Aurora Support

+1 for support as well, just picked up the starter kit. These things are awesome.

Here is the official API documentation.

https://s3.amazonaws.com/aurora-api-docs/Aurora+Open+API+Documentation+v0.1.pdf?utm_source=sendinblue&utm_campaign=Nanoleaf_Aurora_Open_API_beta&utm_medium=email

looks like it should be quite capable. I’m excited to run some sensor notifications through it. Nice bright visual reminders.

2 Likes

Not sure how you managed to get hold of that but good work! Currently been using the ifttt maker channel to control basic functions which is working okay for some basic functions as the delay is only a few seconds for me.

Would love native support as well.

I signed up on the Nanoleaf dev to access api.

The Aurora OPEN API is now out of beta and now v1.

Im not a coder but trying and playing around

Been playing around for a few days.

Natively on command line the following works to turn aurora on and off

/usr/bin/curl -X PUT http://AURORAIPADD:16021/api/v1/myauthcode/state/on -d '{"value": true}'
/usr/bin/curl -X PUT http://AURORAIPADD:16021/api/v1/myauthcode/state/on -d '{"value": false}'

I cant seem to get it to work on HA

If I do:

# Nanoleaf Aurora
- platform: command_line
  switches:
      aurora:
          command_on: '/usr/bin/curl -X PUT http://AURORAIPADD:16021/api/v1/myauthcode/state/on -d '{"value": true}' '
          command_off: '/usr/bin/curl -X PUT http://AURORAIPADD:16021/api/v1/myauthcode/state/on -d '{"value": false}' '
          friendly_name: Nanoleaf Aurora

i get:

cat home-assistant.log
2017-05-12 10:45:56 ERROR (Thread-1) [homeassistant.util.yaml] while parsing a block mapping
in “/home/homeassistant/.homeassistant/switches.yaml”, line 5, column 7
expected , but found ‘’
in “/home/homeassistant/.homeassistant/switches.yaml”, line 5, column 123
2017-05-12 10:45:56 ERROR (MainThread) [homeassistant.bootstrap] Error loading /home/homeassistant/.homeassistant/configuration.yaml: while parsing a block mapping
in “/home/homeassistant/.homeassistant/switches.yaml”, line 5, column 7
expected , but found ‘’
in “/home/homeassistant/.homeassistant/switches.yaml”, line 5, column 123

I tried all sorts of ’ and " around the -d {“value”: true} but no joy.

Anybody have suggention on the syntax I can try?

Not sure on that one. I have been using the following code to control the lights with ifttt. It mostly works with minimal delay.

input_boolean:
  nanoleaf:
    name: Nanoleaf
    icon: mdi:triangle

automations:
  - alias: Turn aurora off
    trigger: 
      - platform: state
        entity_id: input_boolean.nanoleaf
        to: 'off'
    action:
      - service: ifttt.trigger
        data: {"event":"nanoleaf_off"}

  - alias: Turn aurora on
    trigger: 
      - platform: state
        entity_id: input_boolean.nanoleaf
        to: 'on'
    action:
      - service: ifttt.trigger
        data: {"event":"nanoleaf_on"}

Then scenes can be done with:

  - alias: Turn aurora white scene on
    trigger: 
      - platform: state
        entity_id: input_select.scene_select
        to: 'White'
    action:
      - service: ifttt.trigger
        data: {"event":"nanoleaf_white"}
      - service: input_boolean.turn_on
        entity_id: input_boolean.nanoleaf

I have the IFTTT but want to so its local on my network.

I made some progress on the on and off.

BTW /api/v1/ needs to be on firmware 1.5.0

switches.yaml

# Nanoleaf Aurora
- platform: command_line
  switches:
    aurora:
      command_on: '/home/homeassistant/.homeassistant/scripts/aurora-on.sh'
      command_off: '/home/homeassistant/.homeassistant/scripts/aurora-off.sh'
      friendly_name: Nanoleaf Aurora

aurora-on.sh

/usr/bin/curl -d '{"value": true}' -X PUT http://my aurora ip:16021/api/v1/myauroraauthkey/state/on

aurora-off.sh

/usr/bin/curl -d '{"value": false}' -X PUT http://my aurora ip:16021/api/v1/myauroraauthkey/state/on

Important: Dont forget to chmod 777 the 2 scripts.

I will continue to work on testing the effects and post the progress

Oh they look nice, next months un-necessary purchase :smile: Any reason for not using the rest API? Someone has already done the groundwork for a component https://github.com/martinschaef/aurora

Oh wow, super excited for the API to FINALLY be out of beta. Started taking a look around it today - wow this API is so much better than their AWFUL app and Alexa support. Eager to hack something together to get it working in hass.

robmarkcole, that python library is a nice little start, but it has a few problems. One, it assumes you’ve only got one aurora (I have 4, trying to get more now that the API is out.) Two, it’s using the beta API so calls need to be tweaked a bit. Three, it only turns stuff on/off.

There is a completed Node.js implementation here.

I’m going to play around with expanding the python version a bit for my purposes. I’m terrified of reinventing the wheel if someone else is working on a more robust version though.

1 Like

Okay, I ended up throwing away Martin’s python implementation and started writing my own. Didn’t really like how it was structured. Having now spent some time playing with the rest commands, it’s fairly straightforward to just map API calls with simple python methods. That’s exactly what the Node.js version I linked earlier does, and nothing more. I want to make something a bit more robust. For example, there’s an api call to set the light to a specific pre-programmed effect. But I want my lights to turn on to a different random effect each time. And the Nanoleaf phone apps are absolute shit - so I’d like to program in some basic things like an all-white mode so I can use the lights to actually see, because right now I have no way of doing that in the app without it crashing.

But that’s my longer-term plan. I’m just going to get on/off, brightness, and set effect working (nearly done now), then I’m going to work on integrating with hass. Because God I hate when other people talk about how they want to build a super robust system for a new lighting interface and then get bored and release nothing (and all the while nobody else starts working on it because someone else has already staked their claim.)

No estimate on when I’ll have something completed enough for testers. Hopefully soon, but certainly not today… I may have spent more than a few hours getting a web cam setup in my living room so I can see what I’m doing. :disappointed_relieved:

2 Likes

If you get to a testing stage I would be happy to help out. I agree that any home assistant integration would be far superior to the nanoleaf app which works 2/3 of the time if you’re lucky.

I’ve finished a very rudimentary python class. There’s still a ton more to do, but already it’s 1000 times better than Nanoleaf’s app. And oh, how fast and responsive these lights are now that you have direct control! Thoughts and feedback are appreciated!

https://github.com/software-2/nanoleaf

There’s zero error handling or logging. And requesting a token still has to be done manually. But my next step is learning how to get this all integrated in hass as a lighting component. Right now you can interface with my class using shell commands, but of course that’s far from elegant.

1 Like

Got a chance to try it out. In my case the ip address was the same as the router handed out so there wasn’t a need to use wireshark. I have only tested it with one aurora so far but I’ll try with a second when I get a chance. So far the performance has been great.

1 Like

Just an update: I was working on the hass module, but in the process I realized there are some big changes I want to make to the interface first, especially in the API. I’ve got it in and “working” sorta, but there’s a lot more work to go. Home Assistant has one “turn on” method for any change, but the Aurora API takes a different entry for each setting. I need to make this a lot cleaner and responsive.

I’ve updated the git repo with another class to find your Auroras and generate auth tokens. @TheOnlyMatty I’d really appreciate it if you could give this a try - hard to test this on different network configurations besides my own. :wink:

I tried the update and it worked perfectly. Perhaps reduce the scan to 60 seconds as the aurora was detected within a few seconds. Generating a api key also worked fine.

Thanks much! I also found all of my Auroras very quickly every time I tried. But the documentation says they broadcast once every 60 seconds, so I thought to give an error buffer of 15 seconds on each side. I’m a bit paranoid at replicating Nanoleaf’s app behavior of giving up too early, but I’ll play around with lowering it.

It was an interesting experience learning how to do that stuff. I actually found a bug in the tool Home Assistant uses to discover devices on the network. When I get closer to hass integration, I’ll see if I can fix it and make a pull request there.

I also just finished pip support, which will make future updates for everyone much easier.

pip install nanoleaf --upgrade

Okay, I’ve completed my massive overhaul of the python interface. We now have a proper non-hacky python3 package for Nanoleaf Aurora! This will unfortunately break any old scripts you’ve made, but the syntax is much cleaner now, and all the features we need for Home Assistant are now present.

Work on the hass component is again the highest priority. :smiley:

3 Likes

Thanks for all your hard work @Software2 I look forward to trying this out, is there a script for this to work with HA or is that not ready yet?

I’m working on a proper lighting component, so it’ll show up just like any other light. I had hoped to push a preliminary version up last weekend, but had a hardware failure that sucked up my free time. Fear not, I believe in the concept of regular backups! So hopefully this weekend I’ll have something ready for testers.

1 Like

Awesome! Thanks for the update.

Okay, one critical hardware failure and an expensive visit from an electrician later, I’ve finally pushed the alpha build of the Home Assistant component!

Since there is now a working component, I’ve created a new thread to manage future development. Consider this Feature Request thread completed! :santa:

https://community.home-assistant.io/t/nanoleaf-aurora-component/

3 Likes