This is long, sorry.
Here’s the thing…a millivolt system works like this:
A thermocouple that sits in the pilot light flame generates electricity once it gets hot. This tiny voltage, under 25mv, allows the gas valve to open and gas to flow through the system for both the pilot light and the main burner. If the pilot goes out, the thermocouple cools, voltage disappears, and the valve slams shut. This is the primary safety mechanism in these systems and it works amazingly well. This is also why you have to hold the knob down to light the pilot, it manually allows gas flow until the thermocouple gets warm enough to make enough voltage to keep the valve open for the pilot light to stay lit. (Side note, thermocouples can go bad over time and cause the primary symptom of the pilot not ever staying lit unless holding down the knob in the “Pilot” position)
Now the pilot light also provides voltage in the same manner for a secondary main-burner gas valve to open (which is in line after the first safety valve mentioned above) except the voltage is usually in the 700-880mv range. Same general scenario in that if there isn’t enough heat from the pilot, it won’t make enough voltage to open this main-burner valve neither, though at that point the pilot would be out because the primary valve would likely be shut too. So ultimately the pilot does two things: 1) allows the gas valves to open when the lit, and 2) provides ignition to light the main-burner.
Of course you want to actually have the wall furnace (or water heater, or pellet stove, etc) turn on and off and not just be on full blast all the time, so you put a thermostat in the circuit between the thermopile (it’s a thermopile as it’s many stacked thermocouples to provide the higher voltage) and the second gas valve. All this thermostat does is open or close the circuit, it does NOTHING else. The thermostat provides ABSOLUTELY ZERO, I repeat, provides NO, power of it’s own, all power is provided by the furnace itself and under 880mV. In it’s “normal” state the thermostat circuit is open and no current flows to the second valve. When it gets to the set temperature, the circuit is simply closed, like flipping a switch, and the current is allowed through and the valve opens to light the main burner. When the room warms, the circuit is broken and the valve closes and the burner goes out. This is why the thermostats for these devices require no power, they just use bi-metalic strips (or mercury in the olden days) to open and close the circuit. And because no power was needed, you get heat if the power goes out. The downside is the pilot is always on, and uses a lot more gas over time that one would think, that’s why they have all but disappeared.
So all that actually needs to happen is for the two wires to be closed to complete the circuit. What you don’t really want is to put 24 volts down that circuit as the valves are really made to handle that. Also, it doesn’t take much stray power to have that valve open. THIS is why a relay is what’s needed. But even at that you have to be careful. I’m not an electrical engineer, but I remember reading about some intricacies in doing the relay, that’s it may not be as cut and dry as the layperson thinks, but that’s beyond my knowledge and so I won’t offer advice on that. And then you still have to get 24V to power the thermostat.
Now, could smart thermostat manufacturers put this in their devices? Yes, they could. And apparently the Nests in the UK come with something to do this. But in reality, millivolt systems generally haven’t been installed in new systems in decades and most, not all (I have one) of the old ones are being changed out. The percentage who do have them is small compared to the expense of engineering the extra hardware in. But I do wish someone would.
Now here’s my biggest piece of advice…if you screw up your plumbing, you get a wet basement, but if you screw up something to do with your furnace (gas) you get a fire or possibly an explosion and you can die, maybe along with your neighbors. Few people die from a poorly soldered cold water pipe. People do die from gas leaks. Watching some dude on YouTube or reading a blog is not always enough. Make sure YOU have the BASIC knowledge first when it comes to dangerous stuff.
And lastly, and this could have saved a whole lot of typing, there is a device out there made to basically do exactly all this. It’s the Honeywell R8845U. You can get is on the main site that first comes to mind. But it is about $90.
Hope this answers what you need to know. Honestly, there isn’t much left to say. LOL