Skip to content
Permalink
Browse files

Update zigbee2mqtt.class.php

  • Loading branch information...
directman66 committed Apr 27, 2019
1 parent 5142069 commit afbc8c83048f6533a88a70d2c7784a7ebfb02510
Showing with 12 additions and 5 deletions.
  1. +12 −5 modules/zigbee2mqtt/zigbee2mqtt.class.php
@@ -594,7 +594,7 @@ function processMessage($path, $value) {
}
//добавляем в справочник устройств zigbee2mqtt_devices
/* Search 'PATH' in database (db) */
@@ -641,7 +641,7 @@ function processMessage($path, $value) {
$rec['IEEEADDR']=$dev_title;
$rec['FIND']=date('Y-m-d H:i:s');
if ($dev_title=='bridge222' ){
if ($dev_title=='bridge' ){
debmes('это шлюз',zigbee2mqtt);
$cnt=SQLSelectOne("SELECT count(*) cnt FROM zigbee2mqtt_devices WHERE TITLE ='bridge'")['cnt'];
@@ -659,7 +659,9 @@ function processMessage($path, $value) {
$rec['TITLE']=$dev_title;
$rec['IEEEADDR']=$dev_title;
$rec['FIND']=date('Y-m-d H:i:s');
SQLInsert('zigbee2mqtt_devices', $rec);
//if ($rec['TITLE']=='bridge') { $rec['IEEEADDR']='bridge2';}
print_r($rec);
SQLInsert('zigbee2mqtt_devices', $rec);
@@ -678,6 +680,8 @@ function processMessage($path, $value) {
}
//добавляем в справочник топиков zigbee2mqtt
// $dev_id=SQLSelectOne("SELECT * FROM zigbee2mqtt_devices WHERE TITLE LIKE '%".DBSafe($dev_title)."%'")['ID'];
$sql="SELECT * FROM zigbee2mqtt_devices WHERE IEEEADDR LIKE '%".DBSafe($dev_title)."%'";
debmes($sql, 'zigbee2mqtt');
@@ -1818,6 +1822,9 @@ function parse_deviceinfo($ar) {
$cdev=$json[$i]->{'ieeeAddr'};
if ($cdev){
debmes('cdev:'.$cdev, 'zigbee2mqtt');
$sql="SELECT * FROM zigbee2mqtt_devices where IEEEADDR='".$cdev."'";
debmes($sql, 'zigbee2mqtt');
@@ -1866,12 +1873,12 @@ function parse_deviceinfo($ar) {
$res2['TITLE']=$res2['IEEEADDR'];
debmes($res2, 'zigbee2mqtt');
if (($res2['TITLE'])&&($res2['TYPE']!='Coordinator')&&($res2['TITLE']!='bridge'))
if (($res2['TITLE'])&&($res2['TYPE']!='Coordinator')&&($res2['TITLE']!='bridge')&&($res2['TYPE']!='bridge') )
SQLInsert('zigbee2mqtt_devices', $res2);
}
if ($res2['TYPE']=='Coordinator') SQLExec ('update zigbee2mqtt_devices set SELECTVENDOR="Texas Instruments", SELECTTYPE="cc2531", IEEEADDR="'.$res2['IEEEADDR'].'" where TITLE="bridge"', $res2);
if ($res2['TYPE']=='Coordinator') SQLExec ('update zigbee2mqtt_devices set MANUFNAME="parse_deviceinfo", SELECTVENDOR="Texas Instruments", SELECTTYPE="cc2531", IEEEADDR="'.$res2['IEEEADDR'].'" where TITLE="bridge"', $res2);
}

0 comments on commit afbc8c8

Please sign in to comment.
You can’t perform that action at this time.