home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
69.83k stars 28.94k forks source link

Nanoleaf and ha 2021.11.1 #59226

Closed matteos1 closed 1 year ago

matteos1 commented 2 years ago

The problem

the nanoleaf lights panel frequently disconnects from Home Assistant after updating to the latest version.

What version of Home Assistant Core has the issue?

2021.11.1

What was the last working version of Home Assistant Core?

2021.10

What type of installation are you running?

Home Assistant Core

Integration causing the issue

nanoleaf

Link to integration documentation on our website

https://www.home-assistant.io/integrations/nanoleaf/

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant.components.nanoleaf.light
Source: components/nanoleaf/light.py:194
Integration: Nanoleaf (documentation, issues)
First occurred: 10:45:04 (7 occurrences)
Last logged: 10:59:10

Could not connect to Light Panels 57:40:4A

Additional information

No response

probot-home-assistant[bot] commented 2 years ago

Hey there @milanmeu, mind taking a look at this issue as it has been labeled with an integration (nanoleaf) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)


nanoleaf documentation nanoleaf source (message by IssueLinks)

TNTLarsn commented 2 years ago

same here

Logger: homeassistant.components.nanoleaf.light
Source: components/nanoleaf/light.py:194
Integration: Nanoleaf (documentation, issues)
First occurred: 10:41:23 (6 occurrences)
Last logged: 15:07:25
Could not connect to Light Panels 50:3D:5B
andreasm80 commented 2 years ago

Same here:

Logger: homeassistant.components.nanoleaf.light Source: components/nanoleaf/light.py:194 Integration: Nanoleaf (documentation, issues) First occurred: 8:55:23 AM (23 occurrences) Last logged: 12:36:53 PM

Could not connect to Shapes 9150

milanmeu commented 2 years ago

On my instance I get this warning for 0.24% of requests, this makes it difficult to reproduce it in my dev environment. In Home Assistant Core 2021.12 the polling interval will be 5 minutes instead of 30 seconds, so this issue should occur less often. If I have time I'll let my dev instance run overnight so I have some data to work with.

C0ntroller commented 2 years ago

For me it's a bit worse in absolute number of occurrences...

Logger: homeassistant.components.nanoleaf.light
Source: components/nanoleaf/light.py:194
Integration: Nanoleaf (documentation, issues)
First occurred: 29. November 2021, 02:21:47 (722 occurrences)
Last logged: 11:00:31

Could not connect to Nanoleaf Light Panels xx:xx:xx
andreasm80 commented 2 years ago

I am probably in the same boat with occurences: From yesterday:

Logger: homeassistant.components.nanoleaf.light
Source: components/nanoleaf/light.py:194
Integration: Nanoleaf (documentation, issues)
First occurred: December 1, 2021, 3:02:24 PM (150 occurrences)
Last logged: 11:15:56 AM
Could not connect to Shapes 9150

If there is anything I can help out with troubleshooting this just let me know, and how ;-)

LasseTheDude commented 2 years ago

Same problem here. Any fix soon?

LasseTheDude commented 2 years ago

Logger: homeassistant.components.nanoleaf.light Source: components/nanoleaf/light.py:190 Integration: Nanoleaf (documentation, issues) First occurred: 21:02:58 (1 occurrences) Last logged: 21:02:58

Could not connect to Shapes 5DB7

themitchk commented 2 years ago

Also having the same issue. Anything we can do to help?

TNTLarsn commented 2 years ago

Since I repositioned the WiFi-Repeater. The issue seems to be gone for me.

themitchk commented 2 years ago

Since I repositioned the WiFi-Repeater. The issue seems to be gone for me.

My access points are about 15' away from these guys, not seeing any drops on Unifi, and the Nanoleaf app works consistently, so I don't think it's a wifi issue for some of us.

andreasm80 commented 2 years ago

I suspect the issue is on the Shapes itself. In my Nanoleaf app the Shapes are unstable as H... while the older Light Panels are rock solid and perform every action I do from the app without any lags/timeout/disconnect. I am also using Unifi wifi with a bunch of APs all over the house and the Shapes can pick at least 3 AP's that is not further away than 6meters. I have tried alot of different configs for the Nanoleafs, they are in their own SSID, tuned the channels/bandwidth, isolated them on dedicated AP without any other clients at the same AP. It seems to do some improvements but falls back to being unstable after some time again. But its only the Shapes that struggle. My HA does not reside in the same subnet as my Nanoleafs either, I dont have a flat L2 network. I will reach out to Nanoleaf support and have them look at it.

C0ntroller commented 2 years ago

I suspect the issue is on the Shapes itself. In my Nanoleaf app the Shapes are unstable as H... while the older Light Panels are rock solid and perform every action I do from the app without any lags/timeout/disconnect.

