Problems with event call in rules ?

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Lenif
New user
Posts: 4
Joined: 08 Mar 2019, 07:48

Problems with event call in rules ?

#1 Post by Lenif » 08 Mar 2019, 08:14

Hello,

I just update my SonOFF DUAL because regularly, they disconnected from the wifi and I had to reboot via the power supply (because difficult to access).
So I installed the version of March 5th. I'm having trouble with the Rules in this version. Everything works fine except the event call from button event.
My rules:

Code: Select all

on System#Boot do
  gpio,12,0 // Relay 1
  gpio,5,0  // Relay 2
endon

on Bouton#Bouton do  // normal switch (not push)
  DoAction=25
endon

on DoAction do
  if [RelaisUP#RelaisUP]=1 or [RelaisDOWN#RelaisDOWN]=1 //2 switch on the gpio to get output state
    event DoStop
  else
    event StartVolet=%eventvalue%
  endif
endon

on StartVolet do
  if [Volet#VersLeBas]=1  // Dummy(4-1) last up or down
    event DoUp=%eventvalue%
  else
    event DoDown=%eventvalue%
  endif
endon

On DoStop do
   gpio,12,0
   gpio,5,0
   timerset,2,0
endon

On DoUp do
  gpio,12,0
  gpio,5,1
  TaskValueSetAndRun 4,1,0 // Last action is going up
  timerset,2,%eventvalue%
endon

On DoDown do
  gpio,5,0
  gpio,12,1
  TaskValueSetAndRun 4,1,1 // Last action is going down
  timerset,2,%eventvalue%
endon

on Rules#Timer=2 do
 gpio,12,0
 gpio,5,0
endon
Maybe there is a simple way to do it but it works on build mega-20181101.
On the build from 20180305, when I use the button, my sonoff reboot. :(
The event DoAction, DoStop, DoUP and DoDown can be called via http without any problems, all is working good but via button event, I get a reboot. :(

I don't understand what's happening.

Thanks for your help and any suggestion.
Lenif,
Belgium

kimot
Normal user
Posts: 190
Joined: 12 Oct 2017, 20:46

Re: Problems with event call in rules ?

#2 Post by kimot » 08 Mar 2019, 09:56

What is:

DoAction=25

And I am not sure, if your event call method is correct:
Calling event with value assigned.

event DoDown=%eventvalue%

Lenif
New user
Posts: 4
Joined: 08 Mar 2019, 07:48

Re: Problems with event call in rules ?

#3 Post by Lenif » 08 Mar 2019, 16:32

Hello, off course, it's "event DoAction=xx", just mistyping

Lenif
New user
Posts: 4
Joined: 08 Mar 2019, 07:48

Re: Problems with event call in rules ?

#4 Post by Lenif » 08 Mar 2019, 16:51

I notice today that the icon that represents my shutters is not correct today. I added an additional state that I activate in the system#boot event so I can easily see on my Jeedom interface if the sonoff has rebooted.
In the day one of the sonoff reboot while no command was sent.

User avatar
schnurzel59
Normal user
Posts: 32
Joined: 18 Feb 2019, 12:41
Location: Germany
Contact:

Re: Problems with event call in rules ?

#5 Post by schnurzel59 » 15 Mar 2019, 14:25

Hi Lenif,

You say:
Maybe there is a simple way to do it but it works on build mega-20181101.
On the build from 20180305, when I use the button, my sonoff reboot. :(
I think the not working version is these: 20190305. (Not 2018) ?

Why do not you stay with version 20181101?
If everything is going well, then you should be happy. What has improved so important in the version 20191101, what you really need?
It is unfortunately always trying to insert something new into the ESPEasy. It would be better to eliminate the long-known fundamental problems.
My tip: Stay with a working version.

Here is my variant of a shutter control. I can get to a certain position, no matter what the old position was.
Event, DoAction = 7 means drive to position 7.
When booting, the desired standard position is approached.
Like "ShutterReset". Got to Top or Bottom. Relay 1 --- gpio12 --- down Relay 2 --- gpio5 ----- up.
Would be interesting to know if it works. For me there was no problem with any mega-version. Unfortunately, the
ESP8266-MCU often reboots. This problem is well known, but still not eliminated.
I manage with it 3 shutters. "Event,GoTo=12,5,17" means: Left pos. 12, middle pos. 5, right pos. 17
I hope, when adapting to your devices no errors have arisen. But you see that yourself.
Since you have set up a switch in the lower part of your devices, "LongPulse" should work. Without a switch at this point, a longpulse only turns on and not off.

Code: Select all

on System#Boot do
       gpio,12,0 // Relay 1  down off
       gpio,5,0  // Relay 2  up   off
       event ShutterReset
endon
on ShutterReset do
	Longpulse,5,1,25			// or Longpulse,12,1,25	
endon
on Bouton#Bouton do  				// normal switch (not push)
	If [Volet#VersLeBas]>10  		// Old Position from  0=up to 25=down
	gpio,12,0
	Longpulse,5,1,25			// Then up to the End
	TaskValueSet,4,1,0 			// Now in Pos.0  upper position 
	else
	gpio,5,0
	Longpulse,12,1,25			// Then down to the End
	TaskValueSet,4,1,25 			// Now in Pos.25  lower position 
	endif
endon
On DoStop do
      gpio,12,0
      gpio,5,0
endon

on DoAction do					// Event,DoAction=7. That means: Go to position 7. Position 0 is up, position 25 is down.
  let,1,%eventvalue%       			// %var1%
  if [Volet#VersLeBas]>%eventvalue%      	// Old position bigger than new. 
    let,1,[Volet#VersLeBas]-%eventvalue%	// Diff. write in var1
    gpio,12,0
    Longpulse,5,$var1% 				// (Diff-Time) up  
  endif
  if [Volet#VersLeBas]<%eventvalue%		// Old position smaller than new.
    let,1,%eventvalue%-[Volet#VersLeBas]	// Diff. write in var1
    gpio,5,0
    Longpulse,12,$var1% 			// (Diff-Time) down  
  endif
  TaskValueSet 4,1,%eventvalue%		 	// New position
endon
Martin
Greetings Martin

Oh God, my English is horrible.

pe1ago
New user
Posts: 1
Joined: 18 Aug 2019, 20:36

Re: Problems with event call in rules ?

#6 Post by pe1ago » 18 Aug 2019, 21:00

Hello Martin,
I am little new to this.
I think this code is what i can adapt and use for my blinds, but:
a. can you tell me what device type you use in esp-easy
b. can you tell me what device type you use in domoticz
With domoticz blinds and esp-easy, Output - Domoticz MQTT Helper it is not working for me.
Thanks in advance,
Regards Hans

Post Reply

Who is online

Users browsing this forum: No registered users and 22 guests