Use state of mqtt topic to override physical button press action?!

Hi… i have tid in my ESPHome yaml

binary_sensor:
- platform: gpio
id: manual_open_switch
internal: true
pin:
number: GPIO33
mode: INPUT
inverted: true
filters:
- delayed_on_off: 20ms
on_press:
then:
- switch.toggle: relay_toggle
switch:
- platform: gpio
id: relay
pin: GPIO27
internal: true
- platform: template
id: relay_toggle
internal: true
turn_on_action:
- switch.turn_on: relay
- delay: 1s
- switch.turn_off: relay

and in Home Assistant i have defined a MQTT switch like this

switch:
- platform: mqtt
unique_id: big_garagedoor_lockout
name: Deaktiver fysisk bryter til garasjeport
command_topic: 'MH/BigGaragedoor/Lockout'
state_topic: 'MH/BigGaragedoor/Lockout'
payload_on: 'on'
payload_off: 'off'
retain: true

I somehow want the state of the mqtt topic to override the input of the physical switch. like if the topic has the payload of on, i dont want the relay_toggle template switch to be run. Anyone got any clever solutions?

This is so i can disable the physical openswitch of my garagedoor :stuck_out_tongue:

Please read this and post your code properly How to help us help you - or How to ask a good question