core/tests/fixtures
Eugenio Panadero 8d2e72cdf6
Add pvpc electricity prices integration (#32092)
* Add new integration: pvpc_hourly_pricing

to add a sensor with the current hourly price of electricity in Spain.
Configuration is done by selecting one of the 3 reference tariffs, with
1, 2, or 3 billing periods.

* Features config flow, entity registry, RestoreEntity, options flow
  to change tariff, manual yaml config as integration or sensor platform
* Cloud polling sensor with minimal API calls (3/hour at random times)
  and smart retry; fully async
* Only 1 state change / hour (only when the price changes)
* At evening, try to download published tomorrow prices, to always store
  prices info for a window of [3, 27] hours in the future.
* Include useful state attributes to program automations to be run
  at best electric prices.
* Add spanish and english translations.

* Requires `xmltodict` to parse official xml file with hourly prices
for each day.

* Update requirements and add to codeowners

* Avoid passing in hass as a parameter to the entity

Instead, create time change listeners in async_added_to_hass and
call async_generate_entity_id before async_add_entities

* Fix lint issues

* Add tests for config & options flow

* Add tests for manual yaml config

with entity definition as integration and also as a sensor platform

* Fix placement of PLATFORM_SCHEMA and update generated config_flows

* Store prices internally linked to UTC timestamps

- to deal with days with DST changes
- and work with different local timezones

* Add availability to sensor

to 'expire' the sensor if there is no connection available
 and current hour is not in the stored prices.

Also, turn off logging and retrying if prices can't be downloaded
repeatedly, by flagging `data_source_available` as False, so there is no
log-flood mess.

* Add more tests

- to cover behavior in DST changes and complete coverage of sensor logic
- to cover abort config flow

* fix linter

* Better handling of sensor availability and minor enhancements

- Emmit 1 error if data source is marked as unavailable
  (after some retries), and be silent until cloud access is recovered,
  then emmit 1 warning.
- Follow standard of camel_case keys in attributes

* Mock aiosession to not access real API, store fixture data

- Store a set of daily xml files to test sensor logic for all situations
- Mock time and session to run tests with stored API responses
- Add availability test to simulate a lost + recovery of cloud access,
  checking that logging is reasonable: 1 error to flag the continued
  disconnection + 1 warning in recovery.

* Change API endpoint to retrieve JSON data

and remove xmltodict from reqs.

It seems that this endpoint is more reliable than the XML.

* Adapt tests to new API endpoint

* Translate tariff labels to plain English

and sync the default timeout value for all ways of configuration.

* Relax logging levels to meet silver requirements

- 1 warning when becoming unavailable, another warning when recovered.
- Warnings for unexpected TimeoutError or ClientError
- Move the rest to debug level, leaving info for HA internals

Also reduce number of API calls from 3 to 2 calls/hour.

* Fix requirements

* Mod tests to work with timezone Atlantic/Canary

and fix state attributes for timezones != reference, by using 3 price
prefixes: 'price_last_day_XXh', 'price_next_day_XXh' and 'price_XXh',
all generated with local time (backend timezone)

* Try to fix CI tests

* Externalize pvpc data and simplify sensor.py

* add new `aiopvpc` to requirements
* Remove data parsing and price logic from here
* Replace some constant properties with class variables

* Simplify tests for pvpc_hourly_pricing

* Fix updater for options flow

* Updater always reloads
* `tariff` value comes 1st from entry.options, 2nd from entry.data

* Fix lint

* Bump aiopvpc

* Remove options flow and platform setup

- Remove PLATFORM_SCHEMA and async_setup_platform
- Generate config_entry.unique_id with tariff instead of entity_id, in flow step.
- Remove TariffSelectorConfigFlow
- Adapt tests to maintain full coverage

* Fix docstring on test

and rename SENSOR_SCHEMA to SINGLE_SENSOR_SCHEMA to avoid confusion

* Remove timeout manual config, fix entry.options usage, simplify unique_id

* Simplify tests

- No need for a test_setup now, as platform setup is removed and integration
  setup is already used in `test_availability`
- Simplified `_process_time_step`: only one async_fire(EVENT_TIME_CHANGED)/hour

* Fix possible duplicated update

when source is not available.

* Do not access State last_changed for log messages

* Do not update until entity is added to hass

and call to async_update after 1st download or when recovering access, so
async_write_ha_state is not called twice on those.

* minor changes

* Rename method to select current price and make it a callback
2020-03-22 14:25:31 -05:00
..
august Lock operation sensors for August (#32593) 2020-03-10 17:09:49 -07:00
elgato Add Elgato Key Light integration (#29592) 2019-12-08 09:26:31 +01:00
griddy Add griddy integration (#32591) 2020-03-10 23:00:30 +01:00
here_travel_time Add here_travel_time (#24603) 2019-09-23 11:50:18 +02:00
homekit_controller Add support for homekit valve accessories to homekit_controller (#32937) 2020-03-18 21:20:40 +00:00
nexia Add support for nexia automations (#33049) 2020-03-20 18:49:42 -05:00
powerwall Add Powerwalls integration (#32851) 2020-03-19 10:50:17 -05:00
pvpc_hourly_pricing Add pvpc electricity prices integration (#32092) 2020-03-22 14:25:31 -05:00
wled Add Wi-Fi sensors to WLED integration (#33055) 2020-03-21 15:14:41 -07: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
abode_automation.json Add Abode tests (#32562) 2020-03-16 03:05:10 +01:00
abode_automation_changed.json Add Abode tests (#32562) 2020-03-16 03:05:10 +01:00
abode_devices.json Add Abode tests (#32562) 2020-03-16 03:05:10 +01:00
abode_login.json Add Abode tests (#32562) 2020-03-16 03:05:10 +01:00
abode_oauth_claims.json Add Abode tests (#32562) 2020-03-16 03:05:10 +01:00
abode_panel.json Add Abode tests (#32562) 2020-03-16 03:05:10 +01:00
airly_no_station.json Add Airly integration (#26375) 2019-10-04 13:58:29 +02:00
airly_valid_station.json Add Airly integration (#26375) 2019-10-04 13:58:29 +02: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
ambient_devices.json Make Ambient PWS async and cloud-push (#20332) 2019-01-28 15:35:39 -08:00
aurora.txt Fix aurora sensor not converting latitude and longitude correctly (#28643) 2020-01-09 08:40:10 +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
brother_printer_data.json Tests improvements to the Brother integration (#32982) 2020-03-20 10:21:43 +01: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 Add severe weather sensor to Dark Sky (#22701) 2019-07-16 18:03:05 +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
feedreader4.xml fix feedreader handling unrecognized published date (#28225) 2019-10-31 21:05:42 +01: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
google_maps_elevation.json
homematicip_cloud.json Add new devices to HomematicIP Cloud (#31914) 2020-02-19 10:43:12 +01:00
ip-api.com.json
ipapi.co.json Switch to ipapi.co (fixes #19846) (#19886) 2019-01-15 16:18:57 -08:00
london_air.json Adds London_air component (#9020) 2017-08-19 11:05:16 +02: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 Update Ring to 0.6.0 (#30748) 2020-01-14 12:54:45 -08:00
ring_devices_updated.json Update Ring to 0.6.0 (#30748) 2020-01-14 12:54:45 -08: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_doorbot_siren_on_response.json Add ring switch platform (#25612) 2019-08-06 14:39:07 +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 Fixes invalid JSON files and whitespace corrections in YAML files (#26396) 2019-09-03 16:02:42 -07:00
ring_session.json Introduced Ring binary sensors and refactored Ring component (#6520) 2017-03-31 08:53:56 -07:00
sleepiq-bed-single.json Sleepiq single sleeper crash (#24941) 2019-07-07 08:40:02 +02:00
sleepiq-bed.json SleepIQ component with sensor and binary sensor platforms (#3390) 2016-09-14 00:11:50 +02:00
sleepiq-familystatus-single.json Sleepiq single sleeper crash (#24941) 2019-07-07 08:40:02 +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
yandex_transport_reply.json Fix Yandex transport after API change (#32500) 2020-03-07 18:26:35 +01:00
yr.no.xml Fix incorrect file format yr test fixure (#29910) 2019-12-13 12:29:24 +01:00