Control Wemos D1 Mini with Relay module using MQTT

1,333 views
Skip to first unread message

Joe Palazzolo

unread,
Jul 23, 2017, 9:54:36 PM7/23/17
to SonoffUsers
Hi All,

I've been pounding my head against the wall all day trying to figure this one out.  I have a Wemos D1 Mini with a successful build of TASMOTA.  I have configured the module to use GPIO5 for the relay (the Wemos relay shield connects the relay control to GPIO5 which, in the Wemos case, is D1.  Everything is working fine, I can communicate with the Wemos using MQTT.  I just can't figure out the sequence of MQTT commands to identify the GPIO as a relay and then switch the GPIO to toggle the relay.  Can somebody give me the answers?

Joe


Jonathan Roberts

unread,
Jul 25, 2017, 7:07:31 PM7/25/17
to SonoffUsers
Set a topic in the Wemos.  Open the the Tasmota WebUI console and type "cmnd/yourtopic/power"  simple as that.  this assumes you have wiring done correctly but at a minimum your should hear the relay "click"

now integrating with your favorite MQTT server and client like Openhab or Home Assistant or Domiticz is a different question.

I recommend baby steps and make sure that everything works as expected within Tasmota before testing with an MQTT server.  This means using the "Console" in the Tasmota WebUI.

thanks

Joe Palazzolo

unread,
Jul 30, 2017, 11:47:07 AM7/30/17
to SonoffUsers
Jonathon,

Thanks for your reply.  Got it working now.  One thing I didn't have worked out was the command in case of more than one relay hooked up to the IO pins.  With only one relay, use POWER, for more than one IO pin defined, use POWER1, POWER2, etc.  Also making use of the BLINKCOUNT and BLINK commands, since I want my relays to simulate short button presses.

Thanks again,

Joe
Reply all
Reply to author
Forward
0 new messages