But as all of us here have different Nanoleafs (I have the original Aurora) that reason seems weird. But I absolutely have the same experience that the Nanoleaf even need some seconds to act when I'm pressing the physical On/Off button.

It sucks that we have no way of debugging the device, maybe you can ask their support about that? :D

andreasm80 commented 2 years ago

I will try to get the most out of them. I even applied for being a beta tester for their firmware and app last year.. Nothing fun from that side yet ;-) I suspect they will start with the regular stuff like "have you done a factory reset" and try "take out the power for 20 secs and turn them on again".

milanmeu commented 2 years ago

I have not thoroughly investigate this issue yet. But I found that an aiohttp.ClientConnectionError sometimes occurs, and some users regularly get an aiohttp.ServerDisconnectedError. I don't know what is causing these errors because they are raised by aiohttp (the request library used since 2021.11) when communication with the Nanoleaf device. Currently the logging is not sufficient to detect the problem, I will have to improve the logging of the integration first.

bdraco commented 2 years ago

ServerDisconnectedError is raised by aiohttp and needs to be handled

Example handlers for aiohttp: https://github.com/StevenLooman/async_upnp_client/pull/93 https://github.com/bachya/regenmaschine/pull/106 Example handler for httpx: https://github.com/bdraco/ismartgate/commit/0ae507d5ab01da332ad54ee3938d7914f2602585

diamant-x commented 2 years ago

I'm having similar issues. Turning on/off the nanoleaf Elements and Shapes is unreliable. Sometimes takes long time to interact, sometimes they just turn on on their own trying to "match" the home assistant state (which hasn't realised they have been turned off through the elements physical buttons).

Logger: homeassistant.components.nanoleaf
Source: helpers/update_coordinator.py:222
Integration: Nanoleaf (documentation, issues)
First occurred: 2 de mayo de 2022, 11:54:05 (4 occurrences)
Last logged: 10:46:11

Error fetching Elements 728C data:
Error fetching Shapes 4ACE data:
{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2022.4.7",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.9.9",
    "docker": true,
    "arch": "aarch64",
    "timezone": "Europe/Madrid",
    "os_name": "Linux",
    "os_version": "5.10.103-v8",
    "supervisor": "2022.04.0",
    "host_os": "Home Assistant OS 7.6",
    "docker_version": "20.10.9",
    "chassis": "embedded",
    "run_as_root": true
  },
  "custom_components": {
    "edata": {
      "version": "2021.12.2",
      "requirements": [
        "e-data==0.3.9",
        "python-dateutil==2.8.2"
      ]
    },
    "smartir": {
      "version": "1.17.6",
      "requirements": [
        "aiofiles==0.6.0"
      ]
    },
    "adaptive_lighting": {
      "version": "1.0.14",
      "requirements": []
    },
    "reolink_dev": {
      "version": "0.52",
      "requirements": [
        "reolink==0.0.61"
      ]
    },
    "parrotflowerpower": {
      "version": "1.0.1",
      "requirements": [
        "btlewrap @ git+https://github.com/ChristianKuehnel/btlewrap.git@master"
      ]
    },
    "pvpc_hourly_pricing": {
      "version": "2.3.0",
      "requirements": [
        "aiopvpc==2.3.0"
      ]
    },
    "xiaomi_cloud_map_extractor": {
      "version": "v2.1.5",
      "requirements": [
        "pillow",
        "pybase64",
        "python-miio",
        "requests",
        "pycryptodome"
      ]
    },
    "hacs": {
      "version": "1.24.5",
      "requirements": [
        "aiogithubapi>=21.11.0"
      ]
    }
  },
  "integration_manifest": {
    "domain": "nanoleaf",
    "name": "Nanoleaf",
    "config_flow": true,
    "documentation": "https://www.home-assistant.io/integrations/nanoleaf",
    "requirements": [
      "aionanoleaf==0.2.0"
    ],
    "zeroconf": [
      "_nanoleafms._tcp.local.",
      "_nanoleafapi._tcp.local."
    ],
    "homekit": {
      "models": [
        "NL29",
        "NL42",
        "NL47",
        "NL48",
        "NL52",
        "NL59"
      ]
    },
    "ssdp": [
      {
        "st": "Nanoleaf_aurora:light"
      },
      {
        "st": "nanoleaf:nl29"
      },
      {
        "st": "nanoleaf:nl42"
      },
      {
        "st": "nanoleaf:nl52"
      }
    ],
    "codeowners": [
      "@milanmeu"
    ],
    "iot_class": "local_push",
    "loggers": [
      "aionanoleaf"
    ],
    "is_built_in": true
  },
  "data": {
    "info": {
      "entry_id": "1b2d03a2cf6508f8abc318c1ae91af5d",
      "version": 1,
      "domain": "nanoleaf",
      "title": "**REDACTED**",
      "data": {
        "host": "**REDACTED**",
        "token": "**REDACTED**"
      },
      "options": {},
      "pref_disable_new_entities": false,
      "pref_disable_polling": false,
      "source": "user",
      "unique_id": "Elements 8C",
      "disabled_by": null
    },
    "data": {
      "brightness_max": 100,
      "brightness_min": 0,
      "brightness": 63,
      "color_mode": "ct",
      "color_temperature_max": 6500,
      "color_temperature_min": 1200,
      "color_temperature": 2000,
      "effect": "*Solid*",
      "effects_list": [
        "Bloom",
        "Calming Waterfall",
        "Clouds",
        "Ember",
        "Fireflies",
        "Glimmer",
        "Sahara Night",
        "Splash",
        "Sunbeam",
        "Warm Waves"
      ],
      "firmware_version": "5.2.0",
      "hue_max": 360,
      "hue_min": 0,
      "hue": 30,
      "is_on": true,
      "manufacturer": "Nanoleaf",
      "port": 16021,
      "saturation_max": 100,
      "saturation_min": 0,
      "saturation": 95,
      "serial_no": "**REDACTED**"
    }
  }
}
kksligh commented 1 year ago

