Skip to content
Permalink
Browse files

Update zigbee2mqtt.class.php

  • Loading branch information...
directman66 committed Jun 3, 2019
1 parent ac3d572 commit 52615d216ceb705e24cc28cc40f2b3b27bc2d28e
Showing with 84 additions and 7 deletions.
  1. +84 −7 modules/zigbee2mqtt/zigbee2mqtt.class.php
@@ -459,8 +459,32 @@ function setPropertyDevice($id, $value, $set_linked=0) {
*/
if (($value=="device_on_left")&&(strpos($rec[$i]['METRIKA'],"tate")>0)) $json=array( $rec[$i]['COMMAND_VALUE']=> $rec[$i]['PAYLOAD_ON']);
if (($value=="device_off_left")&&(strpos($rec[$i]['METRIKA'],"tate")>0)) $json=array( $rec[$i]['COMMAND_VALUE']=> $rec[$i]['PAYLOAD_OFF']);
if (($value=="device_on_single")&&(strpos($rec[$i]['METRIKA'],"tate")>0)) $json=array( $rec[$i]['COMMAND_VALUE']=> $rec[$i]['PAYLOAD_ON']);
if (($value=="device_off_single")&&(strpos($rec[$i]['METRIKA'],"tate")>0)) $json=array( $rec[$i]['COMMAND_VALUE']=> $rec[$i]['PAYLOAD_OFF']);
if (($value=="device_on_l1")&&(strpos($rec[$i]['METRIKA'],"tate")>0)&&(strpos($rec[$i]['PATH_WRITE'],'l1')>0)) $json=array( $rec[$i]['COMMAND_VALUE']=> $rec[$i]['PAYLOAD_ON']);
if (($value=="device_off_l1")&&(strpos($rec[$i]['METRIKA'],"tate")>0)&&(strpos($rec[$i]['PATH_WRITE'],'l1')>0)) $json=array( $rec[$i]['COMMAND_VALUE']=> $rec[$i]['PAYLOAD_OFF']);
if (($value=="device_on_l2")&&(strpos($rec[$i]['METRIKA'],"tate")>0)&&(strpos($rec[$i]['PATH_WRITE'],'l2')>0)) $json=array( $rec[$i]['COMMAND_VALUE']=> $rec[$i]['PAYLOAD_ON']);
if (($value=="device_off_l2")&&(strpos($rec[$i]['METRIKA'],"tate")>0)&&(strpos($rec[$i]['PATH_WRITE'],'l2')>0)) $json=array( $rec[$i]['COMMAND_VALUE']=> $rec[$i]['PAYLOAD_OFF']);
if (($value=="device_on_l3")&&(strpos($rec[$i]['METRIKA'],"tate")>0)&&(strpos($rec[$i]['PATH_WRITE'],'l3')>0)) $json=array( $rec[$i]['COMMAND_VALUE']=> $rec[$i]['PAYLOAD_ON']);
if (($value=="device_off_l3")&&(strpos($rec[$i]['METRIKA'],"tate")>0)&&(strpos($rec[$i]['PATH_WRITE'],'l3')>0)) $json=array( $rec[$i]['COMMAND_VALUE']=> $rec[$i]['PAYLOAD_OFF']);
if (($value=="device_on_l4")&&(strpos($rec[$i]['METRIKA'],"tate")>0)&&(strpos($rec[$i]['PATH_WRITE'],'l4')>0)) $json=array( $rec[$i]['COMMAND_VALUE']=> $rec[$i]['PAYLOAD_ON']);
if (($value=="device_off_l4")&&(strpos($rec[$i]['METRIKA'],"tate")>0)&&(strpos($rec[$i]['PATH_WRITE'],'l4')>0)) $json=array( $rec[$i]['COMMAND_VALUE']=> $rec[$i]['PAYLOAD_OFF']);
if (($value=="device_on_left")&&(strpos($rec[$i]['METRIKA'],"tate")>0)&&(strpos($rec[$i]['PATH_WRITE'],'left')>0)) $json=array( $rec[$i]['COMMAND_VALUE']=> $rec[$i]['PAYLOAD_ON']);
if (($value=="device_off_left")&&(strpos($rec[$i]['METRIKA'],"tate")>0)&&(strpos($rec[$i]['PATH_WRITE'],'left')>0)) $json=array( $rec[$i]['COMMAND_VALUE']=> $rec[$i]['PAYLOAD_OFF']);
if (($value=="device_on_right")&&(strpos($rec[$i]['METRIKA'],"tate")>0) &&(strpos($rec[$i]['PATH_WRITE'],'right')>0)) $json=array( $rec[$i]['COMMAND_VALUE']=> $rec[$i]['PAYLOAD_ON']);
if (($value=="device_off_right")&&(strpos($rec[$i]['METRIKA'],"tate")>0) &&(strpos($rec[$i]['PATH_WRITE'],'right')>0)) $json=array( $rec[$i]['COMMAND_VALUE']=> $rec[$i]['PAYLOAD_OFF']);
@@ -1612,10 +1636,12 @@ function admin(&$out) {
$cstate=SQLSelectOne('select * from zigbee2mqtt_devices where ID='.$id)['STATE'];
if ($cstate=="0") { $this->setPropertyDevice($id, 'device_on_left'); $this->setPropertyDevice($id, 'device_on_right'); }
if ($cstate=="0") {
$this->setPropertyDevice($id, 'device_on_single');
}
else
{ $this->setPropertyDevice($id, 'device_off_left');
$this->setPropertyDevice($id, 'device_off_right');
{ $this->setPropertyDevice($id, 'device_off_single');
}
@@ -1630,15 +1656,15 @@ function admin(&$out) {
$id=$this->id;
// $this->setProperty($mqtt_properties[$i]['ID'], $value);
if (ZMQTT_DEBUG=="1" ) debmes('!!!!!!!device_on','zigbee2mqtt');
$this->setPropertyDevice($id, 'device_on_left');
$this->setPropertyDevice($id, 'device_on_single');
$this->redirect("?");
}
if ($this->view_mode=='device_off') {
$id=$this->id;
if (ZMQTT_DEBUG=="1" ) debmes('!!!!!!!device_off','zigbee2mqtt');
// $this->setProperty($mqtt_properties[$i]['ID'], $value);
$this->setPropertyDevice($id, 'device_off_left');
$this->setPropertyDevice($id, 'device_off_single');
$this->redirect("?");
}
@@ -1650,6 +1676,57 @@ function admin(&$out) {
$this->redirect("?");
}
if ($this->view_mode=='device_on_left') {
$id=$this->id;
// $this->setProperty($mqtt_properties[$i]['ID'], $value);
if (ZMQTT_DEBUG=="1" ) debmes('!!!!!!!device_on_left','zigbee2mqtt');
$this->setPropertyDevice($id, 'device_on_left');
$this->redirect("?");
}
if ($this->view_mode=='device_on_l1') {
$id=$this->id;
// $this->setProperty($mqtt_properties[$i]['ID'], $value);
if (ZMQTT_DEBUG=="1" ) debmes('!!!!!!!device_on_l1','zigbee2mqtt');
$this->setPropertyDevice($id, 'device_on_l1');
$this->redirect("?");
}
if ($this->view_mode=='device_off_l1') {
$id=$this->id;
// $this->setProperty($mqtt_properties[$i]['ID'], $value);
if (ZMQTT_DEBUG=="1" ) debmes('!!!!!!!device_off_l1','zigbee2mqtt');
$this->setPropertyDevice($id, 'device_off_l1');
$this->redirect("?");
}
if ($this->view_mode=='device_on_l2') {
$id=$this->id;
// $this->setProperty($mqtt_properties[$i]['ID'], $value);
if (ZMQTT_DEBUG=="1" ) debmes('!!!!!!!device_on_l2','zigbee2mqtt');
$this->setPropertyDevice($id, 'device_on_l2');
$this->redirect("?");
}
if ($this->view_mode=='device_off_l2') {
$id=$this->id;
// $this->setProperty($mqtt_properties[$i]['ID'], $value);
if (ZMQTT_DEBUG=="1" ) debmes('!!!!!!!device_off_l2','zigbee2mqtt');
$this->setPropertyDevice($id, 'device_off_l2');
$this->redirect("?");
}
if ($this->view_mode=='device_off_left') {
$id=$this->id;
// $this->setProperty($mqtt_properties[$i]['ID'], $value);
if (ZMQTT_DEBUG=="1" ) debmes('!!!!!!!device_off_left','zigbee2mqtt');
$this->setPropertyDevice($id, 'device_off_left');
$this->redirect("?");
}
if ($this->view_mode=='device_off_right') {
$id=$this->id;
if (ZMQTT_DEBUG=="1" ) debmes('!!!!!!!device_off','zigbee2mqtt');

0 comments on commit 52615d2

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