MQTT Publish

Hello Everyone

Need help with a MQTT Publish

I have a light which can be switched on and off either by using Voice (Alexa) and a Sonoff RF Bridge connected with a Rf remote.
Now if i do a turn on using the voice and same change is not reflected in the RF bridge and it is turning it off after some time

The solution i think is to send a MQTT Publish to the Rf Bridge so that it knows when the light is on and off

This is the code iam using but dont know how to implement the MQTT publish in this

  • alias: Master Bedroom Tubelight on
    hide_entity: True
    trigger:
    platform: mqtt
    payload: ‘1’
    topic: ‘RFBridge/relay/1’
    action:
    service: switch.turn_on
    entity_id: switch.masterbedroom
  • alias: Master Bedroom Tubelight off
    hide_entity: True
    trigger:
    platform: mqtt
    payload : ‘0’
    topic: ‘RFBridge/relay/1’
    action:
    service: switch.turn_off
    entity_id: switch.masterbedroom

The MQTT publish Topic is
For On :
- service: mqtt.publish
data:
topic: RFBridge/relay/1/set
payload: ‘1’
For Off :
- service: mqtt.publish
data:
topic: RFBridge/relay/1/set
payload: ‘0’