Skip to content

Commit

Permalink
Merge pull request #231 from jeedom-zigate/beta
Browse files Browse the repository at this point in the history
v1.5.0
  • Loading branch information
doudz authored Nov 27, 2019
2 parents c60e956 + e30b6cf commit e35c5a8
Show file tree
Hide file tree
Showing 14 changed files with 594 additions and 73 deletions.
2 changes: 2 additions & 0 deletions 3rdparty/vivagraph/vivagraph.min.js

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,20 @@ Retrouvez le sur le Market Jeedom [ici](https://www.jeedom.com/market/index.php?
## Forum

Lien vers le forum [ici](https://www.jeedom.com/forum/viewtopic.php?f=133&t=34490).

# How to contribute

If you are looking to make a contribution to this project we suggest that you follow the steps in these guides:
- https://github.com/firstcontributions/first-contributions/blob/master/README.md
- https://github.com/firstcontributions/first-contributions/blob/master/github-desktop-tutorial.md

Some developers might also be interested in receiving donations in the form of hardware such as Zigbee modules or devices, and even if such donations are most often donated with no strings attached it could in many cases help the developers motivation and indirect improve the development of this project.

# Comment contribuer

Si vous souhaitez apporter une contribution à ce projet, nous vous suggérons de suivre les étapes décrites dans ces guides:
- https://github.com/firstcontributions/first-contributions/blob/master/README.md
- https://github.com/firstcontributions/first-contributions/blob/master/github-desktop-tutorial.md

Certains développeurs pourraient également être intéressés par des dons sous forme de matériel, tels que des modules ou des dispositifs Zigbee, et même si ces dons sont le plus souvent donnés sans aucune condition, cela pourrait dans de nombreux cas motiver les développeurs et indirectement améliorer le développement de ce projet.

142 changes: 92 additions & 50 deletions core/class/zigate.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public static function syncDevice($device)
$eqLogic->setEqType_name('zigate');
$eqLogic->setIsEnable(1);
$eqLogic->setLogicalId($ieee);
$eqLogic->setName('Device ' . $ieee . '(' . $addr . ')');
$eqLogic->setName('Device ' . $ieee . ' (' . $addr . ')');
$eqLogic->setIsVisible(1);
$eqLogic->save();
$eqLogic = self::byId($eqLogic->getId());
Expand Down Expand Up @@ -307,6 +307,26 @@ public function createCommands($device)

$key = $this->_create_action($endpoint_id, $action, 'stop', 'other', 2);
array_push($created_commands, $key);
break;
case 'ias':
$key = $this->_create_action($endpoint_id, 'ias_off', 'off', 'other', 0);
array_push($created_commands, $key);

$key = $this->_create_action($endpoint_id, 'ias_warning', 'buzzer_2sec', 'other', 2);
array_push($created_commands, $key);

$key = $this->_create_action($endpoint_id, 'ias_warning', 'buzzer_5sec', 'other', 5);
array_push($created_commands, $key);

$key = $this->_create_action($endpoint_id, 'ias_warning', 'buzzer_10sec', 'other', 10);
array_push($created_commands, $key);

$key = $this->_create_action($endpoint_id, 'ias_squawk', 'strobe_ON', 'other', 139);
array_push($created_commands, $key);

$key = $this->_create_action($endpoint_id, 'ias_squawk', 'strobe_ON_Buzzer_ON', 'other', 11);
array_push($created_commands, $key);

break;
}
}
Expand Down Expand Up @@ -379,8 +399,14 @@ public function _create_command($endpoint_id, $cluster_id, $attribute)

$cmd_info = $this->getCmd(null, $key);
if (!is_object($cmd_info)) {
log::add('zigate', 'debug', 'Command doesn\'t exist, create it');
$cmd_info = new zigateCmd();
$cmd_info->setLogicalId($key);
$cmd_info->setConfiguration('addr', $this->getConfiguration('addr'));
$cmd_info->setConfiguration('ieee', $this->getLogicalId());
$cmd_info->setConfiguration('endpoint', $endpoint_id);
$cmd_info->setConfiguration('cluster', $cluster_id);
$cmd_info->setConfiguration('attribute', $attribute_id);
$cmd_info->setType('info');
$cmd_info->setEqLogic_id($this->getId());
$cmd_info->setIsHistorized(0);
Expand All @@ -399,71 +425,75 @@ public function _create_command($endpoint_id, $cluster_id, $attribute)
if (isset($attribute['unit'])) {
$cmd_info->setUnite($attribute['unit']);
}
}

