LWT configuration - last will

Hi,
i have mosquitto mqtt and sonoff
i want that the toggle button on HA will go “off” when i turn off the physical switch,
i found out that it can be done with LWT but i coulndnt figure how to config this option

please help me understand how to use the LWT option
thank you

Did you ever figure this out?