Twinkly Christmas Lights

UPDATED

made a fast howto

1: cd /config

2: mkdir python_scripts

3: cd /config/python_scripts

4: git clone https://github.com/joshkay/home-assistant-twinkly.git

5: cp home-assistant-twinkly/twinkly.py /config/python_scripts

6: open and read the file white nano home-assistant-twinkly/README.md

  • Add the following switch config to configuration.yaml
  • Make sure to replace TWINKLY_IP_HERE with the IP address of your twinkly lights (3 occurrences)

7: In the README file wire the text you going to copy to configuration.yaml you need remove name: Twinkly from the code because it isn’t supported anymore, luck att my picture so you understand me

8: when setup is done reboot hassio

I am trying to connect my twinkly curtain 200 LEDs has anyone got them working. ?

I keep getting this error

**Command failed: python3 /config/python_scripts/twinkly.py 192.168.1.17 state
**

I had the same problem the fix was downloading it white git, scroll up then you are going to see it

I was having the same issue with error:
Command failed: python3 /config/python_scripts/twinkly.py ip state

I fixed it by doing 2 things. I changed the path to the full path of the twinkly.py file (I’m using a virtual env on an ubuntu server) and I changed the user to my admin servers admin user instead of homeassistant and it worked.

Thanks for making this!

Is anyone else finding the Twinkly WiFi is poor?
Mine keeps loosing connection.

I have two sets of lights on my tree. Here is what I have in my configuration.yaml (formatting is correct but I can’t seem to have it show up correctly here):

switch:

  • platform: command_line
    name: Twinkly1
    switches:
    twinkly:
    command_on: “python3 /config/python_scripts/twinkly.py 192.168.1.199 on”
    command_off: “python3 /config/python_scripts/twinkly.py 192.168.1.199 off”
    command_state: “python3 /config/python_scripts/twinkly.py 192.168.1.199 state”
    value_template: “{{ value == “1” }}”
    friendly_name: Twinkly1
  • platform: command_line
    name: Twinkly2
    switches:
    twinkly:
    command_on: “python3 /config/python_scripts/twinkly.py 192.168.1.238 on”
    command_off: “python3 /config/python_scripts/twinkly.py 192.168.1.238 off”
    command_state: “python3 /config/python_scripts/twinkly.py 192.168.1.238 state”
    value_template: “{{ value == “1” }}”
    friendly_name: Twinkly2

Everything loads up with no errors but I only see a single switch
- switch.twinkly

The oddest part for me is that it isn’t names as either of the switches I put in the config. It does turn one set of lights on and off though. Anyone know what I’m missing?

Switches:
Twinkly:

Change the second one to
Switches:
Twinkly2:

Wow. I looked at the config like 5 times and missed that every time. Working perfect now. Thanks!

Thanks a lot. Works great.
It would be nice, if this can be a “light” component to change colors and effects. I’m not sure if this is even possible.

Great work!

Glad it works for you! I for sure want to do this in the future. There’s a lot for me to learn when it comes to creating an official component unfortunately. I’ve been spending my time getting my home assistant setup and running the way I want it.

1 Like

It is: WIP Add Twinkly platform in light component with discovery but it turned out that I the future of Home Assistant is not to use proprietary discovery protocols in netdisco like Add XLED Twinkly discovery but use an config flow.

I’m pretty new in this area here as well and from time to time I make a little bit progress in that integration.

1 Like

I have been poking around a little bit and captured some packages.
What I have found out so far is that Twinkly connects to a cloud mqtt broker with the address mqtt.twinkly.com
It connects with a user named twinkly_noauth, a 24 characters long password (I don’t want to post it here if it’s a different password per device, which I doubt) and a 12 character long client id that is the same as the MAC address of the controller (all upper case and no special characters). There are 3 different topics that I have discovered:

  • xled/command/[client id]
  • xled/status/[client id]
  • xled/appstatus/[client id]

The messages are the same in all three topics.

When I cut or gives power to the controller:
{“status”: “offline”}
{“status”: “online”, “ip”: “192.168.1.xxx”, “ssid”: “my_ssid”}

When I press the button on the controller it rotates between:
{“appstatus”: “movie”}
{“appstatus”: “rainbow”}
{“appstatus”: “twinkle”}
{“appstatus”: “snake”}
{“appstatus”: “waves”}
{“appstatus”: “collision”}

When I change pattern in the app I always get the same messages:
{“appstatus”: “rt”}
{“appstatus”: “movie”}

I hope this can be to some help for someone as I for the moment don’t have time to dig more in to this.

1 Like

You can see this also here: Twinkly private messaging API reference

Hey what do I need to do so I can test your add on? I’m a Twinkly beta tester I’m on firmware 2.1.1-net version I’m on hassio and running HA ver: 0.84.6

@Skaven sorry for the unrelated question. How do you become a beta tester?

I am one as well.
Ask via their support site https://www.twinkly.com/support/
You can open a ticket and explain why you would be a good beta tester for them.

I also found this. Could maybe be to some help.
https://labs.mwrinfosecurity.com/blog/twinkly-twinkly-little-star

1 Like

hello, in hassio there isn’t the command python3.
how could i command this script?

It has it but it can’t be run like a command only like a script it seems so, but hassio has in already installed, test my howto I have posted Earlier

Ok i check