I recently got into the home automation thing with ST and im enjoying it.
I looked around for a while and didn’t find much information on this (as basically no products) so figured I would share what I did in case it is helpful to others.
Long story short I love the ST idea / concept but I cant stand battery powered devices, im lazy and I want things to work reliably and constantly without any input.
So see the below imgur link for lots of photos for wiring up a few types of sensors for mains power.
A sensor
Wire
Soldering Iron & Solder
Buck converters (any should suffice, ebay, Amazon, currant draw on these things is negligible)
Terminal Blocks (ebay)
12v Power Supplies (Buy Meanwell PSU`s, they are highly regarded and I dont risk random Chinese stuff in the house)
Other things.
Short version :
Mains > 12V Power Supply > 12v Out > Buck Converter > 3v Out > Sensor
Disclaimer :
Try any of this at your own risk, im not responsible for you or your hardware, if in doubt get a professional in, especially where mains voltage & wiring is concerned.
Quite a few community members have posted project reports on similar projects in the past.
You can find these by going to the quick browse lists in the community-created wiki, going to the projects reports section near the bottom of the page, and choosing the “power” list.
Just be aware, as you note, that any approach that requires soldering to the device internals will void the warranty on the device. That’s why some people prefer to use a dummy battery approach.
Also just a note that one reason people choose battery over mains for some specific devices is so that the device will continue to work if the power goes out.
Obviously that doesn’t fit a use case where a motion sensor triggers a mains powered light. But if you want the sensor to trip a siren on a shed, for example, battery power might be desirable.
I had one friend who got a new pack of 6 sensors, soldered everything, then realized that two of the locations where he wanted to use them were better suited to batteries. (He had fun soldering, though.)