a lot of bugs corrected\nrdc_wc_eclairage
This commit is contained in:
@ -1,10 +1,11 @@
|
||||
<?php
|
||||
//TODO to test and debug
|
||||
$topics["linky2mqtt"] = new topic;
|
||||
$devices["linky2mqtt"] = array();
|
||||
var_dump($topics);
|
||||
if (!array_key_exists("linky2mqtt", $topics)) $topics["linky2mqtt"] = new topic;
|
||||
if (!array_key_exists("linky2mqtt", $devices)) $devices["linky2mqtt"] = array();
|
||||
|
||||
|
||||
$topics["linky2mqtt"]->callback = function($topic, $message)
|
||||
function linky2mqttCallback($topic, $message)
|
||||
{
|
||||
global $topics, $logFh, $devices, $included;
|
||||
$topicName = $topic[0];
|
||||
@ -20,8 +21,9 @@ $topics["linky2mqtt"]->callback = function($topic, $message)
|
||||
$device["device"]->friendlyName = $payloadArray["friendly_name"];
|
||||
$device["device"]->ieeeAddress = $payloadArray["ieeeAddress"];
|
||||
$device["device"]->type = $payloadArray["type"];
|
||||
$indexDevices[$device["device"]->ieeeAddress] = & $device["device"];
|
||||
$indexFriendlyNames[$topicName][$fn] = & $device["device"];
|
||||
//$indexDevices[$device["device"]->ieeeAddress] = & $device["device"];
|
||||
//$indexFriendlyNames[$topicName][$fn] = & $device["device"];
|
||||
mkIndexes();
|
||||
}else
|
||||
{
|
||||
$device = &$device[$fn];
|
||||
@ -34,4 +36,5 @@ $topics["linky2mqtt"]->callback = function($topic, $message)
|
||||
changeDevice($topicName, $friendlyName, $device["device"], $payloadArray);
|
||||
//print_r($device["device"]);
|
||||
}
|
||||
$topics["linky2mqtt"]->callback = "linky2mqttCallback";
|
||||
?>
|
||||
|
@ -1,9 +1,8 @@
|
||||
<?php
|
||||
$topics["pws2mqtt"] = new topic;
|
||||
$devices["pws2mqtt"] = array();
|
||||
if (!array_key_exists("pws2mqtt", $topics)) $topics["pws2mqtt"] = new topic;
|
||||
if (!array_key_exists("pws2mqtt", $devices)) $devices["pws2mqtt"] = array();
|
||||
|
||||
|
||||
$topics["pws2mqtt"]->callback = function($topic, $message)
|
||||
function pws2mqttCallback($topic, $message)
|
||||
{
|
||||
global $logFh, $devices, $included;
|
||||
$topicName = $topic[0];
|
||||
@ -21,8 +20,10 @@ $topics["pws2mqtt"]->callback = function($topic, $message)
|
||||
$device["device"]->ieeeAddress = $payloadArray["ieeeAddress"];
|
||||
$device["device"]->type = $payloadArray["type"];
|
||||
$device["device"]->topic = $topicName;
|
||||
$indexDevices[$device["device"]->ieeeAddress] = & $device["device"];
|
||||
$indexFriendlyNames[$topicName][$fn] = & $device["device"];
|
||||
//$indexDevices[$device["device"]->ieeeAddress] = & $device["device"];
|
||||
//$indexFriendlyNames[$topicName][$fn] = & $device["device"];
|
||||
mkIndexes();
|
||||
|
||||
}else
|
||||
{
|
||||
$device = &$device[$fn];
|
||||
@ -54,5 +55,16 @@ $topics["pws2mqtt"]->callback = function($topic, $message)
|
||||
{
|
||||
changeDevice($topicName, $fn, $device["device"], $payloadArray);
|
||||
}
|
||||
};
|
||||
$topics["pws2mqtt"]->callback = "pws2mqttCallback";
|
||||
|
||||
if (!is_callable("pws2mqttGetList"))
|
||||
{
|
||||
function pws2mqttGetList()
|
||||
{
|
||||
publish("pws2mqtt", array("",""), "get" );
|
||||
}
|
||||
}
|
||||
|
||||
pws2mqttGetList();
|
||||
?>
|
||||
|
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
$topics["zigbee2mqtt"] = new topic;
|
||||
$devices["zigbee2mqtt"] = array();
|
||||
if (!array_key_exists("zigbee2mqtt", $topics)) $topics["zigbee2mqtt"] = new topic;
|
||||
if (!array_key_exists("zigbee2mqtt", $devices)) $devices["zigbee2mqtt"] = array();
|
||||
|
||||
$topics["zigbee2mqtt"]->callback = function($topic, $message)
|
||||
function zigbee2mqttCallback($topic, $message)
|
||||
{
|
||||
global $topics, $devices, $included, $logFh, $indexFriendlyNames;
|
||||
|
||||
@ -85,5 +85,6 @@ $topics["zigbee2mqtt"]->callback = function($topic, $message)
|
||||
}
|
||||
};
|
||||
|
||||
$topics["zigbee2mqtt"]->callback = "zigbee2mqttCallback";
|
||||
|
||||
?>
|
||||
|
Reference in New Issue
Block a user