smartblinds-ble 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. smartblinds_ble-0.1.0/.github/workflows/ci.yml +28 -0
  2. smartblinds_ble-0.1.0/.github/workflows/release.yml +38 -0
  3. smartblinds_ble-0.1.0/.gitignore +34 -0
  4. smartblinds_ble-0.1.0/CLAUDE.md +86 -0
  5. smartblinds_ble-0.1.0/LICENSE +202 -0
  6. smartblinds_ble-0.1.0/NOTICE +35 -0
  7. smartblinds_ble-0.1.0/PKG-INFO +192 -0
  8. smartblinds_ble-0.1.0/README.md +169 -0
  9. smartblinds_ble-0.1.0/contrib/gate_auth_mac.py +151 -0
  10. smartblinds_ble-0.1.0/contrib/mitm_tilt_addon.py +128 -0
  11. smartblinds_ble-0.1.0/contrib/parse_pklg.py +165 -0
  12. smartblinds_ble-0.1.0/docs/CAPTURE.md +61 -0
  13. smartblinds_ble-0.1.0/docs/PROTOCOL.md +109 -0
  14. smartblinds_ble-0.1.0/docs/ROADMAP.md +50 -0
  15. smartblinds_ble-0.1.0/pyproject.toml +52 -0
  16. smartblinds_ble-0.1.0/src/smartblinds_ble/__init__.py +27 -0
  17. smartblinds_ble-0.1.0/src/smartblinds_ble/blind.py +112 -0
  18. smartblinds_ble-0.1.0/src/smartblinds_ble/cloud.py +174 -0
  19. smartblinds_ble-0.1.0/src/smartblinds_ble/const.py +41 -0
  20. smartblinds_ble-0.1.0/src/smartblinds_ble/exceptions.py +19 -0
  21. smartblinds_ble-0.1.0/src/smartblinds_ble/scanner.py +19 -0
  22. smartblinds_ble-0.1.0/src/smartblinds_ble/tilt/__init__.py +44 -0
  23. smartblinds_ble-0.1.0/src/smartblinds_ble/tilt/ble.py +465 -0
  24. smartblinds_ble-0.1.0/src/smartblinds_ble/tilt/protocol.py +525 -0
  25. smartblinds_ble-0.1.0/src/smartblinds_ble/tools/__init__.py +0 -0
  26. smartblinds_ble-0.1.0/src/smartblinds_ble/tools/find_key.py +66 -0
  27. smartblinds_ble-0.1.0/src/smartblinds_ble/tools/import_cloud.py +88 -0
  28. smartblinds_ble-0.1.0/tests/test_protocol.py +67 -0
  29. smartblinds_ble-0.1.0/tests/test_tilt_ble.py +100 -0
  30. smartblinds_ble-0.1.0/tests/test_tilt_protocol.py +330 -0
  31. smartblinds_ble-0.1.0/tests/tilt_helpers.py +176 -0
