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
73.81k stars 30.9k forks source link

Some flux_led devices stop responding #84684

Closed Dvalin21 closed 1 year ago

Dvalin21 commented 1 year ago

The problem

I keep getting this error and the light becomes unavailable in HA

Logger: homeassistant.components.flux_led.coordinator Source: helpers/update_coordinator.py:168 Integration: Magic Home (documentation, issues) First occurred: December 27, 2022 at 3:05:03 PM (364 occurrences) Last logged: 12:43:05 AM

Error fetching 10.0.0.47 data: 10.0.0.47: Bulb not responding, too soon to retry

What version of Home Assistant Core has the issue?

9.4

What was the last working version of Home Assistant Core?

Started with 9.4

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Magic Home

Link to integration documentation on our website

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

Diagnostics information

{ "home_assistant": { "installation_type": "Home Assistant OS", "version": "2022.12.8", "dev": false, "hassio": true, "virtualenv": false, "python_version": "3.10.7", "docker": true, "arch": "x86_64", "timezone": "America/Chicago", "os_name": "Linux", "os_version": "5.15.80", "supervisor": "2022.11.2", "host_os": "Home Assistant OS 9.4", "docker_version": "20.10.19", "chassis": "vm", "run_as_root": true }, "custom_components": { "yeelight_bt": { "version": "1.3.0", "requirements": [ "bleak>=0.18.0", "bleak-retry-connector>=2.1.3" ] }, "frigate": { "version": "3.0.0", "requirements": [] }, "ble_monitor": { "version": "11.0.0", "requirements": [ "pycryptodomex>=3.14.1", "janus>=1.0.0", "aioblescan>=0.2.13", "btsocket>=0.2.0", "pyric>=0.1.6.3" ] }, "dwains_dashboard": { "version": "3.3.0", "requirements": [] }, "hacs": { "version": "1.29.0", "requirements": [ "aiogithubapi>=22.10.1" ] } }, "integration_manifest": { "domain": "flux_led", "name": "Magic Home", "config_flow": true, "dependencies": [ "network" ], "documentation": "https://www.home-assistant.io/integrations/flux_led", "requirements": [ "flux_led==0.28.34" ], "quality_scale": "platinum", "codeowners": [ "@icemanch", "@bdraco" ], "iot_class": "local_push", "dhcp": [ { "registereddevices": true }, { "macaddress": "18B905", "hostname": "[ba][lk]" }, { "macaddress": "249494", "hostname": "[ba][lk]" }, { "macaddress": "7CB94C", "hostname": "[ba][lk]" }, { "macaddress": "ACCF23", "hostname": "[hba][flk]" }, { "macaddress": "B4E842", "hostname": "[ba][lk]" }, { "macaddress": "F0FE6B", "hostname": "[hba][flk]" }, { "macaddress": "8CCE4E", "hostname": "lwip" }, { "hostname": "hf-lpb100-zj*" }, { "hostname": "zengge[0-9a-f][0-9a-f]_" }, { "macaddress": "C82E47", "hostname": "sta*" } ], "loggers": [ "flux_led" ], "is_built_in": true }, "data": { "entry": { "title": "Bulb RGBCW 8E4289", "data": { "host": "10.0.0.47", "remote_access_enabled": true, "remote_access_host": "sl8815us01.magichue.net", "remote_access_port": 8815, "minor_version": 354, "model": "AK001-ZJ21411", "model_num": 53, "model_info": "ZG-BL-BP101", "model_description": "Bulb RGBCW" } }, "data": { "device_state": { "available": true, "brightness": 255, "cold_white": 0, "color_active": true, "color_is_white_only": true, "color_mode": "RGB", "color_modes": [ "CCT", "RGB" ], "color_temp": 2700, "cool_white": 0, "device_type": 0, "dimmable_effects": true, "discovery": { "ipaddr": "10.0.0.47", "id": "2494948E4289", "model": "AK001-ZJ21411", "model_num": 53, "version_num": 354, "firmware_date": { "__type": "<class 'datetime.date'>", "isoformat": "2022-08-01" }, "model_info": "ZG-BL-BP101", "model_description": "Bulb RGBCW", "remote_access_enabled": true, "remote_access_host": "sl8815us01.magichue.net", "remote_access_port": 8815 }, "effect": null, "effect_list": [ "blue_fade", "blue_strobe", "colorjump", "colorloop", "colorstrobe", "cyan_fade", "cyan_strobe", "cycle_rgb", "cycle_seven_colors", "gb_cross_fade", "green_fade", "green_strobe", "purple_fade", "purple_strobe", "rb_cross_fade", "red_fade", "red_strobe", "rg_cross_fade", "rgb_cross_fade", "white_fade", "white_strobe", "yellow_fade", "yellow_strobe", "random" ], "hardware": null, "ic_type": null, "ic_type_num": null, "ic_types": null, "ipaddr": "10.0.0.47", "is_on": false, "max_temp": 6500, "microphone": false, "min_temp": 2700, "mode": "color", "model": "Bulb RGBCW (0x35)", "model_data": { "model_num": 53, "models": [ "AK001-ZJ200", "AK001-ZJ2101", "AK001-ZJ2104", "AK001-ZJ2145", "AK001-ZJ2146", "AK001-ZJ2147", "AK001-ZJ21410" ], "description": "Bulb RGBCW", "always_writes_white_and_colors": false, "protocols": [ { "min_version": 9, "protocol": "LEDENET_DIMMABLE_EFFECTS" }, { "min_version": 7, "protocol": "LEDENET_AUTO_ON" }, { "min_version": 0, "protocol": "LEDENET" } ], "mode_to_color_mode": { "1": [ "CCT", "RGB" ], "23": [ "CCT", "RGB" ] }, "color_modes": [ "CCT", "RGB" ], "channel_map": {}, "microphone": false, "device_config": { "wiring": false, "num_to_wiring": {}, "wiring_to_num": {}, "operating_modes": false, "num_to_operating_mode": {}, "operating_mode_to_num": {}, "pixels": false, "segments": false, "music_pixels": false, "music_segments": false, "ic_type": false, "num_to_ic_type": {}, "ic_type_to_num": {} } }, "model_num": 53, "multi_color_mode": true, "music_pixels_per_segment": null, "music_segments": null, "operating_mode": null, "operating_mode_num": null, "operating_modes": null, "paired_remotes": null, "pixels_per_segment": null, "port": 5577, "power_restore_states": null, "preset_pattern_num": 97, "protocol": "LEDENET_DIMMABLE_EFFECTS", "raw_state": [ 129, 53, 36, 97, 0, 64, 255, 255, 255, 0, 10, 0, 240, 114 ], "remote_config": null, "requires_turn_on": false, "rgb": [ 255, 255, 255 ], "rgb_unscaled": [ 255, 255, 255 ], "rgbcw": [ 255, 255, 255, 0, 0 ], "rgbw": [ 255, 255, 255, 0 ], "rgbwcapable": false, "rgbwprotocol": false, "rgbww": [ 255, 255, 255, 0, 0 ], "segments": null, "speed": 0, "speed_adjust_off": true, "timeout": 5, "version_num": 10, "warm_white": 0, "white_active": false, "white_channel_channel_type": 2700, "wiring": null, "wiring_num": null, "wirings": null }, "last_messages": { "state": "0x81 0x35 0x24 0x61 0x00 0x40 0xFF 0xFF 0xFF 0x00 0x0A 0x00 0xF0 0x72" } } } }

