pycync


Namepycync JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryA Python library to communicate with Cync by GE devices.
upload_time2025-08-01 21:48:16
maintainerNone
docs_urlNone
author@Kinachi249
requires_python>=3.9.0
licenseGPL-3.0-or-later
keywords cync ge lighting smart home
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PyCync
PyCync is a Python API library for interfacing with Cync by GE smart devices.  

The goal of this project is to make a generalized Cync library that will eventually span the gamut of Cync devices and features, while breaking the underlying protocol into more concrete implementations.

## Disclaimers
This library is still an early work in progress. As such, various devices and features may not yet be supported. However, work is ongoing to add features to get the library closer to feature parity with the app.

The code has only been physically tested with Cync full color light bulbs and the dynamic effects LED strip, as those are the only light devices I own.  
If you encounter issues with a specific device, I can do my best to fix them, but there may be a delay if I need to purchase the device to test with.  

Currently, only Wi-Fi connected devices are supported. This means that you must have at least one Wi-Fi connected device in your home to utilize the library.  
Note that if you have a Wi-Fi connected device that acts as a bridge for other Bluetooth-only devices that communicate via Bluetooth mesh, all of the devices should work.  
Direct Bluetooth connections may be supported in the future, however at the moment it isn't a prioritized feature.

This library and its developers are in no way affiliated with GE Lighting or Savant Technologies. All APIs and protocols utilized in the library were created from reverse engineering.

# Using the Library
## Authenticating

1. The first step is to create an Auth object, which will handle authenticating your Cync user.
```
cync_auth = Auth(
                <an aiohttp Client Session>,
                username=your_email,
                password=your_password,
            )
```

2. Attempt to log in using the passed in credentials. If successful without two factor, the function will return your User object containing your auth token.
If two factor is required, the function will raise a TwoFactorRequiredError, and a two factor code will be emailed to your account at the time of the exception being raised.
```
try:
    user = cync_auth.login()
catch TwoFactorRequiredError:
    # Handle Two Factor
```

3. If a two factor code was required, you may call the same login function, and this time provide your two factor code.
```
try:
    user = cync_auth.login("123456")
catch AuthFailedError:
    # Handle Auth failure
```

4. After you have logged in, you may create a new Cync object and provide your Auth object.
```
cync_api = Cync.create(cync_auth)
```

## Getting Your Devices
There are two formats you can fetch your account's devices in.  

The first is a flattened view, where all of your account's devices are in a single-level list.  
This is useful if you want a simple view of all of your account's devices at once.
```
my_devices = cync_api.get_devices()
```

The second is a hierarchical format, with your devices organized into homes, rooms, and groups. It will return a list of homes, which each contain rooms, and then groups.  
This is useful if you would like to view your setup in a format that more closely matches the Cync app's categorization.
```
my_homes = cync_api.get_homes()
```
From here, you can filter devices as desired, and use the functions on the CyncDevice objects to control them.

## Setting a State Change Callback
If you would like to specify a callback function to run whenever device states change, you may provide one to the Cync object.  
The update_data parameter is a JSON object. The key is the device ID, and the value is the CyncDevice object with its new state set.
```
def my_callback(update_data: dict[int, CyncDevice]):
    # Handle updated data
    
cync_api.set_update_callback(my_callback)
```

## Other Things to Note
Only one connection can be established to the Cync server at a time per account.  
This means that if you are using the library, and then you open the Cync app on your phone, your library's connection will be closed.  
The server is the one that closes the connection, so unfortunately there is no getting around this. The library will attempt to reestablish the connection after 10 seconds.  
However, also note that once the library reestablishes the connection, your Cync app's connection will be closed. Love it.

