Trigger Nanoleaf Scene?

I’ve got the new Nanoleaf Shapes, and I’ve added them into HA manually.

I’ve got a scene that I’d like to turn on and set to different brightnesses throughout the day, however I can’t find any documentation on how to do this?

add this to your configuration.yaml. Fill ‘YOURLOCALPANELIP’ and ‘YOURTOKEN’ with your values. To get your token go to: https://www.home-assistant.io/integrations/nanoleaf/

shell_command:
  nanoleaf_brightness: "curl -X PUT -H \"Content-Type: application/json\" -d '{\"brightness\" : {\"value\":{{ brightness }} }}' \"http://YOURLOCALPANELIP:16021/api/v1/YOURTOKEN/state/\""
  nanoleaf_scene: "curl -X PUT -H \"Content-Type: application/json\" -d '{\"select\" : \"{{ scene }}\"}' \"http://YOURLOCALPANELIP:16021/api/v1/YOURTOKEN/effects/\""

Script example:

nanoleaf_scene:
  alias: Nanoleaf scene
  sequence:
  - service: shell_command.nanoleaf_scene
    data:
      scene: 'shooting stars'

nanoleaf_brightness:
  alias: Nanoleaf brightness
  sequence:
  - service: shell_command.nanoleaf_brightness
    data:
      brightness: 95
2 Likes

This seems a little primitive. Lots of variable repetition etc.

Is there nothing a little more elegant?

If you find it, let me know.

That looks pretty elegant to me

you don’t need to create a script for every scene if that is what you mean with that. The script is just an example. You can do the following whithin any automation/script/whatever:

  - service: shell_command.nanoleaf_scene
    data:
      scene: 'name of your scene here'

I use this in all my automations:

    - service: light.turn_on
      data:
        entity_id: light.nanoleaf
        brightness_pct: 30
        effect: '20MinSunset'
1 Like

I read that somewhere but I had no success :confused:
I wonder if the scene needs to be uri encoded or spaces removed

Did you add the Nanoleaf into HA?

Push the on button for 5 seconds on Nanoleaf then on command line:

curl -i -X POST http://192.168.1.155:16021/api/v1/new

(IP number must be the one of Nanoleaf

You get a token then something like this: mFEqo1l7AdheueCcXtbmXi8pb4AJQXXs

  • platform: nanoleaf
    host: 192.168.100.61
    token: HERE_THE_TOKEN

If everything is ok. You get a light.nanoleaf

then you can turn it on and if everything is ok you see this.
Hit effect and you get a list of all scene from Nanoleaf itself.

If this is working then the automation part:

    - service: light.turn_on
      data:
        entity_id: light.nanoleaf
        brightness_pct: 30
        effect: 'clouds'

Yep I’ve done that. I can control it like that, but I don’t have my scenes like you do :face_with_raised_eyebrow:

My scenes are definitely in the app :smiley:

So when you push the Nanoleaf in HA you don’t see the screen I post?
This screenshot is from the Nanoleaf App on your phone.
You don’t use your phone…

If everything went ok, all scenes imported to HA:
Purple Rain, Starlight, sundown, etc…

I’ve just seen an issue, seems they’re reconnected by homekit so assuming that’s overwriting it.

Let me remove the homekit version again…

I have also my 2 Nanoleaf’s in Homekit.
Thats probably not the issue. But you can try…

I’ve removed the HomeKit integration, my config has the settings above, I’ve rebooted by theres no nanoleaf in my devices :confused:

Show your configuration platform part. (replace your token for public)

The IP is correct?

Ah, I think it might just have needed some time.

I can see the entity now, as well as all the effects :smiley:

Thanks!

1 Like
    - service: light.turn_on
      data:
        entity_id: light.nanoleaf
        brightness_pct: 30
        effect: 'Sundown'

Try this !

Remember the effect name must be exact same name. So include capital letters.

3 Likes

That’s what I was looking for!

I really could use some help with this. I added the shell command to my configuration.yaml. But when I they the script example (with a valid scene name) in a yaml script or automation, all I get is the error: Message malformed: Unable to determine action @ data[‘sequence’][0]

anyone experienced this to and know how to fix this?