How are inputs defined?
How inputs are defined and how i can name them?
Why should you name your inputs?
Naming your inputs makes working with the controller much easier. It's simpler to remember "Bedroom Button 1" than "IN_01", right?
Binary Sensors
Let's look at the default configuration for your inputs, which are defined as binary_sensor components.
Here is a complete example of a single input configuration. The most important line for you is name: 'My First Button'.
binary_sensor:
- platform: gpio
name: 'My First Button'
"This is the friendly name for your input"
id: in_01
pin:
pcf8574: pcf_inputs
number: 0
mode:
input: true
inverted: true
on_press:
then:Configuration Explained
| Section | Description |
|---|---|
binary_sensor: | This is the main header for all your binary sensor (input) definitions. |
- platform: gpio | This specifies that the sensor is connected to a General Purpose Input/Output pin. |
name: 'My First Button' | This is the friendly name for your input. It will be visible in Home Assistant and is much easier to identify. You can change it to something descriptive like 'Bedroom Button 1' or 'IN_01_Living_Room_Motion'. This is the most important part for you to customize. |
id: in_01 | This is a unique identifier used within ESPHome. It's essential for referring to this input in automations, such as the on_press action. |
pin: | This section defines the physical pin the sensor is connected to. This part is pre-configured for the boneIO hardware and should not be changed. |
inverted: true | This inverts the logic of the input. It's useful for certain devices like motion sensors, which might have a normally open or normally closed state. |
on_press: | This is an automation that defines what happens when the input is triggered (e.g., a button is pressed). We will cover this in more detail in the automations guide. |