How to set the countdown taskvalue

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
a_k
Normal user
Posts: 17
Joined: 16 Aug 2019, 09:10

How to set the countdown taskvalue

#1 Post by a_k » 17 Sep 2019, 18:29

How to set the countdown taskvalue? I would like one dummy value to change after 1 hour after reaching a given temperature. Unfortunately, the delay doesn't work and delays ALL the task. How to make it work properly? I have no idea.

Code: Select all

on dummy#1 do  
 if [10P#temperature]>78
 Delay 3000000
 TaskValueSet,11,3,1
 endif
 endon
edit:
I have an idea. But it doesn't really work the way I want it to. And if the value exceeds 3600, set the change valuetask..

Code: Select all

on dummy#1 do
 if [10P#temperature]>78
 TaskValueSet,11,3,[dummy#1]+1
 endif
endon

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

Re: How to set the countdown taskvalue

#2 Post by TD-er » 17 Sep 2019, 21:36

Just use a timer ?

a_k
Normal user
Posts: 17
Joined: 16 Aug 2019, 09:10

Re: How to set the countdown taskvalue

#3 Post by a_k » 17 Sep 2019, 21:48

Device: Output - Clock or rules? I have no idea how to do that. I try different things and nothing works... I do something wrong.

User avatar
budman1758
Normal user
Posts: 301
Joined: 15 Apr 2017, 05:13
Location: Riverside CA USA

Re: How to set the countdown taskvalue

#4 Post by budman1758 » 18 Sep 2019, 01:16

On Clock#Time=all,**:00 do
If [something#something]= something
do something
else
do something else
endif
endon

This will perform the function every hour on the hour.
https://espeasy.readthedocs.io/en/lates ... g-examples
See the "Time" section on the above page.
"The glass is twice as big as it needs to be".

a_k
Normal user
Posts: 17
Joined: 16 Aug 2019, 09:10

Re: How to set the countdown taskvalue

#5 Post by a_k » 18 Sep 2019, 04:40

It's not what he wants to do. Unfortunately, it doesn't work:

On 10P#temperatura>26 do
timerSet,1,5
endon

On Rules#Timer=1 do
TaskValueSet,11,3,1
endon

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

Re: How to set the countdown taskvalue

#6 Post by TD-er » 18 Sep 2019, 09:48

a_k wrote: 18 Sep 2019, 04:40 It's not what he wants to do. Unfortunately, it doesn't work:

On 10P#temperatura>26 do
timerSet,1,5
endon

On Rules#Timer=1 do
TaskValueSet,11,3,1
endon
That's indeed what I meant.
This doesn't work?
The timer should then be set for an hour (3600), but I can imagine it will be a bit tedious to test with an hour interval.

a_k
Normal user
Posts: 17
Joined: 16 Aug 2019, 09:10

Re: How to set the countdown taskvalue

#7 Post by a_k » 18 Sep 2019, 09:55

I set a small interval ( 10 s ) for the tests. Unfortunately, once it works and once it does not and with different intervals... :? It doesn't work more often...

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

Re: How to set the countdown taskvalue

#8 Post by TD-er » 18 Sep 2019, 14:52

What do you expect the function should do?
What it does here, is that it does set the timer every time the measured value is above some threshold.
What you probably should do is add some check to see if the timer has already been set.

Also what do you think will happen when the temperature fluctuates? (which is normal when controlling a cooling installation based on temperature for example :) )

If the temp does cross the value, then you should set some flag that you've seen it crossing the threshold and set your timer.

Maybe the plugin called "level" can help you out here.
I've not used that one myself, but I've seen its code a few times.
Does look like it could help je monitor some set level + applying some hysteresis.

a_k
Normal user
Posts: 17
Joined: 16 Aug 2019, 09:10

Re: How to set the countdown taskvalue

#9 Post by a_k » 18 Sep 2019, 15:58

TD-er wrote: 18 Sep 2019, 14:52 What it does here, is that it does set the timer every time the measured value is above some threshold.
Aah. Now I understand how it works. Thank you! I think I have an idea how to do it now. If I still don't know how. I will ask.

Now it's working properly: :) ;)

Code: Select all

on 10P#temperatura>29 do
TaskValueSet,9,1,1
endon

On test#test=0 do   // this task 9,1,1
timerSet,1,600
endon

on Rules#Timer=1 do
TaskValueSet,9,2,1
endon

Post Reply

Who is online

Users browsing this forum: No registered users and 38 guests