You are here

protected function StateValueSensorPlugin::getValue in Monitoring 8

Gets the current value.

Return value

mixed The current value.

Overrides ValueComparisonSensorPluginBase::getValue

File

src/Plugin/monitoring/SensorPlugin/StateValueSensorPlugin.php, line 38
Contains \Drupal\monitoring\Plugin\monitoring\SensorPlugin\StateValueSensorPlugin

Class

StateValueSensorPlugin
Generic sensor that checks for a state value.

Namespace

Drupal\monitoring\Plugin\monitoring\SensorPlugin

Code

protected function getValue() {
  $state = $this
    ->getState();
  $key = $this->sensorConfig
    ->getSetting('key');
  if (empty($key)) {
    return NULL;
  }
  return $state
    ->get($key);
}