Skip to content
Permalink
Browse files

Merge pull request #19 from directman66/alpha

minor updates
  • Loading branch information...
directman66 committed Jul 19, 2019
2 parents 84ddf5c + e041e36 commit 953fe254cc51ab8aab78d995976d8117359f078d
@@ -993,7 +993,7 @@
$par2['type'] = "sensor";
$par2['state_topic'] = "zigbee2mqtt/<FRIENDLY_NAME>";
$par2['availability_topic'] = "zigbee2mqtt/bridge/state";
$par2['unit_of_measurement'] = "°C";
$par2['unit_of_measurement'] = "°C";
$par2['device_class'] = "temperature";
$par2['value_template'] = "temperature";
$par2['json_attributes'] = "" ;
@@ -1092,7 +1092,7 @@
$par2['type'] = "sensor";
$par2['state_topic'] = "zigbee2mqtt/<FRIENDLY_NAME>";
$par2['availability_topic'] = "zigbee2mqtt/bridge/state";
$par2['unit_of_measurement'] = "°C";
$par2['unit_of_measurement'] = "°C";
$par2['device_class'] = "";
$par2['value_template'] = "temperature";
$par2['json_attributes'] = "" ;
@@ -4280,7 +4280,7 @@
$par2['type'] = "sensor";
$par2['state_topic'] = "zigbee2mqtt/<FRIENDLY_NAME>";
$par2['availability_topic'] = "zigbee2mqtt/bridge/state";
$par2['unit_of_measurement'] = "°C";
$par2['unit_of_measurement'] = "°C";
$par2['device_class'] = "temperature";
$par2['value_template'] = "temperature";
$par2['json_attributes'] = "linkquality,battery,voltage";
@@ -5505,7 +5505,7 @@
$par2['type'] = "sensor";
$par2['state_topic'] = "zigbee2mqtt/<FRIENDLY_NAME>";
$par2['availability_topic'] = "zigbee2mqtt/bridge/state";
$par2['unit_of_measurement'] = "°C";
$par2['unit_of_measurement'] = "°C";
$par2['device_class'] = "";
$par2['value_template'] = "temperature";
$par2['json_attributes'] = "";
@@ -7498,7 +7498,7 @@
$par2['type'] = "sensor";
$par2['state_topic'] = "zigbee2mqtt/<FRIENDLY_NAME>";
$par2['availability_topic'] = "zigbee2mqtt/bridge/state";
$par2['unit_of_measurement'] = "°C";
$par2['unit_of_measurement'] = "°C";
$par2['device_class'] = "temperature";
$par2['value_template'] = "temperature";
$par2['json_attributes'] = "" ;
@@ -8251,7 +8251,7 @@
SQLInsert('zigbee2mqtt_devices_command', $par2);
//V3-BTZB;
//GROUP;
$par2['zigbeeModel'] = 'group';
$par2['type'] = "group";
$par2['state_topic'] = "zigbee2mqtt/<FRIENDLY_NAME>";
@@ -8269,6 +8269,42 @@
$par2['command_value'] = "state";
SQLInsert('zigbee2mqtt_devices_command', $par2);
//GROUP;
$par2['zigbeeModel'] = 'group';
$par2['type'] = "group";
$par2['state_topic'] = "zigbee2mqtt/<FRIENDLY_NAME>";
$par2['availability_topic'] = "zigbee2mqtt/bridge/state";
$par2['payload_off'] = "" ;
$par2['payload_on'] = "" ;
$par2['value_template'] = "brightness";
$par2['command_topic'] = "zigbee2mqtt/<FRIENDLY_NAME>/set";
$par2['json_attributes'] = "brightness";
$par2['device_class'] = "";
$par2['unit_of_measurement'] = "";
$par2['brightness'] = "";
$par2['color_temp'] = "";
$par2['xy'] = "";
$par2['command_value'] = "brightness";
SQLInsert('zigbee2mqtt_devices_command', $par2);
//GROUP;
$par2['zigbeeModel'] = 'group';
$par2['type'] = "group";
$par2['state_topic'] = "zigbee2mqtt/<FRIENDLY_NAME>";
$par2['availability_topic'] = "zigbee2mqtt/bridge/state";
$par2['payload_off'] = "" ;
$par2['payload_on'] = "" ;
$par2['value_template'] = "color";
$par2['command_topic'] = "zigbee2mqtt/<FRIENDLY_NAME>/set";
$par2['json_attributes'] = "color";
$par2['device_class'] = "";
$par2['unit_of_measurement'] = "";
$par2['brightness'] = "";
$par2['color_temp'] = "";
$par2['xy'] = "";
$par2['command_value'] = "color";
SQLInsert('zigbee2mqtt_devices_command', $par2);
@@ -180,7 +180,7 @@
// $res=SQLSelect('select zigbee2mqtt_devices.ID DEVID, zigbee2mqtt_devices.*,LOCATION from zigbee2mqtt_devices left join (select ID LOCID, TITLE LOCATION from locations) locations ON zigbee2mqtt_devices.LOCATION_ID=locations.LOCID where TITLE<>"bridge" '.$req_location.' '. $req_type. ' order by FIND DESC' );
$sql='select zigbee2mqtt_devices.ID DEVID, zigbee2mqtt_devices.TYPE , zigbee2mqtt_devices.*,LOCATION from zigbee2mqtt_devices left join (select ID LOCID, TITLE LOCATION from locations) locations ON zigbee2mqtt_devices.LOCATION_ID=locations.LOCID where TITLE<>"bridge" and selecttype<>"cc2531" '.$req_location.' '. $req_type.' '.$req_vendor. ' '.$req_vid. ' '.$req_group. ' order by DATE(FIND) DESC, SELECTVENDOR ';
debmes($sql, 'zigbee2mqtt');
//debmes($sql, 'zigbee2mqtt');
$res=SQLSelect( $sql);
// $res=SQLSelect('select zigbee2mqtt_devices.ID DEVID, zigbee2mqtt_devices.*,LOCATION from zigbee2mqtt_devices left join (select ID LOCID, TITLE LOCATION from locations) locations ON zigbee2mqtt_devices.LOCATION_ID=locations.LOCID where TITLE<>"bridge" order by MANUFACTURE ' );
@@ -333,9 +333,10 @@
if ($basa['model']=='GL-C-008') $res[$i]['COLOR_TEMP']='1';
if ($basa['model']=='GL-C-008') $res[$i]['XY']='1';
if ($basa['model']=='LED1624G9') $res[$i]['XY']='1';
if ($basa['model']=='group') $res[$i]['XY']='1';
if ($basa['model']=='LED1624G9') $res[$i]['COLOR_TEMP']='1';
if ($basa['model']=='ZNLDP12LM') $res[$i]['COLOR_TEMP']='1';
if ($basa['model']=='group') $res[$i]['COLOR_TEMP']='1';
@@ -487,7 +488,7 @@
$sql0='SELECT * FROM zigbee2mqtt_grouplist';
debmes($sql0,'zigbee2mqtt');
//debmes($sql0,'zigbee2mqtt');
$ssql=SQLSelect($sql0);
@@ -500,7 +501,7 @@
$sql0='SELECT * FROM zigbee2mqtt_log order by FIND DESC LIMIT 100';
debmes($sql0,'zigbee2mqtt');
//debmes($sql0,'zigbee2mqtt');
$ssql=SQLSelect($sql0);
@@ -528,7 +529,7 @@
// $sql0='SELECT * FROM (select zigbee2mqtt_devices.ID DEVID, zigbee2mqtt_devices.* from zigbee2mqtt_devices where ID="'.$vm.'" ) zigbee2mqtt_devices LEFT JOIN zigbee2mqtt_devices_list ON zigbee2mqtt_devices_list.zigbeeModel like CONCAT("%",zigbee2mqtt_devices.MODEL,"%") ';
$sql0='SELECT * FROM (select zigbee2mqtt_devices.ID DEVID, zigbee2mqtt_devices.* from zigbee2mqtt_devices where ID="'.$vm.'" ) zigbee2mqtt_devices LEFT JOIN zigbee2mqtt_devices_list ON zigbee2mqtt_devices_list.zigbeeModel like CONCAT("%",zigbee2mqtt_devices.MODELID,"%") ';
debmes($sql0,'zigbee2mqtt');
//debmes($sql0,'zigbee2mqtt');
$ssql=SQLSelectOne($sql0);
@@ -557,7 +558,7 @@
debmes($sql,'zigbee2mqtt');
//debmes($sql,'zigbee2mqtt');
$res=SQLSelect($sql);
@@ -579,7 +580,7 @@
{
//$sql="update zigbee2mqtt set PATH_WRITE='".$res[$i]['command_topic']."/".$res[$i]['value_template']."' where ID='".$res[$i]['zmID']."'";
$sql="update zigbee2mqtt set PATH_WRITE='".$res[$i]['command_topic']."' where ID='".$res[$i]['zmID']."'";
debmes($sql, 'zigbee2mqtt');
//debmes($sql, 'zigbee2mqtt');
SQLExec ($sql);
}
@@ -588,15 +589,15 @@
{
//$sql="update zigbee2mqtt set PATH_WRITE='".$res[$i]['command_topic']."/".$res[$i]['value_template']."' where ID='".$res[$i]['zmID']."'";
$sql="update zigbee2mqtt set PAYLOAD_ON='".$res[$i]['payload_on']."' where ID='".$res[$i]['zmID']."'";
debmes($sql, 'zigbee2mqtt');
//debmes($sql, 'zigbee2mqtt');
SQLExec ($sql);
}
if (($res[$i]['payload_off'])&& (!$res[$i]['PAYLOAD_OFF']))
{
//$sql="update zigbee2mqtt set PATH_WRITE='".$res[$i]['command_topic']."/".$res[$i]['value_template']."' where ID='".$res[$i]['zmID']."'";
$sql="update zigbee2mqtt set PAYLOAD_OFF='".$res[$i]['payload_off']."' where ID='".$res[$i]['zmID']."'";
debmes($sql, 'zigbee2mqtt');
//debmes($sql, 'zigbee2mqtt');
SQLExec ($sql);
}
@@ -605,7 +606,7 @@
{
//$sql="update zigbee2mqtt set PATH_WRITE='".$res[$i]['command_topic']."/".$res[$i]['value_template']."' where ID='".$res[$i]['zmID']."'";
$sql="update zigbee2mqtt set COMMAND_VALUE='".$res[$i]['command_value']."' where ID='".$res[$i]['zmID']."'";
debmes($sql, 'zigbee2mqtt');
//debmes($sql, 'zigbee2mqtt');
SQLExec ($sql);
}
@@ -1796,7 +1796,16 @@ function admin(&$out) {
$this->sendcommand($mqttsendpath, $mqttsendvalue);
$this->redirect("?");
//$this->redirect("?");
$location=$_GET['location'];
$vendor_id=$_GET['vendor_id'];
$type_id=$_GET['type_id'];
$vid_id=$_GET['vid_id'];
$group_list_id=$_GET['group_list_id'];
$this->redirect("?&location=$location&type_id=$type_id&vendor_id=$vendor_id&vid_id=$vid_id&group_list_id=$group_list_id");
}
@@ -1886,11 +1895,11 @@ function admin(&$out) {
switch ($temp)
{
case 'hot':
$itemp=500; break;
case 'deff':
$itemp=255; break;
case 'cold':
case 'hot':
$itemp=500; break;
case 'deff':
$itemp=255; break;
case 'cold':
$itemp=0; break;
}
@@ -1905,7 +1914,16 @@ function admin(&$out) {
$this->sendcommand($mqttsendpath, $mqttsendvalue);
$this->redirect("?");
$location=$_GET['location'];
$vendor_id=$_GET['vendor_id'];
$type_id=$_GET['type_id'];
$vid_id=$_GET['vid_id'];
$group_list_id=$_GET['group_list_id'];
$this->redirect("?&location=$location&type_id=$type_id&vendor_id=$vendor_id&vid_id=$vid_id&group_list_id=$group_list_id");
}
@@ -119,11 +119,15 @@
function procmsg($topic, $msg) {
//$url = BASE_URL . '/ajax/mqtt.html?op=process&topic='.urlencode($topic)."&msg=".urlencode($msg);
//getURLBackground($url);
debmes($topic.":".$msg, 'z2m');
if (!isset($topic) || !isset($msg)) return false;
echo date("Y-m-d H:i:s") . " Topic:{$topic} $msg\n";
if (function_exists('callAPI')) {
callAPI('/api/module/zigbee2mqtt','GET',array('topic'=>$topic,'msg'=>$msg));
// callAPI('/api/module/zigbee2mqtt','GET',array('topic'=>$topic,'msg'=>$msg));
callAPI('/api/module/zigbee2mqtt','POST',array('topic'=>$topic,'msg'=>$msg));
} else {
global $zigbee2mqtt;
$zigbee2mqtt->processMessage($topic, $msg);
@@ -21,23 +21,23 @@


[#if CYCLERUN==1#]
<span class="label label-success" title="Статус цикла"><a href="?view_mode=cycle_start" title="Restart cycle" ><font color="white" >Цикл запущен</span></font></a>
<span class="label label-success" title="Статус цикла"><a href="?view_mode=cycle_start" title="Цикл запущен" ><font color="white" >Цикл</span></font></a>
[#else#]
<span class="label label-danger" title="Статус цикла"><a href="?view_mode=cycle_start" title="Start cycle" ><font color="white" >Цикл остановлен</font></span></a>
<span class="label label-danger" title="Статус цикла"><a href="?view_mode=cycle_start" title="Цико остановлен, нажатие перезапустит" ><font color="white" >Цикл</font></span></a>
[#endif#]

[#if SEEN2==1#]
<span class="label label-success" title="Приложение zigbee2mqtt [#SEEN#]">zigbee2mqtt working</span>
<span class="label label-success" title="Приложение zigbee2mqtt работает [#SEEN#]">zigbee2mqtt</span>
[#else#]
<span class="label label-danger" title="Приложение zigbee2mqtt [#SEEN#]">zigbee2mqtt not working</span>
<span class="label label-danger" title="Приложение zigbee2mqtt не работает [#SEEN#]">zigbee2mqtt</span>
[#endif#]



[#if PERMIT=="1"#]
<span class="label label-success" title="Открыт для сопряжения"> <a href="?view_mode=stoppairing" title="Stop pairing" ><font color="white" > Открыт для сопряжения</font></span></a>
<span class="label label-success" title="Открыт для сопряжения"> <a href="?view_mode=stoppairing" title="Открыт для подключения новых устройств, нажатие переключит режим. " ><font color="white" >Сопряжение</font></span></a>
[#else#]
<span class="label label-danger" title="Закрыт для сопряжения"> <a href="?view_mode=startpairing" title="Start pairing" ><font color="white" >Закрыт для сопряжения</font></span></a>
<span class="label label-danger" title="Закрыт для сопряжения"> <a href="?view_mode=startpairing" title="Закрыт для покдлючения новых устройств, нажатие переключит режим." ><font color="white" >Сопряжение</font></span></a>
[#endif#]


@@ -162,7 +162,11 @@

[#else#]
<span id="mqtt[#ID#]" class="mqtt_value">[#VALUE#]</span>
[#if LINKED_OBJECT!=""#]([#LINKED_OBJECT#].[#LINKED_PROPERTY#])[#endif LINKED_OBJECT#]
[#if LINKED_OBJECT!=""#](
<a href="/panel/linkedobject.html?op=redirect&object=[#LINKED_OBJECT#]&sub=properties" target="_blank">

[#LINKED_OBJECT#].[#LINKED_PROPERTY#]</a>
)[#endif LINKED_OBJECT#]
[#endif#]


@@ -1,69 +1,33 @@


<table width=100% >
<!--<table width=100% > -->
<table align=center class="table table-striped" >
<thead>

<tr>
<th>TOPIK </th>
<th>MESSAGE </th>
<th>ADDED</th>


</tr>
</thead>
<tbody>
<tbody>
[#begin LOG2#]

<td>
[#TITLE#]
</td>
<td>
<span title="Type: [#TYPE#] Topic:[#TITLE#]">[#MESSAGE#] </span>

</td>

<td>[#FIND#] </td>


<!--
<table border =0 width=100%><tr><td>
[#TITLE#]</td>
<td align="left">
[#if POWER_WARNING<>""#]
<span class="label label-[#POWER_WARNING#]"><i class="glyphicon glyphicon-flash"></i> [#BATTERY#]%</span>
[#endif#]
</td></tr></table>
</b>
</a>
-->


<tr>
<td>[#TITLE#]</td>
<td><span title="Type: [#TYPE#] Topic:[#TITLE#]">[#MESSAGE#] </span></td>
<td width="10%">[#FIND#] </td>
</tr>
[#end LOG2#]
</tbody>
</tbody>
</table>
<input type="hidden" name="data_source" value="<#DATA_SOURCE#>">
<input type="hidden" name="view_mode" value="multiple_mqtt">
</form>

<!-- / search results (list) -->
<!-- paging -->
[#if PAGES#]
<table border=0>
<td align=right><b>Pages:</b>&nbsp;</td>
[#begin PREVPAGE#]<td><a href="?view_mode=<#VIEW_MODE#>&mode=<#MODE#>&save_qry=1&page=[#NUM#]">&lt;&lt;&lt;</a></td>[#end PREVPAGE#]
<td>
[#begin PAGES#]
[#if !SELECTED#]<a href="?view_mode=<#VIEW_MODE#>&mode=<#MODE#>&save_qry=1&page=[#NUM#]">[#else#]<b>[#endif#][#NUM#]</b></a>
[#end PAGES#]
</td>
[#begin NEXTPAGE#]<td><a href="?view_mode=<#VIEW_MODE#>&mode=<#MODE#>&save_qry=1&page=[#NUM#]">&gt;&gt;&gt;</a></td>[#end NEXTPAGE#]
</table>
[#endif PAGES#]

<!-- / paging -->

[#endif DEVICES#]


<a href="?view_mode=clearlog" class="btn btn-default">Очистить</a>
<!-- / results -->

0 comments on commit 953fe25

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