pdf-icon

StamPLC Home Assistant Integration

StamPLC is an IoT programmable logic controller designed for industrial automation and remote monitoring. The product uses the Stamp-S3A control module, providing strong processing power and efficient wireless connectivity. This document explains how to integrate StamPLC into Home Assistant.

Note
Many thanks to ESPHome community contributor @Beormund for the provided configuration files. For more references, visit https://github.com/Beormund/esphome-m5stamplc

Preparations

  • A Home Assistant host
  • Install and enable the ESPHome Builder add-on in Home Assistant
Tip
In this tutorial the kit is compiled and uploaded with ESPHome 2025.10.3. If you encounter build/upload issues, consider switching ESPHome to that version.

Open ESPHome Builder in Home Assistant and create an empty configuration file:

  • Click the NEW DEVICE button at the bottom right
  • In the dialog click CONTINUE

  • Select Empty Configuration

  • (Optional) Give the file a name

  • Click EDIT on the newly created configuration file

Then copy the contents of configuration.yaml from the example repository into your config file:

Modify network or API information as needed. For example, create an API Encryption Key for authentication:

yaml
1 2 3
api:
  encryption:
    key: "Your_Encryption_Key"
Tip
If you need a key, generate one via the native api (under encryption).

You can also change the timezone setting, for example:

yaml
1 2
timezone: America/Los_Angeles # Pacific
# timezone: America/New_York # Eastern

After editing, click SAVE and then INSTALL, choose Manual download.

This will generate code and compile the project.

Tip
The first compilation may take a long time depending on your Home Assistant host and network.

When the build finishes, select Factory format to download the firmware.

Upload firmware

Open ESPHome Web in your browser to upload the firmware.

Connect StamPLC to the host via USB-C, click CONNECT and select the device.

Click INSTALL, select the previously downloaded firmware, and click INSTALL again to flash the device.

After flashing completes the device will automatically reset and boot.

Add device to Home Assistant Integrations

When the device boots it will connect to the configured Wi‑Fi. Under Settings -> Devices & services you should see the device.

Click Add to add StamPLC to Home Assistant. If you set an API Encryption Key, you may need to enter it here.

Example StamPLC dashboards:

Live device in action:

Expansion

The StamPLC support expansion via 16 pin headers on the right side of the device.

StamPLC AC

StamPLC AC is an AC relay expansion module compatible with the StamPLC host. The module integrates AC load control and entire system power supply functions, effectively simplifying power wiring during application development. It features a contact-type relay (single-pole single-throw - normally open), supporting up to AC 240V@10A line switching. It also includes a built-in AC-DC isolated conversion circuit supporting AC 100 ~ 240V input, capable of simultaneously powering the relay load and providing a stepped-down DC 12V output for the main system. A programmable tri-color RGB LED is available for working status indication.

Configure the StamPLC AC

In addition to previous StamPLC configurations, several components are required

  • Add a new IO Expander
pi4ioe5v6408:
  - id: pi4ioe5v6408_1
    address: 0x43
  # Configuration of i2c GPIO Expander 2
  # on the StamPLC AC expansion
  - id: pi4ioe5v6408_2
    address: 0x44
  • Add a new switch for AC Relay
switch:
  ...
  - platform: gpio
    restore_mode: RESTORE_DEFAULT_OFF
    name: "StamPLC AC Relay"
    id: ac_r1
    pin:
      pi4ioe5v6408: pi4ioe5v6408_2
      number: 2
      mode:
        output: true
    on_state: 
      - component.update: vdu
  • Add new switches for LED on top of the StamPLC AC
switch:
  ...
  # led indicator on StamPLC AC expansion
  - platform: gpio
    restore_mode: ALWAYS_OFF  
    id: "ac_relay_led_red"
    pin:
      pi4ioe5v6408: pi4ioe5v6408_2
      number: 5
      inverted: true
      mode:
        output: true

  - platform: gpio
    restore_mode: ALWAYS_OFF  
    id: "ac_relay_led_green"
    pin:
      pi4ioe5v6408: pi4ioe5v6408_2
      number: 6
      inverted: true
      mode:
        output: true

  - platform: gpio
    restore_mode: ALWAYS_OFF  
    id: "ac_relay_led_blue"
    pin:
      pi4ioe5v6408: pi4ioe5v6408_2
      number: 7
      inverted: true
      mode:
        output: true
  • UI Update the UI display
display:
  ...
  lambda: |-
    ...
    it.print(5, 80, id(font1), Color(orange), "Relays 1-4");
    it.filled_rectangle(5, 99, 25, 25, id(r1).state ? id(red) : id(grey));
    it.filled_rectangle(34, 99, 25, 25, id(r2).state ? id(red) : id(grey));
    it.filled_rectangle(63, 99, 25, 25, id(r3).state ? id(red) : id(grey));
    it.filled_rectangle(92, 99, 25, 25, id(r4).state ? id(red) : id(grey));
    it.print(141, 80, id(font1), Color(orange), "AC Expansion");    // The AC Relay Expansion
    it.filled_rectangle(141, 99, 25, 25, id(ac_r1).state ? id(red) : id(grey));
  ...

When finishing the configuration, recompile and upload the firmware. Then, you should be able to control additional AC relay in your Home Assistant:

Turn on/off the switch, the UI element on LCD will change accordingly.

Video

On This Page