Python library for Gemstone Lights permanent-Christmas-lights controllers (AWS-backed cloud API)
Project description
pygemstone
Standalone Python library for Gemstone Lights permanent-Christmas-light controllers.
Gemstone's mobile app talks to an AWS Amplify backend
(Cognito +
API Gateway +
AppSync) in us-west-2, so this library
is essentially:
- a Cognito SRP login wrapper (delegated to
pycognito) - an aiohttp REST client for the public endpoints that control the
lights (
/deviceControl/onState,/deviceControl/play/pattern, etc.)
Status: alpha — under active reverse-engineering of the iOS
com.gemstone.lightsapp. APIs will change.
Features
- Async login / token refresh (via Cognito User Pool SRP)
- Account & home group:
account_profile()— your user profilehomegroups()/homegroup_users(hg)invitations(status="pending")— pending invites (raw dict; schema unknown)
- Devices:
devices(hg)— list controllersdevice_state(id)/set_on_state(id, on)/play_pattern(id, p)device_groups(hg)— multi-device zones (raw dict; schema unknown)
- Pattern catalogue:
folders()/folder_patterns(page=N)/save_folder(id, body)swatches()— colour palettesdownloadable_folders(page=N)/downloadable_patterns(page=N)— Gemstone-curated catalogue
- Autopilot / scheduling:
events_settings(hg)— daily on/off window + enabled categoriessubscribed_events(hg, page=N)— date-bound holiday/event subscriptionsevents_categories()— full catalogue of holiday / sport / event categories
- Timers:
timers_by_homegroup(hg)— scheduled on/off timers with optional pattern
- Misc:
announcements()— in-app announcements
A note on AppSync (real-time)
The library ships an AppSync GraphQL HTTP + WebSocket transport
(pygemstone.appsync.AppSyncClient), but two iOS-app captures show
the official app never opens a GraphQL connection — only
unauthenticated /ping healthchecks. State updates propagate via REST
polling of /deviceControl/currentlyPlaying. The AppSync auth scheme
is therefore unknown and the transport is currently un-runnable
against the real backend; it's kept as scaffolding for if Gemstone
ever flips real-time on.
Planned
- Cognito global sign-out (currently only clears local tokens)
- Schedule/event subscribe + unsubscribe mutations
- Timer create / update / delete (only list is currently captured)
Installation
pip install pygemstone
Usage
import asyncio
from pygemstone import GemstoneClient
async def main():
async with GemstoneClient("you@example.com", "...") as gc:
await gc.login()
for group in await gc.homegroups():
print(group.name)
for device in await gc.devices(group.id):
state = await device.refresh()
print(" ", device.name, "on" if state.on_state else "off")
if not state.on_state:
await device.turn_on()
asyncio.run(main())
CLI
A small CLI is provided for manual testing:
python -m pygemstone login
python -m pygemstone list
python -m pygemstone state <DEVICE_ID>
python -m pygemstone on <DEVICE_ID>
python -m pygemstone off <DEVICE_ID>
Credentials are read from GEMSTONE_EMAIL / GEMSTONE_PASSWORD env
vars, or a .env file in the working directory.
Security note
Like the other Amplify-based IoT services, Gemstone's Cognito user pool
id and app client id are public values that any decompiled IPA / packet
capture exposes — they're shipped in const.py
as defaults. Do not commit credential files, JWT tokens, or
mitmproxy .flows files.
Reverse-engineering notes
The endpoint catalogue was derived from a mitmproxy --mode wireguard
capture of the official iOS app. Notes are kept private (the capture
contains a live Cognito session); the public endpoint shape is in
const.py.
License
MIT — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pygemstone-0.0.1.tar.gz.
File metadata
- Download URL: pygemstone-0.0.1.tar.gz
- Upload date:
- Size: 30.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d11ceb00c391aac4855cb41d0ff5e1d15cf60251883774b64e16c6726b671c5c
|
|
| MD5 |
1a65d952a05344b149ee49416fb00dc7
|
|
| BLAKE2b-256 |
64aac1214d7cc1b8d031722e1a5e000921ffda4c28a1ab6dd0b57f87b6d7eb2d
|
Provenance
The following attestation bundles were made for pygemstone-0.0.1.tar.gz:
Publisher:
release.yml on sslivins/pygemstone
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pygemstone-0.0.1.tar.gz -
Subject digest:
d11ceb00c391aac4855cb41d0ff5e1d15cf60251883774b64e16c6726b671c5c - Sigstore transparency entry: 1551562210
- Sigstore integration time:
-
Permalink:
sslivins/pygemstone@39aade7f3e1ecfac9eb170554d273cb42353eb25 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/sslivins
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@39aade7f3e1ecfac9eb170554d273cb42353eb25 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file pygemstone-0.0.1-py3-none-any.whl.
File metadata
- Download URL: pygemstone-0.0.1-py3-none-any.whl
- Upload date:
- Size: 24.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fbb49c9b8b866fe775da1c5141bfbf77b7b4b60e7aef985746cb5c4e633208ce
|
|
| MD5 |
0d8b0bdcc41f734c7b5ea2042654a14a
|
|
| BLAKE2b-256 |
3dbc1a787e7adef9072f8d6a118b3f2537d6e1acdc53136743d963be476aa29c
|
Provenance
The following attestation bundles were made for pygemstone-0.0.1-py3-none-any.whl:
Publisher:
release.yml on sslivins/pygemstone
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pygemstone-0.0.1-py3-none-any.whl -
Subject digest:
fbb49c9b8b866fe775da1c5141bfbf77b7b4b60e7aef985746cb5c4e633208ce - Sigstore transparency entry: 1551562226
- Sigstore integration time:
-
Permalink:
sslivins/pygemstone@39aade7f3e1ecfac9eb170554d273cb42353eb25 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/sslivins
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@39aade7f3e1ecfac9eb170554d273cb42353eb25 -
Trigger Event:
workflow_dispatch
-
Statement type: