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 Up" or "Garden Light Switch" than "IN_01" or "IN_17", right?
Binary Sensors Explained
Your physical inputs (like wall switches) are configured in the binary_sensor: section of your YAML file. You can link any input to control any output (either a cover or a relay).
Example 1: Controlling a Cover
Here's how to configure two inputs (IN_01 and IN_02) to control a single cover (cover_01) using momentary switches. This is ideal for up/down control.
binary_sensor:
# Button to Open Cover 1
- platform: gpio
name: 'Living Room Cover Up'
id: in_01
pin:
pcf8574: pcf_inputs_1to14
number: 0
on_press:
then:
- cover.open: cover_01
on_release:
then:
- cover.stop: cover_01
# Button to Close Cover 1
- platform: gpio
name: 'Living Room Cover Down'
id: in_02
pin:
pcf8574: pcf_inputs_1to14
number: 1
on_press:
then:
- cover.close: cover_01
on_release:
then:
- cover.stop: cover_01Key Parameters:
name: Set a friendly name for the switch, e.g.,'Bedroom Blind Up'.on_press/on_release: These actions control the cover.on_pressstarts the movement, andon_releasestops it.
Example 2: Controlling a Relay (Light)
Here's how to configure an input (IN_17) to toggle a relay (light_17) with a single press of a momentary switch.
binary_sensor:
- platform: gpio
name: 'Garden Light Switch'
id: in_17
pin:
pcf8574: pcf_inputs_15to32 # Or the correct PCF for this input range
number: 2 # Corresponds to IN_17
on_press:
then:
- light.toggle: light_17Key Parameters:
name: Set a friendly name for the switch, e.g.,'Garage Light Switch'.on_press: Thelight.toggleaction will turn the light on if it's off, and off if it's on.