Last Updated on 02/09/2023 by Kevin Agar
I don’t know if it’s my WiFi, ethernet or power supply, but sometimes I get little glitches that are best solved by a power cycle of the controller, gateway or both. This is fairly easy when at home, but becomes a major problem when away and I want to turn the heating on before my return. I decided to add MQTT relays for both the controller and the gateway, and log directly into the relay controller, and power cycle them.
For the processor, I chose a Wemos D1 mini, as I had one spare, but anything that can run Tasmota would do.
You can either use a web-based system to program the Wemos D1 mini, or you can download Tasmotizer and do it on your pc. I chose Tasmotizer
These are the Tasmota settings I used for the Wemos D1 mini
It was now possible to toggle the relay ON, which cuts the power to the Gateway (or Controller), wait a while, and then turn OFF the relay to restore power.
A better system would be if the relay was turned ON, and then after a set time, it switched itself OFF. A true reset function.
A quick read of the documentation for Tasmota and I found the command Pulsetime. Here is the excerpt from the manual
So for relay 1 I entered the following into the Tasmota console window
and for relay 2
This now meant, if I switched the Gateway or Controller OFF, it would turn OFF for 30 seconds, and then automatically turn back ON after 30 seconds had passed
This is the circuit I settled on
This worked well and did what was wanted, but, whenever the system was turned on the relays turned on and then off after a few milliseconds. This caused all sort of problems so another solution was required. I tried inserting a pull-up resistor on the input to the relay board, which didn’t help, and neither did a pull-down resistor.
So it was back to searching the internet, and it appears I’m not the only one with this problem.
After looking at several suggestions, I came across an article at
http://www.thesmarthomehookup.com/post-320/
Which has a link to a video
https://www.youtube.com/watch?v=7h2bE2vNoaY
Here he suggests the best pins to use to avoid this problem, and following his suggestions, I changed from
Tx GPIO1 and RX GPIO3
to
D1 GPIO5 and D2 GPIO4
This is the revised circuit
These are the revised Tasmota settings for the Wemos D1 mini
Now whenever the system is switched on, nothing happens to the relays, and they don’t ‘chatter’