Considerations for hardwiring electronics project in wall
Not only will you need to get your local inspector's approval, in writing (and the inspector will defer to Underwriter's Laboratories or other NRTL, so we're talking about getting a UL listing for your one-off) ... 

... But all your thermostat wiring must now be re-done in Class I wiring methods  Because you are intermixing thermostat control power with mains.  You can no longer enjoy the exemptions provided for low-voltage systems such as phone, doorbell, burglar alarm, everyone else's thermostat, etc.  You'll need to rewire it in Romex or better, with proper junction boxes instead of informal splices.  

Have you noticed something about every single small electronics product of the last 20 years?  They all come with wall warts etc.  You know why?  Because that is how you pass muster with Underwriter's Laboratories and the various other NRTL's (Nationally Recognized Testing Labs).  There are still standards to meet, but it is much more achievable when your product uses an external wall-wart that is already UL listed.  

if you do any competitor research, how does Nest get 120V power? Ecobee? Ring doorbell?  They don't.  They use the 24 volts AC that is already present in the thermostat circuit between the R and C wire. That means they sidestep the hard part of UL listing. 

So you have precisely 3 options: 


set things up so your project is powered off the 24VAC thermostat transformer 
use a wall wart to make a different low voltage, and feed that up via spare thermostat wires   
go through the rigmarole of getting your homebrew project UL listed