+ $req .= '<SENSOR KEY="'.$s->{KEY}.'"/>';
+ }
+ $req .= '</SENSORLIST></REQ>';
+
+ my $sprop = _req($req);
+ foreach my $s (@{$sprop->{RESP}->{SENSORLIST}->{SENSOR}}) {
+ my $sensor = {};
+ foreach my $sp (@{$s->{PROP}}) {
+ $sensor->{$sp->{NAME}} = $sp->{VAL};
+ }
+
+ next if (!defined($sensor->{NAME}));
+ $sensor->{VAL} = '0' if ($sensor->{VAL} eq '');
+ push @sensors, $sensor;
+ }
+ @sensors;
+}
+
+sub show_sensors {
+ my @sensors = get_sensors();
+
+ foreach my $sensor (@sensors) {
+ print $sensor->{NAME}.": ".$sensor->{VAL}.$sensor->{UNITS}." ";
+
+ my @info = ();
+ foreach my $field qw(MIN MAX LOW_NON_CRITICAL UPPER_NON_CRITICAL LOW_CRITICAL UPPER_CRITICAL) {
+ if ($sensor->{$field} ne '') {
+ push @info, "${field}: ".$sensor->{$field}.$sensor->{UNITS};
+ }
+ }
+
+ print " (".join(", ",@info).")" if (@info);
+
+ print "\n";