core/tests/fixtures
Andrew Hayworth eb6b6ed87d Add Awair sensor platform (#18570)
* Awair Sensor Platform

This commit adds a sensor platform for Awair devices, by accessing
their beta API. Awair heavily rate-limits this API, so we throttle
updates based on the number of devices found. We also allow for the
user to bypass API device listing entirely, because the device list
endpoint is limited to only 6 calls per day. A crashing or restarting
server would quickly hit that limit.

This sensor platform uses the python_awair library (also written
as part of this PR), which is available for async usage.

* Disable pylint warning for broad try/catch

It's true that this is generally not a great idea, but we really don't
want to crash here. If we can't set up the platform, logging it and
continuing is the right answer.

* Add space to satisfy the linter

* Awair platform PR feedback

- Bump python_awair to 0.0.2, which has support for more granular exceptions
- Ensure we have python_awair available in test
- Raise PlatformNotReady if we can't set up Awair
- Make the 'Awair score' its own sensor, rather than exposing it other ways
- Set the platform up as polling, and set a sensible default
- Pass in throttling parameters to the underlying data class, rather
than use hacky global variable access to dynamically set the interval
- Switch to dict access for required variables
- Use pytest coroutines, set up components via async_setup_component,
  and test/modify/assert in generally better ways
- Commit test data as fixtures

* Awair PR feedback, volume 2

- Don't force updates in test, instead modify time itself and let
  homeassistant update things "normally".
- Remove unneeded polling attribute
- Rename timestamp attribute to 'last_api_update', to better reflect
  that it is the timestamp of the last time the Awair API servers
  received data from this device.
- Use that attribute to flag the component as unavailable when data
  is stale. My own Awair device periodically goes offline and it really
  hardly indicates that at all.
- Dynamically set fixture timestamps to the test run utcnow() value,
  so that we don't have to worry about ancient timestamps in tests
  blowing up down the line.
- Don't assert on entities directly, for the most part. Find desired
  attributes in ... the attributes dict.

* Patch an instance of utcnow I overlooked

* Switch to using a context manager for timestream modification

Honestly, it's just a lot easier to keep track of patches. Moreover,
the ones I seem to have missed are now caught, and tests seem to
consistently pass.

Also, switch test_throttle_async_update to manipulating time more
explicitly.

* Missing blank line, thank you hound

* Fix pydocstyle error

I very much need to set up a script to do this quickly w/o tox, because
running flake8 is not enough!

* PR feedback

* PR feedback
2018-11-25 09:01:19 +01:00
..
Ddwrt_Status_Lan.txt Unittests for ddwrt device tracker and bugfix (#3996) 2016-10-24 22:18:24 -07:00
Ddwrt_Status_Wireless.txt Unittests for ddwrt device tracker and bugfix (#3996) 2016-10-24 22:18:24 -07:00
alpr_cloud.json Component "Image processing" (#5166) 2017-01-14 08:18:03 +01:00
alpr_stdout.txt Component "Image processing" (#5166) 2017-01-14 08:18:03 +01:00
aurora.txt Add aurora sensor (#6003) 2017-02-17 09:13:52 +01:00
awair_air_data_latest.json Add Awair sensor platform (#18570) 2018-11-25 09:01:19 +01:00
awair_air_data_latest_updated.json Add Awair sensor platform (#18570) 2018-11-25 09:01:19 +01:00
awair_devices.json Add Awair sensor platform (#18570) 2018-11-25 09:01:19 +01:00
bom_weather.json Fix BOM weather '-' value (#14042) 2018-05-08 13:35:55 -04:00
coinmarketcap.json Add configurable decimal rounding of display value for CoinMarketCap sensor and upgrade to 5.0.3 (#14437) (#14604) 2018-05-25 15:39:04 +02:00
darksky.json Change name of Forecast.io platform to Dark Sky (#3698) 2016-10-05 21:42:58 +02:00
efergy_budget.json Efergy (#15380) 2018-07-09 14:39:28 +02:00
efergy_cost.json Efergy (#15380) 2018-07-09 14:39:28 +02:00
efergy_current_values_multi.json Added support for multiple efergy sensors in the same household. (#6630) 2017-03-16 23:22:10 -07:00
efergy_current_values_single.json Added support for multiple efergy sensors in the same household. (#6630) 2017-03-16 23:22:10 -07:00
efergy_energy.json Efergy (#15380) 2018-07-09 14:39:28 +02:00
efergy_instant.json Added support for multiple efergy sensors in the same household. (#6630) 2017-03-16 23:22:10 -07:00
feedreader.xml Make Feedreader component more extendable (#14342) 2018-05-15 20:43:26 +02:00
feedreader1.xml Make Feedreader component more extendable (#14342) 2018-05-15 20:43:26 +02:00
feedreader2.xml Make Feedreader component more extendable (#14342) 2018-05-15 20:43:26 +02:00
feedreader3.xml avoid error in debug log mode and rss entry without title (#16316) 2018-08-31 12:54:25 +02:00
foobot_data.json Adding Foobot device sensor (#12417) 2018-03-15 19:50:58 -07:00
foobot_devices.json Adding Foobot device sensor (#12417) 2018-03-15 19:50:58 -07:00
freegeoip.io.json Move elevation to core config and clean up HTTP mocking in tests (#2378) 2016-06-27 09:02:45 -07:00
google_maps_elevation.json Move elevation to core config and clean up HTTP mocking in tests (#2378) 2016-06-27 09:02:45 -07:00
ip-api.com.json Move elevation to core config and clean up HTTP mocking in tests (#2378) 2016-06-27 09:02:45 -07:00
london_air.json Adds London_air component (#9020) 2017-08-19 11:05:16 +02:00
london_underground.json Add london_underground (#8272) 2017-07-02 11:32:38 -07:00
melissa_cur_settings.json Add Melissa (HVAC/climate) component (#11503) 2018-02-03 03:17:01 +01:00
melissa_fetch_devices.json Add Melissa (HVAC/climate) component (#11503) 2018-02-03 03:17:01 +01:00
melissa_status.json Add Melissa (HVAC/climate) component (#11503) 2018-02-03 03:17:01 +01:00
microsoft_face_create_person.json [image_processing/microsoft_face_identify] face recognition for automation (#5472) 2017-01-24 21:50:10 -08:00
microsoft_face_detect.json [image_processing/microsoft_face_identify] face recognition for automation (#5472) 2017-01-24 21:50:10 -08:00
microsoft_face_identify.json [image_processing/microsoft_face_identify] face recognition for automation (#5472) 2017-01-24 21:50:10 -08:00
microsoft_face_persongroups.json [image_processing/microsoft_face_identify] face recognition for automation (#5472) 2017-01-24 21:50:10 -08:00
microsoft_face_persons.json [image_processing/microsoft_face_identify] face recognition for automation (#5472) 2017-01-24 21:50:10 -08:00
openhardwaremonitor.json Openhardwaremonitor (#8056) 2017-06-25 13:48:05 -07:00
pushbullet_devices.json Remove unnecessary executable permissions (#15469) 2018-07-14 23:03:36 +02:00
ring_chime_health_attrs.json Introducing Ring Door Bell Camera (including StickUp cameras) and WiFi sensors (#9962) 2017-10-21 16:08:40 +02:00
ring_devices.json Introducing Ring Door Bell Camera (including StickUp cameras) and WiFi sensors (#9962) 2017-10-21 16:08:40 +02:00
ring_ding_active.json Make sure Ring binary_sensor state will update only if device_id matches (#9247) 2017-09-01 09:14:16 +02:00
ring_doorboot_health_attrs.json Introducing Ring Door Bell Camera (including StickUp cameras) and WiFi sensors (#9962) 2017-10-21 16:08:40 +02:00
ring_doorbots.json Introduced Ring binary sensors and refactored Ring component (#6520) 2017-03-31 08:53:56 -07:00
ring_oauth.json Upgrade ring_doorbell to 0.2.1 to fix oauth issues (#14984) 2018-06-16 08:58:39 +02:00
ring_session.json Introduced Ring binary sensors and refactored Ring component (#6520) 2017-03-31 08:53:56 -07:00
sleepiq-bed.json SleepIQ component with sensor and binary sensor platforms (#3390) 2016-09-14 00:11:50 +02:00
sleepiq-familystatus.json SleepIQ component with sensor and binary sensor platforms (#3390) 2016-09-14 00:11:50 +02:00
sleepiq-login-failed.json SleepIQ component with sensor and binary sensor platforms (#3390) 2016-09-14 00:11:50 +02:00
sleepiq-login.json SleepIQ component with sensor and binary sensor platforms (#3390) 2016-09-14 00:11:50 +02:00
sleepiq-sleeper.json SleepIQ component with sensor and binary sensor platforms (#3390) 2016-09-14 00:11:50 +02:00
smhi.json Swedish weather institute weather component (#16717) 2018-10-08 23:54:55 +02:00
uk_transport_bus.json Add uk_transport component. (#8600) 2017-07-26 20:49:52 +01:00
uk_transport_train.json Add uk_transport component. (#8600) 2017-07-26 20:49:52 +01:00
unifi_direct.txt Support for Unifi direct access device tracker (No unifi controller software) (#10097) 2017-11-17 14:47:40 -05:00
upc_connect.xml [device_traker/upc] New UPC connect box platform (#5100) 2017-01-09 18:08:37 +02:00
vultr_account_info.json Add platform and sensors for Vultr VPS (#9928) 2017-11-05 14:10:14 +01:00
vultr_server_list.json Add platform and sensors for Vultr VPS (#9928) 2017-11-05 14:10:14 +01:00
wsdot.json Added new Washington State DOT sensor. (#5496) 2017-01-24 22:08:19 -08:00
wunderground-error.json Make WUnderground async (#12385) 2018-02-16 14:54:11 -08:00
wunderground-invalid.json Make WUnderground async (#12385) 2018-02-16 14:54:11 -08:00
wunderground-valid.json Make WUnderground async (#12385) 2018-02-16 14:54:11 -08:00
yahoo_finance.json Added unit test to the Yahoo Finance sensor (#3943) 2016-10-20 20:14:50 +02:00
yahooweather.json Fix line endings [skipci] (#12333) 2018-02-11 23:07:28 -08:00
yr.no.json Move elevation to core config and clean up HTTP mocking in tests (#2378) 2016-06-27 09:02:45 -07:00