Sonoff with esphome listening to mqtt messages

I have flashed esphome to sonoff device and connected to wifi network. I would like to listen for mqtt messages and turn power on or off depending on message. Does someone have working example of it? Could not find example that I could use. I tried following, without any sucess:

mqtt:
broker: 192.168.1.29
username: *****
password: *****
client_id: spow1
on_message:
topic: msgspow1
then:
- switch.turn_on: POWER