Skip to content

Commit

Permalink
Regex
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMysteriousX committed Feb 10, 2024
1 parent 81632f5 commit 7a4a3e2
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion includes/discovery/sensors/charge/dell-powervault.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
foreach ($pre_cache['dell-powervault'] as $index => $entry) {
if (str_contains($entry['connUnitSensorMessage'], 'Charge')) {
$connUnitSensorMessage = explode(':', $entry['connUnitSensorMessage']);
preg_match('^ ([0-9]+\.[0-9]+)A$', array_pop($connUnitSensorMessage), $matches);
preg_match('/^ ([0-9]+)%$/', array_pop($connUnitSensorMessage), $matches);
$value = $matches[1];
$descr = implode(':', $connUnitSensorMessage);

Expand Down
2 changes: 1 addition & 1 deletion includes/discovery/sensors/current/dell-powervault.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
foreach ($pre_cache['dell-powervault'] as $index => $entry) {
if (str_contains($entry['connUnitSensorMessage'], 'Current')) {
$connUnitSensorMessage = explode(':', $entry['connUnitSensorMessage']);
preg_match('^ ([0-9]+\.[0-9]+)A$', array_pop($connUnitSensorMessage), $matches);
preg_match('/^ ([0-9]+\.[0-9]+)A$/', array_pop($connUnitSensorMessage), $matches);
$value = $matches[1];
$descr = implode(':', $connUnitSensorMessage);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
foreach ($pre_cache['dell-powervault'] as $index => $entry) {
if (str_contains($entry['connUnitSensorMessage'], 'Temp')) {
$connUnitSensorMessage = explode(':', $entry['connUnitSensorMessage']);
preg_match('^ ([0-9]+) C ([0-9]+\.[0-9]+)F$', array_pop($connUnitSensorMessage), $matches);
preg_match('/^ ([0-9]+) C ([0-9]+\.[0-9]+)F$/', array_pop($connUnitSensorMessage), $matches);
$value = $matches[1];
$descr = implode(':', $connUnitSensorMessage);

Expand Down
2 changes: 1 addition & 1 deletion includes/discovery/sensors/voltage/dell-powervault.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
foreach ($pre_cache['dell-powervault'] as $index => $entry) {
if (str_contains($entry['connUnitSensorMessage'], 'Voltage')) {
$connUnitSensorMessage = explode(':', $entry['connUnitSensorMessage']);
preg_match('^ ([0-9]+\.[0-9]+)V$', array_pop($connUnitSensorMessage), $matches)[1];
preg_match('/^ ([0-9]+\.[0-9]+)V/$', array_pop($connUnitSensorMessage), $matches)[1];
$value = $matches[1];
$descr = implode(':', $connUnitSensorMessage);

Expand Down

0 comments on commit 7a4a3e2

Please sign in to comment.