A very specific question comes in over WhatsApp: «I've got a Shelly 2PM Gen4 with Add-on and a DHT21 temperature and humidity sensor. It works for about 3 hours and then shows nothing. If I cut power to the 2PM and switch it back on, it works again for a few hours. Do you have experience with this?». Yes, and the pattern you describe —fine for a while, goes blank, revives when you cut the power— has a very recognisable cause and a direct fix: swap the DHT21 for the DHT22, which is the one the Add-on supports.

What's happening: the DHT locks up
The behaviour you see is the classic DHT sensor lock-up. The sensor stays locked and the only way to free it is to cut its power; that's why, when you switch the 2PM off and on, it reads again for a few hours until it hangs again. The underlying reason in your case is clear:
- The DHT21 is not a sensor the Add-on supports. The Shelly Add-on officially supports the DHT22 (and the DS18B20, NTC thermistors, etc.), but not the DHT21. They share the same one-wire protocol, but with different timing tolerances, so the DHT21 works «on and off» and hangs easily.
- Power runs tight. The Add-on delivers 3.3 V and a maximum of 10 mA to the sensor. A sensor that isn't supported in the first place, working in that margin and with some cable, ends up unstable over the hours.
What to check first

Run these four checks to start. First, update the firmware of the 2PM Gen4 and the Add-on: updates fix read lock-ups and improve stability. Second, and this is the key, the sensor must be a DHT22, the only one in the family the Add-on supports. Third, a short cable and firm connections on VCC, DATA and GND; the shorter, the better, because of that 3.3 V margin. And fourth, test the sensor on its own, with no other peripherals connected to the Add-on, to rule out interference.
The fix: swap the DHT21 for the DHT22

The fix is direct: replace the DHT21 with a DHT22 (AM2302). It's the only DHT the Shelly Add-on officially supports, it uses the same wiring (VCC, DATA and GND) and it also measures humidity, which is exactly what you need. You don't have to change the install or the mounting: it's swapping the sensor for the right model. With the supported DHT22 and the firmware up to date, those lock-ups after a few hours go away.
If you later want even more reliability, you have two routes, but they aren't essential to solve your case: for temperature only, a DS18B20 (a very stable 1-Wire probe, up to 5 on the same Add-on); for temperature and humidity without cables, a Shelly BLU H&T over Bluetooth, which the 2PM Gen4 itself reads as a gateway. But to fix what's happening to you, the DHT22 is the answer.
What if the sensor cable is long (around 10 m)?

At 10 metres, the cable becomes part of the problem, because the DHT one-wire protocol isn't designed for long runs. If you need that distance, these wiring good practices help:
- Twisted pair, twisting DATA with GND (not any two wires). With the return tight to the signal, the loop area and the picked-up noise drop. Better still with shielded cable, and the braid to GND only at the Shelly end.
- Strengthen the DATA pull-up to 3.3 V. On long runs, a stronger pull-up (around 1–2.2 kΩ, versus the usual 4.7–10 kΩ for short runs) helps charge the cable capacitance so the edges rise faster.
- A 100 nF capacitor next to the sensor, between VCC and GND. It stabilises the supply, which is critical because the Add-on only delivers 3.3 V and 10 mA. Also use adequate conductor gauge for VCC/GND.
Even with all this, at 10 m a DHT is still at its limit. For that distance, the reliable move is to change the sensor: a DS18B20, whose 1-Wire is designed for long runs (temperature only), or a wireless BLU H&T you place at the measurement point with no cable, read by the 2PM Gen4 itself as a gateway (temperature and humidity).
Before you buy, keep in mind
- Of the DHT family, the Add-on only supports the DHT22. Not the DHT21 or the DHT11. Make sure you order the DHT22 (also called AM2302).
- It's a cheap, direct swap. Same wiring and same function (temperature and humidity): you just replace the sensor.
- Update the firmware when you change it. So you start from the most stable version of the 2PM Gen4 and the Add-on.
- If you later want maximum reliability, the DS18B20 (temperature only) or the BLU H&T (temperature and humidity over Bluetooth) are even more robust, but you don't need them to solve this problem.
Frequently asked questions
Why does it work for a few hours and then show nothing?
Because the DHT sensor locks up and only frees when you cut its power. It's typical DHT behaviour, and in your case it happens because you're using a DHT21, which the Add-on doesn't support.
Which sensor should I use?
A DHT22 (AM2302). It's the only DHT the Shelly Add-on officially supports, it keeps the temperature and humidity measurement and uses the same wiring, so it's a direct swap.
Does the Add-on support the DHT21?
No. The official sensor list for the Shelly Add-on includes the DHT22, the DS18B20 (up to 5), NTC thermistors and other analogue sensors, but not the DHT21, even though it uses the same one-wire protocol.
Do I have to change the install to fit the DHT22?
No. The DHT22 connects the same as the DHT21 (VCC, DATA and GND) on the Add-on input. You just replace the sensor and, while you're at it, update the firmware.
Could it be the sensor cable?
It plays a part. Since the Add-on only gives 3.3 V and 10 mA, a long cable or loose connections worsen stability. Keep the cable short and the connections firm, also with the DHT22.
Can I create an action that restarts the sensor every 20 minutes?
You can schedule a periodic reboot, but it's not a good idea and, above all, it doesn't restart just the sensor. The Add-on offers no way to cut the DHT's power by software, so the only thing you could automate is rebooting the whole 2PM (with a schedule or a script that calls the reboot command). That also interrupts the relays it controls —your blinds or lights—, drops the Wi-Fi/Zigbee connection for a few seconds and is a patch you'd have to keep forever. Cutting only the sensor's power would need a separate relay feeding its VCC: extra hardware to paper over a problem that disappears by fitting the supported DHT22. In short: technically yes, but it's not worth it; the right fix is the DHT22.
And if I want even more reliability in the future?
For temperature only, a DS18B20 (1-Wire, up to 5 probes, very stable). For temperature and humidity without cables, a Shelly BLU H&T over Bluetooth, which the 2PM Gen4 reads as a gateway. They aren't needed to solve your case, but they're the most robust options.
Summary and products
- DHT22 (AM2302) sensor — the sensor the Add-on supports: the direct fix for your case, with the same wiring and measuring temperature and humidity.
- Shelly 2PM Gen4 — your device; a dual relay with metering and, on top, a Bluetooth gateway for BLU sensors.
- Shelly Plus Add-On with DS18B20 probe — if you later want temperature only with maximum stability (up to 5 probes).
- Shelly BLU H&T — a wireless alternative for temperature and humidity, with no Add-on and no lock-ups.
Tell us where you're going to measure and we'll confirm the DHT22 fits your setup and help you get it running without reboots. Technical support in Spanish and English, and shipping from Spain.

Dejar un comentario