Switch led on when relay actif

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
jme
Normal user
Posts: 43
Joined: 11 Apr 2018, 14:20

Switch led on when relay actif

#1 Post by jme » 18 Apr 2020, 23:08

Hi,
I'm using a sonoff modified as a dry contact to open a electric door.

I'm using the command ESPIP/control?cmd=Pulse,12,1,1000 to switch the relay on and off after a delay of 1sec.

Is it the best way to do it ?

Second question, i want to have the led switching on when the relay is on.

How can i set that ?

I have another issue, when. set that commande as on and off in domoticz, it look to go in a loop if i enable send to controller in the espeasy.

I want to set the same command in on and off, so i can ask google to open or close ( just click the relay)

otherwise i have to create a rule to switch de relay off after a timer of 1 sec ?

Thx

jme
Normal user
Posts: 43
Joined: 11 Apr 2018, 14:20

Re: Switch led on when relay actif

#2 Post by jme » 18 Apr 2020, 23:53

I think i get it with that rule:

Code: Select all

On TurnOn do
gpio,12,1
gpio,13,0
Publish domoticz/in,{"idx":47,"nvalue":1}
timerSet 1,1
EndOn
on Rules#Timer=1 do
  gpio,12,0       
  gpio,13,1
Publish domoticz/in,{"idx":47,"nvalue":0}
endon

TD-er
Core team member
Posts: 8748
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Switch led on when relay actif

#3 Post by TD-er » 19 Apr 2020, 09:31

That does look OK to me, but there are others here way more experienced with rules :)
What I like about your solution is that it is not blocking.
The pulse command is blocking all other executions, but this solution isn't.

Post Reply

Who is online

Users browsing this forum: No registered users and 48 guests