Timer rules not working

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Dick60
Normal user
Posts: 242
Joined: 11 Feb 2018, 17:35
Location: The Netherlands

Timer rules not working

#1 Post by Dick60 » 01 Jan 2021, 18:16

I installed the 27 dec build. Now I found that mij timer is not working.
In turn ON the GPIO 15 but does not turn it off after 30 seconds
Does anyone see what I am doing wrong?

Code: Select all

On Keukenradar#Distance do
if [Keukenradar#Distance]=1
GPIO,15,1
timerset,1,30
endif
endon

On Rules#Timer=1 do
GPIO,15,0
endon

User avatar
Ath
Normal user
Posts: 3418
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Timer rules not working

#2 Post by Ath » 01 Jan 2021, 18:23

Can you show the way stuff is wired up? Possibly create a Fritzing diagram to show here?

Does it turn off if you send the GPIO,15,0 command from the Tools tab?

Might it be that it is turned back on immediately after turning it off?
/Ton (PayPal.me)

Dick60
Normal user
Posts: 242
Joined: 11 Feb 2018, 17:35
Location: The Netherlands

Re: Timer rules not working

#3 Post by Dick60 » 01 Jan 2021, 18:35

The wiring is quite simple. GPIO 8 is directly connected to a relaisboard. If I send a GPIO,15,0 it turns off. Included you find also a part of my log:

1921626: EVENT: Keukenradar#Distance=0
1922827: WD : Uptime 32 ConnectFailures 0 FreeMem 18056 WiFiStatus WL_CONNECTED ESPeasy internal wifi status: Conn. IP Init
1936582: ULTRASONIC : TaskNr: 1 state: 1
1936589: EVENT: Keukenradar#Distance=1
1936599: ACT : GPIO,15,1
1936601: GPIO : port#15: set to 1
1936603: ACT : timerset,1,30
1937203: SW : GPIO=15 State=1 Output value=1
1937214: EVENT: Keuken_switch#State=1
1938483: ULTRASONIC : TaskNr: 1 state: 0
1938494: EVENT: Keukenradar#Distance=0
1949482: HTTP: GPIO,15,1
1949486: GPIO : port#15: set to 1
1951233: Domoticz: Sensortype: 1 idx: 536 values: 0
1951802: EVENT: Keukenradar#Distance=0
1953007: WD : Uptime 33 ConnectFailures 0 FreeMem 17984 WiFiStatus WL_CONNECTED ESPeasy internal wifi status: Conn. IP Init
1967378: EVENT: Rules#Timer=1,1
1978254: EVENT: Clock#Time=Fri,17:29
1981125: Domoticz: Sensortype: 1 idx: 536 values: 0
1981690: EVENT: Keukenradar#Distance=0


Here the log after turn off using the tools command line:
{
"log": "port#15: set to 0",
"plugin": 1,
"pin": 15,
"mode": "output",
"state": 0
}

User avatar
Ath
Normal user
Posts: 3418
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Timer rules not working

#4 Post by Ath » 01 Jan 2021, 18:49

Please try not to use a mix of D8 and GPIO-15 (though they are the same pin), that's only confusing stuff. The D{n} port numbers are just an 'invention' of Wemos (AFAIK), naming the actual GPIO numbers is more generic, IMHO.

Why is GPIO,15,1 being set from HTTP? Is another system (Domoticz, Homey, whatever) also being smart and trying to control this port?

Your log:

Code: Select all

1938494: EVENT: Keukenradar#Distance=0
1949482: HTTP: GPIO,15,1
1949486: GPIO : port#15: set to 1
/Ton (PayPal.me)

Dick60
Normal user
Posts: 242
Joined: 11 Feb 2018, 17:35
Location: The Netherlands

Re: Timer rules not working

#5 Post by Dick60 » 01 Jan 2021, 19:07

Good point, to reduice the margin of error I deactivated the HTTP connection. I use Domomticz, where I use a switch for a manual mode (during a holiday. In that case I use the timerswitch with some restrictions using the IF commands. But that is out of scope for now.
For now this is the Log without the HTTP connection.

Code: Select all

31592: EVENT: Keukenradar#Distance=0
32765: WD : Uptime 1 ConnectFailures 0 FreeMem 17968 WiFiStatus WL_CONNECTED ESPeasy internal wifi status: Conn. IP Init
45468: ULTRASONIC : TaskNr: 1 state: 1
45474: EVENT: Keukenradar#Distance=1
45485: ACT : GPIO,15,1
45487: GPIO : port#15: set to 1
45489: ACT : timerset,1,30
46096: SW : GPIO=15 State=1 Output value=1
46105: EVENT: Keuken_switch#State=1
47957: ULTRASONIC : TaskNr: 1 state: 0
47966: EVENT: Keukenradar#Distance=0
61816: EVENT: Keukenradar#Distance=0
62437: NTP : NTP replied: delay 10 mSec Accuracy increased by 0.321 seconds
62438: Time set to 1609525662.321 Time adjusted by 1556.63 msec. Wander: 0.43 msec/second
62441: Local time: 2021-01-01 18:27:42
63008: EVENT: Time#Set
63038: WD : Uptime 1 ConnectFailures 0 FreeMem 17704 WiFiStatus WL_CONNECTED ESPeasy internal wifi status: Conn. IP Init
76255: EVENT: Rules#Timer=1,1
80323: EVENT: Clock#Time=Fri,18:28
91823: EVENT: Keukenradar#Distance=0

User avatar
Ath
Normal user
Posts: 3418
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Timer rules not working

#6 Post by Ath » 01 Jan 2021, 19:59

Can you add a line in the Rules#Timer=1 event that logs something recognizable to see if you actually get there, f.e. LogEntry,"In Timer 1 handler", and check the log if that is turning up?

You can quickly test the timer from the Tools tab, by submitting this command: event,Rules#Timer=1
/Ton (PayPal.me)

Dick60
Normal user
Posts: 242
Joined: 11 Feb 2018, 17:35
Location: The Netherlands

Re: Timer rules not working

#7 Post by Dick60 » 01 Jan 2021, 20:34

Domoticz: Sensortype: 1 idx: 536 values: 0
14489: ULTRASONIC : TaskNr: 1 state: 1
14498: EVENT: Keukenradar#Distance=1
14521: ACT : GPIO,15,1
14523: GPIO : port#15: set to 1
14525: ACT : timerset,1,30
14529: ACT : LogEntry,'In Timer 1 handler'
14531: In Timer 1 handler
14951: SW : GPIO=15 State=1 Output value=1
14959: EVENT: Keuken_switch#State=1
15372: ULTRASONIC : TaskNr: 1 state: 0
15380: EVENT: Keukenradar#Distance=0
15810: ULTRASONIC : TaskNr: 1 state: 1
15814: EVENT: Keukenradar#Distance=1
15842: ACT : GPIO,15,1
15845: GPIO : port#15: set to 1
15847: ACT : timerset,1,30
15850: ACT : LogEntry,'In Timer 1 handler'
15852: In Timer 1 handler
16277: ULTRASONIC : TaskNr: 1 state: 0
16281: EVENT: Keukenradar#Distance=0
31579: EVENT: Keukenradar#Distance=0
32450: WD : Uptime 1 ConnectFailures 0 FreeMem 19120 WiFiStatus WL_CONNECTED ESPeasy internal wifi status: Conn. IP Init
34146: EVENT: Clock#Time=Fri,19:51
46448: EVENT: Rules#Timer=1,1
61345: EVENT: Keukenradar#Distance=0
62650: WD : Uptime 1 ConnectFailures 0 FreeMem 15568 WiFiStatus WL_CONNECTED ESPeasy internal wifi status: Conn. IP Init

Dick60
Normal user
Posts: 242
Joined: 11 Feb 2018, 17:35
Location: The Netherlands

Re: Timer rules not working

#8 Post by Dick60 » 01 Jan 2021, 20:58

but if I add the log option to this part of the timer

Code: Select all

On Rules#Timer=1 do
GPIO,15,0
LogEntry,"In Timer 1 handler"
endon

It never arrivés in the log

User avatar
Ath
Normal user
Posts: 3418
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Timer rules not working

#9 Post by Ath » 01 Jan 2021, 21:17

Have you tried triggering the Rules#Timer=1 event as suggested? Then it should be visible in the log.
/Ton (PayPal.me)

Dick60
Normal user
Posts: 242
Joined: 11 Feb 2018, 17:35
Location: The Netherlands

Re: Timer rules not working

#10 Post by Dick60 » 01 Jan 2021, 21:24

re sult was an "OK". Sorry I did not mentoned it. ( I hope this is what you expected).

User avatar
Ath
Normal user
Posts: 3418
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Timer rules not working

#11 Post by Ath » 01 Jan 2021, 21:32

Well, I'm more interested to see if the message is visible in the log...
/Ton (PayPal.me)

Dick60
Normal user
Posts: 242
Joined: 11 Feb 2018, 17:35
Location: The Netherlands

Re: Timer rules not working

#12 Post by Dick60 » 01 Jan 2021, 21:39

The message is now visible in the log.
Was trying other settings, in Tools/Advanced Settings/Rules Sttings I selected "Old Engine". That solved the Timer issue. Now it works but I do not like I do not know WHY!!!.
I hope you can explain.

User avatar
Ath
Normal user
Posts: 3418
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Timer rules not working

#13 Post by Ath » 01 Jan 2021, 21:51

Aha, the 'new' Rules engine isn't working exactly as intended yet, so the 'old' engine should be used. It was enabled when initially setting up the unit, I presume?

Moving all your logic to the rules files will be a small chore, I think, but then you'll see it'll workout alright.
/Ton (PayPal.me)

Dick60
Normal user
Posts: 242
Joined: 11 Feb 2018, 17:35
Location: The Netherlands

Re: Timer rules not working

#14 Post by Dick60 » 01 Jan 2021, 22:03

ha ha, I didn't know. That explain everything. Thanks for the info and for you a "zeer voorspoedig 2021" ( a happy new year.

User avatar
Ath
Normal user
Posts: 3418
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Timer rules not working

#15 Post by Ath » 01 Jan 2021, 22:05

Dick60 wrote: 01 Jan 2021, 22:03 "zeer voorspoedig 2021"
Voor jou ook een Voorspoedig 2021, en veel knutsel-plezier :D
/Ton (PayPal.me)

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

Re: Timer rules not working

#16 Post by TD-er » 02 Jan 2021, 10:55

Ah een Nederlands feestje hier :)

Just browsed through the topic and one thing immediately came to mind; When using Domiticz with ESPEasy and trying to control switches from Domoticz, then please consider using MQTT as that makes things a lot simpler to get it right.
To get an idea of how to handle GPIO control from Domoticz via MQTT see: https://espeasy.readthedocs.io/en/lates ... z%20helper

Post Reply

Who is online

Users browsing this forum: No registered users and 27 guests