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
72.19k stars 30.22k forks source link

Twinkly going unavailable status often #102809

Open codyc1515 opened 11 months ago

codyc1515 commented 11 months ago

The problem

The Twinkly device is going offline roughly every 30-60 seconds.

What version of Home Assistant Core has the issue?

2023.10.5

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Twinkly

Link to integration documentation on our website

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

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

Logs to follow.

home-assistant[bot] commented 11 months ago

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

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

(message by CodeOwnersMention)


twinkly documentation twinkly source (message by IssueLinks)

codyc1515 commented 11 months ago

Here is logs:

2023-11-09 23:02:05.983 DEBUG (MainThread) [homeassistant.components.twinkly.light] Updating 'Twinkly-8438AD.local'
2023-11-09 23:02:05.984 DEBUG (MainThread) [ttls.client] Authentication token still valid
2023-11-09 23:02:05.984 DEBUG (MainThread) [ttls.client] GET endpoint led/mode
2023-11-09 23:02:06.012 DEBUG (MainThread) [ttls.client] GET response 200
2023-11-09 23:02:06.013 DEBUG (MainThread) [ttls.client] Authentication token still valid
2023-11-09 23:02:06.013 DEBUG (MainThread) [ttls.client] GET endpoint led/out/brightness
2023-11-09 23:02:06.039 DEBUG (MainThread) [ttls.client] GET response 200
2023-11-09 23:02:06.040 DEBUG (MainThread) [ttls.client] Authentication token still valid
2023-11-09 23:02:06.040 DEBUG (MainThread) [ttls.client] GET endpoint gestalt
2023-11-09 23:02:06.073 DEBUG (MainThread) [ttls.client] GET response 200
2023-11-09 23:02:06.074 DEBUG (MainThread) [ttls.client] Authentication token still valid
2023-11-09 23:02:06.074 DEBUG (MainThread) [ttls.client] GET endpoint movies
2023-11-09 23:02:06.099 DEBUG (MainThread) [ttls.client] GET response 200
2023-11-09 23:02:06.100 DEBUG (MainThread) [homeassistant.components.twinkly.light] Movies: {'movies': [], 'available_frames': 6676, 'max_capacity': 6676, 'max': 55, 'code': 1000}
2023-11-09 23:02:06.101 DEBUG (MainThread) [ttls.client] Authentication token still valid
2023-11-09 23:02:06.101 DEBUG (MainThread) [ttls.client] GET endpoint movies/current
2023-11-09 23:02:06.124 DEBUG (MainThread) [ttls.client] GET response 204
2023-11-09 23:02:06.125 DEBUG (MainThread) [homeassistant.components.twinkly.light] Current movie: None
2023-11-09 23:02:35.984 DEBUG (MainThread) [homeassistant.components.twinkly.light] Updating 'Twinkly-8438AD.local'
2023-11-09 23:02:35.984 DEBUG (MainThread) [ttls.client] Authentication token still valid
2023-11-09 23:02:35.984 DEBUG (MainThread) [ttls.client] GET endpoint led/mode
2023-11-09 23:02:35.997 INFO (MainThread) [homeassistant.components.twinkly.light] Twinkly 'Twinkly-8438AD.local' is not reachable (client error)
2023-11-09 23:03:05.985 DEBUG (MainThread) [homeassistant.components.twinkly.light] Updating 'Twinkly-8438AD.local'
2023-11-09 23:03:05.985 DEBUG (MainThread) [ttls.client] Authentication token still valid
2023-11-09 23:03:05.985 DEBUG (MainThread) [ttls.client] GET endpoint led/mode
2023-11-09 23:03:35.985 DEBUG (MainThread) [homeassistant.components.twinkly.light] Updating 'Twinkly-8438AD.local'
2023-11-09 23:03:35.986 DEBUG (MainThread) [ttls.client] Authentication token still valid
2023-11-09 23:03:35.986 DEBUG (MainThread) [ttls.client] GET endpoint led/mode
2023-11-09 23:03:36.025 DEBUG (MainThread) [ttls.client] GET response 200
2023-11-09 23:03:36.026 DEBUG (MainThread) [ttls.client] Authentication token still valid
2023-11-09 23:03:36.026 DEBUG (MainThread) [ttls.client] GET endpoint led/out/brightness
2023-11-09 23:03:36.049 DEBUG (MainThread) [ttls.client] GET response 200
2023-11-09 23:03:36.049 DEBUG (MainThread) [ttls.client] Authentication token still valid
2023-11-09 23:03:36.050 DEBUG (MainThread) [ttls.client] GET endpoint gestalt
2023-11-09 23:03:36.084 DEBUG (MainThread) [ttls.client] GET response 200
2023-11-09 23:03:36.084 DEBUG (MainThread) [ttls.client] Authentication token still valid
2023-11-09 23:03:36.085 DEBUG (MainThread) [ttls.client] GET endpoint movies
2023-11-09 23:03:36.113 DEBUG (MainThread) [ttls.client] GET response 200
2023-11-09 23:03:36.113 DEBUG (MainThread) [homeassistant.components.twinkly.light] Movies: {'movies': [], 'available_frames': 6676, 'max_capacity': 6676, 'max': 55, 'code': 1000}
2023-11-09 23:03:36.114 DEBUG (MainThread) [ttls.client] Authentication token still valid
2023-11-09 23:03:36.114 DEBUG (MainThread) [ttls.client] GET endpoint movies/current
2023-11-09 23:03:36.135 DEBUG (MainThread) [ttls.client] GET response 204
2023-11-09 23:03:36.135 DEBUG (MainThread) [homeassistant.components.twinkly.light] Current movie: None
2023-11-09 23:03:36.136 INFO (MainThread) [homeassistant.components.twinkly.light] Twinkly 'Twinkly-8438AD.local' is now available
codyc1515 commented 11 months ago

