Scripting in blockly possible ??
Moderator: leecollings
-
rick8245
- Posts: 74
- Joined: Wednesday 22 April 2020 15:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Scripting in blockly possible ??
Is is possible to add a script (bash, sh, or python) in Blockly ??
I have a good running python script and I want to embed it into blockly.
Is that possible ? if so How do I do that ??
Thanks in advance .
// Rick
I have a good running python script and I want to embed it into blockly.
Is that possible ? if so How do I do that ??
Thanks in advance .
// Rick
-
AllesVanZelf
- Posts: 265
- Joined: Monday 05 February 2018 8:42
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 12467
- Location: Netherlands, near Haarlem
- Contact:
Re: Scripting in blockly possible ??
You could make a dummy switch and trigger the bash script in there from the 'on action' line as: script://run-script.sh and save this script in the domoticz/scripts folder.
I symlink this script files to my own /home/pi/bin/ folder.
I symlink this script files to my own /home/pi/bin/ folder.
Domoticz 2020.1 (12230) on Raspberry Pi 3B with Raspian Buster. Besides Domoticz, Rpi is running Pi-Hole.
-
rick8245
- Posts: 74
- Joined: Wednesday 22 April 2020 15:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Scripting in blockly possible ??
Hi AllesvanZelf.
Thanks for your reply
Where do i find the ' On Action' item ?
Is that at Events ??
Thanks for your reply
Where do i find the ' On Action' item ?
Is that at Events ??
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Scripting in blockly possible ??
There's a "start script" action in Blockly. No need for a dummy switch.
-
rick8245
- Posts: 74
- Joined: Wednesday 22 April 2020 15:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Scripting in blockly possible ??
Ok I found it.
I have this in the line: python /home/pi/domoticz/scripts/python/hcsr501.py
No further parameters.
Can I see if it works ??
The Domoticz log does not give any messages on this
I have this in the line: python /home/pi/domoticz/scripts/python/hcsr501.py
No further parameters.
Can I see if it works ??
The Domoticz log does not give any messages on this
-
AllesVanZelf
- Posts: 265
- Joined: Monday 05 February 2018 8:42
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 12467
- Location: Netherlands, near Haarlem
- Contact:
Re: Scripting in blockly possible ??
Egregius wrote: Wednesday 29 April 2020 13:24 There's a "start script" action in Blockly. No need for a dummy switch.
Domoticz 2020.1 (12230) on Raspberry Pi 3B with Raspian Buster. Besides Domoticz, Rpi is running Pi-Hole.
-
AllesVanZelf
- Posts: 265
- Joined: Monday 05 February 2018 8:42
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 12467
- Location: Netherlands, near Haarlem
- Contact:
Re: Scripting in blockly possible ??
I would put this python command in a bash script, like: hcsr501.shrick8245 wrote: Wednesday 29 April 2020 13:32 I have this in the line: python /home/pi/domoticz/scripts/python/hcsr501.py
No further parameters.
Can I see if it works ??
The Domoticz log does not give any messages on this
Code: Select all
#!/bin/sh
python /home/pi/domoticz/scripts/python/hcsr501.py
Domoticz 2020.1 (12230) on Raspberry Pi 3B with Raspian Buster. Besides Domoticz, Rpi is running Pi-Hole.
-
rick8245
- Posts: 74
- Joined: Wednesday 22 April 2020 15:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Scripting in blockly possible ??
Can i embed pictures inhere?
In the DO of the If DO construction.
I will put the export here.
<xml xmlns="http://www.w3.org/1999/xhtml"><block type="domoticzcontrols_if" id="qxqq~F1V^#22G~YDf,a6" x="16" y="10"><value name="IF0"><block type="logic_compare" id="aJeFzXRT$j@8lS7/7-H/"><field name="OP">EQ</field><value name="A"><block type="switchvariablesMR" id="Tzo+#Up2HGqdIZ[{yoJO"><field name="Switch">34</field></block></value><value name="B"><block type="logic_states" id="DbIG8h~*%2Z?cU6E[G{;"><field name="State">On</field></block></value></block></value><statement name="DO0"><block type="start_script" id="Fg2T`pJNGo.RylX^h:N)"><field name="TextPath">python /home/pi/domoticz/scripts/python/hcsr501.py > /home/pi/domoticz/scripts/python/hcsrc501.log</field><field name="TextParam"></field></block></statement></block></xml>
In the DO of the If DO construction.
I will put the export here.
<xml xmlns="http://www.w3.org/1999/xhtml"><block type="domoticzcontrols_if" id="qxqq~F1V^#22G~YDf,a6" x="16" y="10"><value name="IF0"><block type="logic_compare" id="aJeFzXRT$j@8lS7/7-H/"><field name="OP">EQ</field><value name="A"><block type="switchvariablesMR" id="Tzo+#Up2HGqdIZ[{yoJO"><field name="Switch">34</field></block></value><value name="B"><block type="logic_states" id="DbIG8h~*%2Z?cU6E[G{;"><field name="State">On</field></block></value></block></value><statement name="DO0"><block type="start_script" id="Fg2T`pJNGo.RylX^h:N)"><field name="TextPath">python /home/pi/domoticz/scripts/python/hcsr501.py > /home/pi/domoticz/scripts/python/hcsrc501.log</field><field name="TextParam"></field></block></statement></block></xml>
-
AllesVanZelf
- Posts: 265
- Joined: Monday 05 February 2018 8:42
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 12467
- Location: Netherlands, near Haarlem
- Contact:
Re: Scripting in blockly possible ??
Ohhh under messages. That is a logical place to put the start script 
Never found that one
You can place an image via an external service like: imgur
then get share link and the BBcode one.
Never found that one
You can place an image via an external service like: imgur
then get share link and the BBcode one.
Domoticz 2020.1 (12230) on Raspberry Pi 3B with Raspian Buster. Besides Domoticz, Rpi is running Pi-Hole.
-
rick8245
- Posts: 74
- Joined: Wednesday 22 April 2020 15:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Scripting in blockly possible ??
I cannot find another location with START SCRIPT
-
AllesVanZelf
- Posts: 265
- Joined: Monday 05 February 2018 8:42
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 12467
- Location: Netherlands, near Haarlem
- Contact:
Re: Scripting in blockly possible ??
In the created dummy switch.rick8245 wrote: Wednesday 29 April 2020 13:17 Where do i find the ' On Action' item ?
Is that at Events ??

Domoticz 2020.1 (12230) on Raspberry Pi 3B with Raspian Buster. Besides Domoticz, Rpi is running Pi-Hole.
-
rick8245
- Posts: 74
- Joined: Wednesday 22 April 2020 15:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Scripting in blockly possible ??
It looks i have another interfce than you have.
I am running Domoticz on a raspberry.
I am running Domoticz on a raspberry.
-
rick8245
- Posts: 74
- Joined: Wednesday 22 April 2020 15:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Scripting in blockly possible ??
found it
-
AllesVanZelf
- Posts: 265
- Joined: Monday 05 February 2018 8:42
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 12467
- Location: Netherlands, near Haarlem
- Contact:
Re: Scripting in blockly possible ??
No it is the same. The page I show is from the switches tab and edit the dummy switch.
Domoticz 2020.1 (12230) on Raspberry Pi 3B with Raspian Buster. Besides Domoticz, Rpi is running Pi-Hole.
-
rick8245
- Posts: 74
- Joined: Wednesday 22 April 2020 15:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Scripting in blockly possible ??
Thanks AllesvnZelf. It works
Who is online
Users browsing this forum: No registered users and 1 guest