Cync owners with python experience, please help me with my conversion of CyncLAN for local control

So, I have been desperately trying to control my Cync devices. I started out with 3 BT bulbs and now have 3x BT bulbs, 3x WiFi/BT plugs, 4x WiFi/BT bulbs. I had tried a few other solutions but none are working 100% for me.

  • nikshriv’s cync_lights integration does not allow for controlling of BT only bulbs (even with a wifi/bt hub device) and relies on the cloud.
  • juanboro’s cync2mqtt needs a BT adapter and I am having strange issues with BT stack on linux. It does work but there seems to be some issues with how Cync sets the mesh up and some devices dont report status even if they are on and part of the mesh. I did a deep dive on this repo and have rewritten most of it. The issues arent fixable, its a cync issue.

There are a few others I couldnt get to work at all. I then stumbled upon:

  • iburistu’s cync-lan project. It is a JS node app and the newer firmware devices dont work with it. I am converting this project to python.

The premise is to create a self signed cert with a certain Common Name. Redirect DNS requests for a domain to a local host that runs cync-lan (redirect using router/firewall, pihole, /etc/hosts, etc.), and trick the cync devices into thinking they are talking to the cloud server. BAM, local only control.

I have the server working and devices are connecting to it (the phone app also connects if the DNS redirect is network wide). I will be adding the async MQTT logic after figuring out how to control the devices and decode the device status packets. The MQTT logic will have HASS auto discovery to integrate the devices.

My fork of cync-lan is here. Currently, the only dep is uvloop (amqtt will be needed when MQTT logic is added). View the README for install instructions.

There is an open issue in the original repo where a user was modifying the original JS script to work with newer firmware and they found out you can control other devices based on an ID byte. This means you can control a BT only device by sending a control command to one of the WiFi devices because all Cync WiFi devices are also BT and create a BT mesh.

Any help would be great, I am currently working on decoding device status packets, I have on/off figured out and am moving onto saturation, temp, brightness and r, g, b.

Looking for help with controlling the devices. In the linked issue, the user has done some work on the control commands, I havent tested them yet.

You can MITM using socat and the self signed cert chain. Meaning you can see what the device sends and how the cloud server responds. You cant run socat and cync-lan at the same time since they both use port 23779.

I have most things figured out for single device control.

I have had it running for 2 or 3 days now with no issues. Devices are responsive.

The only issues so far are sometimes the devices go out of sync on first run of the script. This means the lights may show “unknown” or the wrong state/color until you interact with them via Hass.

I am working on that issue but, there may not be a fix for it because it doesn’t seem like you can ask the cync devices about their current state. IMO, it’s a small issue and does not effect the usage or reliability but, it is bugging me so I will be working on it.

Please test and open issues if there are any problems.

Enjoy!