Here is diagnostics:

{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2023.11.1",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.11.6",
    "docker": true,
    "arch": "aarch64",
    "timezone": "Pacific/Auckland",
    "os_name": "Linux",
    "os_version": "6.1.21-v8",
    "supervisor": "2023.11.0",
    "host_os": "Home Assistant OS 11.1",
    "docker_version": "24.0.6",
    "chassis": "embedded",
    "run_as_root": true
  },
  "custom_components": {
    "entities_calendar": {
      "version": "0.0.10",
      "requirements": []
    },
    "siri": {
      "version": "1.0.0",
      "requirements": []
    },
    "switch_manager": {
      "version": "1.3.1",
      "requirements": []
    },
    "hacs": {
      "version": "1.33.0",
      "requirements": [
        "aiogithubapi>=22.10.1"
      ]
    },
    "dyson_local": {
      "version": "1.3.0",
      "requirements": []
    },
    "alarmo": {
      "version": "v1.9.13",
      "requirements": []
    },
    "tplink_deco": {
      "version": "3.5.3",
      "requirements": [
        "pycryptodome>=3.12.0"
      ]
    },
    "tapo_control": {
      "version": "5.4.0",
      "requirements": [
        "pytapo==3.3.5"
      ]
    },
    "adaptive_lighting": {
      "version": "1.19.0",
      "requirements": [
        "ulid-transform"
      ]
    },
    "powercalc": {
      "version": "v1.9.6",
      "requirements": [
        "numpy>=1.21.1"
      ]
    },
    "managemyhealth": {
      "version": "1.0.0",
      "requirements": []
    },
    "ics_calendar": {
      "version": "4.0.1",
      "requirements": [
        "ics>=0.7.2",
        "recurring_ical_events>=2.0.2",
        "icalendar>=5.0.4"
      ]
    },
    "localtuya": {
      "version": "6.1.0",
      "requirements": []
    },
    "orion_network": {
      "version": "1.0.0",
      "requirements": []
    },
    "yeelock": {
      "version": "1.1.0",
      "requirements": []
    },
    "countdown": {
      "version": "1.0.0",
      "requirements": []
    },
    "zha_toolkit": {
      "version": "v1.1.6",
      "requirements": [
        "pytz"
      ]
    },
    "tuya_local": {
      "version": "2023.9.2",
      "requirements": [
        "pycryptodome~=3.18",
        "tinytuya==1.12.11"
      ]
    },
    "xiaomi_miot": {
      "version": "0.7.13",
      "requirements": [
        "construct>=2.10.56",
        "python-miio>=0.5.6",
        "micloud>=0.3"
      ]
    },
    "blitzortung": {
      "version": "1.0.1",
      "requirements": [
        "paho-mqtt>=1.5.0"
      ]
    },
    "auto_backup": {
      "version": "1.4.1",
      "requirements": []
    },
    "waste_collection_schedule": {
      "version": "1.43.0",
      "requirements": [
        "icalendar",
        "recurring_ical_events",
        "icalevents",
        "bs4",
        "lxml"
      ]
    },
    "tapo": {
      "version": "2.11.0",
      "requirements": [
        "plugp100==3.13.1"
      ]
    },
    "multiscrape": {
      "version": "6.5.0",
      "requirements": [
        "lxml==4.9.1",
        "beautifulsoup4==4.11.1"
      ]
    },
    "panasonic_cc": {
      "version": "1.0.37",
      "requirements": []
    },
    "eufy_security": {
      "version": "7.7.3",
      "requirements": [
        "websocket-client==1.4.2",
        "aiortsp==1.3.7"
      ]
    },
    "thermal_comfort": {
      "version": "2.1.1",
      "requirements": []
    },
    "delonghi_primadonna": {
      "version": "1.5.2",
      "requirements": []
    },
    "orion": {
      "version": "1.0.0",
      "requirements": []
    },
    "pyscript": {
      "version": "1.5.0",
      "requirements": [
        "croniter==1.3.8",
        "watchdog==2.3.1"
      ]
    }
  },
  "integration_manifest": {
    "domain": "twinkly",
    "name": "Twinkly",
    "codeowners": [
      "@dr1rrb",
      "@Robbie1221",
      "@Olen"
    ],
    "config_flow": true,
    "dhcp": [
      {
        "hostname": "twinkly_*"
      }
    ],
    "documentation": "https://www.home-assistant.io/integrations/twinkly",
    "iot_class": "local_polling",
    "loggers": [
      "ttls"
    ],
    "requirements": [
      "ttls==1.5.1"
    ],
    "is_built_in": true
  },
  "data": {
    "entry": {
      "entry_id": "0505a3804ae7684ad12f866dfcc7130c",
      "version": 1,
      "domain": "twinkly",
      "title": "Twinkly",
      "data": {
        "host": "**REDACTED**",
        "id": "587B02CD-B40D-4462-9F1F-548485F476FF",
        "name": "Twinkly_8438AD",
        "model": "TWS200STP"
      },
      "options": {},
      "pref_disable_new_entities": false,
      "pref_disable_polling": false,
      "source": "user",
      "unique_id": "587B02CD-B40D-4462-9F1F-548485F476FF",
      "disabled_by": null
    },
    "device_info": {
      "product_name": "Twinkly",
      "hardware_version": "302",
      "bytes_per_led": 3,
      "hw_id": "8438ac",
      "flash_size": 64,
      "led_type": 14,
      "product_code": "TWS200STP",
      "fw_family": "F",
      "device_name": "Twinkly_8438AD",
      "uptime": "1255761303",
      "mac": "**REDACTED**",
      "uuid": "587B02CD-B40D-4462-9F1F-548485F476FF",
      "max_supported_led": 510,
      "number_of_led": 200,
      "led_profile": "RGB",
      "frame_rate": 25.61,
      "measured_frame_rate": 29.41,
      "movie_capacity": 6676,
      "max_movies": 55,
      "wire_type": 1,
      "copyright": "LEDWORKS 2021",
      "code": 1000
    },
    "sw_version": "2.8.15",
    "attributes": {
      "effect_list": [],
      "supported_color_modes": [
        "rgb"
      ],
      "color_mode": null,
      "brightness": null,
      "hs_color": null,
      "rgb_color": null,
      "xy_color": null,
      "effect": null,
      "icon": "mdi:string-lights",
      "friendly_name": "Twinkly",
      "supported_features": 4
    }
  }
}
Swiftnesses commented 10 months ago

