I have this ESP
I think the ideal setup is to have relay 1 come on when the button is pressed once and relay 2 come on when the button is pressed twice.
Anyone have any advice on how to do this?
Thanks in advance for any help you can provide.
I have a momentary button connected to GPIO15.ESP With 2 Relay 1 Button Control?
Moderators: grovkillen, Stuntteam, TD-er
-
- Normal user
- Posts: 307
- Joined: 06 Nov 2016, 13:45
Re: ESP With 2 Relay 1 Button Control?
Did you study the docs?
You could use double click or long press
https://espeasy.readthedocs.io/en/lates ... ng%20press
and add a rule to it with Switch#State=3, 10 or 11
My experience is that long press is more robust.
You could use double click or long press
https://espeasy.readthedocs.io/en/lates ... ng%20press
and add a rule to it with Switch#State=3, 10 or 11
My experience is that long press is more robust.
30+ ESP units for production and test. Ranging from control of heating equipment, flow sensing, floor temp sensing, energy calculation, floor thermostat, water usage, to an interactive "fun box" for my grandson. Mainly Wemos D1.
Re: ESP With 2 Relay 1 Button Control?
Hi Domosapiens
That's the first I've seen those docs, I've been going by the Wiki all this time, thanks for that.
I should have mentioned I do have a start with this already but I'm not sure it can be adapted to work like this.
I'm by no means a programmer but I have been able to study the rules and with the help of others come up with a solution.
So my current setup is one ESP and One Relay. I have the ESP configured to be manually operated by the momentary pushbutton but I also have it configured to be operated with Openhab.
In ESP Easy I have 2 devices set up they are both Switch input devices configured as normal switches.
The switch with the relay attached to it is configured to send it's state to Openhab MQTT so I can tell if the light is on or off from the Server.
The other device on the ESP is the pushbutton called SwitchIn. When pressed I have a rule that does this.
This makes sure if I press the physical button to turn the light on and I leave the room and then look at my phone and notice the light was left on via the software OpenHAB can shut it off with the appropriate command.
I attempted to just create another Rule Set that was adapted double click and the other relay and that worked a little.
But with it setup like that it was messing with Relay 1 every time I pushed the button.
Hopefully this clears things up.
Any advice on modifying this setup? Will something like this work?
Again I'm not good with creating rules.
Thanks again.
That's the first I've seen those docs, I've been going by the Wiki all this time, thanks for that.
I should have mentioned I do have a start with this already but I'm not sure it can be adapted to work like this.
I'm by no means a programmer but I have been able to study the rules and with the help of others come up with a solution.
So my current setup is one ESP and One Relay. I have the ESP configured to be manually operated by the momentary pushbutton but I also have it configured to be operated with Openhab.
In ESP Easy I have 2 devices set up they are both Switch input devices configured as normal switches.
The switch with the relay attached to it is configured to send it's state to Openhab MQTT so I can tell if the light is on or off from the Server.
The other device on the ESP is the pushbutton called SwitchIn. When pressed I have a rule that does this.
Code: Select all
On SwitchIn#Switch=0 do //When The "Button/SwitchIn" is pressed attached to GPIO15 and 3.3v
if [Relay1#State]=1 //If the GPIO 12 Relay1 is high/on=1
GPIO,12,0 //Set GPIO12 to off=0
else
GPIO,12,1 //Otherwise set GPIO12 to on=1
endif
endon
I attempted to just create another Rule Set that was adapted double click and the other relay and that worked a little.
Code: Select all
On SwitchIn#Switch=3 do //When The Button/SwitchIn is pressed attached to GPIO15 and 3.3v
if [Relay2#State]=1 //If the GPIO 13 Relay2/SSR is high/on=1
GPIO,13,0 //Set GPIO13 to off=0
else
GPIO,13,1 //Other wise set GPIO13 to on=1
endif
endon
Hopefully this clears things up.
Any advice on modifying this setup? Will something like this work?
Code: Select all
On SwitchIn#Switch=0, or 3 do
if [Relay1, or Relay2#State]=1
GPIO,12,0
else
GPIO,12,1
else
GPIO,13,0
else
GPIO,13,1
endif
endon
Thanks again.
-
- Normal user
- Posts: 307
- Joined: 06 Nov 2016, 13:45
Re: ESP With 2 Relay 1 Button Control?
Learn by trying different options....
Double click seems to be detected as single click first.
That's why I wrote:
Double click seems to be detected as single click first.
That's why I wrote:
My experience is that long press is more robust.
30+ ESP units for production and test. Ranging from control of heating equipment, flow sensing, floor temp sensing, energy calculation, floor thermostat, water usage, to an interactive "fun box" for my grandson. Mainly Wemos D1.
Who is online
Users browsing this forum: No registered users and 17 guests