I have the following basic code returning a giant array:
$request = 'http://10.111.113.253/api' $values = Invoke-RestMethod $request foreach ($value in $values){ $value.Setpoints.Refrigeration }
This returns the following values:
RoomTemp : @{current=38.0 F; currentValue=38.0; units=F}
Refrigerant : @{current=R-404A; currentIndex=0; options=System.Object}
MinCompRuntime : @{current=2 MIN; currentValue=2; units=MIN}
MinCompOffTime : @{current=5 MIN; currentValue=5; units=MIN}
AirTempDiff : @{current=1.0 F; currentValue=1.0; units=F}
2ndRoomTemp : @{current=-50.0 F; currentValue=-50.0; units=F}
AuxTemp1 : @{current=T1 Suct Temp; currentIndex=3; options=System.Object}
AuxTemp4 : @{current=T4 Coil Temp; currentIndex=3; options=System.Object}
RefrigFanMode : @{current=Permanent; currentIndex=1; options=System.Object}
FanSpeed : @{current=0.0 %; currentValue=0.0; units=%}
TempUnits : @{current=Fahrenheit; currentIndex=0; options=System.Object}
MultiAirTempControl : @{current=Warmest Air; currentIndex=0; options=System.Object}
I can query/pull the nested values such as:
$value.Setpoints.Refrigeration.AirTempDiff
Which returns:
current currentValue units
1.0 F 1.0 F
However when I try the following I recieve an error:
$value.Setpoints.Refrigeration.2ndRoomTemp
Error:
-
$value.Setpoints.Refrigeration.2ndRoomTemp
-
~
Missing property name after reference operator.
+ CategoryInfo : ParserError: ( , ParentContainsErrorRecordException
+ FullyQualifiedErrorId : MissingPropertyName
I’m assuming this is caused by the one of two things, the “2ndRoomTemp” begins with a number or the negative value it returns, but not 100% sure. I can query all of the values except this one.
Any help or suggestions would be greatly appreciated.