@@ -0,0 +1,28 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ test:
13
+ runs-on: ubuntu-latest
14
+ strategy:
15
+ fail-fast: false
16
+ matrix:
17
+ python-version: ["3.11", "3.12", "3.13"]
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+ - uses: actions/setup-python@v5
21
+ with:
22
+ python-version: ${{ matrix.python-version }}
23
+ - name: Install (with dev extras)
24
+ run: pip install -e ".[dev]"
25
+ - name: Lint
26
+ run: ruff check .
27
+ - name: Test
28
+ run: pytest -q
@@ -0,0 +1,38 @@
1
+ name: Release
2
+
3
+ # Publishes to PyPI via Trusted Publishing (OIDC) when a version tag is pushed.
4
+ # One-time PyPI setup (https://pypi.org/manage/account/publishing/):
5
+ # PyPI project name: smartblinds-ble
6
+ # Owner: benbalter Repository: smartblinds-ble
7
+ # Workflow name: release.yml (leave Environment blank)
8
+ # Then: git tag v0.1.0 && git push origin v0.1.0
9
+
10
+ on:
11
+ push:
12
+ tags: ["v*"]
13
+
14
+ permissions:
15
+ contents: read
16
+
17
+ jobs:
18
+ pypi:
19
+ name: Build and publish to PyPI
20
+ runs-on: ubuntu-latest
21
+ permissions:
22
+ id-token: write # required for Trusted Publishing
23
+ steps:
24
+ - uses: actions/checkout@v4
25
+ - uses: actions/setup-python@v5
26
+ with:
27
+ python-version: "3.13"
28
+ - name: Build sdist and wheel
29
+ run: |
30
+ python -m pip install --upgrade build
31
+ python -m build
32
+ - name: Verify version tag matches pyproject
33
+ run: |
34
+ TAG="${GITHUB_REF_NAME#v}"
35
+ PKG=$(ls dist/*.whl | sed -E 's/.*smartblinds_ble-([0-9.]+)-.*/\1/')
36
+ echo "tag=$TAG wheel=$PKG"
37
+ test "$TAG" = "$PKG"
38
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,34 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ .eggs/
6
+ build/
7
+ dist/
8
+ .venv/
9
+ venv/
10
+ env/
11
+
12
+ # Tooling
13
+ .pytest_cache/
14
+ .ruff_cache/
15
+ .mypy_cache/
16
+
17
+ # Exported BLE keys (secrets) from the cloud importer — never commit
18
+ smartblinds-keys.json
19
+ *-keys.json
20
+
21
+ # Captured cloud traffic (redacted, but still contains emails/MACs/room names)
22
+ tilt-capture/
23
+ *.pklg
24
+ *.pcap
25
+
26
+ # Editors / OS
27
+ .DS_Store
28
+ .vscode/
29
+ .idea/
30
+
31
+ # Local Tilt pairing keys for the in-room gate check — never commit.
32
+ keys/
33
+ *.key
34
+ keys.json
@@ -0,0 +1,86 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## What this is
6
+
7
+ Local, hub-free & cloud-free BLE control of **MySmartBlinds / Tilt** shade motors, so
8
+ they keep working after the (winding-down) vendor cloud dies. Two layers: this
9
+ `smartblinds-ble` async, `bleak`-based Python library, and a planned
10
+ `ha-smartblinds-ble` HACS integration (separate repo). Unofficial, not affiliated
11
+ with the vendor. Apache-2.0; a modern async port of `dnschneid/pysmartblinds` (see
12
+ `NOTICE`).
13
+
14
+ ## ⚠️ M0 gates everything
15
+
16
+ The BLE protocol here was reverse-engineered in 2018 (legacy MySmartBlinds, firmware
17
+ 2.0) and is **UNVERIFIED on current hardware**. The constants in `const.py` and the
18
+ GATT writes in `blind.py` are a *hypothesis*, marked as such. Do not describe them as
19
+ working. `docs/ROADMAP.md` Milestone 0 = confirm connect + key + tilt-write on a real
20
+ shade before any packaging/publishing. Everything downstream is contingent on M0.
21
+
22
+ ## Commands
23
+
24
+ - Install (dev): `pip install -e ".[dev]"`
25
+ - Test: `pytest -q` — single: `pytest tests/test_protocol.py::test_set_tilt_writes_key_then_position`
26
+ - Lint (the CI gate): `ruff check .`
27
+ - CI deliberately does **not** run `ruff format --check` — this ruff version
28
+ reformats Python inside markdown code blocks, which is brittle for the docs.
29
+ - Run a tool without installing (src/ layout needs the path): `PYTHONPATH=src python -m smartblinds_ble.tools.find_key`
30
+ - CLIs (`[project.scripts]`): `smartblinds-find-key` (BLE brute-force key discovery),
31
+ `smartblinds-import-cloud` (legacy-cloud key export; flags `--debug`,
32
+ `--include-deleted`, `--token`).
33
+ - CI: `.github/workflows/ci.yml` runs `ruff check` + `pytest` on Python 3.11/3.12/3.13.
34
+
35
+ ## Architecture
36
+
37
+ - `blind.py` — `SmartBlind`, the async `bleak` client. Takes a `BLEDevice` (not just an
38
+ address) so connections route through Home Assistant / ESPHome Bluetooth proxies.
39
+ Every op: connect → write key (handle `0x001b`) → write a position byte 0–200 (handle
40
+ `0x001f`) → disconnect. **Open-loop**: motors don't report state (reads return
41
+ `0xFF`), so `position` is tracked optimistically — the eventual HA cover must be
42
+ `assumed_state`.
43
+ - `const.py` — protocol constants, all flagged UNVERIFIED. `scanner.py` — discover
44
+ `SmartBlind_DFU` devices.
45
+ - `cloud.py` + `tools/import_cloud.py` — **optional** (`[cloud]` extra) key export from
46
+ the vendor cloud, isolated so the core stays cloud-free. See "Two backends" below.
47
+ - `tools/find_key.py` — cloud-independent BLE brute-force of the first key byte.
48
+ - `contrib/mitm_tilt_addon.py` — mitmproxy addon for reversing the Tilt cloud API;
49
+ auto-redacts secrets, writes `tilt-capture/`.
50
+ - `docs/` — `PROTOCOL.md` (RE'd protocol), `ROADMAP.md` (M0-gated milestones),
51
+ `CAPTURE.md` (definitive field notes for capturing the protocol; read before
52
+ attempting either a network-MITM or BLE capture).
53
+
54
+ ## Two backends / device generations (critical, non-obvious)
55
+
56
+ The hardware split into two ecosystems that do **not** share a data backend:
57
+
58
+ - **Legacy "MySmartBlinds"** → cloud `api.mysmartblinds.com` (GraphQL). `cloud.py`
59
+ targets this. Key is short (first byte often suffices → brute-forceable). BLE is
60
+ plaintext (`0x001b`/`0x001f`).
61
+ - **Newer "Tilt"** → cloud `api.tiltsmarthome.com/v2/store/tilt`. **Same Auth0 tenant**
62
+ (`mysmartblinds.auth0.com`), so a legacy login *succeeds* but returns 0 devices for
63
+ Tilt users. Store: `rooms[].rollerShades[]`/`bridges[]`, each `{id = BLE MAC, name,
64
+ pairingKey}`; `pairingKey` is 32 bytes → Tilt BLE is likely **encrypted/authenticated**,
65
+ unlike the legacy protocol. Use `access_token` (id_token → 401).
66
+
67
+ Implications: `cloud.py` only serves *legacy* accounts. Tilt devices need the Tilt API
68
+ (different Auth0 client_id `Owjr4yOJ2H…`, not yet built) or BLE. The **Tilt bridge is a
69
+ cloud-only AWS IoT MQTT client with no local API** (verified: all ports closed) — it is
70
+ **not** a local control path. Direct BLE is the only durable local path.
71
+
72
+ ## Conventions / gotchas
73
+
74
+ - **ruff broad-except**: an `except Exception` that **re-raises** must NOT have
75
+ `# noqa: BLE001` (RUF100 flags it unused); one that swallows / `sys.exit`s **must**.
76
+ `BLE001` is enabled here; `PLC0415` (lazy import) is not.
77
+ - `__all__` must be sorted per RUF022 (SCREAMING_SNAKE, then CamelCase, then lowercase;
78
+ alphabetical within each group).
79
+ - **Cloud dep**: PyPI `smartblinds-client` is stale (0.6, 2019; won't log in). Install
80
+ the docBliny fork from git; the `[cloud]` extra pin is a floor only (a git URL can't
81
+ live in a PyPI-published extra).
82
+ - **Secrets**: `*-keys.json` and `.pklg`/`.pcap` traces contain keys; `tilt-capture/`
83
+ is redacted but still holds emails/MACs/room names — all gitignored, keep them out.
84
+ - **Python**: `requires-python >=3.11`; the `type X = Y` statement (3.12+) breaks older
85
+ parsers — avoid it.
86
+ - Not on PyPI yet — install from git. Publishing (final name + PyPI) waits for M0.
@@ -0,0 +1,202 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
202
+
@@ -0,0 +1,35 @@
1
+ smartblinds-ble
2
+ Copyright 2026 Ben Balter and contributors
3
+
4
+ This product includes software derived from pysmartblinds
5
+ (https://github.com/dnschneid/pysmartblinds), Copyright 2018 The pysmartblinds
6
+ authors, licensed under the Apache License, Version 2.0.
7
+
8
+ The smartblinds_ble.tilt subpackage (the Tilt-era encrypted protocol codec and
9
+ BLE transport) is vendored from tilt-local-bridge
10
+ (https://github.com/Sunrise-Labs-Dot-AI/tilt-local-bridge), Copyright (c) 2026
11
+ Sunrise Labs, licensed under the MIT License. protocol.py is kept byte-for-byte;
12
+ ble.py adapts only the TiltShadeClient entry point. The MIT license terms:
13
+
14
+ Permission is hereby granted, free of charge, to any person obtaining a copy
15
+ of this software and associated documentation files (the "Software"), to deal
16
+ in the Software without restriction, including without limitation the rights
17
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
+ copies of the Software, and to permit persons to whom the Software is
19
+ furnished to do so, subject to the following conditions:
20
+
21
+ The above copyright notice and this permission notice shall be included in
22
+ all copies or substantial portions of the Software.
23
+
24
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30
+ SOFTWARE.
31
+
32
+ The BLE protocol details were reverse-engineered without any knowledge of the
33
+ internal workings of MySmartBlinds / Tilt products. This project is not
34
+ affiliated with, authorized by, or endorsed by MySmartBlinds or Tilt. Those names
35
+ are used only to describe the hardware this software interoperates with.
@@ -0,0 +1,192 @@
1
+ Metadata-Version: 2.5
2
+ Name: smartblinds-ble
3
+ Version: 0.1.0
4
+ Summary: Local, hub-free async BLE control of MySmartBlinds/Tilt shade motors
5
+ Project-URL: Homepage, https://github.com/benbalter/smartblinds-ble
6
+ Project-URL: Issues, https://github.com/benbalter/smartblinds-ble/issues
7
+ Author: Ben Balter
8
+ License-Expression: Apache-2.0
9
+ License-File: LICENSE
10
+ License-File: NOTICE
11
+ Keywords: ble,blinds,bluetooth,home-assistant,mysmartblinds,tilt
12
+ Requires-Python: >=3.11
13
+ Requires-Dist: bleak-retry-connector>=3.5
14
+ Requires-Dist: bleak>=0.22
15
+ Requires-Dist: cryptography>=42
16
+ Provides-Extra: cloud
17
+ Requires-Dist: smartblinds-client>=0.6; extra == 'cloud'
18
+ Provides-Extra: dev
19
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
20
+ Requires-Dist: pytest>=8; extra == 'dev'
21
+ Requires-Dist: ruff>=0.5; extra == 'dev'
22
+ Description-Content-Type: text/markdown
23
+
24
+ # smartblinds-ble — local control for MySmartBlinds / Tilt smart blinds (no hub, no cloud)
25
+
26
+ [![CI](https://github.com/benbalter/smartblinds-ble/actions/workflows/ci.yml/badge.svg)](https://github.com/benbalter/smartblinds-ble/actions/workflows/ci.yml)
27
+
28
+ Keep your **MySmartBlinds / Tilt motorized blinds** working **even after the cloud
29
+ shuts down**. `smartblinds-ble` controls the shade motors **locally over Bluetooth
30
+ LE** — **no proprietary hub, no cloud account, no phone app required** — and is
31
+ built to run through **Home Assistant** and cheap **ESP32 / ESPHome Bluetooth
32
+ Proxies**.
33
+
34
+ > **Status: pre-alpha / bring-up.** The BLE protocol was reverse-engineered in 2018
35
+ > and is **not yet re-verified** on current firmware — see [`docs/ROADMAP.md`](docs/ROADMAP.md)
36
+ > (Milestone 0 gates everything). The **cloud key-export tool below works today**,
37
+ > independent of that.
38
+ >
39
+ > Unofficial project. Not affiliated with, authorized by, or endorsed by
40
+ > MySmartBlinds, Tilt, or SmarterHome. Use at your own risk; may void your warranty.
41
+
42
+ ## Is this you?
43
+
44
+ If you're searching for any of the following, you're in the right place:
45
+
46
+ - **"Is MySmartBlinds / Tilt shutting down / discontinued / out of business?"** —
47
+ the signs point that way (`tiltsmarthome.com` now redirects to a wind-down page,
48
+ parts are unavailable, support has gone quiet).
49
+ - **"MySmartBlinds app not working / won't connect / no one answers support."**
50
+ - **"How do I control MySmartBlinds without the hub / without the cloud / without the app?"**
51
+ - **"MySmartBlinds / Tilt Home Assistant integration"** — a *local* one, not the
52
+ old laggy cloud bridge.
53
+ - **"Will my smart blinds keep working if the servers go offline?"**
54
+ - **"MySmartBlinds ESP32 / ESPHome / Bluetooth local control."**
55
+
56
+ ## ⏳ Rescue your keys now (do this before the cloud goes dark)
57
+
58
+ Each motor needs a small BLE **key** to accept commands. While the vendor cloud is
59
+ still online, it will hand back the real key for **every shade on your account**
60
+ after a single login. Once the cloud shuts down, keys are only recoverable the hard
61
+ way (brute-force or Bluetooth sniffing). This step needs **no extra hardware**:
62
+
63
+ ```bash
64
+ # Not on PyPI yet — install from GitHub. Use the maintained docBliny fork of the
65
+ # cloud client (PyPI's build is stale and no longer logs in):
66
+ pip install "git+https://github.com/docBliny/smartblinds-client.git" \
67
+ "git+https://github.com/benbalter/smartblinds-ble.git"
68
+
69
+ smartblinds-import-cloud # cloud email/password -> smartblinds-keys.json
70
+ ```
71
+
72
+ > If pip errors with `externally-managed-environment`, run it in a venv:
73
+ > `python3 -m venv .venv && . .venv/bin/activate` then re-run the install.
74
+ > Once this is published to PyPI, the above collapses to `pip install "smartblinds-ble[cloud]"`.
75
+
76
+ The output holds `{name, mac, key}` per shade and is your **offline insurance** if
77
+ the cloud disappears. Keep it safe — it contains secrets (gitignored by default).
78
+
79
+ > **Legacy app only.** This exports from the *legacy MySmartBlinds* cloud. If you
80
+ > set your shades up in the newer **Tilt** app, they live in a separate backend and
81
+ > won't appear here (login works but returns zero blinds). In that case, skip the
82
+ > cloud and read the key directly over BLE with `smartblinds-find-key`.
83
+
84
+ > The importer logs into **your own account** to retrieve **your own devices'**
85
+ > keys, for interoperability with hardware you own. Use your own credentials, at
86
+ > your own risk.
87
+
88
+ ## Why this exists
89
+
90
+ The motors are ordinary Bluetooth LE devices. The only reason the vendor's hub
91
+ exists is to bridge Wi-Fi → cloud → Bluetooth. With the company winding down, that
92
+ cloud is a single point of failure that could take your blinds offline. This
93
+ project talks to the motors **directly and locally**, so:
94
+
95
+ - **No hub, no cloud, no account** — everything stays on your LAN.
96
+ - Control routes through inexpensive **ESP32 ESPHome Bluetooth Proxies** for
97
+ whole-home coverage, or any Home Assistant Bluetooth adapter.
98
+ - Your **MySmartBlinds keep working after the cloud shuts down**.
99
+
100
+ ## How it works
101
+
102
+ Two layers:
103
+
104
+ 1. **`smartblinds-ble`** (this repo) — a small async, `bleak`-based Python library
105
+ for talking to the motors over BLE.
106
+ 2. **`ha-smartblinds-ble`** (in progress) — a HACS-installable **Home Assistant**
107
+ integration exposing each shade as an optimistic tilt `cover`, working through
108
+ ESPHome Bluetooth Proxies.
109
+
110
+ ## Two things everyone gets stuck on
111
+
112
+ - **The per-motor key.** Best: export it from the cloud with `smartblinds-import-cloud`
113
+ (above) while you still can. Offline fallback: brute-force the first byte with
114
+ `smartblinds-find-key`, or sniff the app once. See [`docs/PROTOCOL.md`](docs/PROTOCOL.md).
115
+ - **No state feedback.** The motors are open-loop (reads return `0xFF`). Position is
116
+ tracked optimistically; changes made from the app or a physical wand are invisible.
117
+
118
+ ## Quick start (bring-up, local adapter)
119
+
120
+ ```bash
121
+ pip install -e ".[dev]"
122
+ smartblinds-find-key # scan + brute-force keys for nearby motors
123
+ pytest # protocol/encoding unit tests (mocked BLE)
124
+ ```
125
+
126
+ ```python
127
+ import asyncio
128
+ from smartblinds_ble import SmartBlind, discover
129
+
130
+ async def main():
131
+ (device,) = await discover()
132
+ blind = SmartBlind(device, key="2a") # from the cloud export or find-key
133
+ await blind.set_tilt_percent(50) # flat-ish
134
+
135
+ asyncio.run(main())
136
+ ```
137
+
138
+ ## FAQ
139
+
140
+ ### Is MySmartBlinds / Tilt going out of business?
141
+ There's no formal shutdown announcement, but the signals are strong: the operator
142
+ (SmarterHome, a Hall Labs subsidiary) is winding down, `tiltsmarthome.com`
143
+ permanently redirects to that wind-down page, replacement parts have been
144
+ unavailable for a while, and support has gone quiet. The app still received updates
145
+ into 2025, so the cloud is alive **for now** — which is exactly why you should
146
+ export your keys today.
147
+
148
+ ### Will my blinds stop working if the cloud/app shuts down?
149
+ The blinds themselves are local Bluetooth devices, so they don't *need* the cloud —
150
+ but the **official app and hub depend on it**, and you need each motor's key to
151
+ control it locally. That's what this project (and the key-export tool) is for:
152
+ keeping your **MySmartBlinds working after the cloud goes offline**.
153
+
154
+ ### How do I control MySmartBlinds without the hub or the app?
155
+ Get each motor's key (cloud export or brute-force), then send BLE commands with
156
+ this library — directly from a computer/Raspberry Pi, or through Home Assistant +
157
+ an ESP32 Bluetooth Proxy.
158
+
159
+ ### Does this work with Home Assistant?
160
+ That's the goal — a local HACS integration (`ha-smartblinds-ble`) exposing each
161
+ shade as a tilt `cover`, no cloud bridge. It's in progress and gated on hardware
162
+ validation (see the roadmap).
163
+
164
+ ### Do I need an ESP32 / ESPHome Bluetooth Proxy?
165
+ Only for range. Any Home Assistant Bluetooth adapter works if it's near the shades;
166
+ ESP32 ESPHome Bluetooth Proxies (a few dollars each) extend coverage across a house.
167
+
168
+ ### Does it work with the Tilt app still installed?
169
+ Avoid using both at once — the app and this library can fight over position, since
170
+ the motors don't report their true state.
171
+
172
+ ## Credits
173
+
174
+ - [`dnschneid/pysmartblinds`](https://github.com/dnschneid/pysmartblinds) — the
175
+ original reverse engineering (Apache-2.0); this is a modern async port. See
176
+ [`NOTICE`](NOTICE).
177
+ - [`ianlevesque/smartblinds-client`](https://github.com/ianlevesque/smartblinds-client)
178
+ and [`docBliny/ha-mysmartblinds`](https://github.com/docBliny/ha-mysmartblinds) —
179
+ the cloud client and (cloud-based) HA integration this borrows the key-export idea from.
180
+ - [`LennP/ha-motionblinds_ble`](https://github.com/LennP/ha-motionblinds_ble) — the
181
+ template for the Home Assistant integration layer.
182
+
183
+ ## Keywords
184
+
185
+ MySmartBlinds · Tilt · Tilt SmartHome · SmarterHome · Hall Labs · smart blinds ·
186
+ motorized blinds · local control · no cloud · no hub · cloud shutdown ·
187
+ discontinued · Home Assistant · HACS · Bluetooth · BLE · bleak · ESP32 · ESPHome ·
188
+ Bluetooth Proxy · retire the hub · keep working after cloud shutdown
189
+
190
+ ## License
191
+
192
+ [Apache-2.0](LICENSE).