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.45k stars 30.69k forks source link

Twinkly integration disabling playlist on state change #73336

Open Mr-Groch opened 2 years ago

Mr-Groch commented 2 years ago

The problem

When I turn off / on Twinkly LEDs using HA intergration - it will disable Twinkly playlist playing.

What version of Home Assistant Core has the issue?

core-2022.6.4

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

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

Duplicate of issue #65816, #68699 and #71302 becouse it was closed but not resolved...

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

twinkly documentation twinkly source (message by IssueLinks)

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

Hey there @dr1rrb, @robbie1221, 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! (message by CodeOwnersMention)

RobBie1221 commented 2 years ago

If you get a message that the issue is stale and reply to that, it won’t be closed automatically. This saves the trouble of reopening an issue every time.

Anyway this is not a simple fix and my Twinkly is in a box called Christmas decoration, so I won’t be able to do something before December.

bartbakels commented 2 years ago

Same here

bartbakels commented 2 years ago

I created my own plugin for homeseer back in the days, and it depends on the version v1 or v2 twinklys. The use of the on command can be effect, movie and sound if i recall correctly

in addition the integration now pols and upon polling the app is disconnected due to api limitations on login. This causes the mapping and sometimes uploading of new effects to twinklys to fail. This could be solved by a pause polling function or something?

if needed i can provide my dirty homeseer vbscript ;)

ntindle commented 1 year ago

Do you happen to have that script @bartbakels

just pulled out my tree

bartbakels commented 1 year ago

@ntindle

here it is... dont mind the shitty programming but it worked always as a charm :) Twinkly.zip

Johndolk commented 1 year ago

Would it be possible to make something similar in Home Assistant? Would be awesome if the twinklys would just start on the programmed playlist

ntindle commented 1 year ago

It’s very possible, would require someone to build it. If you are competent with python you could contribute

Johndolk commented 1 year ago

Unfortunately i am very incompetent with all programming... If i had any skill at all i would be happy to contribute!

dnikles commented 1 year ago

It looks like ttls was recently updated to fix this issue https://github.com/jschlyter/ttls/pull/16

Johndolk commented 1 year ago

It looks like ttls was recently updated to fix this issue jschlyter/ttls#16

How do you use this?

dnikles commented 1 year ago

The twinkly component was updated to pull the latest ttls so that's a good start. I installed it and it lets you select any of your saved effects which is really nice. I didn't see a way to do anything with playlists, which is likely coming, but in the meantime you could do this:

  1. Grab all of the files from https://github.com/home-assistant/core/tree/dev/homeassistant/components/twinkly
  2. put them in /config/custom_components/twinkly (you will need to create the twinkly directory)
  3. edit the manifest.json file to add a version string (custom components won't load without one, you can use something like "version": "1.0.0", )
  4. edit light.py around line 219 to look like this
        if not self._is_on:
            await self._client.set_mode("playlist")
            self._client.default_mode = "playlist"
            await self._client.turn_on()

    You are adding the 2 middle lines there. This will make your lights play the playlist whenever they turn on. If you want a color or effect, you can pick it in the gui and it will stay what you chose. To get back to the playlist mode, turn the lights off, then on again. This is certainly not the best way to do this, but I think it will get you what you want until someone who knows what they are doing (not me) adds a playlist mode to the home assistant component.

dnikles commented 1 year ago

I created a PR that will add "playlist" to the list of effects. If you select that "effect" it will play the playlist. I don't know if it's an ideal way to handle this or not, but it works. I did not include the edits above that set playlist as the default mode when the lights are turned on.

Johndolk commented 1 year ago

I created a PR that will add "playlist" to the list of effects. If you select that "effect" it will play the playlist. I don't know if it's an ideal way to handle this or not, but it works. I did not include the edits above that set playlist as the default mode when the lights are turned on.

It really seems you know what you are doing ;)

I have tried your nice 4 steps with creating the twinkly directory and put all the files in there. I also added "the code" you mentioned to light.py but unfortunately whitout any luck. I am not even sure i have done correctly - niether am i sure ive added the version string to the manifest.json file correctly. This one i have just started your file with the suggested They look something like this:

manifest.json:

"version": "1.0.0", )

<!DOCTYPE html>

**light.py (from line 218 to 226)**