pdf-icon

SwitchC6 Home Assistant Integration

This chapter describes the configuration method and practical steps for integrating the SwitchC6 Single Firewire Switch Controller into Home Assistant.

Preparation

Note

In this tutorial, the firmware is compiled and uploaded using ESPHome 2025.12.5. If you encounter compilation / upload issues, please consider switching ESPHome to this version.

Create Device

  1. Create a new device.

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

  2. Create device name.

    2.1 Click CONTINUE.

    2.2 Click New Device Setup.

    2.3 Enter the device name and click NEXT.

  3. Select device type.

    Note
    Here we use Atom-Lite as the main controller to operate the SwitchC6 relay switch.

    3.1 Click ESP32.

    3.2 Click SKIP.

  4. Start editing the YAML file. Click EDIT. We can customize device functions through the YAML file.

Device Configuration

The following is the core part of the code, along with relevant references and descriptions.

External Components Configuration

Add External component:

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

ESPNOW Configuration

Add ESPNOW component:

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

Switch Configuration

Add Switch component:

switch:
  - platform: m5stack_switchc6
    id: sw1
    name: "SwitchC6 Device 1"
    espnow_id: espnow1
    mac_address: "XX:XX:XX:XX:XX:XX"
    retry_count: 40
    retry_interval: 300
Note
To add multiple devices, you need to update both the ESPNOW configuration and the 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

Download and Burn Firmware

  1. After completing the modifications, click SAVE and INSTALL in the upper right corner, then select Manual Download in the pop-up window.

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

    Note
    Click SwitchC6 to view the complete example configuration. The first build may take some time, depending on the performance and network quality of the Home Assistant host.
  3. Click INSTALL again to burn and wait for completion.

  4. Connect the device to the host via a USB Type-C cable. Open ESPHome Web and click CONNECT to connect the device.

  5. Find the corresponding serial port number.

  6. Click INSTALL.

  7. Select the previously compiled firmware for uploading.

  8. Restart the device after burning is complete.

Start Using

  1. Click Settings -> Device & services to view the device.

  2. Click Add to integrate the device into Home Assistant.

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

  4. Finally, we add these entities to the dashboard, and the display result is shown below.

On This Page