Exactly the same issue here.

andyloree commented 10 months ago

Also seeing the same issue, constantly see " became unavailable" to "turned on".

codyc1515 commented 10 months ago

Setting up the device from new it is able to set-up but now never shows as available. I was not able to see anything in logs or diagnostics that might help. Still broken in 2023.12.

codyc1515 commented 10 months ago

I did a factory reset a few times. May be fixed now.

MrQu33f commented 10 months ago

I too am having this issue. The Lights become randomly unavailable throughout the day and do not turn on or off with my daily automations

dr1rrb commented 10 months ago

There are multiple issues that are reporting connection/configuration issues and which sounds all related.

  1. https://github.com/home-assistant/core/issues/102809 (this one)
  2. https://github.com/home-assistant/core/issues/104905
  3. https://github.com/home-assistant/core/issues/104578
  4. https://github.com/home-assistant/core/issues/105337

Apparently a fix/workaround has been found in last issue https://github.com/home-assistant/core/issues/105337#issuecomment-1848799314

Closing this in favor of the 4. as it has a possible workaround.

@home-assistant close

dr1rrb commented 10 months ago

@home-assistant close

dr1rrb commented 10 months ago

Actually, I read too quickly the 4., it look like to be also related to the configuration issue, re-opening this one to track the connection stability issue.

