Gratis domotica › Forums › Meld een bug › Problem with Scene and random timer
- Dit onderwerp bevat 13 reacties, 2 deelnemers, en is laatst bijgewerkt op 5 jaren geleden door
Coyote.
-
AuteurBerichten
-
december 24, 2015 om 7:36 pm #2196
Coyote
LidHi,
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
december 24, 2015 om 7:44 pm #2197Coyote
LidSorry, 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
december 26, 2015 om 8:44 am #2216Mika
SleutelbeheerderDont 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.december 27, 2015 om 10:44 am #2228Coyote
LidHi 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 : StartI ‘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
december 27, 2015 om 11:07 am #2229Mika
SleutelbeheerderI’ll try to reproduce it.
If you try to add a “manual” timer ?
december 28, 2015 om 10:18 pm #2258Coyote
LidHi 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
december 31, 2015 om 1:06 pm #2278Coyote
LidHi,
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 boucleI avoid you all the notifications I get with my loops… 🙂
JMarc
januari 1, 2016 om 2:36 pm #2282Mika
SleutelbeheerderMaybe the sleep isnt a good “block”.
Maybe you have to put multiple timer…januari 1, 2016 om 11:26 pm #2289Coyote
LidHi,
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 Boucle12) 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
januari 2, 2016 om 8:21 am #2295Mika
SleutelbeheerderHi,
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…
etcThat’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
januari 2, 2016 om 9:00 am #2296Mika
SleutelbeheerderI 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.
januari 2, 2016 om 9:57 am #2301Coyote
LidHi,
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
januari 2, 2016 om 10:21 am #2302Mika
SleutelbeheerderCurrently 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…
januari 2, 2016 om 6:00 pm #2311Coyote
LidHi 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
-
AuteurBerichten
- Je moet ingelogd zijn om een reactie op dit onderwerp te kunnen geven.