I am learning by doing. Unless there is good reading material or youtube video that explains all compoments that controls device, think learning by doing is the way to go.
I am playing with Sonoff device with ESPHome flashed and integrated to HA. By taking parts of code from various internet sources I put together source, but still not sure about some parts of it. Not sure why and how it works…
Hope someone can shed some light over yaml file comands to understant what controls what…
This example adds switch for ESP1. Adds 2 switches: separate switch for Device “ESP1 relay” as well as for the whole Area where ESP1 is located
OK, I am not 100% sure if I understand you correct. But let me explain. The first switch is the actual gpio itself. As it doesn’t have a name it will not show up in Home Assistant. If you are seeing two switches in HA that may be a feature of the UI element you are using.
The scond switch is a template switch that combindes the other switch and the LED. So that the LED is on when the relay is on.
output is the physical device that does the switching (in this case a GPIO pin) and light is the logical object based on the ouput. The light is represented in Home Assistant. You could use the same ouput for another type of device. For example a fan. Then it will show/work as a fan in HA.
This is a picture of what I see in HA Overview. Too many labels with useless labels. Basically I would only want to see one line: ESP1 relay with a switch, so that I could turn it on or off. I suspect those are coming from another Sonoff device with ESPHome, but I thought I should see what is defined in yaml file. Every Sonoff device has separate yaml file…
And then that Area switch to the right of Area name “Greenhouse” is also not needed.
Funny, i just changed my green status led to act reverse to relay (that was how it was with Tasmota, which i dropped a couple of days ago)
I was eager to have the led act as ‘glow in the dark’ again, so the button is easy to find in the dark; the status function i find very useless🤔
Anyway, not sure if it’s of any use, but here is my yaml.
What i did was:
drop status_led and control gpio13 with output (so it doesn’t show up in HA)
use output.turn_on/off from within the light to copy the relay. N.B. It seems the led is inverted, so on is off and off is on. I could have used invert, but i didn’t
The screenshot you are showing has nearly nothing to do with your ESPHome yaml.
It is just your UI configuration. There should be a menu button in the top right corner that will allow you to configure your HA UI. The “area switch” is generated from HA and when you edit the entity card using the edit UI there is a option to disable it.
And also to remove all other entities you do not want to see in HA.