Page 1 of 5
Script editor
Posted: Tuesday 20 August 2013 16:35
by theolsen
Here's an idea.
I don't know if it is even possible but it would be uber cool if we had a script editor built into the Domoticz web gui.
Any text (and filename) entered in here could be written directly to the lua folder on the host device.
-theolsen.
Re: Script editor
Posted: Tuesday 20 August 2013 19:29
by bistoury
+1
good idea
Re: Script editor
Posted: Tuesday 20 August 2013 19:38
by pepijn
-1
The eventsystem (Blocky) is designed to create events (lua) scripts for regular users. The scripts are saved in the Domoticz database witch can be backed up through the gui.
Re: Script editor
Posted: Tuesday 20 August 2013 21:24
by Dynamic
+1.
I do not always have SSH-access to my Pi, but the web-interface is always available. Would be great to have a webbased editor. But I think it should be hidden for 'normal' users (checkbox in settings?).
Re: Script editor
Posted: Tuesday 20 August 2013 21:56
by theolsen
Dynamic wrote:+1.
I do not always have SSH-access to my Pi, but the web-interface is always available. Would be great to have a webbased editor. But I think it should be hidden for 'normal' users (checkbox in settings?).
Exactly my reasoning.
Moreover it would enable scripting from a tablet device.
Re: Script editor
Posted: Tuesday 20 August 2013 23:08
by bistoury
I would also add that blocky does not give the same flexibility as LUA.
For instance, and IF/DO/ELSE/DO/END statement embedded into another IF/DO/ELSE/DO/END is not possible in blocky.
So having a web-based LUA editor would be a very welcome new functionality.
so +1.
bistoury.
Re: Script editor
Posted: Tuesday 20 August 2013 23:15
by pepijn
Dynamic wrote:+1.
I do not always have SSH-access to my Pi,
Try installing shellinabox this gives you full web based ssh access. All you need is a webserver running. If you use the Domoticz SD card it comes with nginx installed for secure https access.
Re: Script editor
Posted: Tuesday 20 August 2013 23:52
by simonrg
-1
While I think having a LUA IDE built into Domoticz would be neat and potentially platform independent. I would prefer the skilled programming effort was put into extending / supporting the core capabilities of Domoticz.
Pepijn's suggestion of Shellinabox sounds like a good approach. Even more so having set it and played with it all in 5 minutes.
I would like to suggest a compromise, based on pepijn's suggestion, to include Shellinabox configured on the Domoticz SD card and to explain how to set it up on the Wiki.
In fact using Shellinabox seems to be very easy on Raspberry Pi simply two commands:
Code: Select all
sudo apt-get install shellinabox
shellinaboxd --port=4201 -t -s /:AUTH:HOME:/bin/bash
Now in a web browser
http://192.168.1.111:4201 opens a shell in my web browser which allows me to modify LUA scripts.
This means that Domoticz does the automation it's good at and Shellinabox plus all the command line tools looks after all the security issues etc..
Re: Script editor
Posted: Wednesday 21 August 2013 19:14
by theolsen
Just installed Shellinabox - very nice indeed!
Thanks for the suggestions.
-theolsen.
Re: Script editor
Posted: Thursday 26 June 2014 3:47
by sdh
Sorry for opening an old thread, but it would be great if we could enter the LUA script for the device directly in domoticz, similar to Fibaro HC2.
Re: Script editor
Posted: Thursday 26 June 2014 14:12
by pipersw
+1 for a LUA text editor integrated to Domoticz.
The problem with shellinabox is that it not only allowed to edit text, but also allow ssh command and others stuff.
I prefer to use my own SSH tool for admin commands, and let only a simple text editor integrated in Domoticz for users.
I think it's more secure
for example:
http://foicica.com/textadept/ is a lightweight text editor
Re: Script editor
Posted: Thursday 26 June 2014 21:17
by remb0
I was also thinking about that (when I was @ work where all ports except 80 are blocked)
But the comments in this thread are fair, the mainstrain users and options are more important.
a LUA settings page
script status versie test edit
---------------------------------------------
script1 active 1.0 check edit
script2 disabled 2.0 check edit
script3 active 0.2 check edit
options: upload script globale variables
script editor:
- velden als:
versie,
opmerking
status
- syntax checker (
http://www.lua.org/demo.html)
- testen met test variablen
Re: Script editor
Posted: Monday 21 July 2014 22:23
by commodore white
simonrg wrote:
In fact using Shellinabox seems to be very easy on Raspberry Pi simply two commands:
Code: Select all
sudo apt-get install shellinabox
shellinaboxd --port=4201 -t -s /:AUTH:HOME:/bin/bash
Now in a web browser
http://192.168.1.111:4201 opens a shell in my web browser which allows me to modify LUA scripts.
I mostly use an android tablet to prrewardrd ogram my raspi domoticz so i thought i'd try this.
Everything went well until I typed in my raspi username and password (pi/raspberry) at which point I was rewarded by a Session Closed message.
What might I have forgotten to do?
Re: Script editor
Posted: Wednesday 02 December 2015 16:30
by galadril
+1 would love a script editor within Domoticz
Re: Script editor
Posted: Wednesday 16 December 2015 12:09
by alfred_j_kwak
Maybe this link can go under script editor thread?
In Digital Ocean website there is guide how to use sshfs. It is possible to mount like Domoticz script folder in your programming PC and use it like a local folder.
I use Sublime Text for editing scripts and with sshfs I can edit scripts straight from /domoticz/scripts/ folder.
Link to Digital Ocean page:
https://www.digitalocean.com/community/ ... s-over-ssh
Like so:
Re: Script editor
Posted: Saturday 26 December 2015 10:48
by Dnpwwo
I'm working on putting an editor (see
https://ace.c9.io/#nav=about) into Domoticz that will handle Lua (& Python if enabled). It will have code highlighting and and collapsing.
Should be in the Beta release within a week and will need some testers. It will be backwards compatible with old file based scripts but will store new scripts in the database like Blockly does.
It will look a bit like this:

- Untitled.png (87.4 KiB) Viewed 8282 times
will allow users to choose their langauge and when the scripts will be called (device, time, security or uservariable).
Re: Script editor
Posted: Saturday 26 December 2015 11:15
by jvdz
I wouldn't mind doing testing on LUA scripts, but would like to understand first why you opted to put the scripts into the database in stead of the regular file systems like it is today?
It feels like you are then totally limited to use the internal editor only, which is not something I would want for myself.
Jos
Re: Script editor
Posted: Saturday 26 December 2015 13:28
by remb0
Very nice!! I will test it when released. When de scripts are I the db. It would be great to have extra options like.:
- version
- option to enable/disable
- export to file
- script checker: are variables valid?
Dnpwwo wrote:I'm working on putting an editor (see
https://ace.c9.io/#nav=about) into Domoticz that will handle Lua (& Python if enabled). It will have code highlighting and and collapsing.
Should be in the Beta release within a week and will need some testers. It will be backwards compatible with old file based scripts but will store new scripts in the database like Blockly does.
It will look a bit like this:
Untitled.png
will allow users to choose their langauge and when the scripts will be called (device, time, security or uservariable).
Re: Script editor
Posted: Saturday 26 December 2015 14:13
by Dnpwwo
It will be backwards compatible with old file based scripts
You don't have to use it at all if you don't want to. If you want to develop scripts outside Domoticz you can, then store the final version in the database if you want to.
Enable/disable will work for scripts the same way it does for Blockly currently.
Wasn't going to do an export because you can cut and paste directly in and out of the editor.
Might do syntax checker and 'run now' functionality later but want to get a first version merged
Re: Script editor
Posted: Saturday 26 December 2015 14:25
by tlpeter
I agree on not putting the scripts in the database but in the folder where it belongs.
Otherwise you have two locations where such a script is.
Sometimes i copy the script out, change it and put it back for different kind of reasons.
I do like the effort being put in to this for sure.