Adding Nanoleaf Shapes Touch functionality through Homekit Button

Hey Hassio’s,

I’ve hit a brick wall in trying to add the Nanoleaf Shapes touch functionality into Home Assistant, I’m hoping someone here can help me figure it out.

My goal: I want to use the Nanoleaf Shapes as a light as well as use its touch features as input for automation triggers within Home Assistant.

Now, with Home Assistant 9.1 came official Nanoleaf integration support, which is great! After searching and reading any information regarding Nanoleaf Shapes and their touch functionality, I’ve found out that:

  • Home Assistant and its Nanoleaf integration supports all the light functionality, but does not natively support anything touch related (as far as I can tell).
  • Nanoleaf has full Homekit compatibility, where its touch functionality is supported for Homekit Automation.
  • Home Assistant has Homekit Controller which can support touch functionality from Homekit compatible/connected devices as a stateless switch.

This is the point where I hit the earlier mentioned brick wall. As the official Nanoleaf integration adds each Nanoleaf product as an entity rather than a device, I can’t try configuring the touch functionality as outlined by the stateless switch documentation.

I can’t add the Nanoleaf Shapes as a Homekit Controller either, as it is already integrated by the official Nanoleaf integration (and keeps getting added back in with automatic discovery). I’d rather not mess with/disable the default_config to turn off automatic discovery as it manages a lot of other functionalities besides that.

So now I’m looking to somehow have the Nanoleaf Shapes in Home Assistant as both a Nanoleaf integration and as a Homekit Controller. I’m of course open to any other possibilities that would allow me to do that.

1 Like

Hi, this is something i am also looking forward to.
I did find the following python-api: https://github.com/MylesMor/nanoleafapi

In https://github.com/MylesMor/nanoleafapi#Events is explained how to register an event.
So i think it should be possible to write a custom integration.
It could convert the nanoleaf event into an homeassistant event so it would be possible to create an automation like: deCONZ - Ikea Tradfri Shortcut Button - #19 by Intro_Verti

A few things:

Nanoleaf has been supported for a long time, it just took a while for it to be added through the UI instead of the config file

Not that I can see. I have a shapes device added using both integrations, available device triggers are on/off/toggle/brightup/brightdown

Here’s why there’s no touch support in the Nanoleaf integration yet: https://github.com/home-assistant/home-assistant.io/issues/19204#issuecomment-912977105.

1 Like

Today I have been testing @milanmeu 's dev code (with some modification for my docker setup) on my Shapes and it is going great, touch events are working, as are the individual tile states for touch and hover.

For when it goes live, this is how you can hook the touch events as follows:

alias: New Automation
description: ''
trigger:
  - platform: event
    event_type: nanoleaf_event
    event_data:
      type: touch
      gesture: Swipe Down
condition: []
action:
  - service: do your thing here
mode: single

Where the event is “nanoleaf_event”, the type is “touch”, and the gesture is what you are looking for out of the following options:
“Single Tap”
“Double Tap”
“Swipe Up”
“Swipe Down”
“Swipe Left”
“Swipe Right”

1 Like

Nope. 10 charrrr

Home Assistant Core 2021.3 adds support for Nanoleaf touch events as device triggers. Support is currently limited to swipes: up, down, left and right. You should be able to set it up using the Automation UI, YAML or this blueprint from @ldvc86.

Excellent news! I’ve had quite a few ideas on using Nanoleaf touch events for triggering automations, and now I’ll be able to put them into practice. And If/when “single press” touch events are supported, the possibilities will be even greater.

Thanks again for your work done already @milanmeu!

2 Likes