Example YAML snippet

NA

Anything in the logs that might be useful for us?

MA

Additional information

NA

home-assistant[bot] commented 1 year ago

Hey there @icemanch, @bdraco, mind taking a look at this issue as it has been labeled with an integration (flux_led) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `flux_led` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Change the title of the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign flux_led` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


flux_led documentation flux_led source (message by IssueLinks)

isertkaya commented 1 year ago

Is there already a solution, have the same issue

egold555 commented 1 year ago

I am having this same issue recently. In the past hour, my lights have disconnect and reconnected 271 times

cmille34 commented 1 year ago

Same here

Dvalin21 commented 1 year ago

So since the Core 9.5, its went back to the same function as before. Only one lamp works and the other one seems never to connect. Where as they both connected before, but wouldn't stay connected long.

dasaqui commented 1 year ago

I can confirm the same issue, since the begining my bulbs keep disconnecting every minute and keep unavailable for ten seconds.

What version of Home Assistant Core has the issue?

Home Assistant 2023.2.3

What was the last working version of Home Assistant Core?

It has failed since the first installation with latest docker container on December 2022

What type of installation are you running?

Home Assistant Container

Integration causing the issue

Magic Home

Link to integration documentation on our website

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

Log information

Logger: homeassistant.components.flux_led.coordinator Source: helpers/update_coordinator.py:182 Integration: Magic Home (documentation, issues) First occurred: 19:10:44 (78 occurrences) Last logged: 19:35:58

Error fetching 192.168.100.70 data: 192.168.100.70: Bulb not responding, too soon to retry Error fetching 192.168.100.69 data: 192.168.100.69: Bulb not responding, too soon to retry Error fetching 192.168.100.71 data: 192.168.100.71: Bulb not responding, too soon to retry Error fetching 192.168.100.72 data: 192.168.100.72: Bulb not responding, too soon to retry Error fetching 192.168.100.74 data: 192.168.100.74: Bulb not responding, too soon to retry

egold555 commented 1 year ago

So I have been messing around with the code in flux_led, and I think I think I have a temporary patch solution.

All I have done is in coordinator.py, changed the update_interval from 10 to 50. I pulled 50 out of my butt, just testing things, and it seems to be happy and no longer randomly disconnecting.

"""The Flux LED/MagicLight integration coordinator."""
from __future__ import annotations

from datetime import timedelta
import logging
from typing import Final

from flux_led.aio import AIOWifiLedBulb

from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.debounce import Debouncer
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed

from .const import FLUX_LED_EXCEPTIONS

_LOGGER = logging.getLogger(__name__)

REQUEST_REFRESH_DELAY: Final = 2.0

class FluxLedUpdateCoordinator(DataUpdateCoordinator[None]):
    """DataUpdateCoordinator to gather data for a specific flux_led device."""

    def __init__(
        self, hass: HomeAssistant, device: AIOWifiLedBulb, entry: ConfigEntry
    ) -> None:
        """Initialize DataUpdateCoordinator to gather data for specific device."""
        self.device = device
        self.title = entry.title
        self.entry = entry
        self.force_next_update = False
        super().__init__(
            hass,
            _LOGGER,
            name=self.device.ipaddr,
-            update_interval=timedelta(seconds=10),
+            update_interval=timedelta(seconds=50),
            # We don't want an immediate refresh since the device
            # takes a moment to reflect the state change
            request_refresh_debouncer=Debouncer(
                hass, _LOGGER, cooldown=REQUEST_REFRESH_DELAY, immediate=False
            ),
        )

    async def _async_update_data(self) -> None:
        """Fetch all device and sensor data from api."""
        try:
            await self.device.async_update(force=self.force_next_update)
        except FLUX_LED_EXCEPTIONS as ex:
            raise UpdateFailed(ex) from ex
        finally:
            self.force_next_update = False

I will try to do some more testing with different numbers, but so far maybe this is a start?

Dvalin21 commented 1 year ago

Honestly this was something I was thinking myself, however not having the know how to do test hinder me. It sounds like your on the right track

dasaqui commented 1 year ago

Thankyou egold555, I tested the patch proposed and it worked for me, now I have disconnections in only one between five bulbs (the farthest from the access point).

In my case, your patch solves the problem.

egold555 commented 1 year ago

I'm glad it seems to be working.

I've move all my 26 bulbs over for roughly 24h, and so far none are not erroring out, and are all working flawlessly.

I have not had much time to dive into the code of the flux_led library just due to homework and life.

I will try to keep poking and trying to understand a better fix for this issue. The whole 50 seconds was a total random trial and error guess. I also still don't fully understand the library's code.

Dvalin21 commented 1 year ago

Look forward for the update

On Wed, Feb 15, 2023, 2:46 PM Eric Golde @.***> wrote:

I'm glad it seems to be working.

I've move all my 26 bulbs over for roughly 24h, and so far none are not erroring out, and are all working flawlessly.

I have not had much time to dive into the code of the flux_led library just due to homework and life.

I will try to keep poking and trying to understand a better fix for this issue. The whole 50 seconds was a total random trial and error guess. I also still don't fully understand the library's code.

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/84684#issuecomment-1432009464, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABY7PVN3F3IGIXLGW7NAC6DWXU6CXANCNFSM6AAAAAATLAFH2M . You are receiving this because you authored the thread.Message ID: @.***>

egold555 commented 1 year ago

Well. It's not totally fixed. Came home today with random lights on, and in the HA logs it had that error message again.

At least it's much more infrequent 🥴

Screenshot_20230222-135300_Home Assistant.jpg

I'm swamped with exams right now, but with how much this is driving me crazy, we will see how much sleep I sacrifice to debug this more

Dvalin21 commented 1 year ago

Well. It's not totally fixed. Came home today with random lights on, and in the HA logs it had that error message again.

At least it's much more infrequent woozy_face

Screenshot_20230222-135300_Home Assistant.jpg

I'm swamped with exams right now, but with how much this is driving me crazy, we will see how much sleep I sacrifice to debug this more

You are appreciated!!

dasaqui commented 1 year ago

Same for me, in my case I have connection issues only in two bulbs (the farthest to my access point), for the rest of my bulbs I had only one or two disconnection events in all the week. Trying to use another constant instead of "50" I used "20" without success (and then returned to use 50).

techdoutdev commented 1 year ago

I'm experiencing this same issue as well with my AK001-ZJ21411 Floor Lamp RGBCW (0x0E) by Zengge Firmware: 11.78. However, I have 2 AK001-ZJ2146 Controller RGB (0x33) by Zengge Firmware: 10.48 that are working perfectly fine. Configuration is more or less the same.

stalakerob commented 1 year ago

My suggestion: make update_interval a configurable integration option. That would be specifically useful for users that run HA in a docker container.

Dvalin21 commented 1 year ago

My suggestion: make update_interval a configurable integration option. That would be specifically useful for users that run HA in a docker container.

I run it in VM HAOS. And just for reference sake, I'm having the same issue.

egold555 commented 1 year ago

I am still facing the same issues sadly even after the flux_led update.

I'm not sure if I should make a new issue or not. Please let me know.

image

If I change the update_interval to 50 in the patch I had before, it seems to mostly mitigate the issue.