Connecting to nanoleaf is having error with shapeType

I’m currently getting following error with nanoleaf as

ERROR (MainThread) [homeassistant.components.nanoleaf.config_flow] Unknown error connecting with Nanoleaf at <ip>

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/nanoleaf/config_flow.py", line 203, in async_setup_finish
await self.nanoleaf.get_info()
File "/usr/local/lib/python3.9/site-packages/aionanoleaf/nanoleaf.py", line 295, in get_info
self._panels = {Panel(panel) for panel in data["panelLayout"]["layout"]["positionData"]}
File "/usr/local/lib/python3.9/site-packages/aionanoleaf/nanoleaf.py", line 295, in <setcomp>
self._panels = {Panel(panel) for panel in data["panelLayout"]["layout"]["positionData"]}
File "/usr/local/lib/python3.9/site-packages/aionanoleaf/layout.py", line 61, in __init__
self._shape_type_id = panel_data["shapeType"]
KeyError: 'shapeType'

using Home Assistant 2022.3.0
Do I need some config?

Is there anything else I can do to get more diagnostic messages?

Hello,

I have Nanoleaf Aurora, Essentials, Canvas, and Shapes. I have all of them successfully integrated and working well. I had a couple different troubles when I first got them all into HA. I’m not familiar with these errors. Is it getting stuck in the pairing process? Do you still need help on this?

I seem to be having following issue: nanoleaf integration fails to add new device · Issue #67816 · home-assistant/core · GitHub

oh wow. That issue is…substantial. I haven’t experienced anything like that. I have HA running randomizers on mine every 30 mins so if one ever went down, I’d know immediately and they’ve been stable for a while. Best of luck to you :slightly_smiling_face:

I’m not sure what is randomizer but I would like to know if you have pointer (and redundancy while at it if you know) - Sorry this is off topic but didn’t want to start new topic

lol, it’s your thread :slight_smile: I literally look for any excuse to talk about these things.

I built a script that all it does is handle the randomizer for 1 device:

alias: 'Nanoleaf: Effect Randomizer'
sequence:
  - service: light.turn_on
    target:
      device_id: fc000451bfaf18f9a8f9791cebf0f61a
    data:
      effect: >-
        {{ ["Nanoleaf Aurora Borealis","Nanoleaf Checkerboard","Nanoleaf Cherry
        Blossoms","Nanoleaf Chill Vibes Bedroom","Nanoleaf Colored
        Snakes","Nanoleaf Dark Northen Lights","Nanoleaf EarthTone","Nanoleaf
        Flickering Candle","Nanoleaf Holodek","Nanoleaf JadePalace","Nanoleaf
        Purple Sun","Nanoleaf Relaxing neon","Nanoleaf Retro","Nanoleaf Retro
        Future","Nanoleaf Scary Night Forest","Nanoleaf Sea of thieves night
        s","Nanoleaf Sparrows","Nanoleaf Starry Night","Nanoleaf Sunlight
        Through Trees"] | random }}
mode: single
icon: mdi:triforce

You’ll notice that I have several selected scenes using a value template that randomizes just that list.

I have about 5 music scenes and I only want them to be randomized when Sonos is playing music. When music is not playing, select/randomize effects from THIS list (that’s the main reason I have the separation).

Pay no attention to the dumb naming. It was leftover from my Hubitat integration which had a really wonky way to read the effects. Yours would probably be a lot simpler.

For this next part, I have it separated into another script but that’s because I have multiple nanoleafs randomizing different things. You could easily put all this in one

alias: Randomizer Control
sequence:
  - service: script.1642351975423
    data: {}
  - service: script.canvas_effect_randomizer
    data: {}
  - service: script.shapes_effect_randomizer
    data: {}
  - service: script.woodleaf_randomizer
    data: {}
mode: single
icon: mdi:shape-plus

Whenever this script is triggered, it runs the randomizer script for each of the devices. Again, you can easily combine all this, separating it was best for my needs.

When the house wakes up in the morning, I wake/randomize each of them:

service: light.turn_on
target:
  device_id: fc000451bfaf18f9a8f9791cebf0f61a
data:
  brightness_pct: 50
  effect: >-
    {{ ["Nanoleaf Aurora Borealis","Nanoleaf Checkerboard","Nanoleaf Cherry
    Blossoms","Nanoleaf Chill Vibes Bedroom","Nanoleaf Colored Snakes","Nanoleaf
    Dark Northen Lights","Nanoleaf EarthTone","Nanoleaf Flickering
    Candle","Nanoleaf Holodek","Nanoleaf JadePalace","Nanoleaf Purple
    Sun","Nanoleaf Relaxing neon","Nanoleaf Retro","Nanoleaf Retro
    Future","Nanoleaf Scary Night Forest","Nanoleaf Sea of thieves
    nights","Nanoleaf Sparrows","Nanoleaf Starry Night","Nanoleaf Sunlight
    Through Trees"] | random }}

Then an automation automatically takes over when the house awake conditions are met throughout the day. Which gives the effect of randomizing the effect every 30 mins as long as the house is awake.
It’s really easy for me to tell if one stops communicating or stops randomizing because nearly every time I walk into a room, the effect should be different:

alias: Nanoleaf Randomizer Control
description: ''
trigger:
  - platform: time_pattern
    minutes: '30'
condition:
  - condition: and
    conditions:
      - condition: state
        entity_id: input_boolean.house_awake
        state: 'on'
      - condition: time
        after: '08:00:00'
        before: '21:45:00'
      - type: is_open
        condition: device
        device_id: 253da192a574953187a6ffa226818201
        entity_id: binary_sensor.bedroom_2_door_contact_sensor
        domain: binary_sensor
      - type: is_open
        condition: device
        device_id: b1c35c134c59dd8979a12b3c488e301e
        entity_id: binary_sensor.bedroom_door_contact_sensor
        domain: binary_sensor
action:
  - service: script.1642351975423
    data: {}
  - service: script.canvas_effect_randomizer
    data: {}
  - service: script.shapes_effect_randomizer
    data: {}
mode: single

Then I have a set of randomizers just for the music scenes. Automation looks something like: when sonos starts playing, run nanoleaf randomizer script that only contains the music scenes. Other automations that track when sonos stops playing to switch back to non music randomized scenes.

I of course have ridiculous automations that will “change the scene” “alter the mood” as Castor said on Tron and it will randomize the nanoleafs with/without music depending on the command, but all it’s doing it hitting the randomizer button every time it’s triggered :nerd_face:

All nanoleafs change to a night effect at night and then eventually turn off when the house goes to sleep.

1 Like