Currently, in updateInfo, the else case (empty return) is hit even when data?.result?.result exists (i.e. when device info was fetched successfully). I suspect this is not intended. This PR modifies the else condition so that it is not hit when data is fetched successfully.
I tracked this down after noticing the error below in my logs:
[homebridge-levoit-humidifiers] This plugin generated a warning from the characteristic 'Current Relative Humidity': characteristic value expected valid finite number and received "undefined" (undefined). See https://homebridge.io/w/JtMGR for more info.
Aside: Although similar conditionals were added to setPower, the same error isn’t present there, because the happy path (success) is checked first in that function.
Currently, in
updateInfo
, theelse
case (emptyreturn
) is hit even whendata?.result?.result
exists (i.e. when device info was fetched successfully). I suspect this is not intended. This PR modifies theelse
condition so that it is not hit when data is fetched successfully.I tracked this down after noticing the error below in my logs:
This error was introduced in v1.7.1; it does not repro in v1.7.0. Specifically, the
if
/else
conditions were modified in https://github.com/pschroeder89/homebridge-levoit-humidifiers/commit/2bfec876f23160730908644f369b35760a11bba2.Aside: Although similar conditionals were added to
setPower
, the same error isn’t present there, because the happy path (success
) is checked first in that function.