pdf-icon

SwitchC6 Home Assistant Integration

Introduction

SwitchC6 is an IoT single-live wire switch controller. It integrates the ESP32-C6-MINI-1 core controller and a magnetic latching relay, supports connecting to electrical load circuits of AC 100 ~ 230V, and helps quickly build IoT smart homes. The controller comes pre-installed with ESP-NOW control firmware, and provides related control protocols and SDKs, allowing users to wirelessly control it with any ESP32 device. The back adopts a rail clip design, making it easy to install on DIN rails, suitable for embedded smart home control, upgrading single-live wire lighting circuits, and other application scenarios.

Preparation

Tip
In this tutorial, the firmware is compiled and uploaded with ESPHome 2025.12.5. If you encounter compile/upload issues, consider switching ESPHome to this version.

Step 1. Create New Device

  • Click the green button in the lower right corner to create a device.

Step 2. Create Device Name

  • Click CONTINUE.

  • Click New Device Setup.

  • Enter the name of the device and click NEXT.

Step 3. Choose Device Type

Tip
Here we use Atom-Lite as the main controller to operate the SwitchC6 relay switch.
  • Click ESP32.

  • Click SKIP.

Step 4. Start Edit YAML File

  • Click EDIT. We can customize device functionality through YAML files.

Device Setup

The following is the core part of the code. Relevant references and explanations are provided below.

External Components Configuration

external_components:
  - source: github://m5stack/esphome-yaml/components
    components: espnow_switch
    refresh: 0s

ESPNOW Configuration

espnow:
  id: espnow1
  auto_add_peer: true
  peers:
    - XX:XX:XX:XX:XX:XX
  on_broadcast:
    - lambda: |-
        id(sw1).handle_broadcast(data, size);
Tip
You need to enter your device's espnow address here - XX:XX:XX:XX:XX:XX

Switch Configuration

switch:
    - platform: espnow_switch
    id: sw1
    name: "SwitchC6 Device 1"
    espnow_id: espnow1
    mac_address: "XX:XX:XX:XX:XX:XX"
    retry_count: 40
    retry_interval: 300
Tip
To add multiple devices, you need to update both the ESPNOW configuration and switch entries. For example:
espnow:
  id: espnow1
  auto_add_peer: true
  peers:
    - AA:BB:CC:DD:EE:01
    - AA:BB:CC:DD:EE:02
  on_broadcast:
    - lambda: |-
        id(sw1).handle_broadcast(data, size);
        id(sw2).handle_broadcast(data, size);

switch:
  - platform: espnow_switch
    id: sw1
    name: "SwitchC6 Device 1"
    espnow_id: espnow1
    mac_address: "AA:BB:CC:DD:EE:01"
    retry_count: 40
    retry_interval: 300
  - platform: espnow_switch
    id: sw2
    name: "SwitchC6 Device 2"
    espnow_id: espnow1
    mac_address: "AA:BB:CC:DD:EE:02"
    retry_count: 40
    retry_interval: 300

Firmware Build

  • Click INSTALL again to flash and wait for it to complete.

  • After making changes, click SAVE and INSTALL in the top-right corner, then choose Manual Download in the popup.

  • After the firmware compilation is complete, click Download and select Factory format(Previously Modern)

Tip
Click SwitchC6 to view the complete example configuration. The first build may take a while, depending on the performance of the Home Assistant host and network quality.

Firmware Upload

  • Connect the device to your host via a USB Type‑C cable. Open ESPHome Web and click CONNECT to connect to the device.

  • Locate the corresponding serial port number

  • Click INSTALL

  • Select the previously compiled firmware to upload.

Tip
Please note that after the download is completed, the device must be reset.

Home Assistant Integration

  • Click Settings -> Device & services to check the device.

  • We can find the corresponding device in the Discover section.

  • After adding the device, the data will be displayed correctly.

  • Finally, we add these entities to the Dashboard, and the following shows their display results.

On This Page