if (isset($attribute['name'])) {
$cmd_info->setConfiguration('property', $name);
if ($cluster_id < 5) {
$this->setConfiguration($name, $attribute['value']);
// rename device to add type in name if not renamed
if ($name == 'type' && $attribute['value'] && $this->getName() == 'Device ' . $this->getLogicalId()) {
$this->setName('Device ' . $this->getLogicalId(). ' '.$attribute['value']);
if (isset($attribute['name'])) {
$cmd_info->setConfiguration('property', $name);
if ($cluster_id < 5) {
$this->setConfiguration($name, $attribute['value']);
}
$this->save();
}
}

$cmd_info->setConfiguration('addr', $this->getConfiguration('addr'));
$cmd_info->setConfiguration('ieee', $this->getLogicalId());
$cmd_info->setConfiguration('endpoint', $endpoint_id);
$cmd_info->setConfiguration('cluster', $cluster_id);
$cmd_info->setConfiguration('attribute', $attribute_id);

switch (gettype($value)) {
case 'boolean':
$cmd_info->setSubType('binary');
break;
case 'integer':
$cmd_info->setSubType('numeric');
if ($name == 'current_level') {
$cmd_info->setConfiguration('minValue', 0);
$cmd_info->setConfiguration('maxValue', 100);
}
if ($name == 'current_hue') {
$cmd_info->setConfiguration('minValue', 0);
$cmd_info->setConfiguration('maxValue', 360);
}
if ($name == 'current_saturation') {
$cmd_info->setConfiguration('minValue', 0);
$cmd_info->setConfiguration('maxValue', 100);
}
if ($name == 'colour_temperature') {
$cmd_info->setConfiguration('minValue', 153);
$cmd_info->setConfiguration('maxValue', 500);
}
break;
case 'double':
$cmd_info->setSubType('numeric');
break;
default:
$cmd_info->setSubType('string');
break;
}
$cmd_info->save();
}

// rename device to add type in name if not renamed
if ($name == 'type' && $attribute['value'] && $this->getName() == 'Device ' . $this->ieee() . ' (' . $this->addr() . ')') {
$this->setName($this->getConfiguration('manufacturer').' '.$attribute['value'].' ('.$this->addr().') '.$this->ieee());
}
$this->save();

if ($name == 'battery' or $name == 'battery_voltage') {
$this->evaluateBattery($value);
} elseif ($name == 'battery_percent') {
$this->batteryStatus($value);
}


switch (gettype($value)) {
case 'boolean':
$cmd_info->setSubType('binary');
break;
case 'integer':
$cmd_info->setSubType('numeric');
if ($name == 'current_level') {
$cmd_info->setConfiguration('minValue', 0);
$cmd_info->setConfiguration('maxValue', 100);
}
if ($name == 'current_hue') {
$cmd_info->setConfiguration('minValue', 0);
$cmd_info->setConfiguration('maxValue', 360);
}
if ($name == 'current_saturation') {
$cmd_info->setConfiguration('minValue', 0);
$cmd_info->setConfiguration('maxValue', 100);
}
if ($name == 'colour_temperature') {
$cmd_info->setConfiguration('minValue', 153);
$cmd_info->setConfiguration('maxValue', 500);
}
break;
case 'double':
$cmd_info->setSubType('numeric');
break;
default:
$cmd_info->setSubType('string');
break;
}

$cmd_info->save();
if ($value != $cmd_info->getCache('value', '')) {
$cmd_info->event($value);
}

return $key;
}

public function ieee()
{
return $this->getConfiguration('ieee');
}

public function addr()
{
return $this->getConfiguration('addr');
}

