Not an expert on this and the docs are less than easy to understand but you really should look at switch, binary_sensor, and output. Switch has multiple meanings in English, but it is not the right component to use for the noun. It does the verb meaning of switch, it is an output (from what I understand).
I believe your push button should be using the binary_sensor component
Your relay which controls the remote should be a switch
Output is probably best left for something else.
Where exactly to put the logic for the pulse you need might not matter, but I would put it like @Karosm showed.
You need one GPIO for the push button and one other one for the relay. Make sure you are clear which is which and that you use ones that wonât cause an issue on startup (ones that are not output during startup and also have the right default state).
The picture does indicate that, but the code does not. @NituN you really need to try again and describe what you are really trying to do and how you have things wired up.
It seems like you might be making things more complicated than they need to be.
Iâm repeating myself here, but you donât need output components. This is Enough.
switch:
- platform: gpio
id: id1
pin:
number: 19
inverted: true # or false for high side trigger
restore_mode: ALLWAYS_ON # Or ALLWAYS_OFF
name: "Relay 1 Switch" # Name for the switch controlling relay 1
on_turn_on:
- delay: 100ms
- switch.turn_off: id1
If that code doesnât trigger the relay correctly, there are two options:
-your relay module has high side trigger and you need to set inverted: false
-your relay module is wired incorrectly and it never turns off because it canât.
Feel free to post a good photo presenting how relay module is wired to Esp.
See those yello jumpers on your relay? One side sais âHâ and the other sais âLâ ?? Thats for High and Low and its referencing the relay trigger and you can set it so either a Low signal or a High signal are what triggers the relay.
Right now you have both set on High(H) and your also using gpio as invertedâŚ