Nanoleaf Aurora Component

Hi !

I’m new to HA and I’m trying to configure all my devices. I’ve tried to add Canvas light, but in the log file I see some error:

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 239, in async_update_ha_state
attr = self.state_attributes or {}
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/light/__init__.py", line 444, in state_attributes
data[ATTR_BRIGHTNESS] = self.brightness
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/light/nanoleaf_aurora.py", line 107, in brightness
return int(self._brightness * 2.55)
TypeError: unsupported operand type(s) for *: 'dict' and 'float'

Hi all… got my nanoleaf today… and it worked right away with hass. Now i am hesitating with my firmware upgrade. Actual firmware is 2.3.0 and new firmware would be 3.0.6

are here people who can report if this upgrade won’t break any function or even restrictions (like Harmony etc).

Thanks in advance.

@4D3K canvas does not work at the moment with this component unfortunately, see my comment at #57 Nanoleaf Aurora Component

With the next firmware upgrade everything except directly setting on/off should be working, to get on/off to work I (or someone else) would need to change the API in use from https://github.com/software-2/nanoleaf . I don’t know when I will be able to get around that since I am currently a bit swarmed with work (a good problem to have tbh).

As for an issue with white light or firmware upgrades, this has nothing to do with homeassistant and if it occurs please talk with Nanoleaf directly. For what it’s worth both my Auroras worked fine since day one, even though I am always on the latest version.

Hi @Oro and @Software2 I´m coming from a commercial home automation software named SYMCON. You can extend the functionality with modules. There is also a Nanoleaf modules which was initially for the Aurora but also works with the Canvas.

Here is the gut hub link https://github.com/Wolbolar/IPSymconNanoleaf

Maybe this helps?

For me I really need the support for canvas as its one of my Ceilinglights :slight_smile:

I had some time today and created a Pull Request on https://github.com/home-assistant/home-assistant/pull/21913 which will allow home assistant to also work with Canvas.

To get it merged might take some time and would currently result in a breaking change from platform: nanoleaf_aurora to platform: nanoleaf, I hope that this does not cause too much confusion.
If this gets merged I’ll post an update :slight_smile:

2 Likes

Update sooner than expected :slight_smile: It got merged, so come next version you’ll have to change to platform: nanoleaf for the lights to continue working.
If you’re using auto discovery you’ll need to change the .nanoleaf-aurora.conf in ~/.homeassistant/ to .nanoleaf.conf.

