relay-esphome
The relay-esphome driver switches the relays of a network-attached board that
runs ESPHome with its
web_server component enabled.
The bench talks to the board over HTTP, so the board can sit anywhere the bench
can reach on the network.
| Property | Value |
|---|---|
kind | relay-esphome |
| Interfaces | relay |
location | The board's base URL, such as http://192.168.27.34/switch |
Example
button_relay:
kind: relay-esphome
name: "ESPHome Relay for Buttons"
description: "Networked relay board driving DUT power and test points"
location: http://192.168.27.34/switch
interfaces:
- type: relay
channel: 0
config:
channels:
- { number: 1, name: "Power button", path: relay60_relay_1_gpio32 }
- { number: 2, name: "User button", path: relay60_relay_2_gpio33 }
- { number: 3, name: "Trigger 1", path: relay60_relay_3_gpio25 }
- { number: 4, name: "Trigger 2", path: relay60_relay_4_gpio26 }
Location
The location is the board's URL up to, but not including, the switch entity:
usually http://<board-address>/switch. Leave off the trailing /.
The bench doesn't discover ESPHome boards, so they don't appear as unclaimed
hardware in mimick peripheral list. Give the board a fixed IP address or a
DHCP reservation so the location stays valid.
Relay
The relay interface takes a channels list with at least one entry:
| Key | Required | Allowed values |
|---|---|---|
number | Yes | 1 or higher, each used once |
name | Yes | Any label |
path | Yes | The ESPHome switch entity ID for this relay |
The entity ID is the switch's ID in the board's ESPHome web page, or the id
in the switch: block of its ESPHome YAML.
Every read asks the board for its current state, with no caching. A relay someone switches by hand or through an ESPHome automation shows its real state.
The bench checks the board by requesting the location URL. If that request fails or returns an HTTP error, the peripheral shows as missing.
Use it
mimick relay list -p button_relay
mimick relay write -p button_relay "Power button" on
In the web UI, select Open relay controls on the peripheral's row in the bench's Inventory tab.