Add logging for cache category and source variable checks in MqttSync method

This commit is contained in:
jhartworks
2026-04-22 12:56:14 +02:00
parent 1cd8bb5547
commit 1bb10e2bc7
+9 -2
View File
@@ -127,19 +127,24 @@ class MonitoringClient extends IPSModule {
$cacheCat = $this->ReadPropertyInteger("ParseSetpointCacheCategoryID"); $cacheCat = $this->ReadPropertyInteger("ParseSetpointCacheCategoryID");
if ($cacheCat == 0){ if ($cacheCat == 0){
IPS_LogMessage("Monitoring Client", "No Cache Category defined for Setpoint Sync. Please define a Cache Category to use this feature.");
return false; return false;
} }
if (IPS_CategoryExists($cacheCat) == false){ if (IPS_CategoryExists($cacheCat) == false){
IPS_LogMessage("Monitoring Client", "Cache Category does not exist for Setpoint Sync.");
return false; return false;
} }
if (IPS_VariableExists($source) == false){ if (IPS_VariableExists($source) == false){
IPS_LogMessage("Monitoring Client", "Source variable does not exist for Setpoint Sync.");
return false; return false;
} }
// ensure server instance exists // ensure server instance exists
if(!IPS_InstanceExists($server_id)) { if(!IPS_InstanceExists($server_id)) {
IPS_LogMessage("Monitoring Client", "Server instance does not exist for Setpoint Sync.");
return false; return false;
} }
@@ -155,6 +160,7 @@ class MonitoringClient extends IPSModule {
$ips_var_type = 0; $ips_var_type = 0;
} else { // unsupported } else { // unsupported
return false; return false;
IPS_LogMessage("Monitoring Client", "Unsupported data type for Setpoint Sync.");
} }
$module_id = "{01C00ADD-D04E-452E-B66A-D253278743FE}" /* Module ID of MQTT Server Device */; $module_id = "{01C00ADD-D04E-452E-B66A-D253278743FE}" /* Module ID of MQTT Server Device */;
@@ -280,8 +286,9 @@ class MonitoringClient extends IPSModule {
$isSetpoint = isset($catId["setpoint"]) ? $catId["setpoint"] : false; $isSetpoint = isset($catId["setpoint"]) ? $catId["setpoint"] : false;
if ($isSetpoint == true){ if ($isSetpoint == true){
$this->MqttSync($mqttId, $topic, $payload, false, $syncname, $childid);
IPS_LogMessage("Monitoring Client", "Sync Setpoint: " . $topic . " mit Payload: " . $payload. " und Source: " . $childid . " und Ident: " . $syncname); IPS_LogMessage("Monitoring Client", "Sync Setpoint: " . $topic . " mit Payload: " . $payload. " und Source: " . $childid . " und Ident: " . $syncname);
$this->MqttSync($mqttId, $topic, $payload, false, $syncname, $childid);
}else{ }else{
if($changedtime > $time - $updatetime){ if($changedtime > $time - $updatetime){
$this->MqttPublish($mqttId, $topic, $payload, false); $this->MqttPublish($mqttId, $topic, $payload, false);
@@ -313,8 +320,8 @@ class MonitoringClient extends IPSModule {
$isSetpoint = isset($catId["setpoint"]) ? $catId["setpoint"] : false; $isSetpoint = isset($catId["setpoint"]) ? $catId["setpoint"] : false;
if ($isSetpoint == true){ if ($isSetpoint == true){
$this->MqttSync($mqttId, $topic, $payload, false, $parname."_".$varname, $childid);
IPS_LogMessage("Monitoring Client", "Sync Setpoint: " . $topic . " mit Payload: " . $payload. " und Source: " . $childid . " und Ident: " . $syncname); IPS_LogMessage("Monitoring Client", "Sync Setpoint: " . $topic . " mit Payload: " . $payload. " und Source: " . $childid . " und Ident: " . $syncname);
$this->MqttSync($mqttId, $topic, $payload, false, $parname."_".$varname, $childid);
}else{ }else{
if($changedtime > $time - $updatetime){ if($changedtime > $time - $updatetime){