I did actually start with one of the example device handlers, and have reviewed many other published device handlers for techniques and ideas.
You can see my code in it’s entirety at https://github.com/peternixon/SmartThings-PeterNixon
In particular I’m taking about:
However for it to make sense you will need to also look at the parent DTH at:
You may also want to review the associated Service Manager at:
I’d appreciate any ideas that you may have.