Page 1 of 1

Execute bash from Blocky

Posted: Sunday 20 December 2015 21:46
by void
Hi,
TL;DR
I've created several LUA scripts which execute bash scripts on their turn.
It works pretty nice, but I can't add a 'wait' or 'sleep' in it without Domoticz complaining about it.
2015-12-20 21:37:06.709 Error: EventSystem: Warning!, lua script /home/pi/domoticz/scripts/lua/script_device_TG_on_Alarm-Door.lua has been running for more than 10 seconds
I need the sleep for timing issues I can't seem to fix.

Blocky allows '<action> after <seconds>' which would solve my issue.
However, I can't seem to find how to start a bash script from Blocky events.

Full
I use bash scripts to make snapshots from my stream-only webcam with ffmpeg, and curl for posting the created snapshot via my Telegram bot to me.
My phone presence script runs as a script_device AND as script_time in the hope it would detect my presence soon enough.
However, it happens quite regular that my presence is detected when I'm 20 to 40 seconds in my house.
This would trigger an 'alarm' (being the snapshot and TG message) since my phone sets the security panel to disarm.

Re: Execute bash from Blocky

Posted: Thursday 24 December 2015 14:01
by void
Really? Nobody ever encountered such issues?

Re: Execute bash from Blocky

Posted: Wednesday 20 January 2016 23:36
by jin
+1 for me!

I really need that feature implemented :)

With kind regards

Re: Execute bash from Blocky

Posted: Friday 22 January 2016 7:34
by jannl
When you presence script runs as a shell/perl/python script you do not have that issues. Lua is intended do only run short.

Re: Execute bash from Blocky

Posted: Tuesday 09 February 2016 12:12
by Pisellon1
I really need this feature too!! Thank for help!

Re: Execute bash from Blocky

Posted: Tuesday 09 February 2016 13:48
by oopee
I personally hate to make virtual switches for every issue like this but, again, it's easy work-around.

Re: Execute bash from Blocky

Posted: Wednesday 17 February 2016 11:42
by jin
Yes I definitively aggree, it's easy "workaround" :)
But creating many and many virtual switch add un-necessary complexity :)

This feature implemented will add an easy, fast and clean way to execute script based on events.

with kind regards

Re: Execute bash from Blocky

Posted: Monday 22 February 2016 10:57
by Pisellon1
Jin got the point.
Hope this feature should be considered in future by developers!

Thank you!

Re: Execute bash from Blocky

Posted: Monday 29 February 2016 18:14
by xinhood
The "After 30 seconds" feature in blocky is for things that, when done from LUA, would be put in the commandarray. In LUA you can put strings like "On AFTER 30" in the commandarray. But in the commandarray you cannot put bash script execution as far as I know. So I think it would not be trivial to implement this feature in blocky the same way as the other "After x" functions.

Maybe it's possible to implement bash scripts as a device in Domoticz. Then you could activate it trough the commandarray and it would automaticly work with the existing blocky featureset I guess.

Re: Execute bash from Blocky

Posted: Sunday 07 August 2016 13:07
by gizmocuz