I'm seeing this behavior as well. Constantly going in and out. I've tried all the standard trouble shooting protocols to no avail. My kids love these things, but the inner nerd in me must have these work on HA or they got to go...;-)

Logger: homeassistant.components.nanoleaf Source: helpers/update_coordinator.py:237 Integration: Nanoleaf (documentation, issues) First occurred: 11:29:11 AM (78 occurrences) Last logged: 5:20:11 PM

Error fetching Kohens Room - Shape Lights - Nanoleaf data:

sygys commented 1 year ago

Cant say that i have this problem. I do know that the panels have a terrible wifi connection and loose connection allot. i contacted nanoleaf about this several times asking them to make a controller powersupply with utp connection so they can be connected wired.

Besides that im using my custom rest command to control the lightpanels individually. so i dont really use the integration very much. Just get the light panel id's from the api and you can control them. i will share the code for people who are interested for this until this lands in the integration. Still waiting for the HA nanoleaf integration to have support for controlling the panels as individual lights...

nanoleaf:
  url: http://192.168.178.86:16021/api/v1/VMtrh4tgcRFG88Jen7Wg02pn4gtrr/effects
  method: PUT
  payload: >
    { "write" : {"command": "display", "animType": "static", "animData":
    {%- set all = [ 36776, 40379, 39889, 47065, 62644, 56943, 44929, 4212, 50749, 42705, 55753, 9801, 2975, 5181, 59276, 33852, 34713, 42845 ] %}
    {%- set ns = namespace(panels=[panels | count | string]) %}
    {%- for panel in panels %}
    {%- set ns.panels = ns.panels + [ '{} 1 {} {} {} 0 20'.format(all[panel.number-1], panel.r, panel.g, panel.b) ] %}
    {%- endfor %}
    "{{ ns.panels | join(' ') }}",
    "loop": false, "palette": [], "colorType": "HSB"}
    }
  content_type: 'application/json'

the panel id's are set in this line: 36776, 40379, 39889, 47065, 62644, 56943, 44929, 4212, 50749, 42705, 55753, 9801, 2975, 5181, 59276, 33852, 34713, 42845 an example automation looks like this then:

- id: '1618492041197'
  alias: Nanoleaf post
  description: ''
  trigger:
  - platform: state
    entity_id: input_select.post
    to: Er is post
  condition:
  - condition: state
    entity_id: input_boolean.niet_storen
    state: 'off'
  action:
  - service: scene.create
    data:
      scene_id: nanoleaf_voordat
      snapshot_entities:
      - light.woonkamer_nanoleaf
  - service: rest_command.nanoleaf
    data:
      panels:
      - number: 1
        r: 100
        g: 0
        b: 100
      - number: 2
        r: 0
        g: 0
        b: 0
  mode: single

rgb are the colors and the number corresponds with the panel id. 100 is max brightness for that color led.

with this get command with your own api offcourse you can get the info you need in a json.

http://192.168.178.86:16021/api/v1/VMvqeHgeewf430fec02pn7

with some effort it should be even possible to get the position of each panel in a layout in the integration with the x and y positions (see screenshot)

Schermafbeelding 2022-11-17 121710

The integration as is, is still terrible basic and can do so much more

milanmeu commented 1 year ago

Let's continue the conversation in issue #78230 and close this.

@home-assistant close