/**
* Create an action.
Expand Down Expand Up @@ -628,6 +658,7 @@ public static function deamon_start($_debug = false)
$port = config::byKey('port', 'zigate');
$host = config::byKey('host', 'zigate');
$gpio = config::byKey('gpio', 'zigate');
$enable_led = config::byKey('enable_led', 'zigate');
$channel = config::byKey('channel', 'zigate');
$sharedata = config::byKey('sharedata', 'zigate');
$zigate_path = dirname(__FILE__) . '/../../resources';
Expand All @@ -646,6 +677,7 @@ public static function deamon_start($_debug = false)
$cmd .= ' --socket ' . jeedom::getTmpFolder('zigate') . '/daemon.sock';
$cmd .= ' --callback ' . $callback;
$cmd .= ' --sharedata ' . $sharedata;
$cmd .= ' --enable_led ' . $enable_led;
if ($channel) {
$cmd .= ' --channel ' . $channel;
}
Expand Down Expand Up @@ -934,6 +966,16 @@ public function execute($_options = [])
case 'refresh':
zigate::callZiGate('refresh_device', [$addr]);
break;

case 'ias_warning':
zigate::CallZiGate('action_ias_warning', [$addr, $endpoint, 0x18, $value, 1, 1 ]);
break;
case 'ias_off':
zigate::CallZiGate('action_ias_warning', [$addr, $endpoint, 0, 0, 0, 0 ]);
break;
case 'ias_squawk':
zigate::CallZiGate('action_ias_squawk', [$addr, $endpoint, $value ]);
break;
}
}
}
46 changes: 40 additions & 6 deletions core/i18n/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,8 @@
"TouchLink": "TouchLink",
"Configuration": "Setup",
"Scan réseau": "Network Scan",
"Synchroniser": "Synchronize",
"Nettoyer": "Clean",
"Redémarrage Zigate": "Restart Zigate",
"Effacement Zigate": "Erase Zigate",
"Terminal": "Terminal",
"Réseau Zigate": "Zigate Network",
"Santé": "Health",
"Mes équipements ZiGate": "My Zigate devices",
"Sauvegarder": "Save",
Expand All @@ -52,7 +49,7 @@
"Type": "Type",
"Constructeur": "Manufacturer",
"IEEE": "IEEE",
"Qualité du lien (1-255)": "Link quality (1-255)",
"Qualité du lien LQI (1-255)": "Link quality LQI (1-255)",
"Alimentation (0=Batterie, 1=Secteur)": "Power Source (0=Battery, 1=AC Power)",
"Batterie (%)": "Battery (%)",
"Nom": "Name",
Expand Down Expand Up @@ -82,7 +79,7 @@
"Tester": "Test",
"Etes-vous sûr de vouloir effacer les équipements manquants ?": "Are you sure you want to delete the missing devices ?",
"Etes-vous sûr de vouloir effacer les données de la zigate ?": "Are you sure you want to erase the data from the zigate ?",
"Veuillez d\\'abord sélectionner un": "Please first select a",
"Veuillez d\\'abord sélectionner un objet": "Please first select a object",
"Commande envoyée": "Command sent",
"Mode inclusion lancé pour 30sec.": "Include mode for 30sec.",
"Reset de la clé ZiGate.": "Reset Zigate key",
Expand Down Expand Up @@ -111,5 +108,42 @@
"Envoyer": "Send",
"Résultat": "Result",
"Commande envoyée": "Command sent"
},
"plugins/zigate/desktop/js/network.js": {
"Etes-vous sûr de vouloir effacer les équipements manquants ?": "Are you sure you want to delete the missing devices ?",
"Etes-vous sûr de vouloir effacer les données de la zigate ?": "Are you sure you want to erase the data from the zigate ?",
"voisin(s)": "neighbor(s)"
},
"plugins/zigate/desktop/modal/network.php": {
" Demon actif": " Daemon running",
" Demon non actif : ": "Daemon not running : ",
"Résumé": "Resume",
"Actions": "Actions",
"Graphique du réseau": "Network graphic",
"Arbre Zigate": "Zigate tree",
"Réseau démarré le": "Network started since",
"Le réseau Jeedom contient": "Jeedom network has",
"Le réseau Zigate contient": "Zigate network has",
"noeuds, actuellement": "nodes, actually",
"Etat": "State",
"Etat actuel :": "Actual state",
"Système": "System",
"Chemin du contrôleur Zigate :": "Zigate controler port :",
"Version du firmware Zigate :": "Zigate firmware version :",
"Version de la librairie Zigate :": "Zigate library version :",
"Scan réseau": "Network Scan",
"Lancement d’un scan du réseau ZigBee. Peut résoudre des problèmes d’association, mais pour l’instant l’impact est inconnu.": "Zigbee network scan. Can solve association problems, but for the moment the impact is unknown.",
"Synchroniser": "Synchronize",
"Synchronise les informations du plugin avec les informations réelles du réseau ZigBee.": "Synchronize plugin information with real ZigBee network information.",
"Nettoyer": "Clean",
"Supprime les équipements fantômes.": "Remove ghost devices",
"Redémarrage Zigate": "Restart Zigate",
"équivalent à un débranchement/rebranchement de la ZiGate. Cette commande ne supprime aucune donnée.": "Like plug/unplug Zigate key",
"Effacement Zigate": "Erase Zigate",
"Remise à zéro du contrôleur.": "Reset to factory the controller.",
"Légende": "Legend",
"Coordinateur Zigbee": "Zigbee Coordinator",
"Routeur Zigbee (FFD)": "Zigbee router (FFD)",
"Terminal Zigbee (RFD)": "Zigbee Terminal (RFD)"
}
}
Loading

0 comments on commit e35c5a8

Please sign in to comment.