Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"delay" command does not work in rules #1654

Closed
nonflammable opened this issue Aug 15, 2018 · 16 comments
Closed

"delay" command does not work in rules #1654

nonflammable opened this issue Aug 15, 2018 · 16 comments
Labels
Category: Rules Related to the rule engine Type: Bug Considered a bug

Comments

@nonflammable
Copy link
Contributor

If you self compile, please state this and PLEASE try to ONLY REPORT ISSUES WITH OFFICIAL BUILDS!

Summarize of the problem/feature request

versions <=mega-20180804
rules:
On System#Boot do
neopixelall,0,0,0
neopixelall,128,0,0
delay 400
neopixelall,0,128,0
delay 400
neopixelall,0,0,128
delay 400
neopixelall,0,0,0
endon
is blinking led strip off/red/green/blue/off with 400ms delays

versions >=mega-20180808
above example is only one short flash

Expected behavior

should work like in versions <=mega-20180804

Actual behavior

the "delay" command looks skipped

Steps to reproduce

as in the above example

System configuration

Hardware: Wemos + WS2812 strip

ESP Easy version: >=mega-20180808

ESP Easy settings/screenshots:

Rules or log data


@TD-er
Copy link
Member

TD-er commented Aug 15, 2018

The delay command should need a complete make-over. See #1600

@Grovkillen Grovkillen added the Type: Bug Considered a bug label Aug 22, 2018
@giig1967g
Copy link
Contributor

Is the "delay" command still not working in rules?

@TD-er
Copy link
Member

TD-er commented Aug 29, 2018

I have not changed it, so its status should be the same at this moment.
As soon as this project of mine is ready and merged, I will also have a look at the timers used in rules.
These rules timers are not yet included in the new scheduler, since they seem to support something like "pause", which is not yet part of the scheduler.
I guess the most logical interpretation for "delay" should be some kind of pause of the rules execution.
However, I guess it is a bit more complex, since you only would want the execution of the current scope to pause/wait for a while.

So proper fixing of the 'delay' in rules, may take quite some effort to get it right.

@TD-er TD-er added the Category: Rules Related to the rule engine label Aug 29, 2018
@TD-er TD-er added this to Needs triage in Improve Timing via automation Aug 29, 2018
@TD-er TD-er added this to Needs triage in Improve Stability via automation Aug 29, 2018
@giig1967g
Copy link
Contributor

ok.
what could be a workaround to send two commands with 200ms of pause between them from rules?

(I have a light that will change it's color if I quickly turn off and on it.)

@TD-er
Copy link
Member

TD-er commented Aug 29, 2018

My pull request, I linked, is about managing send intervals by controllers.
These controllers could be set to delay the commands to 200 msec as minimum send interval.

Maybe that's an option for your use case?

@giig1967g
Copy link
Contributor

I am not sure it's my case.
The code is:

on R1OffOn do
  PCFGPIO,65,1
  delay,200
  PCFGPIO,65,0
endon

@TD-er
Copy link
Member

TD-er commented Aug 29, 2018

Nope, that won't be fixed by that pull request.

@giig1967g
Copy link
Contributor

I could think of two possible solutions:

  1. more complex but possibly faster execution:
    using the syntax used by OpenHAB. So, something that actually creates a timer:
    Example:
        timer = Timer.create(now.plusSeconds(3) [|
        {sendCommand(EnergiseGD, OFF)}
        {sendCommand(EnergiseGD, OFF)}
        ]

In ESPEasy could be:

on R1OffOn do
  PCFGPIO,65,1
  createTimer,200
    PCFGPIO,65,0
  endtimer
endon
  1. less complex but possibly slower execution:
    using events with timers in milliseconds (even if I suspect that maybe 200ms could easily be too short.)

new command:
msTimerSet (set timer in milliseconds),n,ms

on R1OffOn do
  PCFGPIO,65,1
  msTimerSet,1,200
endon

on rules#msTimer=1 do
  PCFGPIO,65,0
endon

What do you think?

@TD-er
Copy link
Member

TD-er commented Aug 29, 2018

I think adding a single command for 1 pulse also solves it.

@giig1967g
Copy link
Contributor

a new command or an existing command?

@TD-er
Copy link
Member

TD-er commented Aug 29, 2018

Not sure yet, just a thought of how to fix your issue.

@giig1967g
Copy link
Contributor

do you mean using PCFPULSE?

@TD-er
Copy link
Member

TD-er commented Aug 29, 2018

I haven't looked at existing commands, but if there is something like that, which does output a logical '1' for something like 200 msec, then yes, that should also work.

@giig1967g
Copy link
Contributor

will test

@giig1967g
Copy link
Contributor

I solved with pcfpulse.

@tonhuisman
Copy link
Contributor

This seems to be solved, so can be closed.

@TD-er TD-er closed this as completed Sep 4, 2023
Improve Timing automation moved this from Needs triage to Closed Sep 4, 2023
Improve Stability automation moved this from Needs triage to Closed Sep 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Rules Related to the rule engine Type: Bug Considered a bug
Projects
Improve Timing
  
Closed
Development

No branches or pull requests

5 participants