Share My Creation Domoticz Scripts Viewer Tool

Domoticz Scripts Viewer Tool

upload_2018-10-26_10-51-17.png


Objectives
  • To view and save the Domoticz (Open Source Home Automation System) automation scripts stored in the Domoticz SQLite database on the remote server (i.e. Raspberry Pi 3B+).
  • To locally backup the remote Domoticz database.
Tool Functionality
  • List all automation scripts (events) from the database and view the code.
  • Save a selected script to a text file.
  • Save all scripts to a text file.
  • Text file name: script name with extension depending interpreter.
  • File Extensions: Python=py,dzVents=lua,Lua=lua,Blockly=xml. These are set using a map.
  • Filter scripts using where clause, i.e. WHERE Interpreter = "dzVents".
  • Refresh the database by downloading from the Domoticz server to the application folder.
  • The refresh option can also be used to backup the Domoticz database.

B4J Source Code
Attached
Requires the jSch library which can be found here.
Created with B4J 6.51, tested with Java 1.8.0_191 running on Windows 10

B4J Development Notes
Some notes regarding functionality created.

ToolBar: a button toolbar with fontawesome icons is dynamically created from a JSON array with ordered list of values.
The values describe a button, which uses properties tag,icon,hint. Example: {"tag":"close","icon":"F00D","hint":"Close app"}.
The tag is used to execute the button event, i.e. close_action.

Settings: settings are defined in a map and maintained by a settings dialog.
The dialog contains a customized listview, which is created from a settingsmap and a, semicolon delimited, string for setting the order of listview items.
Each listview item contains an EditText view.

Refresh: The database, domoticz.db, is refreshed by downloading using methods (Initialize, downloadfile) from the jsch library with wait for event completed.

Filter: Scripts can be filtered using SQL where clause. The clause is defined by an InputDialog.

ToastMessage: A, Android like, ToastMessage class is created to show messages with short (2s) or long duration (3.5s).

DBUtils module is used to load the content of the SQLite table EventsMaster.
 

Attachments

  • scriptsviewer.zip
    20.6 KB · Views: 365
Top