TimerStop Rule

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
maluko
Normal user
Posts: 112
Joined: 02 Sep 2015, 00:49

TimerStop Rule

#1 Post by maluko » 18 Dec 2016, 21:37

hi guys

thanks for the work that all have done.

i am thinking about this rules command "TimerStop" that dont are implemmented, i wonder that was a good idea to save memory when its is runing the timerset command.

So i will give a example:

i have domoticz to send http command to start event on esp "http://xx.xx.xx.xx/control?cmd=event,rele10", and on esp rules have:

Code: Select all

on rele10 do
 MCPGPIO,1,0 // Open valve
 timerSet 1,1800
endon
on Rules#Timer=1 do
 MCPGPIO,1,1 // close valve
endon
so mean that the rule will run 30 min to close the relay, but this is only for security because on domoticz i only have timer for 5,10,15, or 20 min, dont want when domoticz fails have the irrigation run for internity.
resume: domoticz open and close the relay but esp rule timer continues run after close.

what i want say with this?

with this command we could do this:

Code: Select all

on rele10 do
 MCPGPIO,1,0  //open valve
 timerSet 1,1800
endon
on Rules#Timer=1 do
 MCPGPIO,1,1 //close valve
endon
on rele10#Switch=1
  timerStop 1 //will stop timer  if valve are close before 1800s
endon  

I have 8 reles running one after the other, but it is causing some reboot so I think it will exceed the RULES_TIMER_MAX or SYSTEM_TIMER_MAX.

thanks and merry christmas

User avatar
toffel969
Normal user
Posts: 469
Joined: 03 Jan 2017, 10:58
Location: Germany

Re: TimerStop Rule

#2 Post by toffel969 » 07 Jan 2017, 22:42

If you can live with 1 second delay you could do

Code: Select all

on rele10 do
 MCPGPIO,1,0  //open valve
 timerSet 1,1800
endon
on Rules#Timer=1 do
 MCPGPIO,1,1 //close valve
endon
on rele10#Switch=1
  timerSet 1,1 //will set the timer to 1 second ~"stop" the timer (maybe even 0 works, i never tried)
endon  
concerning your reboots. Are you powering all 8 relays through the 3,3 V of your ESP device (nodeMcu?,Wemos mini ? ).
If yes you might just overload the power regulator (usually switching the relays is fine, but 8 Relays + the Wifi TX burst are too much). You can try a nice capacitor over 3,3V and GND (in order to stabilize voltage for TX bursts) or try to supply the relay with a seperate 3,3V power regulator (just tie GNDs together).
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8

maluko
Normal user
Posts: 112
Joined: 02 Sep 2015, 00:49

Re: TimerStop Rule

#3 Post by maluko » 07 Jan 2017, 23:10

thanks, i think that all reboot was from breadboard so i will do a pcb to try because now its more stable.
the relay board is runing with power from 24vac- 5vdc converter and not by esp12f.(3.3V), have too on pcb for future propose the capacitor field.

and at this moment i have this rules:

Code: Select all

On System#Boot do
 MCPGPIO,1,1
 delay 10
 MCPGPIO,2,1
 delay 10
 MCPGPIO,3,1
 delay 10
 MCPGPIO,4,1
 delay 10 
MCPGPIO,5,1
 delay 10
 MCPGPIO,6,1
 delay 10
 MCPGPIO,7,1
 delay 10
 MCPGPIO,8,1
endon
on rele10 do
 MCPGPIO,1,0
 timerSet 1,1800
endon
on Rules#Timer=1 do
 MCPGPIO,1,1
endon
on rele20 do
 MCPGPIO,2,0
 timerSet 2,1800
endon
on Rules#Timer=2 do
 MCPGPIO,2,1
endon
on rele30 do
 MCPGPIO,3,0
 timerSet 3,1800
endon
on Rules#Timer=3 do
 MCPGPIO,3,1
endon
on rele40 do
 MCPGPIO,4,0
 timerSet 4,1800
endon
on Rules#Timer=4 do
 MCPGPIO,4,1
endon
on rele50 do
 MCPGPIO,5,0
 timerSet 5,1800
endon
on Rules#Timer=5 do
 MCPGPIO,5,1
endon
on rele60 do
 MCPGPIO,6,0
 timerSet 6,1800
endon
on Rules#Timer=6 do
 MCPGPIO,6,1
endon
on rele70 do
 MCPGPIO,7,0
 timerSet 7,1800
endon
on Rules#Timer=7 do
 MCPGPIO,7,1
endon
on rele80 do
 MCPGPIO,8,0
 timerSet 8,1800
endon
on Rules#Timer=8 do
 MCPGPIO,8,1
