Open spokrandt opened 5 years ago
ok i tried,. is it better to check if they are null then a number?
def temperature
if ( !isNull(response.results[0].temp_f) && !isNull(response.results[1].temp_f) )
// if (response.results[0].temp_f?.isNumber() && response.results[1].temp_f?.isNumber()) temperature = roundIt(((response.results[0].temp_f.toBigDecimal() + response.results[1].temp_f.toBigDecimal()) / 2.0), 1)
sendEvent(name: 'temperature', value: temperature, unit: 'F')
sendEvent(name: 'temperatureDisplay', value: roundIt(temperature, 0), unit: 'F', displayed: false)
I think the version 1.1.02 that I just posted should handle the situation better - please let me know (I am travelling, so my responses may be delayed).
I added some additional handling for only a single reporting sensor as 1.1.02a
2019-04-12 12:30:24.448 pm errorjava.lang.NullPointerException: Cannot get property 'temp_f' on null object on line 485 (purpleAirResponse)
I have no clue when it comes to groovy... os i thought i'd create an issue
this is on hubitat version 2.0.8.113