I don't think you can do you own testing like you suggest. You can self declare but you still need to include test data in that declaration so unless you happen to own all of the highly expensive calibrated test equipment you will need to pay an external test lab.
You don't need UL if you are just selling directly via your own website. However, if you want to sell the product in stores, most stores are going to require it.
You don't need UL for smart home sensors.