- # $hsh{'Air_Temp_Inside_f'} = $t;
- $hsh{'Air_Temp_Inside_c'} = sprintf("%.1f",($t - 32) * 5/9);
- my $tf = unpack("s", substr $blk,12,2) / 10;
- # $hsh{'Air_Temp_Outside_f'} = $tf;
- $hsh{'Air_Temp_Outside_c'} = sprintf("%.1f",($tf - 32) * 5/9);
-
- $hsh{'Wind_Speed_mph'} = unpack("C", substr $blk,14,1);
- # $hsh{'Wind_Speed_mps'} = sprintf("%.1f",$hsh{'Wind_Speed_mph'}*0.44704);
- $hsh{'Wind_Speed_10min_Avg_mph'} = unpack("C", substr $blk,15,1);
- # $hsh{'Wind_Speed_10min_Avg_mps'} = sprintf("%.1f",$hsh{'Wind_Speed_10min_Avg_mph'}*0.44704);
- $hsh{'Wind_Dir'} = unpack("s", substr $blk,16,2);
-
+ $h{Temp_In} = sprintf("%.1f", f2c($t))+0;
+
+ $t = unpack("s", substr $blk,12,2) / 10;
+ $h{Temp_Out} = sprintf("%.1f", f2c($t))+0;
+
+ $t = unpack("C", substr $blk,14,1);
+ $h{Wind} = sprintf("%.1f",mph2mps($t))+0;
+ $h{Dir} = unpack("s", substr $blk,16,2)+0;
+
+ my $wind = {w => $h{Wind}, d => $h{Dir}};
+ push @min, $wind;
+
+ $h{'Humidity_Out'} = unpack("C", substr $blk,33,1)+0;
+ $h{'Humidity_In'} = unpack("C", substr $blk,11,1)+0;
+
+ $t = unpack("C", substr $blk,43,1)+0;
+ $h{'UV'} = $t unless $t >= 255;
+ $t = unpack("s", substr $blk,44,2)+0; # watt/m**2
+ $h{'Solar'} = $t unless $t >= 32767;
+
+ $h{'Rain_Rate'} = sprintf("%0.1f",unpack("s", substr $blk,41,2) * $rain_mult)+0;
+ $h{'Rain_Day'} = sprintf("%0.1f", unpack("s", substr $blk,50,2) * $rain_mult)+0;
+
+ # what sort of packet is it?
+
+ $t = unpack("C", substr $blk,4,1);
+ if ($t) {
+
+ # Newer LOOP2 packet
+ $t = unpack("C", substr $blk,18,2);
+# $h{Wind_Avg_10} = sprintf("%.1f",mph2mps($t/10))+0;
+ $t = unpack("C", substr $blk,20,2);
+# $h{Wind_Avg_2} = sprintf("%.1f",mph2mps($t/10))+0;
+ $t = unpack("C", substr $blk,22,2);
+# $h{Wind_Gust_10} = sprintf("%.1f",mph2mps($t/10))+0;
+
+# $h{Dir_Avg_10} = unpack("C", substr $blk,24,2)+0;
+ $t = unpack("C", substr $blk,30,2);
+ $h{Dew_Point} = sprintf("%0.1f", f2c($t))+0;