Permalink
Browse files

Update zigbee2mqtt.class.php

  • Loading branch information...
directman66 committed Jan 12, 2019
1 parent bca083f commit a24aa5a9df32fd3689fe6e5dc12b04fae8efdafd
Showing with 5 additions and 11 deletions.
  1. +5 −11 modules/zigbee2mqtt/zigbee2mqtt.class.php
@@ -233,22 +233,16 @@ function setProperty($id, $value, $set_linked=0) {
}
$json=array( $rec['METRIKA']=> $value);
$jsonvalue=json_encode($json) ;
debmes('Публикую zigbee2mqqtt '.$rec['PATH'].":".$jsonvalue, 'zigbee2mqtt');
debmes('Публикую zigbee2mqqtt '.$rec['PATH_WRITE'].":".$jsonvalue, 'zigbee2mqtt');
if ($rec['PATH_WRITE']) {
if (preg_match('/^http:/',$rec['PATH_WRITE'])) {
$url=$rec['PATH_WRITE'];
$url=str_replace('%VALUE%',$value,$url);
getURL($url,0);
} else {
$mqtt_client->publish($rec['PATH_WRITE'],$value, (int)$rec['QOS'], (int)$rec['RETAIN']);
}
} else {
$mqtt_client->publish($rec['PATH'],$jsonvalue, (int)$rec['QOS'], (int)$rec['RETAIN']);
$mqtt_client->publish($rec['PATH_WRITE'],$jsonvalue, (int)$rec['QOS'], (int)$rec['RETAIN']);
}
// else { $mqtt_client->publish($rec['PATH'],$jsonvalue, (int)$rec['QOS'], (int)$rec['RETAIN']); }
$mqtt_client->close();
/*

0 comments on commit a24aa5a

Please sign in to comment.