control bulb with push button

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
delan009
New user
Posts: 9
Joined: 05 Jan 2017, 22:30

control bulb with push button

#1 Post by delan009 » 15 Jan 2017, 09:44

Hi
I'm niewbie in domoticz and ESPEasy.
ESPEASY_basis_met_drukknop.JPG
ESPEASY_basis_met_drukknop.JPG (102.61 KiB) Viewed 10231 times
I have allready made working some parts.
I have made a virtual switch in domoticz for switching the LED and the Relay.
The command i use is :
http://192.168.xxx.xxx/control?cmd=GPIO,14,1 and http://192.168.xxx.xxx/control?cmd=GPIO,14,0
In ESPEASY :
ESPEASY_basis_setting.JPG
ESPEASY_basis_setting.JPG (30.93 KiB) Viewed 10231 times
Now i want to use a push button to switch the lamp on/off.
How can i tell this to domoticz?

delan009
New user
Posts: 9
Joined: 05 Jan 2017, 22:30

Re: control bulb with push button

#2 Post by delan009 » 15 Jan 2017, 16:01

I think I found it :
In ESP Easy i made a device :
ESPEASY_basis_setting_devices.JPG
ESPEASY_basis_setting_devices.JPG (38.14 KiB) Viewed 10220 times
Then i found that i must activate rules whit the checkbox and the TAB rules is comming on
There i made the rule:
on testsch_in#value do
if [testsch#value] = 0
GPIO,14,1
else
GPIO,14,0
endif
endon

After couple of tests, it seems to work.

Is there anyone that can me tips or so?

Thanks

delan009
New user
Posts: 9
Joined: 05 Jan 2017, 22:30

Re: control bulb with push button

#3 Post by delan009 » 15 Jan 2017, 16:10

Problem

Sometimes after a couple of swithing the output is continue switching ????

What should be the problem????

delan009
New user
Posts: 9
Joined: 05 Jan 2017, 22:30

Re: control bulb with push button

#4 Post by delan009 » 15 Jan 2017, 19:44

Now I use gpio12 and i don't have this anymore. everything seems to work :?

DeNB3rt
Normal user
Posts: 120
Joined: 15 Dec 2015, 14:07

Re: control bulb with push button

#5 Post by DeNB3rt » 17 Jan 2017, 14:04

delan009 wrote:Now I use gpio12 and i don't have this anymore. everything seems to work :?
I'm using a similar setup, but using a pull up instead of pull down.
I'm not using rules, I let domoticz decide.
but maybe it's giving some false inputs. Did you try with a capacitor?

Image
Located in Belgium, Bruges. Working on a full DIY domoticz setup with ESPEasy.

delan009
New user
Posts: 9
Joined: 05 Jan 2017, 22:30

Re: control bulb with push button

#6 Post by delan009 » 17 Jan 2017, 21:28

Thx DeNB3rt

I see you are from Bruges. I'm from Veurne :)
I control the relay with my domoticzand a nodeMCU Amica V1, no problem (http://192.168.10.224/control?cmd=GPIO,12,1)
But how tell you to domoticz when the push button is pressed the relay should changed?
Your schematic is probebly for the debouncing?
You use active high in easpeasy?
And wich pins you are using?
So a lot of questions :?

(wich program yuo use for the schematic?)

delan009
New user
Posts: 9
Joined: 05 Jan 2017, 22:30

Re: control bulb with push button

#7 Post by delan009 » 17 Jan 2017, 22:06

Hi DenB3rt

Did what you say
Added virtual hardware
addede virtual device
on-off action equal as virtual switch for the relay
The only problem that i have is when i push on the relay with the switch and i switch off the relay with the virtual switch (domoticz) i must switch 2 times on the physical switch

ashfaaaa
New user
Posts: 4
Joined: 09 Feb 2017, 07:49

Re: control bulb with push button

#8 Post by ashfaaaa » 09 Feb 2017, 10:00

hi delan009

did you solve the problems I'm planning to control the 4 channel relay board with 4 buttons.. is it possible or not?

DMeekelenkamp
Normal user
Posts: 35
Joined: 11 Nov 2015, 13:52

Re: control bulb with push button

#9 Post by DMeekelenkamp » 11 Feb 2017, 10:56

You can use this rule to update domoticz and switch local on your esp.

Code: Select all

On switchon do
gpio 12,1
gpio 13,0
inputswitchstate 0,1
endon

On switchoff do
gpio 12,0
gpio 13,1
inputswitchstate 0,0
endon

On Switch1#Switch do
if [Switch1#Switch]=1
event switchon
else
event switchoff
endif
endon
In your esp create a switch with value name: Switch1

And in domoticz create a dummy switch with:
On action: http://your esp ip/control?cmd=event,switchon
Off action: http://your esp ip/control?cmd=event,switchoff

delan009
New user
Posts: 9
Joined: 05 Jan 2017, 22:30

Re: control bulb with push button

#10 Post by delan009 » 18 Feb 2017, 08:51

THX !!
I'll try it
(was away for couple of weeks)

DeNB3rt
Normal user
Posts: 120
Joined: 15 Dec 2015, 14:07

Re: control bulb with push button

#11 Post by DeNB3rt » 22 Feb 2017, 10:13

delan009 wrote: The only problem that i have is when i push on the relay with the switch and i switch off the relay with the virtual switch (domoticz) i must switch 2 times on the physical switch
Hello Delan009 (je bent van Veurne, das dichtbij :D )

I had the same 'issue' with the push button or switch button.
I have one virtual switch in domoticz for each relay.
Then I use on/off actions in domoticz that control the gpio of the ESP (ON = http://192.168.0.100/control?cmd=gpio,5,0 and OFF http://192.168.0.100/control?cmd=gpio,5,1)
The switch is connected to an gpio and is configured with the same IDX as the virtual switch in domoticz.
Located in Belgium, Bruges. Working on a full DIY domoticz setup with ESPEasy.

bobbybeans
Normal user
Posts: 119
Joined: 26 Feb 2017, 17:30

Re: control bulb with push button

#12 Post by bobbybeans » 03 Mar 2017, 12:37

I know this is slightly off of what you want to do but why don't you buy an itead sonoff touch. its a built in relay and esp that nicely fits into a standard wall socket

Post Reply

Who is online

Users browsing this forum: No registered users and 70 guests