Problem with Scene and random timer

Domotica gratuit Forums Report a bug Problem with Scene and random timer

Ce sujet a 13 réponses, 2 participants et a été mis à jour par  Coyote, il y a 1 an et 10 mois.

14 sujets de 1 à 14 (sur un total de 14)
  • Auteur
    Messages
  • #2196

    Coyote
    Membre

    Hi,

    I have a blocky scene which use the weather sunset and a random timer inside to close my shutters
    I use the sunset time to enable my scene, and the random timer to simulate someone at home.

    I have a problem with the execution of the scene. When time is oki, blocky runs the scene, but it runs it many times, and I have many pushover notifications, and many impulsions to close the shutters (about 10 times)..

    Any ideas ?

    Thank you and merry christmas to you !

    JMarc

    #2197

    Coyote
    Membre

    Sorry, not sure that the link is oki,

    Here a link that seems to work, with the blocky rule I use..

    http://upandpost.com/image/view/9/a8504ad01160afaa21ead8bef77c906.jpg

    JMarc

    #2216
    Mika
    Mika
    Admin bbPress

    Dont see something special in your scene.

    Can you try a more simple scene to start. I mean, just with your test + timer.
    Then in your timer just add a “log” block so you’ll see in the log of the scene service if it’s call many times.

    #2228

    Coyote
    Membre

    Hi Mika,

    Here is a simple scene with just a trigger condition and a timer :

    http://upandpost.com/image/view/3/3ee12e4556e144bad8b2daa5e322798.jpg

    With this condition, when time is the weather sunset, It makes 4 actions with PushOver, and I get 4 résults in the scene.log.
    Here are the results :

    2015-12-26 17:07:01 Periodic : Start
    2015-12-26 17:07:01 Periodic : End
    2015-12-26 17:08:01 Periodic : Start
    2015-12-26 17:08:02 Periodic : End
    2015-12-26 17:09:02 Test
    2015-12-26 17:10:01 Test
    2015-12-26 17:11:01 Test
    2015-12-26 17:12:01 Test
    2015-12-26 17:12:02 Periodic : Start
    2015-12-26 17:12:02 Periodic : End
    2015-12-26 17:13:00 Periodic : Start

    I ‘ve added ‘Add log’ on my original scene too, and the problem is the same in the scene.log.
    I ‘ll try this evening to remove the ‘sleep’ command in the scene to see the difference.

    Thank you for your help.

    JMarc

    #2229
    Mika
    Mika
    Admin bbPress

    I’ll try to reproduce it.

    If you try to add a “manual” timer ?

    #2258

    Coyote
    Membre

    Hi Mika,

    If I remove the ‘sleep’ command, it only works one time.
    I’m not sure, but the problem seems to come from the sleep command.
    It appears like the scene service runs the scene each time the sleep command wait in the loop.
    For example, if you sleep 2 min, each minute the scene service will run the command in the loop…

    To investigate..

    JMarc

    #2278

    Coyote
    Membre

    Hi,

    Here is my scene with “add log” comments to see what Scene service do :

    http://upandpost.com/image/view/4/328fc8ebd22555c093d70ae840b6f28.jpg#code_forums

    And the results are very strange :

    2015-12-30 17:30:01 Periodic : Start
    2015-12-30 17:30:01 Periodic : End
    2015-12-30 17:30:02 Avant boucle
    2015-12-30 17:31:01 Periodic : Start
    2015-12-30 17:31:02 Periodic : End
    2015-12-30 17:31:02 Avant timer
    2015-12-30 17:31:02 Avant boucle
    2015-12-30 17:32:01 Periodic : Start
    2015-12-30 17:32:02 Periodic : End
    2015-12-30 17:32:02 Avant boucle
    2015-12-30 17:33:01 Periodic : Start
    2015-12-30 17:33:02 Periodic : End
    2015-12-30 17:33:02 Avant boucle
    2015-12-30 17:34:01 Periodic : Start
    2015-12-30 17:34:01 Periodic : End
    2015-12-30 17:34:02 Avant boucle
    2015-12-30 17:35:01 Periodic : Start
    2015-12-30 17:35:01 Periodic : End
    2015-12-30 17:35:02 Avant boucle
    2015-12-30 17:36:01 Periodic : Start
    2015-12-30 17:36:02 Periodic : End
    2015-12-30 17:36:02 Avant boucle
    2015-12-30 17:37:01 Periodic : Start
    2015-12-30 17:37:01 Periodic : End
    2015-12-30 17:37:02 Avant boucle
    2015-12-30 17:38:02 Avant sleep2
    2015-12-30 17:39:02 Avant sleep2
    2015-12-30 17:40:02 Apres sleep2
    2015-12-30 17:40:03 Avant sleep6
    2015-12-30 17:40:04 Avant sleep2
    2015-12-30 17:41:01 Avant sleep2
    2015-12-30 17:41:02 Apres sleep2
    2015-12-30 17:41:03 Avant sleep6
    2015-12-30 17:42:01 Avant sleep2
    2015-12-30 17:42:04 Apres sleep2
    2015-12-30 17:42:05 Avant sleep6
    2015-12-30 17:43:01 Avant sleep2
    2015-12-30 17:43:01 Apres sleep2
    2015-12-30 17:43:02 Avant sleep6
    2015-12-30 17:44:01 Apres sleep2
    2015-12-30 17:44:02 Avant sleep2
    2015-12-30 17:44:03 Avant sleep6
    2015-12-30 17:45:01 Apres sleep2
    2015-12-30 17:45:01 Avant sleep2
    2015-12-30 17:45:02 Avant sleep6
    2015-12-30 17:46:01 Avant sleep2
    2015-12-30 17:46:02 Apres sleep2
    2015-12-30 17:46:03 Apres sleep6
    2015-12-30 17:46:03 Periodic : Start
    2015-12-30 17:46:03 Avant sleep6
    2015-12-30 17:46:03 Periodic : End
    2015-12-30 17:46:04 Avant boucle
    2015-12-30 17:47:00 Periodic : Start
    2015-12-30 17:47:01 Periodic : End
    2015-12-30 17:47:01 Avant boucle
    2015-12-30 17:47:01 Apres sleep2
    2015-12-30 17:47:02 Avant sleep6
    2015-12-30 17:47:03 Apres sleep6
    2015-12-30 17:47:03 Periodic : Start
    2015-12-30 17:47:03 Periodic : End
    2015-12-30 17:47:03 Avant boucle
    2015-12-30 17:48:00 Periodic : Start
    2015-12-30 17:48:01 Periodic : End
    2015-12-30 17:48:01 Apres sleep2
    2015-12-30 17:48:01 Avant boucle
    2015-12-30 17:48:02 Avant sleep6
    2015-12-30 17:48:05 Apres sleep6
    2015-12-30 17:48:05 Periodic : Start
    2015-12-30 17:48:05 Periodic : End
    2015-12-30 17:48:05 Avant boucle

    I avoid you all the notifications I get with my loops… 🙂

    JMarc

    #2282
    Mika
    Mika
    Admin bbPress

    Maybe the sleep isnt a good “block”.
    Maybe you have to put multiple timer…

    #2289

    Coyote
    Membre

    Hi,

    There are many problems with timers.

    1) If I want to use the “sleep block” in a timer (manual or random) block, it makes bugs with the scene service. Here a simple example :

    http://upandpost.com/image/view/7/5f8f4b8cceebbd1a99a41f83ac4faf2.jpg

    In this case, it makes a loop in the timer block during the sleeping time, and after that, scene service is totaly lost with the scene, and redo it many times each minute. Here is the associated log :

    2016-01-01 21:11:00 Periodic : Start
    2016-01-01 21:11:00 Periodic : End
    2016-01-01 21:11:01 Boucle1
    2016-01-01 21:12:00 Periodic : Start
    2016-01-01 21:12:00 Periodic : End
    2016-01-01 21:12:01 Boucle1
    2016-01-01 21:12:01 Boucle2
    2016-01-01 21:13:00 Boucle3
    2016-01-01 21:14:00 Boucle3
    2016-01-01 21:15:00 Boucle3
    2016-01-01 21:16:00 Boucle3
    2016-01-01 21:16:00 Periodic : Start
    2016-01-01 21:16:01 Periodic : End
    2016-01-01 21:16:01 Boucle1
    2016-01-01 21:17:00 Periodic : Start
    2016-01-01 21:17:00 Periodic : Start
    2016-01-01 21:17:01 Periodic : End
    2016-01-01 21:17:01 Periodic : End
    2016-01-01 21:17:02 Boucle1
    2016-01-01 21:17:02 Boucle1
    2016-01-01 21:18:00 Periodic : Start
    2016-01-01 21:18:00 Periodic : End
    2016-01-01 21:18:01 Boucle1

    2) If I want to use multiple timers (Timer in a timer) like this example :

    http://upandpost.com/image/view/3/e609c4869b6656e1bec3b6a14a61a9c.jpg

    I have two options :
    2-1) Scene service stop to run this scene, with nothing at all in the log file
    2-2) The scene works, but makes a infinite loop.. here is the log :

    2016-01-01 21:55:00 Periodic : Start
    2016-01-01 21:55:01 Periodic : End
    2016-01-01 21:55:01 Boucle 0
    2016-01-01 21:56:01 Periodic : Start
    2016-01-01 21:56:01 Periodic : End
    2016-01-01 21:56:01 Boucle 0
    2016-01-01 21:57:01 Periodic : Start
    2016-01-01 21:57:01 Periodic : End
    2016-01-01 21:57:01 Boucle 0
    2016-01-01 21:57:01 Time ok
    2016-01-01 21:58:01 Time +1 min
    2016-01-01 21:59:01 Time +1 min
    2016-01-01 22:00:02 Time +1 min
    2016-01-01 22:01:01 Time +1 min
    2016-01-01 22:02:01 Time +1 min
    2016-01-01 22:03:01 Time +1 min
    2016-01-01 22:04:01 Time +1 min
    2016-01-01 22:05:01 Time +1 min
    2016-01-01 22:06:02 Time +1 min
    2016-01-01 22:07:01 Time +1 min
    2016-01-01 22:08:02 Time +1 min
    2016-01-01 22:09:00 Time +1 min
    2016-01-01 22:10:00 Time +1 min
    2016-01-01 22:11:00 Time +1 min

    … Not easy to find a working solution… I’ll try with a test on the real time..

    JMarc

    #2295
    Mika
    Mika
    Admin bbPress

    Hi,

    I found the bug for the infinite loop, your are right.
    There is also a bug with “timer block inside timer block”, need more investigation.

    For the sleep block, I have an idea.
    The “sleep block” call the “sleep” function in php. So the script is waiting for x minutes.
    In parrallel, I check every minutes the queue generated by the timer block.

    The first time I check the queue, it run the sleep command ( the script is waiting, I cannot remove the command from the queue).
    The next minute, I check the queue again, there are still the command because the first call didnt finish yet…
    etc

    That’s why you have multiple call…

    Once the first call is finish, the queue is empty. The scene is finished for real.

    I need to investigate a little bit more to find a proper solution…

    Mika

    #2296
    Mika
    Mika
    Admin bbPress

    I made the correction.

    I’m busy to build a new version of the scene service. Dont know if I’ll have time to publish it this morning…

    I recommend you to use “timer inside timer” instead of “sleep”. It will better work and prevent multiple execution.

    #2301

    Coyote
    Membre

    Hi,

    Thanks a lot for your help, I’ll try again with timers.

    Just another thing about the timer block : You can’t also put a ‘set variable block’ inside it.
    If you do that, scene service doesn’t execute blocks inside the timer….

    JMarc

    #2302
    Mika
    Mika
    Admin bbPress

    Currently busy to upgrade the add-ons. You should see the new version in a few minutes.

    For the “set variables”, I’ll take also a look…

    #2311

    Coyote
    Membre

    Hi Mika,

    I’ve tried to put a timer in a timer, but there is still a problem in the second loop.
    You can’t use any other block in the second timer, otherwise the scene stop running (no launches with scene service).

    There is a problem with virtual device new value (blue) block, Zwave device new value (blue) block, and pushOver block.
    For the moment, it only works with “add log blocks”, or “set item variable block” inside the second loop..

    So I’m still blocked.. 🙂

    JMarc

14 sujets de 1 à 14 (sur un total de 14)

Vous devez être connecté pour répondre à ce sujet.