-
Notifications
You must be signed in to change notification settings - Fork 196
Control a Sonoff using a remote button
I have a cabin that is remote from my house, and I'm using a Sonoff to turn on/off the heaters remotely, so the place can be warm when I get there. The Sonoff(heater control) is located near the fuse box, and it controls a relay which switches the 120V/30A to the heaters.
It's awkward to get at the Sonoff(heater control) physically, so when I'm using it, I use MQTT commands to control the heaters. But I have some family members that are not comfortable with MQTT usage.
So I built a small ESP-01 and a DHT22 and a push button, and used Theo's code to it (>rev 1.0.30). I use the cmnd/my_DHT/buttontopic to set the mqtt command to control the heaters. Yes, you can program a sonoff so that the button sends out any arbitrary command. In this case, I'm using the button to control the other sonoff. This ESP+DHT device is in the common area of the cabin, so my family members can simply push the button to toggle the heater.
In other words, I'm using one trivial (DHT+button) wifi device to control the other (sonoff+heater relay). This technique uses Theo's flexible design, since buttontopic can be made different from topic.
Schematic:
NOTE: with this schematic, the DHT sensor is on GPIO2. You'll have to change the#define DHT_PINfrom 14 to 2.
Pat B