Defining Outputs
boneIO outputs configuration
What are outputs?
Outputs are the executive parts of our controller.
This guide applies to
On other pages, you will find instructions for controlling the other boneio ESP modules.
Why should you name them?
Naming your outputs will make working with the controller much easier. It's much easier to remember "Bedroom light" than "Light 01", right?
In our examples, we focus on a part of the configuration, which you can then adjust to your entire configuration.
Let's get started!
24x16A
We have prepared a configuration file for you where all outputs are defined as switches. This is the most common use case for the 24x16A model, which is often used to control sockets or high-power devices.
Of course, you can easily change some of them to lights. We will explain how to do that!
Below is a part of the default configuration from the boneio-24x16_switches_v0_7.yaml file.
We are looking for the part with the switch: header.
switch:
- platform: output
name: 'Switch 01'
output: out_01
id: switch_01
- platform: output
name: 'Switch 02'
output: out_02
id: switch_02
- platform: output
name: 'Switch 03'
output: out_03
id: switch_03
- platform: output
name: 'Switch 04'
output: out_04
id: switch_04
- platform: output
name: 'Switch 05'
output: out_05
id: switch_05
- platform: output
name: 'Switch 06'
output: out_06
id: switch_06| Parameter | Description |
|---|---|
- platform: output | Defines the component type. output creates a basic switch entity that controls a GPIO pin. |
name: 'Switch 01' | This is the friendly name for your switch. You can change it freely. There are many naming approaches. For example, you can change it to Living_Room_Socket or Switch_01_Circulation_Pump. |
output: out_01 | This links the switch to a specific physical relay output. |
id: switch_01 | This is a unique identifier used in the ESPHome configuration to control this switch from other components. |
I'd like to get 10 lights and 14 switches!
You need to adjust your configuration file a little bit. It's really simple and very useful. Let's assume we want to change the first 10 switches to lights in our boneio-24x16_switches_v0_7.yaml file.
As you've learned, the header (light: or switch:) describes the output type. To make the change, you need to move the definitions for the first 10 outputs under a new light: header and change their platform from output to binary.
# First, we define the lights
light:
- platform: binary
name: 'Light 01'
output: out_01
id: light_01
- platform: binary
name: 'Light 02'
output: out_02
id: light_02
# ...and so on, up to Light 10
- platform: binary
name: 'Light 10'
output: out_10
id: light_10
# Then, we define the remaining switches
switch:
- platform: output
name: 'Switch 11'
output: out_11
id: switch_11
- platform: output
name: 'Switch 12'
output: out_12
id: switch_12
# ...and so on, up to Switch 24
- platform: output
name: 'Switch 24'
output: out_24
id: switch_24So what have we done? We created a light: section for the first 10 relays and changed their platform to binary. The rest of the relays (11-24) remain in the switch: section with the output platform. As a result, we have lights from relay 1 to 10 and switches from relay 11 to 24!