New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not choke on no awair data #19708

Merged
merged 2 commits into from Jan 3, 2019

Conversation

Projects
None yet
3 participants
@ahayworth
Copy link
Contributor

ahayworth commented Jan 2, 2019

Description:

The awair API returns an empty response for various air data queries
when a device is offline. The underlying library (python_awair) does
not directly inform us that a device is offline, since we really can
only infer it from an empty response - there is no online/offline
indicator in the graphql API.

So - we should just ensure that we do not attempt to update device state
from an empty response. This ensures that the platform does not crash
when starting up with offline devices, and also ensures that the
platform is marked unavailable once devices go offline.

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.
awair: do not choke on no data
The awair API returns an empty response for various air data queries
when a device is offline. The underlying library (python_awair) does
not directly inform us that a device is offline, since we really can
only infer it from an empty response - there is no online/offline
indicator in the graphql API.

So - we should just ensure that we do not attempt to update device state
from an empty response. This ensures that the platform does not crash
when starting up with offline devices, and also ensures that the
platform is marked unavailable once devices go offline.
Fix typo
Further proof that coding after 10pm is rolling the dice.

@ahayworth ahayworth closed this Jan 2, 2019

@ahayworth ahayworth reopened this Jan 2, 2019

@wafflebot wafflebot bot added in progress and removed in progress labels Jan 2, 2019

@fabaff fabaff changed the title awair: do not choke on no data Do not choke on no awair data Jan 3, 2019

@fabaff

fabaff approved these changes Jan 3, 2019

Copy link
Member

fabaff left a comment

Looks good to me 🐦

@fabaff fabaff merged commit 87a0118 into home-assistant:dev Jan 3, 2019

5 checks passed

Hound No violations found. Woof!
WIP Legacy commit status override — see details
Details
cla-bot Everyone involved has signed the CLA
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage increased (+0.009%) to 93.107%
Details

@wafflebot wafflebot bot removed the in progress label Jan 3, 2019

mxworm added a commit to mxworm/home-assistant that referenced this pull request Jan 5, 2019

Merge branch 'homematicip_cloud-update_rest_api_version' into current
* homematicip_cloud-update_rest_api_version:
  Update of requirements files
  Update version to 0.10.1
  Update HAP-python to 2.4.2 (home-assistant#19776)
  update powerview scene component to latest api. (home-assistant#19717)
  Fix some ESPHome race conditions (home-assistant#19772)
  Use manufacturer id only for configure_reporting only when specified. (home-assistant#19729)
  Don't slugify unique id (home-assistant#19770)
  Support for Homekit controller/alarm control panel (home-assistant#19612)
  check config instead of config_entry for quirks flag (home-assistant#19730)
  Round illumination and lux value to one (home-assistant#19747)
  Upgrade tibber library (home-assistant#19768)
  Add mychevy optional country parameter (home-assistant#19727)
  Move envisalink component to package and add services.yaml (home-assistant#19731)
  Proactive Alexa ChangeReport messages (home-assistant#18114)
  Filter urllib3.connectionpool warnings in camera.axis and camera.zoneminder (home-assistant#19641)
  Add exception handling to ADS shutdown (home-assistant#19682)
  Drop bme680 os_lookup for temp_offset (home-assistant#19733)
  Fix WeMo incorrect mapping of device type during discovery (home-assistant#19691)
  Do not choke on no awair data (home-assistant#19708)

@balloob balloob referenced this pull request Jan 10, 2019

Merged

0.85.0 #19897

kellerza added a commit to kellerza/home-assistant that referenced this pull request Jan 18, 2019

Do not choke on no awair data (home-assistant#19708)
* awair: do not choke on no data

The awair API returns an empty response for various air data queries
when a device is offline. The underlying library (python_awair) does
not directly inform us that a device is offline, since we really can
only infer it from an empty response - there is no online/offline
indicator in the graphql API.

So - we should just ensure that we do not attempt to update device state
from an empty response. This ensures that the platform does not crash
when starting up with offline devices, and also ensures that the
platform is marked unavailable once devices go offline.

* Fix typo

Further proof that coding after 10pm is rolling the dice.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment