diff --git a/pandora_console/include/rest-api/models/VisualConsole/Items/ColorCloud.php b/pandora_console/include/rest-api/models/VisualConsole/Items/ColorCloud.php index ca3bc71297..35109b72cb 100644 --- a/pandora_console/include/rest-api/models/VisualConsole/Items/ColorCloud.php +++ b/pandora_console/include/rest-api/models/VisualConsole/Items/ColorCloud.php @@ -225,11 +225,17 @@ final class ColorCloud extends Item if (empty($dynamicData['colorRanges']) === false) { // Connect to node. $nodeConnected = false; - if (is_metaconsole() === true && $metaconsoleId !== null) { - $nodeConnected = metaconsole_connect( + if (\is_metaconsole() === true && $metaconsoleId !== null) { + $nodeConnected = \metaconsole_connect( null, $metaconsoleId ) === NOERR; + + if ($nodeConnected === false) { + throw new \InvalidArgumentException( + 'error connecting to the node' + ); + } } // Fetch module value. @@ -237,12 +243,12 @@ final class ColorCloud extends Item if ($metaconsoleId === null || ($metaconsoleId !== null && $nodeConnected) ) { - $value = modules_get_last_value($moduleId); + $value = \modules_get_last_value($moduleId); } // Restore connection. if ($nodeConnected === true) { - metaconsole_restore_db(); + \metaconsole_restore_db(); } // Value found. diff --git a/pandora_console/include/rest-api/models/VisualConsole/Items/SimpleValue.php b/pandora_console/include/rest-api/models/VisualConsole/Items/SimpleValue.php index 4d4a8bd312..ad2aea9178 100644 --- a/pandora_console/include/rest-api/models/VisualConsole/Items/SimpleValue.php +++ b/pandora_console/include/rest-api/models/VisualConsole/Items/SimpleValue.php @@ -165,6 +165,7 @@ final class SimpleValue extends Item throw new \InvalidArgumentException('missing module Id'); } + // TODO: Connect to a metaconsole node? // Get the formatted value. $value = \visual_map_get_simple_value( $data['type'],