Script editor Topic is solved
Moderators: leecollings, remb0
Script editor
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.
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
+1
good idea
good idea
-
- Posts: 251
- Joined: Friday 12 July 2013 13:19
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: The Netherlands
- Contact:
Re: Script editor
-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.
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.
- Dynamic
- Posts: 109
- Joined: Friday 12 July 2013 14:50
- Target OS: -
- Domoticz version:
- Location: Enschede
- Contact:
Re: Script editor
+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?).
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
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
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.
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.
-
- Posts: 251
- Joined: Friday 12 July 2013 13:19
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: The Netherlands
- Contact:
Re: Script editor
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.Dynamic wrote:+1.
I do not always have SSH-access to my Pi,
-
- Posts: 329
- Joined: Tuesday 16 July 2013 22:54
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.8807
- Location: North East England
- Contact:
Re: Script editor
-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:
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..
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
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..
Raspberry Pi 2 B - 2A@5V PSU - Raspbian + Domoticz + RFXtrx(89), LightwaveRF House(dimmers, sockets, wireless/mood switches), Owl CM113, 4 LaCross Temp / Humidity Sensors, 4 Siemens PIR, Smappee, Solaredge, ESP8266
Re: Script editor
Just installed Shellinabox - very nice indeed!
Thanks for the suggestions.
-theolsen.
Thanks for the suggestions.
-theolsen.
-
- Posts: 4
- Joined: Tuesday 25 March 2014 3:43
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Script editor
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.
- pipersw
- Posts: 5
- Joined: Thursday 29 May 2014 17:47
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: France
- Contact:
Re: Script editor
+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
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
Domoticz server : Raspberry + RFXCOM433 USB + Razberry
Server : Windows Home Server 2011
Weather : Oregon temperature sensor + Weather Underground
Energy: OWL119
3x plug Chacon DIO
1x Fibaro FDG-211
1x Fibaro FGWPE-101
1x Karotz with OpenKarotz firmware
Server : Windows Home Server 2011
Weather : Oregon temperature sensor + Weather Underground
Energy: OWL119
3x plug Chacon DIO
1x Fibaro FDG-211
1x Fibaro FGWPE-101
1x Karotz with OpenKarotz firmware
- remb0
- Posts: 499
- Joined: Thursday 11 July 2013 22:21
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: The Netherlands
- Contact:
Re: Script editor
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
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
-
- Posts: 63
- Joined: Sunday 14 July 2013 11:19
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Ipswich, UK
- Contact:
Re: Script editor
I mostly use an android tablet to prrewardrd ogram my raspi domoticz so i thought i'd try this.simonrg wrote:
In fact using Shellinabox seems to be very easy on Raspberry Pi simply two commands: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.Code: Select all
sudo apt-get install shellinabox shellinaboxd --port=4201 -t -s /:AUTH:HOME:/bin/bash
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?
- galadril
- Posts: 828
- Joined: Monday 07 September 2015 10:32
- Target OS: Raspberry Pi / ODroid
- Domoticz version: latest
- Contact:
Re: Script editor
+1 would love a script editor within Domoticz
Solar panels of Ginlong, Omnik-Solar, Transenergy or Solarman?? Try my Android app:
https://play.google.com/store/apps/deta ... ongmonitor
https://play.google.com/store/apps/deta ... ongmonitor
-
- Posts: 110
- Joined: Friday 20 September 2013 18:49
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2.3530
- Location: Finland
- Contact:
Re: Script editor
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:
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:
- Attachments
-
- Sublime.png (25.1 KiB) Viewed 8328 times
- Dnpwwo
- Posts: 820
- Joined: Sunday 23 March 2014 9:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Melbourne, Australia
- Contact:
Re: Script editor
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: will allow users to choose their langauge and when the scripts will be called (device, time, security or uservariable).
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: will allow users to choose their langauge and when the scripts will be called (device, time, security or uservariable).
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
- jvdz
- Posts: 2269
- Joined: Tuesday 30 December 2014 19:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.107
- Location: Netherlands
- Contact:
Re: Script editor
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
It feels like you are then totally limited to use the internal editor only, which is not something I would want for myself.
Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
- remb0
- Posts: 499
- Joined: Thursday 11 July 2013 22:21
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: The Netherlands
- Contact:
Re: Script editor
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?
- 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: will allow users to choose their langauge and when the scripts will be called (device, time, security or uservariable).
- Dnpwwo
- Posts: 820
- Joined: Sunday 23 March 2014 9:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Melbourne, Australia
- Contact:
Re: Script editor
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.It will be backwards compatible with old file based scripts
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
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
-
- Posts: 191
- Joined: Wednesday 26 November 2014 18:43
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Script editor
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.
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.
Who is online
Users browsing this forum: No registered users and 0 guests