In AWSENSOR.swift the battery formattedValue uses this logic
case .Battery:
return String("(_value as! Int == 0 ? "Good" : "Bad")")
this is inverted relative to the Ambient Weather API specification, which defines battery fields (battout, batt1–batt10, batt_25) as:
• 0 = low battery (bad)
• 1 = normal / OK (good)
With the current code, a station reporting healthy batteries (1) is displayed as "Bad", and a station with a dead battery (0) is displayed as "Good".
the Fix:
case .Battery:
return String("(_value as! Int == 1 ? "Good" : "Bad")")
In AWSENSOR.swift the battery formattedValue uses this logic
case .Battery:
return String("(_value as! Int == 0 ? "Good" : "Bad")")
this is inverted relative to the Ambient Weather API specification, which defines battery fields (battout, batt1–batt10, batt_25) as:
• 0 = low battery (bad)
• 1 = normal / OK (good)
With the current code, a station reporting healthy batteries (1) is displayed as "Bad", and a station with a dead battery (0) is displayed as "Good".
the Fix:
case .Battery:
return String("(_value as! Int == 1 ? "Good" : "Bad")")