Page 1 of 2
[667] Ability to execute script:/// from Blocky
Posted: Saturday 26 December 2015 18:20
by void
tracker.php?p=2&t=667
As asked in
viewtopic.php?f=23&t=9489 it would be really nice to be able to run system scripts (bash, python, whatever) from Blocky.
LUA is nice, but putting a sleep in LUA will cause it to run multiple times sequential, which really is a killer for scripts.
A Blocky option 'execute $script after $time' would be a great addition to the Domoticz OS in my opinion.
Cheers.
Re: [667] Ability to execute script:/// from Blocky
Posted: Friday 01 July 2016 15:20
by Ritmeester
+10
Absolute a good idea.
Re: [667] Ability to execute script:/// from Blocky
Posted: Wednesday 27 July 2016 16:47
by Muyz
+10
This is indeed a very good suggestion. I have been using Domoticz only for one week and it's exactly what I need.
Re: [667] Ability to execute script:/// from Blocky
Posted: Thursday 28 July 2016 4:54
by raym
You could call a script from a dummy switch and then call that switch from blocky.
Re: [667] Ability to execute script:/// from Blocky
Posted: Sunday 07 August 2016 13:06
by gizmocuz
Implemented in beta #5437

- BlocklyScript.PNG (12.05 KiB) Viewed 12496 times
if you enter an IDX in between {{ and }} , from for example a temperature sensor, it is replaced with the value of this sensor
Hope all is working well....
Re: [667] Ability to execute script:/// from Blocky
Posted: Sunday 07 August 2016 13:15
by fransiefrans
Sounds good! I will try this tonight. Thanks
Re: [667] Ability to execute script:/// from Blocky
Posted: Sunday 07 August 2016 13:16
by gizmocuz
Forgot to mention... you can find it under the 'messages' section... not sure if it is the logical place, but as open_url was also in here....
Re: [667] Ability to execute script:/// from Blocky
Posted: Tuesday 09 August 2016 15:23
by gizmocuz
Is it working ?
Re: [667] Ability to execute script:/// from Blocky
Posted: Wednesday 10 August 2016 1:42
by fransiefrans
I'm unable to update to the latest beta version. After 2% it says error internet connection.
Re: [667] Ability to execute script:/// from Blocky
Posted: Saturday 13 August 2016 15:00
by bearded
Works great for me. I'm triggering batch files to run in Windows directly from blockly now rather than having to run them from switches. Really useful functionality, thanks!
Sent from my iPhone using Tapatalk
Re: [667] Ability to execute script:/// from Blocky
Posted: Saturday 13 August 2016 23:59
by Muyz
Great! Now I will move from stable to latest greatest

Re: [667] Ability to execute script:/// from Blocky
Posted: Wednesday 17 August 2016 12:20
by jonazp
I cant seem to run a script within blockly. I get error 32512.
The script works fine when run fron putty or with a switch that calls the script.
Any ideas?

- Blockly.JPG (49.06 KiB) Viewed 12336 times
Re: [667] Ability to execute script:/// from Blocky
Posted: Friday 19 August 2016 7:12
by bearded
My scripts run batch files (on Windows) which are contained in the 'domoticz' folder and therefore do not need a path specifying. (i.e. just 'tv-on.bat with no / or \ required.) Maybe the problem is when you specify a path in blockly? Try moving a file into your domoticz root folder and executing it as I do. Could be a bug in blockly.
Sent from my iPhone using Tapatalk
Re: [667] Ability to execute script:/// from Blocky
Posted: Friday 26 August 2016 10:49
by jonazp
Cant get it to work
Re: [667] Ability to execute script:/// from Blocky
Posted: Sunday 02 October 2016 12:39
by heggink
I noticed that in some cases, starting a script without any parameters results in an error as follows:
Error executing script command (/home/pi/domoticz/scripts/say_ad.sh#). returned: 32512
If I add a space after the script's name then the # is still there but taken as the first parameter of the script (where my script doesn't use any so it works as a workaround).
Anyone else seen this? Obviously only applies to linux( /raspbian).
H
Re: [667] Ability to execute script:/// from Blocky
Posted: Tuesday 17 January 2017 10:25
by mikkel75
I see the exact same - I'll try the workaround and report back.... Thanks...
(I'm on x86_64 Ubuntu 16.04)
Re: [667] Ability to execute script:/// from Blocky
Posted: Thursday 19 January 2017 12:09
by mikkel75
The space workaround works - but why is there a tailing '#' when the script is called?
Re: [667] Ability to execute script:/// from Blocky
Posted: Friday 30 June 2017 12:11
by sjoerd1953
Works great with me. Thanks a lot for this improvement. A few notes:
When Domoticz is running on a Raspberry Pi and you place the bash script in a seperate folder (e.g. /home/pi/domoticz/scripts/bash) then, next to making the script executable with CHMOD 755 you also have to add the folder to your $PATH. You can do this by adding this code to your .profile file and reboot. Use the full directory name as mentioned above.
You will find the .profile file in the /home/pi directory as a hidden file. Add the code at the bottom of the file.
I use this to set Milight bulbs to nightlight at sunset. This is the bash code:
Code: Select all
#!/bin/bash
echo -n -e "\x33\x00" | nc -u -q 1 192.168.2.25 8899 # set zone 2 OFF
echo -n -e "\x3A\x00" | nc -u -q 1 192.168.2.25 8899 # set zone 3 OFF
echo -n -e "\x36\x00" | nc -u -q 1 192.168.2.25 8899 # set zone 4 OFF
sleep 1
echo -n -e "\xB3\x00" | nc -u -q 1 192.168.2.25 8899 # set zone 2 NightLight
echo -n -e "\xBA\x00" | nc -u -q 1 192.168.2.25 8899 # set zone 3 NightLight
echo -n -e "\xB6\x00" | nc -u -q 1 192.168.2.25 8899 # set zone 4 NightLight
and this the Blockly code:

- blockly_nachtlicht_aan.PNG (6.04 KiB) Viewed 11004 times
at sunrise they go out again with:
Code: Select all
#!/bin/bash
echo -n -e "\x33\x00" | nc -u -q 1 192.168.2.25 8899 # set zone 2 OFF
echo -n -e "\x3A\x00" | nc -u -q 1 192.168.2.25 8899 # set zone 3 OFF
echo -n -e "\x36\x00" | nc -u -q 1 192.168.2.25 8899 # set zone 4 OFF
and this:

- blockly_nachtlicht_uit.PNG (5.99 KiB) Viewed 11004 times
Run local batch file Windows
Posted: Thursday 22 February 2018 8:54
by Oxyandy
Hi I have Windows 10
have tried a bunch of different syntax - log says
2018-02-22 18:37:13.940 Executing script: 'C:\_\done.bat '#
But it never fires the batch file
help please

- New Bitmap Imtttage (2).jpg (74.18 KiB) Viewed 9474 times
Re: [667] Ability to execute script:/// from Blocky
Posted: Tuesday 27 February 2018 20:17
by htilly
Hi! Having the same problem. Did you figure out why there is a tailing # ?!
It's messing up my scripting! =)
mikkel75 wrote: ↑Thursday 19 January 2017 12:09
The space workaround works - but why is there a tailing '#' when the script is called?