[667] Ability to execute script:/// from Blocky

Use this forum to discuss possible implementation of a new feature before opening a ticket.
A developer shall edit the topic title with "[xxx]" where xxx is the id of the accompanying tracker id.
Duplicate posts about the same id. +1 posts are not allowed.

Moderators: leecollings, remb0

void
Posts: 26
Joined: Wednesday 04 November 2015 10:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

[667] Ability to execute script:/// from Blocky

Post 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.
Ritmeester
Posts: 53
Joined: Thursday 06 March 2014 18:30
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: [667] Ability to execute script:/// from Blocky

Post by Ritmeester »

+10
Absolute a good idea.
Muyz
Posts: 5
Joined: Tuesday 19 July 2016 8:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: [667] Ability to execute script:/// from Blocky

Post 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.
raym
Posts: 81
Joined: Tuesday 03 November 2015 5:07
Target OS: Linux
Domoticz version: beta
Contact:

Re: [667] Ability to execute script:/// from Blocky

Post by raym »

You could call a script from a dummy switch and then call that switch from blocky.
Last edited by raym on Thursday 28 July 2016 4:54, edited 1 time in total.
User avatar
gizmocuz
Posts: 2350
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: [667] Ability to execute script:/// from Blocky

Post by gizmocuz »

Implemented in beta #5437
BlocklyScript.PNG
BlocklyScript.PNG (12.05 KiB) Viewed 11525 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....
Quality outlives Quantity!
fransiefrans
Posts: 59
Joined: Sunday 14 June 2015 13:22
Target OS: Raspberry Pi / ODroid
Domoticz version: stable
Location: Netherlands
Contact:

Re: [667] Ability to execute script:/// from Blocky

Post by fransiefrans »

Sounds good! I will try this tonight. Thanks
User avatar
gizmocuz
Posts: 2350
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: [667] Ability to execute script:/// from Blocky

Post 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....
Quality outlives Quantity!
User avatar
gizmocuz
Posts: 2350
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: [667] Ability to execute script:/// from Blocky

Post by gizmocuz »

Is it working ?
Quality outlives Quantity!
fransiefrans
Posts: 59
Joined: Sunday 14 June 2015 13:22
Target OS: Raspberry Pi / ODroid
Domoticz version: stable
Location: Netherlands
Contact:

Re: [667] Ability to execute script:/// from Blocky

Post by fransiefrans »

I'm unable to update to the latest beta version. After 2% it says error internet connection.
bearded
Posts: 9
Joined: Tuesday 28 June 2016 17:22
Target OS: Windows
Domoticz version:
Location: Huddersfield, UK
Contact:

Re: [667] Ability to execute script:/// from Blocky

Post 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
Muyz
Posts: 5
Joined: Tuesday 19 July 2016 8:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: [667] Ability to execute script:/// from Blocky

Post by Muyz »

Great! Now I will move from stable to latest greatest :)
jonazp
Posts: 2
Joined: Wednesday 17 August 2016 12:17
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: [667] Ability to execute script:/// from Blocky

Post 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
Blockly.JPG (49.06 KiB) Viewed 11365 times
bearded
Posts: 9
Joined: Tuesday 28 June 2016 17:22
Target OS: Windows
Domoticz version:
Location: Huddersfield, UK
Contact:

Re: [667] Ability to execute script:/// from Blocky

Post 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
jonazp
Posts: 2
Joined: Wednesday 17 August 2016 12:17
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: [667] Ability to execute script:/// from Blocky

Post by jonazp »

Cant get it to work
User avatar
heggink
Posts: 972
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 12451
Location: NL
Contact:

Re: [667] Ability to execute script:/// from Blocky

Post 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
Docker in Truenas scale, close to latest beta
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
mikkel75
Posts: 39
Joined: Thursday 08 December 2016 20:50
Target OS: Linux
Domoticz version:
Contact:

Re: [667] Ability to execute script:/// from Blocky

Post by mikkel75 »

I see the exact same - I'll try the workaround and report back.... Thanks...
(I'm on x86_64 Ubuntu 16.04)
mikkel75
Posts: 39
Joined: Thursday 08 December 2016 20:50
Target OS: Linux
Domoticz version:
Contact:

Re: [667] Ability to execute script:/// from Blocky

Post by mikkel75 »

The space workaround works - but why is there a tailing '#' when the script is called?
sjoerd1953
Posts: 11
Joined: Monday 09 January 2017 9:42
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Swolgen
Contact:

Re: [667] Ability to execute script:/// from Blocky

Post 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.

Code: Select all

export PATH=$PATH:directory name
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
blockly_nachtlicht_aan.PNG (6.04 KiB) Viewed 10033 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
blockly_nachtlicht_uit.PNG (5.99 KiB) Viewed 10033 times
Sjoerd van Staveren

Domoticz running on a Raspberry Pi 3; Milight RGBW and Dual White bulbs; RFXcom XL;HOMEeasy switch; Flamingo switches; Sonoff switches
Oxyandy
Posts: 2
Joined: Thursday 22 February 2018 8:47
Target OS: Windows
Domoticz version:
Contact:

Run local batch file Windows

Post 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
New Bitmap Imtttage (2).jpg (74.18 KiB) Viewed 8503 times
htilly
Posts: 14
Joined: Saturday 09 January 2016 22:05
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Stockholm
Contact:

Re: [667] Ability to execute script:/// from Blocky

Post 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?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest