-
Notifications
You must be signed in to change notification settings - Fork 3
Dev Tips Jeedom Plugin
[FR] [How-To: Développement d'un Plugin Jeedom]
Let's say the **root **directory for a new Jeedom plugin is into
plugins/{name} that means for us plugins/lgthinq and every files and paths on this page are relative to this 'plugin root dir'.
the absolute path should be something like /var/www/html/plugins/{name}/
The main class that is the entry point for jeedom is, from the plugin root dir:
./core/class/{name}.class.php
./core/class/lgthinq.class.php
This class contains both the lgthinq extends eqLogic for each object, and also the lgthinqCmd extends cmd for each commands of the object.
The HTML Form commands for configuration are into the template in ./desktop/modal/include.php
The HTML Form call ajax action located in the ./core/ajax/lgthinq.ajax.php, may include also core class if required.
The main page is the first one you get when opening the plugin, it usually contains the list of every configured objects, and also one - or more - link(s) to the Configuration Form.
This page also contains the tabs for editing / configuring any object, the first panel for activate / rename / change the parent relationship, and so on... The second panel for adding / deleting / editing any command and information.
Main page is /desktop/{name}.php
Using both Visual Studio Code extensions : multi command (from @ryuta46) and command runner (from @edonet) I can add a 'multi-command' triggered on 'Ctrl+s' shortkey (when saving file) that copy the file to another directory:
Create a new 'multi command' named copyFile : adjust the destination as needed. This command save the file, wait 2 seconds, and copy to another location.
"multiCommand.commands": [
{
"command": "multiCommand.copyFile",
"label": "Copy file to another location",
"description": "copy the current $file to another root hard-coded destination, require 'command-runner' plugin.",
"interval": 2,
"sequence": [
"workbench.action.files.save",
{
"command": "command-runner.run",
"args": { "command": "cp \"${file}\" \"x:/${relativeFile}\"" }
}
]
}
]
Trigger the previously defined copyFile multicommand on 'Ctrl+s'
[
{
"key": "ctrl+s",
"command": "extension.multiCommand.execute",
"args": {
"command": "multiCommand.copyFile"
},
"when": "editorTextFocus"
}
]