plambrechtsen / xled

🎄Unofficial control for Twinkly - Smart Decoration LED lights.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

XLED - unofficial control of Twinkly - Smart Decoration LED lights

XLED is a python library and command line interface (CLI) to control Twinkly - Smart Decoration LED lights for Christmas.

Official materials says:

Twinkly is a LED light device that you can control via smartphone. It allows you to play with colouful and animated effects, or create new ones. Decoration lights, not suitable for household illumination.

Since its Kickstarter project in 2016 many products were introduced with varying properties and features. Most notably products released since September 2019 are identified as Generation II. Older products are since then referred as Generation I.

Library and CLI are free software available under MIT license.

Documentation for the library can be found on https://xled.readthedocs.io.

Use of the library:

>>> import xled
>>> discovered_device = xled.discover.discover()
>>> discovered_device.name
'Twinkly_33AAFF'
>>> control = xled.ControlInterface(discovered_device.ip_address, discovered_device.hw_address)
>>> control.set_mode('movie')
>>> control.get_mode()['mode']
u'movie'
>>> control.get_device_info()['number_of_led']
105

Use of the CLI:

$ xled on
Looking for any device...
Working on device: Twinkly_33AAFF
Turned on.

Unofficial documentation of private protocol and API is available online.

Why?

My first Twinkly was 105 LEDs starter light set. That was the latest available model in 2017: TW105S-EU. As of December 2017 there are only two ways to control lights: mobile app on Android or iOS or hardware button on the cord.

Android application didn't work as advertised on my Xiaomi Redmi 3S phone. On first start it connected and disconnected in very fast pace (like every 1-2 seconds) to the hardware. I wasn't able to control anything at all. Later I wanted to connect it to my local WiFi network. But popup dialog that shouldn't have appear never did so.

Public API was promised around Christmas 2016 for next season. Later update from October 2016 it seems API won't be available any time soon:

API for external control are on our dev check list, we definitely need some feedback from the community to understand which could be a proper core set to start with.

It turned out that application uses HTTP to control lights. I ended up with capturing network traffic and documented this private API. In the end I'm able to configure the device pretty easilly.

As of 2020 Twinkly devices can be controlled by Amazon Alexa and Google Assistant as well. Mobile application now requires an account to operate lights even locally. No sign of public API for local devices though. Therefore with my second device - Twinkly 210 RGB+W Wall I keep improving this library and CLI documentation to be able to operate my devices locally and not rely on availability of manufacturer's servers.

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

Join the chat at https://gitter.im/xled-community/chat

About

🎄Unofficial control for Twinkly - Smart Decoration LED lights.

License:MIT License


Languages

Language:Python 99.6%Language:Makefile 0.4%