Improve force update logic in MQTT publishing to handle child variables and links more effectively
This commit is contained in:
@@ -216,9 +216,11 @@ class MonitoringClient extends IPSModule {
|
|||||||
|
|
||||||
$parname = IPS_GetName($catChild);
|
$parname = IPS_GetName($catChild);
|
||||||
|
|
||||||
|
if (IPS_VariableExists($catChild) != 1 && IPS_LinkExists($catChild) != 1){
|
||||||
|
|
||||||
foreach ($childids as $childid){
|
foreach ($childids as $childid){
|
||||||
|
|
||||||
if (IPS_VariableExists($childid) != 1 && IPS_LinkExists($childid) != 1){
|
|
||||||
|
|
||||||
foreach ($childids as $childid){
|
foreach ($childids as $childid){
|
||||||
if (IPS_VariableExists($childid) != 1){
|
if (IPS_VariableExists($childid) != 1){
|
||||||
@@ -240,7 +242,10 @@ class MonitoringClient extends IPSModule {
|
|||||||
IPS_LogMessage("Monitoring Client", "Force Update with Parent: " . $topic . " mit Payload: " . $payload);
|
IPS_LogMessage("Monitoring Client", "Force Update with Parent: " . $topic . " mit Payload: " . $payload);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
|
$childid = $catChild;
|
||||||
if (IPS_VariableExists($childid) != 1){
|
if (IPS_VariableExists($childid) != 1){
|
||||||
|
|
||||||
if(IPS_LinkExists($childid) == 1){
|
if(IPS_LinkExists($childid) == 1){
|
||||||
@@ -262,8 +267,6 @@ class MonitoringClient extends IPSModule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
$topic = "Projekte". $projectyear."/".$projectnumber. "/ISP" .$ispnumber. "/Name";
|
$topic = "Projekte". $projectyear."/".$projectnumber. "/ISP" .$ispnumber. "/Name";
|
||||||
$this->MqttPublish($this->InstanceID,$mqttId, $topic, $projectname, false);
|
$this->MqttPublish($this->InstanceID,$mqttId, $topic, $projectname, false);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user