Taking a Coway Air Purifier Off the Cloud


A connected appliance can be physically inside your house while every command takes a trip through somebody else’s servers. Scott Goldman’s Coway Airmega IconS was a case in point. He wanted his Apple Home “Good Night” scene to raise the fan speed for white noise. A Home Assistant integration made that possible, but it impersonated Coway’s phone app: commands and status still passed through the IoCare cloud. App changes, service outages, and even an account ban had interrupted control. The purifier itself kept filtering air; the remote control path was fragile.

Goldman’s investigation eventually replaced that path with a local Home Assistant integration. The decisive discovery was in the initial Bluetooth setup message. It told the purifier where to fetch its certificate authority and where to enroll for MQTT credentials. Once he could send that message himself, the device could be pointed at his own server from the start. The intermediary traffic-capture rig was useful for learning the protocol, but it was unnecessary for ordinary use.

The dependency hidden in a simple scene

The original arrangement was Apple Home → Home Assistant → an unofficial IoCare integration → Coway’s servers → the purifier. The integration polled the cloud for status and sent commands back through it. This arrangement worked when Coway’s interfaces, account policy, and service were available. It also made a bedroom fan dependent on all three.

Goldman documented several concrete failures: the integration was blocked for making too many requests, an IoCare-to-IoCare+ app rewrite forced changes, scraped HTML changed, the servers went offline, and an account running an older integration was banned for weeks. These are different failure modes with one shared cause: control lived outside the home network. A local replacement would need to reproduce both enrollment and the message channel that carries fan commands.

Cloud control routes Apple Home through Home Assistant and Coway servers to the purifier; local control routes Home Assistant directly to the purifier over the LAN.
The local route removes the vendor service from the everyday control path.

Learning what the purifier expects

Goldman first built a small isolated Wi-Fi network around a Raspberry Pi running mitmproxy. The Pi acted as the purifier’s access point and redirected web traffic to the proxy. Its initial location had insufficient Wi-Fi reach, so he moved it beside the purifier and used an Ethernet connection to a laptop that shared the home’s internet access. This arrangement let him observe startup traffic without modifying the appliance.

The first useful request was surprising: the purifier fetched AmazonRootCA1.pem over plain HTTP. It used that certificate to decide which later TLS connections to trust. In the experiment, substituting a lab certificate in the HTTP response made the subsequent HTTPS traffic readable. That showed that the root of trust was delivered on a channel without authentication. The recently discussed eMudhra certificate issue was an early possible route into the experiment; the HTTP certificate download made that route irrelevant for this device.

The newly visible enrollment response included a host, port, certificate URLs, a private-key URL, and a CA URL. In other words, the server told the purifier which MQTT endpoint and credentials to use. A packet capture during app actions then showed traffic on TCP port 8883, the standard port for MQTT over TLS. Changes to speed, mode, timer, sensitivity, lighting, and filter settings corresponded to MQTT messages. Redirecting enrollment and decoding those messages supplied the pieces for a replacement server, but it still left the vendor app and a proxy in the setup procedure.

Bluetooth was the actual escape hatch

The phone app configures Wi-Fi over Bluetooth. Goldman captured Android Bluetooth HCI logs, compared them with a decompiled copy of the app, and reconstructed the exchange. The purifier exposes an identity through characteristic FFA0; setup writes to FFA2. First comes a random 20-letter key in a P001 protobuf message. The app combines those letters with the purifier’s 12-character MAC address to form the AES key for a second, encrypted P002 configuration payload.

That second payload carries the Wi-Fi SSID and password, plus caUrl and certSvrUrl. The latter two fields define the certificate bootstrap and enrollment destinations. Since the setup client supplies them, a replacement client can put local server addresses there. The purifier then fetches a local CA, enrolls with a local HTTPS service, and connects to a local MQTT broker. The team verified the reconstruction against captured Bluetooth messages before implementing the setup flow.

Bluetooth setup sends Wi-Fi and local service URLs to the purifier, which fetches a local CA, enrolls for a certificate, and connects to a local MQTT broker.
The two URLs in Bluetooth provisioning determine where the purifier goes next.

This is the key distinction between discovery and deployment. During discovery, an interception network exposed the certificate and MQTT behavior. In deployment, the browser sends the right destinations during pairing, and the purifier goes straight to Home Assistant over the LAN. No ongoing proxy is required.

What the local integration runs

The published Coway Local integration hosts the three services the purifier needs: an HTTP endpoint for its public CA certificate, an HTTPS enrollment endpoint for the device certificate and key, and an MQTT broker for ongoing control. Its documented default ports are 8080, 9443, and 9883. Each fan authenticates with its enrolled certificate and is limited to its own topics. The broker belongs to this integration; it is not a general replacement for Home Assistant’s MQTT integration.

Pairing uses a static Web Bluetooth setup page. A laptop near the purifier opens it in Chrome, selects the device, and sends Wi-Fi details plus the Home Assistant address over Bluetooth. The Wi-Fi password is sent to the purifier and is not stored by Home Assistant. The static page is hosted over HTTPS because Chrome requires a secure context for Web Bluetooth; the project also documents a localhost option. Once the device connects, Home Assistant exposes power, three manual speeds, smart and sleep modes, lighting, timer, sensitivity, filter status, PM2.5, and ambient light. Home Assistant can then bridge the fan to Apple Home, completing the original Good Night scene.

There are operational details to get right. Home Assistant needs a fixed reachable LAN address because the purifier stores it at setup; changing the address or service ports requires pairing again. The purifier needs 2.4 GHz Wi-Fi. Its three local service ports should stay on a trusted LAN rather than being forwarded to the internet. The integration stores certificate material under Home Assistant’s .storage/coway_local/, so backups matter: losing those credentials means enrolling each fan again. Removing a fan from Home Assistant revokes its access, but does not reset the physical unit.

The result and its limits

The author demonstrated the Airmega IconS receiving local commands from Home Assistant and appearing in Apple Home. The repository identifies the tested device as AP-1022K and calls the project experimental. It does not claim that other Coway models or firmware versions work. The original Coway phone app also stops controlling a fan provisioned for the local broker. This is a deliberate change of control plane, not a transparent bridge to both systems.

The broader engineering lesson is in the provisioning boundary. MQTT encryption and device certificates protect a connection only after the device has decided which certificate authority and broker to trust. On this purifier, the original process fetched a CA over HTTP, and the Bluetooth payload supplied the service URLs. Understanding those first steps made a durable local route possible. It also shows why a claim of “encrypted IoT traffic” says little on its own about who controls enrollment.

Sources

100%