On my side while I have few disconnection, but I noticed them only by looking at the logs, I never experienced any issue with any of my 3 lights.

dr1rrb commented 10 months ago

@home-assistant reopen

markus99 commented 9 months ago

Same issues here, have two of these connected and they're going 'unavailable' quite often. This is light group of both of them: image

config_entry-twinkly-a0242b84474043145f5956f2a9254aa9.json.txt

And3rsL commented 9 months ago

It seems it goes to a sleep state, if you open the app it reconnetcs after few seconds

Ascathon commented 9 months ago

It seems it goes to a sleep state, if you open the app it reconnetcs after few seconds

Maybe it looked for you like that. If the thing is in a sleep mode, I don't think something external (the/a app) will wake it up. But I get the idea somethings wrong on the controller side? Have it unavailable from their app too. Controller (II) is reconnecting at that moment. In hass we just seem to notice it faster.

But ... that could always be my controller or my wifi.

hneel commented 9 months ago

Same here. Whenever it becomes 'turned on', it becomes 'unavailable' after either 30 or 60 seconds. I installed everything today. It has not worked yet.

Device info TWS250STP by LEDWORKS Firmware: 2.8.18

Diagnostics: { "home_assistant": { "installation_type": "Home Assistant OS", "version": "2023.12.4", "dev": false, "hassio": true, "virtualenv": false, "python_version": "3.11.6", "docker": true, "arch": "x86_64", "timezone": "Europe/Amsterdam", "os_name": "Linux", "os_version": "6.1.63-haos", "supervisor": "2023.12.0", "host_os": "Home Assistant OS 11.2", "docker_version": "24.0.7", "chassis": "embedded", "run_as_root": true }, "custom_components": { "mikrotik_router": { "version": "0.0.0", "requirements": [ "librouteros>=3.2.0", "mac-vendor-lookup>=0.1.12" ] }, "hacs": { "version": "1.33.0", "requirements": [ "aiogithubapi>=22.10.1" ] }, "home_connect_alt": { "version": "1.0.1", "requirements": [ "home-connect-async==0.7.16" ] }, "tapo_control": { "version": "5.4.11", "requirements": [ "pytapo==3.3.18" ] } }, "integration_manifest": { "domain": "twinkly", "name": "Twinkly", "codeowners": [ "@dr1rrb", "@Robbie1221", "@Olen" ], "config_flow": true, "dhcp": [ { "hostname": "twinkly_*" } ], "documentation": "https://www.home-assistant.io/integrations/twinkly", "iot_class": "local_polling", "loggers": [ "ttls" ], "requirements": [ "ttls==1.5.1" ], "is_built_in": true }, "data": { "entry": { "entry_id": "d67a74799f076391235138be7566720f", "version": 1, "domain": "twinkly", "title": "Schoens Lampjes", "data": { "host": "**REDACTED**", "id": "E94743EB-FA4C-4A10-A4A7-B6CCC85AD16D", "name": "Schoens Lampjes", "model": "TWS250STP" }, "options": {}, "pref_disable_new_entities": false, "pref_disable_polling": false, "source": "user", "unique_id": "E94743EB-FA4C-4A10-A4A7-B6CCC85AD16D", "disabled_by": null }, "device_info": { "product_name": "Twinkly", "hardware_version": "300", "bytes_per_led": 3, "hw_id": "23257c", "flash_size": 64, "led_type": 14, "product_code": "TWS250STP", "fw_family": "F", "device_name": "Schoens Lampjes", "uptime": "8849677", "mac": "**REDACTED**", "uuid": "E94743EB-FA4C-4A10-A4A7-B6CCC85AD16D", "max_supported_led": 510, "number_of_led": 250, "led_profile": "RGB", "frame_rate": 20.49, "measured_frame_rate": 24.39, "movie_capacity": 5397, "max_movies": 55, "wire_type": 1, "copyright": "LEDWORKS 2021", "code": 1000 }, "sw_version": "2.8.18", "attributes": { "effect_list": [], "supported_color_modes": [ "rgb" ], "icon": "mdi:string-lights", "friendly_name": "Schoens Lampjes", "supported_features": 4 } } }