Also, the integration should now gracefully fail if the lights become unavailable (once https://github.com/home-assistant/home-assistant/pull/21945 is merged)

In short: Change to platform: nanoleaf, Canvas now supported, graceful failing if the lights become unavailable.

2 Likes

Hi. Is it possible to command each panel individually?

1 Like

Hi everyone,

I need some help applying a scene or brightness with the native component.
My nanoleaf aurora works well from the lovelace ui, and it was discovered flawlessly by home assistant 0.95.4 (I did not even need to push the nanoleaf on button for 5 seconds).

But I want to set a scene from a script when I change my hue scenes.

I tried this code:

        - service: light.turn_on
          data:
            entity_id: light.nanoleaf_light_panels_55_7d_00
            brightness: 35
            effect: 'Fraise'

It switches on the nanoleaf, but ignored brightness and scene (the scene name is the same in the app).

Do I need to install a custom component ? I thought it was included natively.

I do not understand the example provided above:

light.aurora:
  state: on
  brightness: 204
  effect: Vintage Modern

How do I use this in a script ?

Well I will answer to myself, I found a solution.
I did it manually.

First I declared two shell commands in the configuration file.

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

You need to open the port 16021 in your firewall.

Then you can use the commands in a script like this:

    start_party:
      sequence:
        - service: shell_command.nanoleaf_scene
          data:
            scene: 'Streaking Notes'
        - service: shell_command.nanoleaf_brightness
          data:
            brightness: 95

It is really fast.
I hope it helps someone.

2 Likes

Glad you got it working, weird however that the integration worked without you needing to press the button and that the script did not work as expected - also weird that you did not have to allow 16021 before your script.
I tried it just now (changed entity_id and effect name, of course) and got the expected results, low brightness and changed effect.

Maybe you are using something like Homekit or Google Assistant instead of the native integration Seeing as you’ve already solved it a different way that is probably already moot anyway :slight_smile:

@Entropyst nope. I might be implementing it in the future seeing as this is something I would also like, but not in the near future, sorry. If someone else wants to pick it up that would be very much appreciated.

1 Like

Thank you for your answer. It is really weird actually.

I checked the entity registration in core.entity_registry (from .storage). And I found this:
{
“config_entry_id”: “98dc16a0f50c457388b31a2b4425d6a8”,
“device_id”: “4f3fc340782e46d0a4dde3021130ed37”,
“disabled_by”: null,
“entity_id”: “light.nanoleaf_light_panels_55_7d_00”,
“name”: null,
“platform”: “homekit_controller”,
“unique_id”: “homekit-S19102A0276-65280”
}

It says “platform homekit_controller”. That might explain it …

Thing is, I do not own any apple devices … The only thing I added in the last week is that I replaced my old nas with a synology DS218j. Maybe there is homekit implemented in it by default … But I doubt.

If I may, what do you think is the best course of action? I’d prefer use the native implementation.

I am thinking of removing the integration from home assistant through the GUI, then declaring manually the nanoleaf component in the configuration (I already have the token), and using it normally from there.
Do I need to remove anything else ?

A few releases ago home assistant started discovering the aurora’s automatically using homekit and then displaying them on the integrations page as a discovered homekit accessory. Since the nanoleaf component doesn’t support integrations yet it can’t be setup in the GUI. Removing the homekit integration entries and setting them up using the config entry with the nanoleaf component should work just fine. You’ll need to get the token for each device.

1 Like

Thanks for the information.
I only have one device.
I removed the nanoleaf integration on the GUI from home assistant and restarted it.

Then I added the following code in my configuration.yaml file:

# Nanoleaf
light:
  - platform: nanoleaf
    host: 192.168.0.109
    token: XXX_TOKEN_XXX
    name: nanoleaf_chambre

I know the token is fine because I can launch the following command line on the home assistant device with success:

curl -X PUT -H "Content-Type: application/json" -d '{"select" : "Forest"}' "http://192.168.0.109:16021/api/v1/XXX_TOKEN_XXX/effects/"

But after a home assistant reboot, it does not do anything. The component is not detected.
And there is nothing in the log.

I tried adding the following code to get information, but it stays empty with nanoleaf information.

# Logs
logger:
  default: info
  logs:
     homeassistant.components.nanoleaf: debug

Any idea?
I am a bit lost.
I use the latest home assistant version (0.95.4).

Sorry for bothering you.

1 Like

Ah interesting, then maybe the next thing I oughta do with this is to check integrations so that other won’t experience this, thanks for the heads up!

As to why this doesn’t work, I am stumped, the config snippet you posted should be fine as well as the API request… on the off chance I can find anything in your logs, could you please post the full logs if possible?

Well it works as intended now.
The issue was not in the code, but was sitting in front of the computer :slight_smile:

I forgot that I used a lights.yaml file, so there was two declarations of light. And nanoleaf was ignored. As soon as I changed that, everything worked perfectly.

Thank you both for your help (and for the great work).

1 Like

Hi,

I have configured aurora integration. Is successful paired and I can select color and toggle state. But I don’t have select for effects.

HA: 0.99.3
Nanoleaf firmware: 3.2.0

light:
  - platform: nanoleaf
    host: 192.168.0.101
    token: xxx

It shows below the colour wheel for me. I don’t see a scroll bar on your screenshot but any chance its hiding down there?

1 Like

I have also issues with my NanoLeaf. I can control the light within HA but also see some errors pop up:

HA Version: 0.102.3
Nanoleaf FW: 3.3.3

2019-12-09 21:16:21 ERROR (SyncWorker_8) [pynanoleaf.pynanoleaf] 192.168.100.2 is not available
2019-12-09 21:16:21 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 421, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 416, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/local/lib/python3.7/http/client.py", line 1336, in getresponse
    response.begin()
  File "/usr/local/lib/python3.7/http/client.py", line 306, in begin
    version, status, reason = self._read_status()
  File "/usr/local/lib/python3.7/http/client.py", line 267, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/local/lib/python3.7/socket.py", line 589, in readinto
    return self._sock.recv_into(b)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 720, in urlopen
    method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/retry.py", line 400, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/usr/local/lib/python3.7/site-packages/urllib3/packages/six.py", line 735, in reraise
    raise value
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 672, in urlopen
    chunked=chunked,
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 423, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 331, in _raise_timeout
    self, url, "Read timed out. (read timeout=%s)" % timeout_value
urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='192.168.100.2', port=16021): Read timed out. (read timeout=2)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/pynanoleaf/pynanoleaf.py", line 188, in _request
    response = self._session.send(req.prepare(), timeout=self.timeout)
  File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 529, in send
    raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPConnectionPool(host='192.168.100.2', port=16021): Read timed out. (read timeout=2)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 564, in async_request_call
    await coro
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/nanoleaf/light.py", line 213, in turn_on
    self._light.effect = effect
  File "/usr/local/lib/python3.7/site-packages/pynanoleaf/pynanoleaf.py", line 175, in effect
    self._put("effects", {"select": value})
  File "/usr/local/lib/python3.7/site-packages/pynanoleaf/pynanoleaf.py", line 219, in _put
    self._request(path, 'PUT', data)
  File "/usr/local/lib/python3.7/site-packages/pynanoleaf/pynanoleaf.py", line 194, in _request
    raise Unavailable("{} is not available".format(self.host)) from e
