* First step of an EnOcean integration refactoring, including code reorganisation and support of a setup config flow
* Moved title to root of strings file
* Fixed pre-commit checks failures
* Fixed linter errors
* Updated formatted string format in logs
* Removed leftover comment
* Multiple changes after PR change requests.
Using an import flow for yaml config, removed unnecessary logs, added proper unload in __init__ and EnOceanDongle
Replaced config state machine by several flows.
Serial port validity check done in the EnOceanDongle class asynchronously, removed unique ID from config flow
Multiple cosmetic changes
* Multiple changes after PR change requests
* Added variable to store default value, as setdefault was caught returning None when the empty dict literal was passed as an argument
* Literal used directly
* Added tests for EnOcean config flows, changed static methods to bundle methods for bundle
* Updated variable name
* Added missing mock to test, replaced repeated magic strings by constants
* Changed imports to avoid an unused import warning from pylint on DOMAIN
* Adding pylint exception for unused import
* Added proper propagation of setup and unload to platforms, removed dead code, some syntax changes
* Removed setup_entry forwarding as the entities can only be configured using yaml
* Removed forwarding of unload
* Enabled code coverage for config flow only
* Clean up coveragerc
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Convert Android TV integration to async
* pylint
* Remove unused test code
* Require async versions of androidtv and adb-shell
* Cleanup
* Remove commented out code
* Use constants SHELL_RESPONSE_OFF and SHELL_RESPONSE_STANDBY
- Bumps bravia-tv lib to 1.0.6 which fixes is_connected() to actually
return True only when API is connected, instead of just returning whether
or not cookies are cached (regardless if they actually worked).
- Wrap is_connected() because it now performs io.
- Remove unnecessary logic to refresh cookies. Now that
is_connected() works, the bravia instance only needs to be
reconnected when is_connected is False and TV is not off.
* Initial commit for Dexcom integration
* Dexcom config flow testing
* Clarify errors during setup
* Resolve minor test issues
* Update sensor availability, resolve linting issues
* Add sensor tests
* Remove title due to 0.109, add abort
* >94.97% codecov/patch
* Move .translations/ to translations/
* Add constants for servers and unit of measurements
* Bump pydexcom version
* Updated domain schema, Dexcom creation
* Support for different units of measurement
* Update tests
* Remove empty items from manifest
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Raise UpdateFailed if fetching new session fails
* Switch everything over to required
* Simplify state information
* Simplify async_on_remove
* Pydexcom package now handles fetching new session
* Only allow config flow
* Remove ternary operator
* Bump version, pydexcom handling session refresh
* Using common strings
* Import from test.async_mock
* Shorten variable names
* Resolve tests after removing yaml support
* Return false if credentials are invalid
* Available seems to handle if data is empty
* Now using option flow, remove handling import
* Add fixture for JSON returned from API
* Overhaul testing
* Revise update options
* Bump pydexcom version
* Combat listener repetition
* Undo update listener using callback
* Change sensor availability to use last_update_success
* Update sensor availability and tests
* Rename test
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* add first unit test to config flow for Plum Lightpad
* add first unit test to config flow for Plum Lightpad (add changed requirements_test_all.txt)
* add first unit test to config flow for Plum Lightpad
* add first unit test to config flow for Plum Lightpad (bring coverage to 100%)
* add first unit test to config flow for Plum Lightpad
* add first unit test to config flow for Plum Lightpad (updated patch path as suggested)
* add first unit test to config flow for Plum Lightpad (add unit test for abort)
* Added GLOB capability to entityfilter and every place that uses it. All existing tests are passing
* added tests for components affected by glob change
* fixed flake8 error
* mocking the correct listener
* mocking correct bus method in azure test
* tests passing in 3.7 and 3.8
* fixed formatting issue from rebase/conflict
* Checking against glob patterns in more performant way
* perf improvments and reverted unnecessarily adjusted tests
* added new benchmark test around filters
* no longer using get with default in entityfilter
* changed filter name and removed logbook from filter benchmark
* simplified benchmark tests from feedback
* fixed apache tests and returned include exclude schemas to normal
* fixed azure event hub tests to properly go through component logic
* fixed azure test and clean up for other tests
* renaming test files to match standard
* merged mqtt statestream test changes with base
* removed dependency on recorder filter schema from history
* fixed recorder tests after merge and a bunch of lint errors
* Squeezebox add config flow and player discovery
* Fixes to config flow
* Unavailable player detection and recovery
* Improved error message for auth failure
* Testing for squeezebox config flow
* Import configuration.yaml
* Support for discovery integration
* Internal server discovery
* Fix bug restoring previously detected squeezebox player
* Tests for user and edit steps in config flow
* Tests for import config flow
* Additional config flow tests and fixes
* Linter fixes
* Check that players are found before iterating them
* Remove noisy logger message
* Update requirements_all after rebase
* Use asyncio.Event in discovery task
* Use common keys in strings.json
* Bump pysqueezebox to v0.2.2 for fixed server discovery using python3.7
* Bump pysqueezebox version to v0.2.3
* Don't trap AbortFlow exception
Co-authored-by: J. Nick Koston <nick@koston.org>
* Refactor validate_input
* Update squeezebox tests
* Build data flow schema using function
* Fix linter error
* Updated en.json
* Update homeassistant/components/squeezebox/media_player.py
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/squeezebox/media_player.py
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/squeezebox/media_player.py
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/squeezebox/media_player.py
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update .coveragerc for squeezebox config flow test
* Mock TIMEOUT for faster testing
* More schema de-duplication and testing improvements
* Apply suggestions from code review
Co-authored-by: J. Nick Koston <nick@koston.org>
* Testing and config flow improvements
* Remove unused exceptions
* Remove deprecated logger message
* Update homeassistant/components/squeezebox/media_player.py
Co-authored-by: J. Nick Koston <nick@koston.org>
* Implement suggestions from code review
* Add async_unload_entry
* Use MockConfigEntry in squeezebox tests
* Remove unnecessary config schema
* Stop server discovery task when last config entry unloaded
* Improvements to async_unload_entry
* Fix bug in _discovery arguments
* Do not await server discovery in async_setup_entry
* Do not await start server discovery in async_setup
* Do not start server discovery from async_setup_entry until homeassistant running
* Re-detect players when server removed and re-added without restart
* Use entry.entry_id instead of unique_id
* Update unittests to avoid patching homeassistant code
Co-authored-by: J. Nick Koston <nick@koston.org>
* Refactor / update Awair integration
This commit does a few things, all in service of making the Awair
integration more modern and reliable. Specifically we do the following:
- Update to python_awair 0.1.1
- Begin using config entries / flow for setting up the integration.
- YAML support is completely removed.
- The integration now allows adding multiple Awair accounts, should a
user wish to do so (I found it _very_ useful in development).
- Group various Awair sensors into devices, using the device registry.
- Renames various sensors and treats the "dust" sensor as a particulate sensor.
- Device update rate-limits are no longer dynamically calculated; the
Awair API now separates rate-limits on a per-device basis.
- Supports sound pressure and illuminance sensors found on some Awair devices.
- We report the "awair index" for certain sensors as part of device_state_attributes.
The "index" is a subjective measure of whether or not a sensor reading
is "good" or "bad" (and to what extent). It's a component of the Awair
score, and it is useful on its own as an input for those who wish to
do things like "display this color if the value is 'bad'".
This is a breaking change, and requires updates to documentation and a
warning in the README. The breaking changes in detail, are:
- Support for all YAML configuration is removed, and users will need to
re-add the integration via the UI.
- We no longer support overriding device discovery via manual
configuration of device UUIDs. This was previously supported because
the Awair API had severe limits on the device list endpoints; however
those have since been removed.
- Gen 1 devices no longer show a "dust" sensor; rather we create a PM2.5
sensor and a PM10 sensor and just keep the values in sync. This better
reflects the sensor capabilities: it can detect particles in a range
from 2.5 -> 10, but cannot differentiate between sizes.
- Sensors are renamed as follows:
- "sensor.devicename_co2" -> "sensor.devicename_carbon_dioxide"
- "sensor.devicename_voc" -> "sensor.devicename_volatile_organic_compounds"
- "sensor.devicename_score" -> "sensor.devicename_air_quality_index"
- I've chosen to call the "Awair Score" an "air quality index" sensor,
because fundamentally the "Awair Score" and other air quality indices
(such as CAQI) do the same thing: they calculate a value based on a
variety of other inputs.
Under the hood, the integration has seen some improvements:
- We use the DataUpdateCoordinator class to handle updates, rather than
rolling our own update class.
- The code no longer tracks availability based on a timestamp returned
from the Awair service; we assert that if we have received a response
and the response has data for our device, then we are available (and
otherwise, not available). We don't need to test the actual Awair API
so heavily.
- Test coverage has been expanded to handle a variety of products that
Awair produces, not just the one I happen to own.
- Test coverage no longer concerns itself with testing behavior that is
now handled by the DataUpdateCoordinator; nor is it concerned with
ensuring that the overall component sets up and registers properly.
These are assumed to be well-tested functionaity of the core and not
things we need to re-test ourselves.
Finally - between library updates and integration updates, this
integration is well-positioned to support future updates. I have a
proof-of-concept patch for device automations, and the underlying
library now supports subclassing authentication (which clears the way
for us to use OAuth authentication for Awair).
* Wrap test fixture in mock_coro
Truthfully I'm not sure why this was passing on my local dev
environment, but I was developing with python 3.8 before. After
installing python 3.7, I was able to reproduce the CI failures and fix
them.
* Fix broken tests after #34901 and/or #34989
* Do not rename sensors so broadly
We're going to keep the sensors named as they were before, pending the
outcome of any decisions around the air_quality component and what names
should be standardized for air-quality-like devices.
If standardized names are selected (which does seem likely), then we
will update this integration to match them - at which point, it would be
a breaking change.
But for now, we'll keep names mostly identical to what users had before.
Notable in this commit is that we generate the entity_id ourselves,
rather than just allowing it to be auto-generated from the name
attribute. This allows us to provide more human friendly names, while
keeping the old format for entity ids. For example, given an Awair
device called "Living Room", we'll generate an entity id of
"sensor.living_room_voc" but show set the name of the device to "Living
Room Volatile organic compounds".
* Support import from config.yaml
We'll create a config entry from config.yaml the first time we're
loaded, and then defer to it from then on.
We ignore all keys other than the access_token, since we no longer need
to deal with per-account rate-limits (rather, everything is per-device
now).
* Add myself to CODEOWNERS
Since I wrote the initial integration, and now this re-write, it feels
appropriate for me to take care of the integration along with `danielsjf`.
* Remove name mangling
* Update homeassistant/components/awair/manifest.json
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update homeassistant/components/awair/config_flow.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update homeassistant/components/awair/sensor.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update homeassistant/components/awair/sensor.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Address some review feedback
* Set up reauth flow in a job, rather than awaiting
* Remove unnecessary title string
* Remove unnecessary config schema checking
As pointed out in review, because this comes in via import from
`configuration.yaml`, we can rely on the `PLATFORM_SCHEMA` validation instead.
* Fix tests
* Set unique_id appropriately for legacy devices
For users who have had this integration already installed (and who have
updated their home assistant installation sometime in recent history),
we want to ensure that unique_id's are set to the same thing as before,
to facilitate the upgrade process.
To do that, we add an additional property to the `SENSOR_TYPES` dict
(`ATTR_UNIQUE_ID`) which allows us to map modern sensor names from
python_awair to what older versions called them - ie: `humidity` ->
`HUMID`. We then use that value when constructing the unique ID. This
should allow users to upgrade and not lose configuration even if entity
IDs would otherwise change (because we have changed the name format that
generates entity IDs).
One note is that for the gen1 `DUST` sensor, we have to treat it
differently. This integration used to call that a "PM2.5" sensor, but
the unique_id generated would be something like `awair_12345_DUST`. So
we special-case that sensor, and do the same thing. We do not need to
special-case the PM10 sensor for gen1 devices, because we didn't create
a PM10 sensor in the past (we do now, because the "DUST" sensor is
really a hybrid PM2.5/PM10 sensor).
* Patch async_setup_entry for two tests
* Update awair config_flow to require / use an email address for unique_id
Also, only start one re-auth flow.
* Add a few more tests, try to get coverage up.
* Add another test
* Move attribution to device_state_attributes
* Don't require email
* Switch from Union[dict, None] to Optional[dict]
* Use a mock where requested
* Fix missing constant rename
* Use async_create_task
* Bump test coverage a bit for config_flow
* s/CONF_UNIQUE_ID/UNIQUE_ID/g
* Add warning about deprecated platform config
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Allow activity change on start of switch
Allow activity to be updated when a switch to a new activity is initiated instead of when it is completed.
* Updates based on feedback
Some items are not required to be done as YAML is not used anymore.
Cleaned-up some code.
* Fix for change on how to set callbacks
How callbacks are set now one has to set the new_activity and new_activity_starting as well, even just with None.
* Added callback update
Added so that when it is changed in the UI the callbacks will be changed as well.
* Added test cases for notify setting
Added test cases for config flow to test new setting for activity notifications.
* Vera now polls for all status data, no only incremental.
Vera polling is not handled using hass event loops with proper backoffs.
* Using long polling.
* Addressing PR feedback.
* Addressing PR feedback.
Adding controller stop on config unload.
* Bump python-synology to 0.8.2
* state_attributes to device_state_attributes
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
* Add config_flow to the dunehd integration
* Add tests
* Run gen_requirements_all
* Fix pylint error
* Better hostname validation
* Build device info in the class
* Improve configuration
* Read new properties for basic device information
Improve tests by mocking less improving stability of tests
* Clean up in device tests
* Support new port management api
* Improve initializing data
* Bump dependency to v28
* Requires 0.7.18 of elkm1 library to decode LD messages, and uses those messages to reliably set the arming/disarming user when there are more than one area. See https://github.com/home-assistant/core/issues/35310.
* Fixed typo
* Fixed off by one error -- LD command reports 1-based user-numbers which is the changed_by_id we want, but we need 0-based indices as argument to username.
* Bump required version of elkm1, remove logging message I was using for testing; prepping for PR.
* Black formatted
* Fixed bug whereby I needed to ref elements when running against released build of elkm1-lib
* Update plugwise async, config_flow and multi entity
* Update battery percentage
* Fix yamllint on services
* Fix yamllint on services
* Fix formatting for pyupgrade
* Update homeassistant/components/plugwise/__init__.py
Co-Authored-By: Robert Svensson <Kane610@users.noreply.github.com>
* Add try/except on setup
* Bump module version, battery version and valve position
* Removing sensor, switch, water_heater for later (child) PRs
* Catchup and version bump
* Remove title from strings.json
* Readd already reviewd await try/except
* Readd already reviewed config_flow
* Fix pylint
* Fix per 0.109 translations
* Remove unused import from merge
* Update plugwise async, config_flow and multi entity
* Update battery percentage
* Fix yamllint on services
* Fix yamllint on services
* Bump module version
* Bump module version, battery version and valve position
* Removing sensor, switch, water_heater for later (child) PRs
* Catchup and version bump
* Remove title from strings.json
* Fix pylint
* Fix per 0.109 translations
* Translations and config_flow, module version bump with required changes
* Translations and config_flow, module version bump with required changes
* Fix requirements
* Fix requirements
* Fix pylint
* Fix pylint
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/__init__.py
Improvement
Co-authored-by: J. Nick Koston <nick@koston.org>
* Include configentrynotready on import
* Update __init__.py
* DataUpdateCoordinator and comment non-PR-platforms
* Fix reqs
* Rename devices variable in favor of entities
* Rework updates with DataUpdateCoordinator
* Peer review
* Peer review second part
* Cleanup comments and redundant code
* Added required config_flow test
* Peer review third part
* Update service was replaced by DataUpdateCoordinator
* Corrected testing, version bump for InvalidAuth, move uniq_id
* Remove according to review
* Await connect (py38)
* Remove unneccesary code
* Show only when multiple
* Improve config_flow, rename consts
* Update homeassistant/components/plugwise/climate.py
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update homeassistant/components/plugwise/climate.py
Co-authored-by: J. Nick Koston <nick@koston.org>
* Process review comments
Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
* Add support for Elexa Guardian water valve controllers
* Zeroconf + cleanup
* Sensors and services
* API registration
* Service bug fixes
* Fix bug in cleanup
* Tests and coverage
* Fix incorrect service description
* Bump aioguardian
* Bump aioguardian to 0.2.2
* Bump aioguardian to 0.2.3
* Proper entity inheritance
* Give device a proper name
* Code review
* add tests
* better error handling in dependency
* dont suppress errors
* add support for multiple devices
* add test for Unauthorized status
* raise error on service call failure
* Working PoC
* Store
* Handle subscribing to MQTT and stopping stream when first telegram arrives
* Improve naming
* Now with test
* Better strings
* Fix Martins comments
* Improve mock device patching
* Bump dependency to v27
Add MQTT as after dependency