Bridge Cync bluetooth mesh to mqtt. Includes auto-discovery for HomeAssistant. Tested on Raspberry Pi3B+,Pi-Zero-W/2W,and x86-64 also with container images available.
- Supports home assistant MQTT Discovery
- Supports mesh notifications (bulb status updates published to mqtt regardless of what set them).
- Cleanly recovers from communication errors both with the BLE mesh as well as MQTT broker.
- Linux like OS with bluez bluetooth stack. Has been tested on a number of X86 and ARM (Raspberry Pi) configurations. It might work on Windows but as far as I know no one has tried. I recommend using a Raspberry Pi Zero 2W installed with Raspberry Pi OS Bookworm and docker as a low cost and reliable bridge solution.
- MQTT broker (my config is mosquitto from Entware running on router).
- GE/Savant Cync Switches, Bulbs.
- Optional (but recommended): Home Assistant
See also Docker Instructions (recommended). Alternatively - you can use a Python virtual environment:
python3 -mvenv ~/venv/cync2mqtt~/venv/cync2mqtt/bin/pip3 install git+https://github.com/juanboro/cync2mqtt.gitMake sure your devices are all configured in the Cync app, then:
~/venv/cync2mqtt/bin/get_cync_config_from_cloud ~/cync_mesh.yamlYou will be prompted for your username (email) - you'll then get a onetime passcode on the email you will enter as well as your password.
Edit the generated yaml file as necessary. The only thing which should be necessary at a minimum is to make sure the mqtt_url definition matches your MQTT broker. Also see: cync_mesh_example.yaml
Run the script with the config file:
~/venv/cync2mqtt/bin/cync2mqtt ~/cync_mesh.yamlIf it works you should see an INFO message similar to this:
cync2mqtt - INFO - Connected to mesh mac: XX:XX:XX:XX:XX:XXYou can view MQTT messages on the topics: acyncmqtt/# and homeassistant/# ...i.e:
mosquitto_sub -h $meship -I rx -v -t 'acyncmqtt/#' -t 'homeassistant/#'sudo nano /etc/systemd/system/cync2mqtt.service[Unit]
Description=cync2mqtt
After=network.target
[Service]
ExecStart=/home/pi/venv/cync2mqtt/bin/cync2mqtt /home/pi/cync_mesh.yaml
Restart=always
User=pi
[Install]
WantedBy=multi-user.targetsudo systemctl enable cync2mqtt.serviceI recommend using a GUI like mqqt-spy to work with your MQTT broker. Below are some basic mosquitto command line topic examples. You need to also be subscribed with mosquitto command abvoe to see the responses.
Get list of devices - publish 'get' to topic acyncmqtt/devices, i.e:
mosquitto_pub -h $mqttip -t 'acyncmqtt/devices' -m getYou will receive a response on the topic homeassistant/devices/<meshid>/<deviceid> for every defined mesh and device.
Devices can be controlled by sending a message to the topic: acyncmqtt/set/<meshid>/<deviceid>, i.e:
Turn on:
mosquitto_pub -h $mqttip -I tx -t "acyncmqtt/set/$meshid/$deviceid" -m onTurn off:
mosquitto_pub -h $mqttip -I tx -t "acyncmqtt/set/$meshid/$deviceid" -m offSet brightness:
mosquitto_pub -h $mqttip -I tx -t "acyncmqtt/set/$meshid/$deviceid" -m '{"state": "on", "brightness" : 50}' Certain direct connect devices (those with WIFI) have trouble connecting with the Linux Bluez-DBUS bluetooth-LE stack (can not connect/receive notiications). If possible - the best workaround is to have at least one device in your mesh cync2mqtt can connect to that does not have these issues. As a workaround, it is also possible to use bluepy which does not have these issues. See the cync_mesh_example.yaml for how to enable this. Note that using bluepy seems to be less reliable at establishing an initial connection, and may need multiple retries.
Outside of the initial setup of downloading the mesh credentials from your cloud account, this has no dependencies on the cloud. If neccessary, in the future a standalone pairing script can also be written to remove all cloud depdendencies. Generally though for my own setup - I find having the cloud connectivity good to have for Alexa/Google Home support and then having HomeAssistant support via this mqtt bridge to bluetooth.
Establishing the cync2mqtt bluetooth mesh connection I would describe as "finicky". Once the connection is established though, it seems to be very stable (long uptimes). You may find you need to toggle the power on your bulbs and devices in order to establish a new cync2mqtt mesh connection.
Several other alternatives also exist out there depending on what your own needs may be to connect to these products:
- cync_lights - Home assistant custom component that does all communication with the cloud server.
- cbyge - Standalone app to communicate with the cloud server. I believe this also has a mqtt wrapper interface which has been developed.
- cync-lan - A good proof of concept of direct wifi connection to cync devices. This almost makes me want to block the official cloud access to my Cync devices :-).
- Telink-Mesh python: https://github.com/google/python-laurel
- 2FA Cync login: https://github.com/unixpickle/cbyge/blob/main/login.go
- Async BLE python: https://pypi.org/project/bleak/
- Async MQTT: https://amqtt.readthedocs.io/en/latest/index.html
- zimmra for initial docker container, debug, and testing.