Is there a reason you didn’t just search the forum for Sonoff To see what had already been posted?
I ask because we do have some community members with physical challenges or cognitive issues which make it difficult for them to use the normal search, and people will always be glad to help if you have one of those issues.
But for those not in need of special assistance, just using the search (magnifying glass icon) at the top right of the forum would turn up the following thread. It should have everything you need, and you can ask any follow-up questions there. ( this is a clickable link)
If you want to first read a general introduction to using custom code in smartthings, see the following FAQ which explains the basic concepts and terminology:
Hello. I have few Sonoff DW2 wifi door sensors. These cheap sensors working well , reports fast with Ewelink app. The ST recognize that as a thing, nothing else. I need some DH for it. Any advice?