[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.
void
Posts: 32
Joined: Wednesday 04 November 2015 11:26
Target OS: Raspberry Pi
Domoticz version:
Contact:

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

Post by void » Saturday 26 December 2015 19:20

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: 117
Joined: Thursday 06 March 2014 19:30
Target OS: Raspberry Pi
Domoticz version:
Contact:

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

Post by Ritmeester » Friday 01 July 2016 15:20

+10
Absolute a good idea.

Muyz
Posts: 5
Joined: Tuesday 19 July 2016 8:51
Target OS: Raspberry Pi
Domoticz version:
Contact:

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

Post by Muyz » Wednesday 27 July 2016 16:47

+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: 127
Joined: Tuesday 03 November 2015 6:07
Target OS: Linux
Domoticz version: beta
Contact:

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

Post by raym » Thursday 28 July 2016 4:54

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: 8602
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi
Domoticz version: beta
Location: Top of the world
Contact:

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

Post by gizmocuz » Sunday 07 August 2016 13:06

Implemented in beta #5437
BlocklyScript.PNG
BlocklyScript.PNG (12.05 KiB) Viewed 4320 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: 77
Joined: Sunday 14 June 2015 13:22
Target OS: Raspberry Pi
Domoticz version: stable
Location: Netherlands
Contact:

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

Post by fransiefrans » Sunday 07 August 2016 13:15

Sounds good! I will try this tonight. Thanks

User avatar
gizmocuz
Posts: 8602
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi
Domoticz version: beta
Location: Top of the world
Contact:

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

Post by gizmocuz » Sunday 07 August 2016 13:16

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: 8602
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi
Domoticz version: beta
Location: Top of the world
Contact:

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

Post by gizmocuz » Tuesday 09 August 2016 15:23

Is it working ?
Quality outlives Quantity!

fransiefrans
Posts: 77
Joined: Sunday 14 June 2015 13:22
Target OS: Raspberry Pi
Domoticz version: stable
Location: Netherlands
Contact:

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

Post by fransiefrans » Wednesday 10 August 2016 1:42

I'm unable to update to the latest beta version. After 2% it says error internet connection.

bearded
Posts: 13
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 » Saturday 13 August 2016 15:00

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
Domoticz version:
Contact:

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

Post by Muyz » Saturday 13 August 2016 23:59

Great! Now I will move from stable to latest greatest :)

jonazp
Posts: 2
Joined: Wednesday 17 August 2016 12:17
Target OS: Raspberry Pi
Domoticz version:
Contact:

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

Post by jonazp » Wednesday 17 August 2016 12:20

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 4159 times

bearded
Posts: 13
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 » Friday 19 August 2016 7:12

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
Domoticz version:
Contact:

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

Post by jonazp » Friday 26 August 2016 10:49

Cant get it to work

User avatar
heggink
Posts: 455
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi
Domoticz version: V3.9530
Location: NL
Contact:

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

Post by heggink » Sunday 02 October 2016 12:39

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
Pi3, latest beta
RFXCOM, z-wave (AEOTEC, switches, temhum, pir, contacts),
Plugwise2py, P1 'smart'meter & solar panel
Alexa, Wifi Cams motion detection
ESP: relays, PIR & Temp/TempHum
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest

mikkel75
Posts: 32
Joined: Thursday 08 December 2016 21:50
Target OS: Linux
Domoticz version:
Contact:

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

Post by mikkel75 » Tuesday 17 January 2017 11:25

I see the exact same - I'll try the workaround and report back.... Thanks...
(I'm on x86_64 Ubuntu 16.04)

mikkel75
Posts: 32
Joined: Thursday 08 December 2016 21:50
Target OS: Linux
Domoticz version:
Contact:

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

Post by mikkel75 » Thursday 19 January 2017 13:09

The space workaround works - but why is there a tailing '#' when the script is called?

sjoerd1953
Posts: 6
Joined: Monday 09 January 2017 10:42
Target OS: Raspberry Pi
Domoticz version: V3.5877
Location: Swolgen
Contact:

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

Post by sjoerd1953 » Friday 30 June 2017 12:11

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 2827 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 2827 times
Sjoerd van Staveren

Domoticz running on a Raspberry Pi 3; Milight RGBW and Dual White bulbs.

Oxyandy
Posts: 2
Joined: Thursday 22 February 2018 9:47
Target OS: Windows
Domoticz version:
Contact:

Run local batch file Windows

Post by Oxyandy » Thursday 22 February 2018 9:54

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 1297 times

htilly
Posts: 9
Joined: Saturday 09 January 2016 23:05
Target OS: Raspberry Pi
Domoticz version:
Contact:

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

Post by htilly » Tuesday 27 February 2018 21:17

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 13: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: Ries and 4 guests