PHPackages                             mips/jeedom-tools - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. mips/jeedom-tools

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

mips/jeedom-tools
=================

Jeedom tools for plugin dev

v2.0.1(3mo ago)4721↓20%2MITPHPCI passing

Since Apr 18Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/Mips2648/jeedom-tools)[ Packagist](https://packagist.org/packages/mips/jeedom-tools)[ RSS](/packages/mips-jeedom-tools/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (1)Versions (32)Used By (0)

jeedom-tools
============

[](#jeedom-tools)

Tools and helper class for Jeedom plugin development

[![Tests PHP 7.4](https://github.com/Mips2648/jeedom-tools/actions/workflows/ci.yml/badge.svg)](https://github.com/Mips2648/jeedom-tools/actions/workflows/ci.yml)

How to use it
-------------

[](#how-to-use-it)

The most simple and cleanest way is to use composer: `composer require mips/jeedom-tools`

And then to add the autoloader in your eqLogic file, example:

```
require_once __DIR__ . '/../../vendor/autoload.php';

class pluginTemplate extends eqLogic {
    use MipsEqLogicTrait;
```

Using composer will make easier to upgrade the library if needed (`composer u`)

Alternatively you can add the source as you wish to your plugin, add the `require` statement and make sure to use the trait.

Running eqLogic function asynchronously
---------------------------------------

[](#running-eqlogic-function-asynchronously)

To run a function asynchronously we will use the cron system of Jeedom.

First you need to create a method with this signature that will do the work you want:

```
public static function myMethodAsync($_options) {

}
```

`$_options` is a array of value that you will use to pass arguments to your method, exactly like cron tasks.

To execute your method you need to call the `executeAsync` method:

```
utils::executeAsync(__CLASS__, 'myMethodAsync', array(
    'param1' => 'value1',
    'param2' => 'value2'
));
```

The static function `executeAsync` will simply create a new oneTime cron and run it. There is a third argument `$_date`, which is by default equal to `now`, to which you can pass any English textual datetime description that `strtotime()` can interpret.

> Warning The method `self::executeAsync` from this trait is deprecated, please use `utils::executeAsync(__CLASS__, ...)` from Jeedom core instead; all arguments are exactly the same except that you must provide your class name as first argument. Method from the core is behaving exactly the same way (it's a copy/paste)

Creating eqLogic commands
-------------------------

[](#creating-eqlogic-commands)

The concept is to define commands to use in a json file, with a defined structure then call the method that will create all corresponding commands. I suggest to put this config file in the following folder of your plugin: `/core/config/` and the code snippet below will assume that.

I know it is possible import a json file directly to create commands config put the following give more flexibility and control like ability to assign values only at creation (template &amp; display section), link action &amp; info commands...

The code that actually creates the command has been widely inspired from the one that we can found in some official plugins: I've added some features, made it more generic and put in place a way to share it between all my plugins (this repo) (and maybe yours ;-))

A generic example of json file, below you will see more details information:

```
{
    "node": [
        {
            "logicalId": "refresh",
            "name": "Rafraichir",
            "type": "action",
            "subtype": "other",
            "isVisible": 1
        },
        {
            "logicalId": "cpu",
            "name": "CPU",
            "type": "info",
            "subtype": "numeric",
            "unite": "%",
            "isVisible": 1,
            "isHistorized": 1,
            "configuration": {
                "minValue" : 0,
                "maxValue" : 100
            }
        },
        {
            "logicalId": "maxcpu",
            "name": "Nombre de CPU",
            "type": "info",
            "subtype": "numeric",
            "isVisible": 0,
            "isHistorized": 0,
            "template": {
                "dashboard" : "line",
                "mobile" : "line"
            }
        },
        {
            "logicalId": "start",
            "name": "Démarrer",
            "type": "action",
            "subtype": "other",
            "isVisible": 1,
            "display": {
                "icon": ""
            }
        },
        {
            "logicalId": "pause",
            "name": "Pause",
            "type": "action",
            "subtype": "other",
            "isVisible": 1,
            "display": {
                "icon": ""
            }
        }
  ],
  "lamp": [
        {
            "logicalId": "nightLightOn",
            "name": "Veilleuse On",
            "type": "action",
            "subtype": "other",
            "generic_type": "LIGHT_ON",
            "value": "nightLightState",
            "template": {
                "dashboard" : "light",
                "mobile" : "light"
            }
        },
        {
            "logicalId": "nightLightOff",
            "name": "Veilleuse Off",
            "type": "action",
            "subtype": "other",
            "generic_type": "LIGHT_OFF",
            "value": "nightLightState",
            "template": {
                "dashboard" : "light",
                "mobile" : "light"
            }
        },
        {
            "logicalId": "nightLightState",
            "name": "Veilleuse",
            "type": "info",
            "subtype": "binary",
            "generic_type": "LIGHT_STATE",
            "isVisible": 0,
            "isHistorized": 1,
            "initialValue": 0
        }
  ]
}
```

As you see you can have different set of commands in your file, `node`and `lamp` in the example, and they can be created with following line of code:

```
$eqLogic->createCommandsFromConfigFile(__DIR__ . '/../config/commands.json', 'lamp');
```

Below you will find several concrete case. I create commands of my most complexe plugins using this method, it means that I've encountered a lot of use cases already and the current version should cover all your needs so if you don't achieve something or if something is unclear, you probably know how to find me ;-)

### A state information and 2 actions on &amp; off

[](#a-state-information-and-2-actions-on--off)

You can see in the example below how to assign generic type, default template, command type &amp; subtype.

Please note that the template section is applied on the command only during creation, if the command already exists the function will not replace it to not override a change done by a user of the plugin.

- `value` is used on an action command to link the corresponding info command; the order is not important, the function will take care to link both after having created both.
- `initialValue` is used to assign an initial value to an info command, it might not be needed in this particular example but they are others cases when this is very handy ;-)

```
        {
            "logicalId": "nightLightOn",
            "name": "Veilleuse On",
            "type": "action",
            "subtype": "other",
            "generic_type": "LIGHT_ON",
            "value": "nightLightState",
            "template": {
                "dashboard" : "light",
                "mobile" : "light"
            }
        },
        {
            "logicalId": "nightLightOff",
            "name": "Veilleuse Off",
            "type": "action",
            "subtype": "other",
            "generic_type": "LIGHT_OFF",
            "value": "nightLightState",
            "template": {
                "dashboard" : "light",
                "mobile" : "light"
            }
        },
        {
            "logicalId": "nightLightState",
            "name": "Veilleuse",
            "type": "info",
            "subtype": "binary",
            "generic_type": "LIGHT_STATE",
            "isVisible": 0,
            "isHistorized": 1,
            "initialValue": 0
        }
```

### A slider action command

[](#a-slider-action-command)

The example is self-explanatory

```
        {
            "logicalId": "nightLightBrightness",
            "name": "Etat luminosité",
            "type": "info",
            "subtype": "numeric",
            "generic_type": "LIGHT_BRIGHTNESS",
            "isVisible": 0,
            "isHistorized": 0,
            "initialValue": 0
        },
        {
            "logicalId": "setNightLightBrightness",
            "name": "Luminosité veilleuse",
            "type": "action",
            "subtype": "slider",
            "configuration": {
                "value" : "#slider#",
                "minValue" : 0,
                "maxValue" : 255
            },
            "generic_type": "LIGHT_SLIDER",
            "isVisible": 1,
            "value": "nightLightBrightness"
        }
```

### A select action command (list)

[](#a-select-action-command-list)

```
        {
            "logicalId": "nightLightMode",
            "name": "Etat mode veilleuse",
            "type": "info",
            "subtype": "string",
            "isVisible": 0,
            "isHistorized": 0
        },
        {
            "logicalId": "setNightLightMode",
            "name": "Mode veilleuse",
            "type": "action",
            "subtype": "select",
            "configuration": {
                "listValue": "rgb|Couleur;temperature|Blanc;rainbow|Jeu de lumière"
            },
            "isVisible": 1,
            "value": "nightLightMode"
        }
```

### A color action command

[](#a-color-action-command)

```
{
            "logicalId": "nightLightColor",
            "name": "Etat couleur veilleuse",
            "type": "info",
            "subtype": "string",
            "generic_type": "LIGHT_COLOR",
            "isVisible": 0,
            "isHistorized": 0
        },
        {
            "logicalId": "setNightLightColor",
            "name": "Couleur veilleuse",
            "type": "action",
            "subtype": "color",
            "generic_type": "LIGHT_SET_COLOR",
            "isVisible": 1,
            "value": "nightLightColor"
        }
```

### A message action command

[](#a-message-action-command)

The property in the display section are the one available within Jeedom:

- `title_placeholder`: the custom label of title zone (use in scenario e.g.)
- `message_placeholder`: the custom label of message zone (use in scenario e.g.)
- `title_disable` : 0 if title should be disabled (use in scenario e.g.)
- `message_disable` : 0 if message should be disabled (use in scenario e.g.)
- `message_cmd_type`: "info" or "action", if the zone must be a jeedom command, putting this will automatically create the command selector in scenario
- `message_cmd_subtype`: "numeric" (e.g.)
- `icon`: for example: `` to assign a icon to the command (could be used on any type of command, not only message.

```
        {
            "logicalId": "sendSnapshot",
            "name": "Envoyer une capture",
            "type": "action",
            "subtype": "message",
            "generic_type": "",
            "isVisible": 0,
            "display": {
                "title_placeholder": "Texte (optionnel)",
                "message_placeholder": "Commande d'envoi de la capture",
                "message_cmd_type": "action",
                "message_cmd_subtype": "message"
            }
        }
```

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance79

Regular maintenance activity

Popularity24

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 98% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~73 days

Recently: every ~120 days

Total

30

Last Release

110d ago

Major Versions

v0.24 → v1.02024-08-12

v1.1.1 → v2.0.12026-01-28

### Community

Maintainers

![](https://www.gravatar.com/avatar/56503efd0e9c18e24f3ff31818ff5919f1640e7632f2cf0756215ec73f6f0dbf?d=identicon)[Mips2648](/maintainers/Mips2648)

---

Top Contributors

[![Mips2648](https://avatars.githubusercontent.com/u/41119856?v=4)](https://github.com/Mips2648 "Mips2648 (48 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mips-jeedom-tools/health.svg)

```
[![Health](https://phpackages.com/badges/mips-jeedom-tools/health.svg)](https://phpackages.com/packages/mips-jeedom-tools)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
