Skip to main content

Async client for old Samsung air conditioners using the DPLUG/AC14K protocol (TLS, port 2878)

Project description

pysamsung-dplug

Async Python client for old Samsung air conditioners that speak the legacy DPLUG / AC14K protocol over TLS on port 2878 (Wi-Fi modules such as SWL-B70F, used by the AR**HSFS generation, ~2013–2015).

These units were dropped by SmartThings. This library lets you control them locally again — no cloud. It is the protocol layer used by the samsung_ac_dplug Home Assistant integration, but works standalone.

Features

  • Mutual-TLS handshake with the bundled Samsung client certificate (legacy TLS 1.0 / weak ciphers handled for you).
  • Token acquisition (GetToken), authentication (AuthToken).
  • Read full device state (DeviceState) and send commands (DeviceControl).
  • Auto-discover the device id (DeviceList) and a passive async_probe().

Install

pip install pysamsung-dplug

Usage

import asyncio
from samsung_dplug import SamsungAcClient, build_ssl_context

async def main():
    ctx = build_ssl_context()                      # uses the bundled certificate
    client = SamsungAcClient("192.168.1.53", token="xxxxxxxx-....", ssl_context=ctx)
    state = await client.async_get_state()
    print("Power:", state["AC_FUN_POWER"], "Room:", state["AC_FUN_TEMPNOW"])
    await client.async_set("AC_FUN_POWER", "On")

asyncio.run(main())

Getting a token

The unit only issues a token at power-on (a physical proof-of-access step):

client = SamsungAcClient("192.168.1.53", ssl_context=ctx)
# turn the unit OFF, call this, then turn it ON within ~30 s:
token = await client.async_get_token()

build_ssl_context() does blocking file I/O; inside async frameworks run it in an executor (e.g. Home Assistant: await hass.async_add_executor_job(build_ssl_context)).

Protocol notes

Reverse-engineered from the official Smart Air Conditioner app and live devices. The unit greets with DPLUG-1.x, requires mutual TLS, and uses an XML request/response protocol. The DUID equals the Wi-Fi module MAC without separators. See the Home Assistant integration repo for the full write-up, including the undocumented APConnectionConfig Wi-Fi provisioning command.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pysamsung_dplug-0.5.1.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pysamsung_dplug-0.5.1-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

Details for the file pysamsung_dplug-0.5.1.tar.gz.

File metadata

  • Download URL: pysamsung_dplug-0.5.1.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pysamsung_dplug-0.5.1.tar.gz
Algorithm Hash digest
SHA256 687f78d5f8a8e872276dbca176ae16ce4550f5244ff9f9b75c6f05cf12903e3a
MD5 e311954188922d5b277cebaf237548a7
BLAKE2b-256 f51ebe0b2b7c9f2640409c0df6caae733bc77de851cd12c3eaa97ffe8c6ad0b8

See more details on using hashes here.

Provenance

The following attestation bundles were made for pysamsung_dplug-0.5.1.tar.gz:

Publisher: publish.yml on porech/pysamsung-dplug

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pysamsung_dplug-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: pysamsung_dplug-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 15.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pysamsung_dplug-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 79ba1a089d29021874ae717056d21eb89551e0dfe0b909e5ce6635db56b148a6
MD5 d5c6d72e92dbfc60cb729aa0c6260c56
BLAKE2b-256 31958b77bd0e316fb1bb531f009a9d7799a680328c4fb60b01ce9759e0e5ff41

See more details on using hashes here.

Provenance

The following attestation bundles were made for pysamsung_dplug-0.5.1-py3-none-any.whl:

Publisher: publish.yml on porech/pysamsung-dplug

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page