Skip to content

Commit

Permalink
Merge pull request #146 from Jeedom-Zigate/develop
Browse files Browse the repository at this point in the history
v1.2.3
  • Loading branch information
doudz authored Feb 25, 2019
2 parents 912fd11 + a3b473e commit 887cd1d
Show file tree
Hide file tree
Showing 20 changed files with 53 additions and 43 deletions.
26 changes: 19 additions & 7 deletions core/class/zigate.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public static function syncDevice($device)
}

$eqLogic->setStatus('lastCommunication', $device['info']['last_seen']);
$eqLogic->setStatus('rssi', $device['info']['rssi']);
$eqLogic->setStatus('lqi', $device['info']['lqi']);
$eqLogic->save();
$eqLogic->createCommands($device);

Expand Down Expand Up @@ -275,15 +275,18 @@ public function createCommands($device)
array_push($created_commands, $key);
break;
case 'level':
$key = $this->_create_action($endpoint_id, $action, 'level', 'slider');
$key = $this->_create_action($endpoint_id, $action, 'level', 'slider', [0, 100]);
array_push($created_commands, $key);

$key = $this->_create_action($endpoint_id, 'stop', 'stop', 'other');
array_push($created_commands, $key);
break;
case 'color':
$key = $this->_create_action($endpoint_id, $action, 'color', 'color');
array_push($created_commands, $key);
break;
case 'temperature':
$key = $this->_create_action($endpoint_id, $action, 'temperature', 'slider');
$key = $this->_create_action($endpoint_id, $action, 'temperature', 'slider', [1700, 6500]);
array_push($created_commands, $key);
break;
case 'hue':
Expand Down Expand Up @@ -457,7 +460,7 @@ public function _create_action($endpoint_id, $action, $name, $subtype, $value =
{
log::add('zigate', 'debug', 'create action '.$action.' for endpoint '.$endpoint_id);
$key = $this->getLogicalId().'.'.$endpoint_id.'.'.$action;
if (!is_null($value)) {
if (!is_null($value) and $subtype != 'slider') {
$key = $key.'.'.$value;
}

Expand All @@ -476,7 +479,12 @@ public function _create_action($endpoint_id, $action, $name, $subtype, $value =
$cmd_action->setConfiguration('action', $action);

if (!is_null($value)) {
$cmd_action->setConfiguration('value', $value);
if ($subtype == 'slider') {
$cmd_action->setConfiguration('minValue', $value[0]);
$cmd_action->setConfiguration('maxValue', $value[1]);
} else {
$cmd_action->setConfiguration('value', $value);
}
}
$cmd_action->save();

Expand Down Expand Up @@ -683,6 +691,7 @@ public function getImage()
{
$filename = $this->getConfiguration('type') . '.jpg';
$filename = str_replace(' ', '_', $filename);
$filename = str_replace('/', '_', $filename);
$path = dirname(__FILE__). '/../../images/'. $filename;
if (file_exists($path)) {
return 'plugins/zigate/images/' . $filename;
Expand Down Expand Up @@ -877,6 +886,10 @@ public function execute($_options = [])
}
zigate::CallZiGate('action_move_level_onoff', [$addr, $endpoint, $onoff, $value]);
break;

case 'stop':
zigate::CallZiGate('action_move_stop_onoff', [$addr, $endpoint]);
break;

case 'lock':
zigate::CallZiGate('action_lock', [$addr, $endpoint, $value]);
Expand All @@ -888,8 +901,7 @@ public function execute($_options = [])

case 'temperature':
// min 1700 max 6500
$value = intval(($value*(6500-1700)/100)+1700);
zigate::CallZiGate('action_move_temperature', [$addr, $endpoint, $value]);
zigate::CallZiGate('action_move_temperature_kelvin', [$addr, $endpoint, $value]);
break;

case 'hue':
Expand Down
2 changes: 1 addition & 1 deletion core/php/jeeZiGate.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
$attribute = $results['attribute'];
$eqLogic->update_command($attribute['endpoint'], $attribute['cluster'], $attribute);
$eqLogic->setStatus('lastCommunication', $device['info']['last_seen']);
$eqLogic->setStatus('rssi', $device['info']['rssi']);
$eqLogic->setStatus('lqi', $device['info']['lqi']);
}
}
} elseif ($action == 'ZIGATE_FAILED_TO_CONNECT') {
Expand Down
22 changes: 11 additions & 11 deletions desktop/modal/health.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<th>{{Module}}</th>
<th>{{ID}}</th>
<th>{{Modèle}}</th>
<th>{{Rssi}}</th>
<th>{{LQI}}</th>
<th>{{Statut}}</th>
<th>{{Batterie}}</th>
<th>{{Dernière communication}}</th>
Expand All @@ -49,17 +49,17 @@
'" style="' . $opacity . '">' . $eqLogic->getHumanName(true) . '</a></td>';
echo '<td><span class="label label-info" style="font-size : 1em; cursor : default;' . $opacity . '">' . $eqLogic->getId() . '</span></td>';
echo '<td><span class="label label-info" style="font-size : 1em; cursor : default;' . $opacity . '">' . $eqLogic->getConfiguration('type') . '</span></td>';
$rssi_status = '<span class="label label-success" style="font-size : 1em;' . $opacity . '">{{OK}}</span>';
if ($eqLogic->getConfiguration('rssi') < 50 && $eqLogic->getConfiguration('rssi') != '') {
$rssi_status = '<span class="label label-danger" style="font-size : 1em;' . $opacity . '">' . $eqLogic->getConfiguration('rssi') . '</span>';
} elseif ($eqLogic->getConfiguration('rssi') < 100 && $eqLogic->getConfiguration('rssi') != '') {
$rssi_status = '<span class="label label-warning" style="font-size : 1em;' . $opacity . '">' . $eqLogic->getConfiguration('rssi') . '</span>';
} elseif ($eqLogic->getConfiguration('rssi') >= 100 && $eqLogic->getConfiguration('rssi') != '') {
$rssi_status = '<span class="label label-success" style="font-size : 1em;' . $opacity . '">' . $eqLogic->getConfiguration('rssi') . '</span>';
$lqi_status = '<span class="label label-success" style="font-size : 1em;' . $opacity . '">{{OK}}</span>';
if ($eqLogic->getConfiguration('lqi') < 50 && $eqLogic->getConfiguration('lqi') != '') {
$lqi_status = '<span class="label label-danger" style="font-size : 1em;' . $opacity . '">' . $eqLogic->getConfiguration('lqi') . '</span>';
} elseif ($eqLogic->getConfiguration('lqi') < 100 && $eqLogic->getConfiguration('lqi') != '') {
$lqi_status = '<span class="label label-warning" style="font-size : 1em;' . $opacity . '">' . $eqLogic->getConfiguration('lqi') . '</span>';
} elseif ($eqLogic->getConfiguration('lqi') >= 100 && $eqLogic->getConfiguration('lqi') != '') {
$lqi_status = '<span class="label label-success" style="font-size : 1em;' . $opacity . '">' . $eqLogic->getConfiguration('lqi') . '</span>';
} else {
$rssi_status = '<span class="label label-primary" style="font-size : 1em;' . $opacity . '">' . $eqLogic->getConfiguration('rssi') . '</span>';
$lqi_status = '<span class="label label-primary" style="font-size : 1em;' . $opacity . '">' . $eqLogic->getConfiguration('lqi') . '</span>';
}
echo '<td>' . $rssi_status . '</td>';
echo '<td>' . $lqi_status . '</td>';
$status = '<span class="label label-success" style="font-size : 1em; cursor : default;' . $opacity . '">{{OK}}</span>';
if ($eqLogic->getStatus('state') == 'nok') {
$status = '<span class="label label-danger" style="font-size : 1em; cursor : default;' . $opacity . '">{{NOK}}</span>';
Expand All @@ -84,4 +84,4 @@
}
?>
</tbody>
</table>
</table>
2 changes: 1 addition & 1 deletion desktop/php/zigate.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@
<div class="form-group">
<label class="col-sm-3 control-label">{{Link quality (1-255)}}</label>
<div class="col-sm-3">
<input type="text" class="eqLogicAttr form-control" data-l1key="configuration" data-l2key="rssi" placeholder="0" readonly=true/>
<input type="text" class="eqLogicAttr form-control" data-l1key="configuration" data-l2key="lqi" placeholder="0" readonly=true/>
</div>
</div>
<div class="form-group">
Expand Down
Binary file added images/LIGHTIFY_Outdoor_Flex_RGBW.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/LLC020.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/LST001.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/LTW007.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/RB_278_T.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/TRADFRI_Driver_10W.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/TRADFRI_bulb_E14_W_op_ch_400lm.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/TRADFRI_bulb_E27_WS_opal_1000lm.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/TRADFRI_control_outlet.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/TRADFRI_motion_sensor.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/TRADFRI_transformer_10W.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/TRADFRI_transformer_30W.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/lumi.light.aqcn02.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 20 additions & 20 deletions plugin_info/info.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"id": "zigate",
"name": "ZiGate",
"description": "Plugin zigate pour utilisation de la zigate",
"licence": "MIT License",
"author": "Sébastien RAMAGE",
"require": "3.0",
"category": "automation protocol",
"hasDependency": true,
"hasOwnDeamon": true,
"maxDependancyInstallTime": 30,
"link": {
"forum": "https://www.jeedom.com/forum/viewtopic.php?f=133&t=34490"
},
"changelog": "https://jeedom-zigate.github.io/jeedom-plugin-zigate/fr_FR/changelog",
"documentation": "https://jeedom-zigate.github.io/jeedom-plugin-zigate",
"language": ["fr_FR", "en_US"],
"compatibility": ["Jeedomboard", "RPI/RPI2", "Docker", "DIY"],
"pluginVersion": "1.2.2"
}
{
"id": "zigate",
"name": "ZiGate",
"description": "Plugin zigate pour utilisation de la zigate",
"licence": "MIT License",
"author": "Sébastien RAMAGE",
"require": "3.0",
"category": "automation protocol",
"hasDependency": true,
"hasOwnDeamon": true,
"maxDependancyInstallTime": 30,
"link": {
"forum": "https://www.jeedom.com/forum/viewtopic.php?f=133&t=34490"
},
"changelog": "https://jeedom-zigate.github.io/jeedom-plugin-zigate/fr_FR/changelog",
"documentation": "https://jeedom-zigate.github.io/jeedom-plugin-zigate",
"language": ["fr_FR", "en_US"],
"compatibility": ["Jeedomboard", "RPI/RPI2", "Docker", "DIY"],
"pluginVersion": "1.2.3"
}
2 changes: 1 addition & 1 deletion resources/zigate_version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.27.9
0.28.2
2 changes: 0 additions & 2 deletions resources/zigated/zigated.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,6 @@ def sharedata():
if os.path.exists(key_file):
with open(key_file, 'r') as fp:
key = fp.read()
if key == '3d5c898817b211e88b59080027ca08a3': # banned key
key = ''
if not key:
key = uuid.uuid1().hex
with open(key_file, 'w') as fp:
Expand Down

0 comments on commit 887cd1d

Please sign in to comment.