broadlink-magic
Python library for the local LAN protocol of BroadLink Magic Home families, maintained by BroadLink. It powers the Broadlink Magic Home integration in Home Assistant.
A Magic Home family is set up in the BroadLink app. The family's gateways (for example the RM MAX) connect to a UDP server on the local network (port 12346 by default). The server answers discovery and heartbeat messages, receives status uploads, and sends control packets for the family's devices.
Install
pip install broadlink-magic
Requires Python 3.13 or newer.
What it covers
- Parsing the family export the BroadLink app uploads (
import_data). - The gateway session: message framing, discovery, heartbeat, status upload
and query, and control (
inbound,gateway). - Payload encoding for lights, switches, curtains, air conditioners and three-in-one climate devices.
- Remote-controlled devices learned on an RM MAX (
remote).
Security
The gateway protocol has no authentication. The server identifies a gateway by the MAC address in its discovery and heartbeat messages, and the session follows the address those messages come from, so a gateway that changes its IP address or port reconnects right away. Another host on the same network that knows the gateway's MAC address can therefore take over its session. The library logs a warning whenever a session moves. Use it on a trusted local network only, and do not expose the UDP port to the internet or to untrusted networks.
Device and family keys are kept out of the repr of the data classes, so
logging a device or family does not write them to the log.
Development
python -m venv .venv
.venv/bin/pip install -e ".[dev]"
.venv/bin/ruff check .
.venv/bin/ruff format --check .
.venv/bin/pytest
Releases
Pushing a v* tag that matches the version in pyproject.toml publishes the
package to PyPI through trusted publishing. See CHANGELOG.md.
License
MIT. See LICENSE.
Metadata
Release files for broadlink-magic 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| broadlink_magic-0.1.1.tar.gz | 35.5 kB | With provenance | Details for broadlink_magic-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| broadlink_magic-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for broadlink_magic-0.1.1-py3-none-any.whl |
Total release size: 66.2 kB
Release files / broadlink_magic-0.1.1.tar.gz
| Download URL | broadlink_magic-0.1.1.tar.gz |
|---|---|
| Size | 35.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
77ab996f09ccabee018c4fad0e3becc7973503c9ba4f5df48865915e4292f830
|
|
BLAKE2b-256 checksum How to use checksums |
e4b4db847d8fafd72f0105c1a9b0e3eb5cec098c0fc2e2912781ab073dea12d5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.
Transparency logRelease files / broadlink_magic-0.1.1-py3-none-any.whl
| Download URL | broadlink_magic-0.1.1-py3-none-any.whl |
|---|---|
| Size | 30.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cb56d26fdab4bab4fb6445deff7f893c2b9f0b1da11b1087ba1a5c87faee650d
|
|
BLAKE2b-256 checksum How to use checksums |
c892713cf1bafc6c5442cb26c750789314f9d794d2f42cd05c0b6f87e8bf9729
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.
Transparency logSecurity for broadlink-magic 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for broadlink_magic-0.1.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.