Page 1 of 1

controlling blinds with espeasy on nodemcu+2ch relays

Posted: Saturday 22 September 2018 22:04
by megamarco83
hi, i have:
n°1 nodemcu with espeasy 192.168.0.151
n° raspberry with domoticz 192.168.0.105
n°1 ralay arduino 2ch

i want to:
control with wall switch the blind (up and down)
control with domoticz (up and down...and STOP)
put with domoticz at 50% opening or 20% opening or 80%opening and so on...

now, i created on espeasy this tasks:
Image
and under esp rules i create this rules:

Code: Select all

on pulsante_gpio3#Switch do
  if [pulsante_gpio3#Switch]=1
    gpio,12,1
  else
    gpio,12,0
  endif
endon

on pulsante_gpio1#Switch do
  if [pulsante_gpio1#Switch]=1
    gpio,15,1
  else
    gpio,15,0
  endif
endon



on rele_gpio12#Switch do
if [rele_gpio12#Switch]=1
gpio,15,0  // metto off altro relè
timerSet,1,9 //timer 1 set for 6 secondi
endon

on rele_gpio12#Switch do
if [rele_gpio12#Switch]=0
timerSet,1,0 //timer to STOP
endon

On Rules#Timer=1 do  
   gpio,12,0 //stop relè
endOn


on rele_gpio15#Switch do
if [rele_gpio15#Switch]=1
gpio,12,0 //metto off altro relè
timerSet,1,9 //timer 1 set for 9 secondi
endon

on rele_gpio15#Switch do
if [rele_gpio15#Switch]=0
timerSet,1,0 //timer to STOP
endon

On Rules#Timer=1 do  
   gpio,15,0 //stop rele
endOn
with external wall switch is perfect:
if i put GPIO3 (wall switch UP) or GPIO1 (wall switch DOWN) to GND the relay (GPIO12 UP or GPIO15 DOWN) are activated for 10seconds and then turn off
i added a rule to prevent that if i click on wall switch gpio1 down and i press gpio3 up when the gpio1 is still active the system stop GPIO1 and acrivate GPIO3.
and also that works well

the problems come with domoticz
i put same idx=24 in rele_gpio12 and rele_gpio15 because when i create a dummy sensor as switch and then i modify it from switch web page in "venetian blinds EU" i have only to commad to write here:
1) action for power on
2) action for power off

how i can menage my 2ch relay that has 4 commands? (relay 1 on, relay stop , relay 2 on, relay 2 stop)
Image

the commands that i have are:
http://192.168.0.151/control?cmd=GPIO,12,1
that activate relay ch1 to go UP

http://192.168.0.151/control?cmd=GPIO,12,0
that disactivate relay ch1

http://192.168.0.151/control?cmd=GPIO,15,1
that activate relay ch2 to go DOWN

http://192.168.0.151/control?cmd=GPIO,15,0
that disactivate relay ch2

what i have to do to control the blinds with domoticz? and also manage the stop? and the percentage opening?
Image
thanks