pynanoleaf.pynanoleaf.Unavailable: 192.168.100.2 is not available
2019-12-09 21:19:49 ERROR (SyncWorker_12) [pynanoleaf.pynanoleaf] 192.168.100.2 is not available
2019-12-09 21:19:51 ERROR (SyncWorker_12) [pynanoleaf.pynanoleaf] 192.168.100.2 is not available
2019-12-09 21:19:51 ERROR (SyncWorker_12) [homeassistant.components.nanoleaf.light] Could not update status for Nanoleaf (192.168.100.2 is not available)
2019-12-09 21:20:20 ERROR (SyncWorker_1) [pynanoleaf.pynanoleaf] 192.168.100.2 is not available
2019-12-09 21:20:21 ERROR (SyncWorker_1) [pynanoleaf.pynanoleaf] 192.168.100.2 is not available
2019-12-09 21:20:21 ERROR (SyncWorker_1) [homeassistant.components.nanoleaf.light] Could not update status for Nanoleaf (192.168.100.2 is not available)
2019-12-09 21:20:51 ERROR (SyncWorker_18) [pynanoleaf.pynanoleaf] 192.168.100.2 is not available
2019-12-09 21:20:52 ERROR (SyncWorker_18) [pynanoleaf.pynanoleaf] 192.168.100.2 is not available
2019-12-09 21:20:52 ERROR (SyncWorker_18) [homeassistant.components.nanoleaf.light] Could not update status for Nanoleaf (192.168.100.2 is not available)
2019-12-09 21:21:22 ERROR (SyncWorker_0) [pynanoleaf.pynanoleaf] 192.168.100.2 is not available
2019-12-09 21:21:23 ERROR (SyncWorker_0) [pynanoleaf.pynanoleaf] 192.168.100.2 is not available
2019-12-09 21:21:23 ERROR (SyncWorker_0) [homeassistant.components.nanoleaf.light] Could not update status for Nanoleaf (192.168.100.2 is not available)

After this error dump I can still use NanoLeaf lights in HA. But cant find where this is come from…

I have the same problem that i don’t see the effects drop-down.

Configured the Nanoleaf using the “HomeKit Accessory” integration and selecting color and brightness works fine (No manual config anywhere).

I requested the current list of effects using the REST API and there are effects available and i also can set it using REST.

When browsing through the DOM i can see the “effects” DIV. The max-height of the .effect_list class is set to 0px. If i disable it, i can see the drop-down, but cannot open it.

So, everything needed seems to be there. Did i miss anything?

HA Version: 0.105.4
Nanoleaf FW: 3.3.3

Thank you
Urs

Although Nanoleaf lights are recognized by the HomeKit integration, doing so will NOT display the effects list, and it will even show a plain light bulb icon instead of the more appropriate triangle shape (for Aurora). For best support, set up the nanoleaf integration manually, in configuration.yaml.