# Thanks
A special thanks to [nikshriv](https://github.com/nikshriv)'s cync_lights project (https://github.com/nikshriv/cync_lights), and  
[unixpickle](https://github.com/unixpickle)'s cbyge project (https://github.com/unixpickle/cbyge).  

These projects and the discussions within them helped kickstart the direction to take for reverse engineering the Cync protocols.
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pycync",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9.0",
    "maintainer_email": null,
    "keywords": "cync, ge, lighting, smart home",
    "author": "@Kinachi249",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/ad/b8/27ad949f5a6c80e582d273bf514867efdfeaae204a2688fd35a821bf0b6d/pycync-0.1.0.tar.gz",
    "platform": null,
    "description": "# PyCync\nPyCync is a Python API library for interfacing with Cync by GE smart devices.  \n\nThe goal of this project is to make a generalized Cync library that will eventually span the gamut of Cync devices and features, while breaking the underlying protocol into more concrete implementations.\n\n## Disclaimers\nThis library is still an early work in progress. As such, various devices and features may not yet be supported. However, work is ongoing to add features to get the library closer to feature parity with the app.\n\nThe code has only been physically tested with Cync full color light bulbs and the dynamic effects LED strip, as those are the only light devices I own.  \nIf you encounter issues with a specific device, I can do my best to fix them, but there may be a delay if I need to purchase the device to test with.  \n\nCurrently, only Wi-Fi connected devices are supported. This means that you must have at least one Wi-Fi connected device in your home to utilize the library.  \nNote that if you have a Wi-Fi connected device that acts as a bridge for other Bluetooth-only devices that communicate via Bluetooth mesh, all of the devices should work.  \nDirect Bluetooth connections may be supported in the future, however at the moment it isn't a prioritized feature.\n\nThis library and its developers are in no way affiliated with GE Lighting or Savant Technologies. All APIs and protocols utilized in the library were created from reverse engineering.\n\n# Using the Library\n## Authenticating\n\n1. The first step is to create an Auth object, which will handle authenticating your Cync user.\n```\ncync_auth = Auth(\n                <an aiohttp Client Session>,\n                username=your_email,\n                password=your_password,\n            )\n```\n\n2. Attempt to log in using the passed in credentials. If successful without two factor, the function will return your User object containing your auth token.\nIf two factor is required, the function will raise a TwoFactorRequiredError, and a two factor code will be emailed to your account at the time of the exception being raised.\n```\ntry:\n    user = cync_auth.login()\ncatch TwoFactorRequiredError:\n    # Handle Two Factor\n```\n\n3. If a two factor code was required, you may call the same login function, and this time provide your two factor code.\n```\ntry:\n    user = cync_auth.login(\"123456\")\ncatch AuthFailedError:\n    # Handle Auth failure\n```\n\n4. After you have logged in, you may create a new Cync object and provide your Auth object.\n```\ncync_api = Cync.create(cync_auth)\n```\n\n## Getting Your Devices\nThere are two formats you can fetch your account's devices in.  \n\nThe first is a flattened view, where all of your account's devices are in a single-level list.  \nThis is useful if you want a simple view of all of your account's devices at once.\n```\nmy_devices = cync_api.get_devices()\n```\n\nThe second is a hierarchical format, with your devices organized into homes, rooms, and groups. It will return a list of homes, which each contain rooms, and then groups.  \nThis is useful if you would like to view your setup in a format that more closely matches the Cync app's categorization.\n```\nmy_homes = cync_api.get_homes()\n```\nFrom here, you can filter devices as desired, and use the functions on the CyncDevice objects to control them.\n\n## Setting a State Change Callback\nIf you would like to specify a callback function to run whenever device states change, you may provide one to the Cync object.  \nThe update_data parameter is a JSON object. The key is the device ID, and the value is the CyncDevice object with its new state set.\n```\ndef my_callback(update_data: dict[int, CyncDevice]):\n    # Handle updated data\n    \ncync_api.set_update_callback(my_callback)\n```\n\n## Other Things to Note\nOnly one connection can be established to the Cync server at a time per account.  \nThis means that if you are using the library, and then you open the Cync app on your phone, your library's connection will be closed.  \nThe server is the one that closes the connection, so unfortunately there is no getting around this. The library will attempt to reestablish the connection after 10 seconds.  \nHowever, also note that once the library reestablishes the connection, your Cync app's connection will be closed. Love it.\n\n# Thanks\nA special thanks to [nikshriv](https://github.com/nikshriv)'s cync_lights project (https://github.com/nikshriv/cync_lights), and  \n[unixpickle](https://github.com/unixpickle)'s cbyge project (https://github.com/unixpickle/cbyge).  \n\nThese projects and the discussions within them helped kickstart the direction to take for reverse engineering the Cync protocols.",
    "bugtrack_url": null,
    "license": "GPL-3.0-or-later",
    "summary": "A Python library to communicate with Cync by GE devices.",
    "version": "0.1.0",
    "project_urls": {
        "Homepage": "https://github.com/Kinachi249/pycync",
        "Issues": "https://github.com/Kinachi249/pycync/issues"
    },
    "split_keywords": [
        "cync",
        " ge",
        " lighting",
        " smart home"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "97c5f5d8b1483707abf4c4a901744006f050cfb590cfe957286dc8b516b7beef",
                "md5": "9de6c71efa2d3afbac30dc0738ef3e4f",
                "sha256": "5994e3a6d4fc995bd11d8e74e48574c85d665c5c4f51f26ab81aacf5f808475a"
            },
            "downloads": -1,
            "filename": "pycync-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9de6c71efa2d3afbac30dc0738ef3e4f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9.0",
            "size": 43402,
            "upload_time": "2025-08-01T21:48:14",
            "upload_time_iso_8601": "2025-08-01T21:48:14.519708Z",
            "url": "https://files.pythonhosted.org/packages/97/c5/f5d8b1483707abf4c4a901744006f050cfb590cfe957286dc8b516b7beef/pycync-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "adb827ad949f5a6c80e582d273bf514867efdfeaae204a2688fd35a821bf0b6d",
                "md5": "faa9860b1f909de30ed6c9e7b6944ba5",
                "sha256": "83d2449cd16f9214e4a39ca57082fc9425c07c93f97ee0cdb5e0a9401f6c0977"
            },
            "downloads": -1,
            "filename": "pycync-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "faa9860b1f909de30ed6c9e7b6944ba5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9.0",
            "size": 41223,
            "upload_time": "2025-08-01T21:48:16",
            "upload_time_iso_8601": "2025-08-01T21:48:16.298993Z",
            "url": "https://files.pythonhosted.org/packages/ad/b8/27ad949f5a6c80e582d273bf514867efdfeaae204a2688fd35a821bf0b6d/pycync-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-01 21:48:16",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Kinachi249",
    "github_project": "pycync",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pycync"
}
        
Elapsed time: 1.11993s