endon
On botao1#Switch=1 do
 if [rele10#Switch]=1
  event rele10
 else
  MCPGPIO,1,1
 endif
endon
On botao2#Switch=1 do
 if [rele20#Switch]=1
  event rele20
 else
  MCPGPIO,2,1
 endif
endon
On botao3#Switch=1 do
 if [rele30#Switch]=1
  event rele30
 else
  MCPGPIO,3,1
 endif
endon
On botao4#Switch=1 do
 if [rele40#Switch]=1
  event rele40
 else
  MCPGPIO,4,1
 endif
endon
On botao5#Switch=1 do
 if [rele50#Switch]=1
  event rele50
 else
  MCPGPIO,5,1
 endif
endon
On botao6#Switch=1 do
 if [rele60#Switch]=1
  event rele60
 else
  MCPGPIO,6,1
 endif
endon
On botao7#Switch=1 do
 if [rele70#Switch]=1
  event rele70
 else
  MCPGPIO,7,1
 endif
endon
On botao8#Switch=1 do
 if [rele80#Switch]=1
  event rele80
 else
  MCPGPIO,8,1
 endif
endon

maluko
Normal user
Posts: 112
Joined: 02 Sep 2015, 00:49

Re: TimerStop Rule

#4 Post by maluko » 07 Jan 2017, 23:59

i tried what you said and work fine, even with 0s, it stop the first time command. so this are a little modification that can be done on my rules, only with a little problem Current size: 2133 characters (Max 2048) :D

Code: Select all

On System#Boot do
 MCPGPIO,1,1
 delay 10
 MCPGPIO,2,1
 delay 10
 MCPGPIO,3,1
 delay 10
 MCPGPIO,4,1
 delay 10 
MCPGPIO,5,1
 delay 10
 MCPGPIO,6,1
 delay 10
 MCPGPIO,7,1
 delay 10
 MCPGPIO,8,1
endon
on rele10 do
 MCPGPIO,1,0
 timerSet 1,1800
endon
on Rules#Timer=1 do
 MCPGPIO,1,1
endon
on rele10#Switch=1 do
 timerSet 1,0
endon
on rele20 do
 MCPGPIO,2,0
 timerSet 2,1800
endon
on Rules#Timer=2 do
 MCPGPIO,2,1
endon
on rele20#Switch=1 do
 timerSet 2,0
endon
on rele30 do
 MCPGPIO,3,0
 timerSet 3,1800
endon
on Rules#Timer=3 do
 MCPGPIO,3,1
endon
on rele30#Switch=1 do
 timerSet 3,0
endon
on rele40 do
 MCPGPIO,4,0
 timerSet 4,1800
endon
on Rules#Timer=4 do
 MCPGPIO,4,1
endon
on rele40#Switch=1 do
 timerSet 4,0
endon
on rele50 do
 MCPGPIO,5,0
 timerSet 5,1800
endon
on Rules#Timer=5 do
 MCPGPIO,5,1
endon
on rele50#Switch=1 do
 timerSet 5,0
endon
on rele60 do
 MCPGPIO,6,0
 timerSet 6,1800
endon
on Rules#Timer=6 do
 MCPGPIO,6,1
endon
on rele60#Switch=1 do
 timerSet 6,0
endon
on rele70 do
 MCPGPIO,7,0
 timerSet 7,1800
endon
on Rules#Timer=7 do
 MCPGPIO,7,1
endon
on rele70#Switch=1 do
 timerSet 7,0
endon
on rele80 do
 MCPGPIO,8,0
 timerSet 8,1800
endon
on Rules#Timer=8 do
 MCPGPIO,8,1
endon
on rele80#Switch=1 do
 timerSet 8,0
endon
On botao1#Switch=1 do
 if [rele10#Switch]=1
  event rele10
 else
  timerSet 1,0
 endif
endon
On botao2#Switch=1 do
 if [rele20#Switch]=1
  event rele20
 else
  timerSet 2,0
 endif
endon
On botao3#Switch=1 do
 if [rele30#Switch]=1
  event rele30
 else
  timerSet 3,0
 endif
endon
On botao4#Switch=1 do
 if [rele40#Switch]=1
  event rele40
 else
  timerSet 4,0
 endif
endon
On botao5#Switch=1 do
 if [rele50#Switch]=1
  event rele50
 else
  timerSet 5,0
 endif
endon
On botao6#Switch=1 do
 if [rele60#Switch]=1
  event rele60
 else
  timerSet 6,0
 endif
endon
On botao7#Switch=1 do
 if [rele70#Switch]=1
  event rele70
 else
  timerSet 7,0
 endif
endon
On botao8#Switch=1 do
 if [rele80#Switch]=1
  event rele80
 else
  timerSet 8,0
 endif
endon

User avatar
toffel969
Normal user
Posts: 469
Joined: 03 Jan 2017, 10:58
Location: Germany

Re: TimerStop Rule

#5 Post by toffel969 » 08 Jan 2017, 20:28

[quote="maluko"]thanks, i think that all reboot was from breadboard so i will do a pcb to try because now its more stable.
the relay board is runing with power from 24vac- 5vdc converter and not by esp12f.(3.3V), have too on pcb for future propose the capacitor field.

Be careful with the 5V supply to the relay board. I found unstable behaviour when using a nodemcu with a 5V power supply, connecting the Vcc of the Relayboard straigt to a Vin (=5v) --> I dont remeber exactly what happened, i just made mental note that Vcc must be equal to TTL-level (=3,3v), and that I had to rewire a node already in the field
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8

maluko
Normal user
Posts: 112
Joined: 02 Sep 2015, 00:49

Re: TimerStop Rule

#6 Post by maluko » 08 Jan 2017, 21:18

toffel969 wrote:
maluko wrote:thanks, i think that all reboot was from breadboard so i will do a pcb to try because now its more stable.
the relay board is runing with power from 24vac- 5vdc converter and not by esp12f.(3.3V), have too on pcb for future propose the capacitor field.

Be careful with the 5V supply to the relay board. I found unstable behaviour when using a nodemcu with a 5V power supply, connecting the Vcc of the Relayboard straigt to a Vin (=5v) --> I dont remeber exactly what happened, i just made mental note that Vcc must be equal to TTL-level (=3,3v), and that I had to rewire a node already in the field

isnt work with 5v, i have a converter to 3.3v only for esp and sensors.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 39 guests