a momentary switch (pushbutton) has two states but the “on” state is only a temporary state while the button is being held down. to use that as a toggle the firmware should only use the change from either ‘off’ to ‘on’ (positive edge trigger) or ‘on’ to ‘off’ (negative edge trigger) but it should completely ignore the other. Otherwise as soon as you push the button it would toggle and when you release the button it would toggle back. So, when you push the button the relay switches to the opposite state and when you release the button nothing happens (if you use a positive edge trigger).
a normal light switch has two maintained positions (‘on’ & ‘off’) and can be used in two different modes.
the first mode is the ‘edge detection’ mode in which the firmware looks at ever change in state of the switch (‘on’ to ‘off’ or ‘off’ to ‘on’) and toggles the relay to the opposite state for every change in the switch. so in the end the device doesn’t care what the current state of the switch is compared to the state of the output just that there was change and the output was reversed in response to that change.
the other mode is a ‘follow’ mode in which the state of the output is always the same as the state of the switch (but only when the switch controls the relay but not when HA controls the relay). So if the switch is turned ‘on’ the relay will also turn ‘on’ (unless it was already ‘on’ then nothing would change…I think…I never use that mode). If the relay is ‘on’ and the switch turned to ‘off’ then relay will turn ‘off’ but if the relay is already ‘off’ then nothing happens when you turn the switch to ‘off’.
I hope that’s clear
If not I can try again.