codyc1515 commented 9 months ago

What is the criteria to mark a device as Unavailable?

adfrancis commented 7 months ago

any updates on this issue?

codyc1515 commented 7 months ago

It looks like the device is marked as available when an async update is succesful and marked unavailable when there is a timeout or client error.

https://github.com/home-assistant/core/blob/5da629b3e59bca2cf7ca1236ffe82c49e89b85a0/homeassistant/components/twinkly/light.py#L284C25-L297

However, it looks like there is a bug in the code here that only shows that error if the device was available (should be if unavailable):

https://github.com/home-assistant/core/blob/5da629b3e59bca2cf7ca1236ffe82c49e89b85a0/homeassistant/components/twinkly/light.py#L293-L296

canoben commented 6 months ago

I'm having the same problem with Home Assitant 2024.03 and a Twinkly Flex. Deleting and re-adding the integration did not help.

bigboychemdawg commented 4 months ago

I've faced this issue too. Any updates?

bigboychemdawg commented 4 months ago

As they say "sink or swim". I spent the evening creating a solution to our problem. It is quite limited in functionality, allowing only to control the state of the device (on/off) and adjust its brightness. However, it is sufficient for my automations.

https://github.com/bigboychemdawg/twinkly-controller

cmitz commented 3 months ago

I was debugging this, and here you can see the difference between before a workaround and after. Normally it went unavailable after about 30 seconds, but now it stays connected!

image

The workaround for me was this comment: https://github.com/home-assistant/core/issues/105337#issuecomment-1848799314. dr1rrb mentioned that already but I failed to read it. In short:

✅ I went to the gallery in the Twinkly app, chose an effect, and "applied" it (bottom right) to the device. Now it says this on the device page:

image

I still think it is a bug in the integration, though 🙂 @dr1rrb could you reopen https://github.com/home-assistant/core/issues/93081 maybe?

Th3H0ff commented 3 months ago

Hi all I need to share something that I cannot find written in any of the other github threads related to Twinkly being unavailable in Home Assistant. I bought a TWL100STW stip firmware: 2.8.18 a month ago and straight after unpacking it ran into the constant unavailability issue i Home Assistant. After digging through github I pretty much shelved the strip and wrote off the cost. Today I decided my kid could use it, the manual control still works and the different effects was a success. While he was trying out the effects I installed the Android Twinkly app and made him some custom effects and I don't know at what point things fell into place, but after I saved the effects I can no control the strip 100% from HA. In short New strip, fresh integration in HA=Unavailable Same strip, same integration, saved set of effects=Working in HA. I haven't tried to "clear" the strip any effects and only have it set for different steady colors. My original plan was to use it with the Ambient Light HACS addon

Hope this helps someone Peace Fredrik

mija87 commented 3 months ago

Same issue with the squares. :(

michaeltryl commented 1 month ago

any news on this issue