I don't know how to build an $2 device. Especially given that in any small device I've designed, power management always took 30-60% of board space and device cost. You reach the upper bounds if it uses a Li-Po battery.
There is a big gap between powering a hobby device from a bench power supply and building an actual end-user solution.
EDIT: I'm reading the answers here and it's clear I did not clearly communicate what I meant. Taping a board to a bunch of AA batteries is not an actual end-user solution. Neither is hanging a couple of boards off a bunch of wires. I was talking about products, something you might expect to pull out of a retail box and use.
Those mentioning PoE clearly haven't designed a device that is powered with IEEE 802.3af-2003 :-) (I have, and I have the battle scars to prove it). PoE doesn't mean you can just connect the wires and call it a day.
In a way designing a $2 device is simpler, as the low price means a low component count.
Having built a Dash Button clone with an ESP8266:
1. Choose a microcontroller that will run on <3 volts, and power it directly from two AA batteries in series. You have neither the power budget nor the financial budget for anything more complicated than that.
2. Your microcontroller should spend 99.99% of its time in its lowest power sleep mode. When sleeping, the microcontroller should consume <10μA and the other, non-microcontroller circuitry should consume the same amount.
These are rock-bottom power levels, expect to remove any status LEDs, USB-serial converter/in-circuit debugger chips, and even linear regulators compared to a development kit.
You don't have to use an ESP8266 like I did - a more experienced guy might have chosen an MSP430 or something similar.
3. Given you can only leave sleep mode 0.01% of the time, i.e. 8 seconds per day, if it takes 1 second to connect to wifi, send a message and get an acknowledgement back, you can only do that 8 times per day. If you want to update more often, you'll need something faster to connect and send a message. This is why many smart home systems use 433MHz to a base station, rather than using wifi directly.
4. A $2 budget won't include a case until you're making fairly serious volumes. Repurpose something you were throwing out, or wrap it the circuit in electrical tape, or go over budget but declare victory as you could hit the target in larger volumes.
You can use ESP-NOW instead of WiFi, although I'm not sure how quickly that connects and how much power it uses. I think it's much less than WiFi, but do double-check.
I don't know how it turned out, but a friend of mine was talking about running a DC power loop round his house alongside the AC one. The idea was that he could pull 5-12v lines off that for powering things like motion sensors, or even tablets being used as control panels, rather than having the house scattered with USB wall warts.
I'm not sure. Though I see a whole lot of chatter from chip makers trying to sell solutions into that market. Sounds like they have figured out you can run lighting and and other IoT stuff off it.
If you think about it most current IoT stuff blows. You need power for the device. And then you're using shit like WiFi for data. And even worse shit like Bluetooth for configuration. Security is a big big problem because it's brittle and conflicts with consumers need for stuff to just work. PoE solves all of those issues.
The single pair ethernet web pages gave me the impression that it is aimed at industrial applications - the connectors alone look like they would cost $2
I don't know how to build an $2 device. Especially given that in any small device I've designed, power management always took 30-60% of board space and device cost. You reach the upper bounds if it uses a Li-Po battery.
There is a big gap between powering a hobby device from a bench power supply and building an actual end-user solution.
EDIT: I'm reading the answers here and it's clear I did not clearly communicate what I meant. Taping a board to a bunch of AA batteries is not an actual end-user solution. Neither is hanging a couple of boards off a bunch of wires. I was talking about products, something you might expect to pull out of a retail box and use.
Those mentioning PoE clearly haven't designed a device that is powered with IEEE 802.3af-2003 :-) (I have, and I have the battle scars to prove it). PoE doesn't mean you can just connect the wires and call it a day.