How to control 4 channel relay with button and MQTT
Moderators: grovkillen, Stuntteam, TD-er
-
- New user
- Posts: 4
- Joined: 09 Feb 2017, 07:49
How to control 4 channel relay with button and MQTT
Hello guys I'm new to Esp Easy is it possible to control 4 channel relay board with esp8266 esp(12F) control it with MQTT and add 4 physical buttons to control this relays.?
-
- Normal user
- Posts: 469
- Joined: 03 Jan 2017, 10:58
- Location: Germany
Re: How to control 4 channel relay with button and MQTT
yesashfaaaa wrote:Hello guys I'm new to Esp Easy is it possible to control 4 channel relay board with esp8266 esp(12F) control it with MQTT and add 4 physical buttons to control this relays.?
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8
-
- New user
- Posts: 7
- Joined: 24 Aug 2016, 16:33
Re: How to control 4 channel relay with button and MQTT
Hello,
How did you do to revert the GPIO state ?
Using the rules (EspEasyMega) I'm not able to read the GPIO state to revert the state of the relay...
In my case, I want to use the same ESP to read the input and control the relay using a specific rule.
Thanks !
How did you do to revert the GPIO state ?
Using the rules (EspEasyMega) I'm not able to read the GPIO state to revert the state of the relay...

In my case, I want to use the same ESP to read the input and control the relay using a specific rule.
Thanks !
-
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
Re: How to control 4 channel relay with button and MQTT
Have you read the wiki tutorials regarding rules?
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you

ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you



-
- New user
- Posts: 7
- Joined: 24 Aug 2016, 16:33
Re: How to control 4 channel relay with button and MQTT
Yes, I have try reading the Rules Tutorial.
I want to do anything like that :
But it seem not possible to read a GPIO used as output...
I want to do anything like that :
Code: Select all
on Button#State=1 do
If GPIO14#State=1
gpio,14,0
Else
gpio,14,1
Endif
endon
-
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
Re: How to control 4 channel relay with button and MQTT
guslinux wrote: ↑07 Jan 2018, 20:55 Yes, I have try reading the Rules Tutorial.
I want to do anything like that :But it seem not possible to read a GPIO used as output...Code: Select all
on Button#State=1 do If GPIO14#State=1 gpio,14,0 Else gpio,14,1 Endif endon
Code: Select all
on Button#State do
If [Button#State]=1
gpio,14,0
Else
gpio,14,1
Endif
endon
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you

ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you



-
- New user
- Posts: 7
- Joined: 24 Aug 2016, 16:33
Re: How to control 4 channel relay with button and MQTT
In my case,
I have 3 push button connected to the esp (on the same input), and I want also change the output state with a On/Off command using a domotic box (using MQTT).
I want to use rules to had more reactivity than using the domotic box to do that.
I want to use the less input possible on my esp (regarding your proposal to connect the relay output ton an input to monitor)...
I have 3 push button connected to the esp (on the same input), and I want also change the output state with a On/Off command using a domotic box (using MQTT).
I want to use rules to had more reactivity than using the domotic box to do that.
I want to use the less input possible on my esp (regarding your proposal to connect the relay output ton an input to monitor)...
-
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
Re: How to control 4 channel relay with button and MQTT
So funnel all these inputs to the same event? You may use dummy devices to store the state.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you

ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you



Who is online
Users browsing this forum: Anthropic Claude Bot [bot] and 23 guests