This can be something like a LED or a relay that can be switched by switching a digital output.
There are several possibilities to do this which end up in slightly different appearances in HA:
Output - GPIO
output:
- platform: gpio
pin: GPIO13
id: gpio_d7
But this does not show up in HA.
If you want it to be shown in HA, you can for example use
Light - Binary Light
You need to add a few lines to the above. The result is:
output:
- platform: gpio
pin: GPIO13
id: gpio_d7
light:
- platform: binary
name: "red LED"
output: gpio_d7
As you see, in the light you refer to the output's id.
The result looks like this in HA:
![](https://cdn.hackaday.io/images/2199511739045716944.png)
You could also define a
Switch - GPIO Switch
The code is:
switch:
- platform: gpio
name: "Yellow output"
pin: GPIO12
Result:
![](https://cdn.hackaday.io/images/9264441739046178622.png)
or you can use
Switch - Generic Output Switch
Replace the above code with:
output:
- platform: gpio
pin: GPIO12
id: gpio_d6
switch:
- platform: output
name: "Generic yellow switch"
output: gpio_d6
Beware, you can have only a single output section. So together with the red LED it looks like:
output:
- platform: gpio
pin: GPIO12
id: gpio_d6
- platform: gpio
pin: GPIO13
id: gpio_d7
light:
- platform: binary
name: "red LED"
output: gpio_d7
switch:
- platform: output
name: "Generic yellow switch"
output: gpio_d6
And the result in HA:
![](https://cdn.hackaday.io/images/495701739046589873.png)
And there are other components which in the end only toggle a GPIO between 0 and 1.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.