* Consolidate switch entities to one class
* Move turn on/off into UnifiSwitchEntity
* Add event subscription
Remove storing entity for everything but legacy poe switch
* Only one entity class
* Improve generics naming
* Rename loader to description
* Improve control_fn naming
* Move wrongfully placed method that should only react to dpi apps being emptied
* Improve different methods
* Minor renaming and sorting
* Mark callbacks properly
* Support case-insensitive matching
* Revert "Support case-insensitive matching"
This reverts commit 0fdb2aa6bc.
* Explicitly check the case of matcher fields in `async_is_plugged_in`
The CI sets the timezone to US/Pacific and the logbook
uses start_of_local_day when called without a time.
We now call the logbook api with a specific time to
avoid them being out of sync since the test would
fail at CET 8:55am on Mon Nov 7th 2022 (and probably
other dates)
* Added initial files for air-Q integration
* Allow FIXME comments in pylint (temporary)
Also reintroduce --ignore-missing-annotations=y
* Set up air-q entry to connect to aioairq's API (initial attempt)
Also add necessary constants
* Implement a class for sensors and its update logic
Very early stage, WIP
* Zeroconf and authentication are working
* Complete the bare-bone minimal working version
Specifically, make AirQSensor update its values.
* Handle invalid authentication gracefully
* Handle ClientConnectionError gracefully
* Add field hint for the login form
The key in the schema, which defines the form in
`ConfigFlow.async_show_form` is looked up in both `airq/strings/json`
and `airq/translations/en.json`. I am still not 100% sure how this
lookup is performed. WIP
* Minor cleanups
* Extend sensor list to all supported by SensorDeviceClass
Also manage warming up sensors
* aioairq is published to PyPI and mentioned in requirements
* Reordered constants and list content alphabetically
As required by style guides. Also turned SENSOR_TYPES to a list
* Updated file docstrings for a dev unfamiliar w/homeassistant like myself
* Adding a bit of logging for the integration setup process
* Expose scan interval & smoothing flag
Also streamline test_authentication in config_flow.
* Fix a type annotation mistake
* Use as many constants from homeassistant.const as possible
My only concern is using CONST_IP_ADDRESS = "ip_address" for smth which
stands for both IP address and mDNS...
* Temporarily rollback ConfigFlow.async_step_configure and use defaults
TODO: implement OptionFlowHandler instead
* Define custom Coordinator, w subset of airq config
The latter is then accessed from entity / sensor constructors to define
correct DeviceInfo
* Provide translations to de & fr + minor changes to en
* Provide translations to ru + a minor en changes
* Make translation a little more helpful and polite
* Fix devicename and entry title
* Remove stale commented out code
* Test config_flow
At this point two helper functions which interact with the external
library are not tested
* Clean up unrelated and meant as temporary changes
* Clean up unnecessary comments meant for internal use
* Move fetching config to a dedicated async coordinator method
As opposed to it being a potentially poorly justified step in
async_setup_entry
* Remove zeroconf support since it is not yet ready
* Remove translations other than en
* Remove unnecessary comments, manifest.json entries, and constants
* Improve exception handling
- `_LOGGER` uses `debug` and not `error` levels.
- Drop `ClientConnect` and catch `aiohttop.ClientConnectError` directly
- Drop `Exception` as it is not expected from `aioairq` (remove the
corresponding test too)
* Drop strings for obsolete errors and steps
Specifically, `unknown` error isn't caught any more. `configure` step
has also been removed.
* Refactor en.json to be consistent with strings.json
* Move target_route from a coordinator argument to a constant
At this point a user cannot configure the target_route route, thus it
does not make sense to expose it half-heartedly in
`AirQCoordinator.__init__`, since it cannot be accessed.
* Fix an async call in `AirQCoordinator.async_setup_entry`
* Refactor underlying aioairq API
- Use `homeassistant.helpers.aiohttp.async_get_clientsession` and pass a
single persistent session to `aioariq.AirQ.__init__`
- `aioairq.AirQ.fetch_device_info` now returns a `DeviceInfo` object heavily
inspired and almost compatible with `homeassistant.helpers.entity.DeviceInfo`.
Make heavier use of this object and define a single `DeviceInfo` in the
`AirQCoordinator` (instead of recreating the same object for each sensor
of the device in `sensor.AirQSensor`)
- Drop two helper functions in `config_flow.py` and operate on `aioariq.AirQ`
methods directly
* Fix the version of aioairq
* Add 15 more sensors + icons
* Remove cnt* & TypPS, change units of health & performance
* Add 12 more sensors
* Add a missing icon
* Gracefully handle device not being available on setup
If the device and the host are not on the same WiFi,
ServerTimeoutError is raised, which is caught by
ClientConnectionError.
If the device is powered off, ClientConnectionError is expected.
In both cases, ConfigEntryNotReady is raised, as prescribed by the docs.
Newer version of aioairq times-out far quicker than the default 5 mins.
* Rename two sensors
* Validate provided IP address / mDNS
aioairq now raises InvalidInput if provided IP / mDNS does not seem
valid. Handle this exception correctly
* Apply suggestions from code review
Clean up the comments and rename the logger
Co-authored-by: Erik Montnemery <erik@montnemery.com>
Co-authored-by: Artem Draft <Drafteed@users.noreply.github.com>
* Only fetch device info during the first refresh
- Fetched info is stored in AirQCoordinator.device_info.
- In `AirQSensor.native_value` only multiply by the factor if
the sensor reading is not None
- Fix the tests for ConfigFlow for aioairq==0.2.3. Specifically
make the dummy data pass the new validation step upstream
+ add a test which fails it
* Drop custom device classes for now
* Apply suggestions from code review
Co-authored-by: Artem Draft <Drafteed@users.noreply.github.com>
* Only fetch device info during ConfigFlow.async_step_user
Store the result obtained by `airq.fetch_device_info` it in
`config_entry.data`. Pass the entire config entry to `AirQCoordinator`
and build the entire `homeassistant.helpers.entity.DeviceInfo` in the
`AirQCoordinator.__init__`. This makes
`AirQCoordinator._async_fetch_device_info` and overloaded
`AirQCoordinator._async_config_entry_first_refresh` obsolete.
Bump aioairq version.
Turn update_interval from `AirQCoordinator.__init__` argument into a
contestant.
* Custom entity description exposing a hook to modify sensor value
Use a `AirQEntityDescription` with a callable `value_fn` which allows to
change the sensor value retrieved from the device. Note that the
callable does not handle data retrieval itself (even from
`coordinator.data`). Instead it is purely a hook to transform obtained
value.
* Avoid duplicated use of unique_id
Device info is fetched during the `ConfigFlow.async_user_step`.
`unique_id` is taken from the device info and is **not** stored
in `config_entry.data`. Subsequently `config_entry.unique_id` is
used instead.
* Drop unnecessary try-except
Co-authored-by: Artem Draft <Drafteed@users.noreply.github.com>
* Clarify the use of value_transform_fn
* Refactor the use of lambdas in AirQEntityDescription
Now it is the job of the callable under `value` to get the sensor
reading from the coordinator's data. Factoring this functionality into a
callback decouples the key of the description from the key of dict,
returned by the API, so `AirQEntityDescription` no longer requires its key
to be set to smth clearly internal (e.g. `nh3_MR100`).
* Use a callback to update native_value
Since all `native_value`s are updated synchronously, it can as well be
done in a callback for better state consistency (right?)
* Revert the description keys to match data keys
Must match given the current way of identifying available sensors. On a
broader scale, they must match to be able to relate the descriptions to
sensors, unless a separate lookup table is maintained.
* Reduce number of loops when adding sensors
Filtering warming up sensors and non-sensor keys can be combined with
adding entities.
* Remove obsolete imports
* Update integrations.json
* Add integration_type
Integration supports multiple devices => hub
Co-authored-by: dl2080 <daniel.lehmann@runbox.com>
Co-authored-by: Erik Montnemery <erik@montnemery.com>
Co-authored-by: Artem Draft <Drafteed@users.noreply.github.com>
Co-authored-by: Daniel Lehmann <43613560+dl2080@users.noreply.github.com>
Co-authored-by: Martin Selbmann <job@martin-selbmann.de>
* use DataUpdateCoordinator for glances
add tests to increase coverage
fix test_config_flow.py
fix codecov/patch
remove unused const, minor tweaks
remove invalid_auth test as it is not implemented
fix type hints
* change to async_forward_entry_setups
* Use Dataupdatecoordinator for glances
* minor fixex
* minor fixes
* minor fix
* remove support_versions const
* coe cleanup
* address comments
* fix sensor native_value
* Rename entry to entry_data in `get_api`
* Remove whitespace in sensor name
* Review comments from #74325
* Remove moved test
* Fix init
* Handle no data
* Remove print
* Fix tests
* PlatformNotReady if no data
* Recover failed platform setup
* Fix broken test
* patch context
* reset test init
* Move to platform
* asyncio gather
* Remove duplicate code
* Improve typing device_tracker discovery
* Improve typing device_tracker yaml
* Add test source_type attribute
* Follow up comment
* Initialize at `__init__` not at class level.
* Use full name for return variable
* Correct import, remove assert
* Use AsyncSeeCallback
* Sync google calendar and serve from local storage
Update to use new gcal_sync APIs
Update google calendar filter logic
Remove storage on config entry removal
Make timeline queries timezone aware
Do not block startup while syncing
* Minor readability tweaks
* Remove unnecessary args to async_add_entities
* Change how task is created on startup
* Update homeassistant/components/google/calendar.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Revert min time between updates
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Add GJ as supported unit for energy sensors
* Update homeassistant/const.py
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
* Added EventBridge support to aws integration
* Added type hints for all aws notification services + Added unit tests for EventBridge AWS integration
* Increase line coverage for unit tests for aws integration.
* mapping
* update
* working
* tests
* fixes
* temp add binary sensor platform to make sure it works
* fixes
* 100% cover
* adjust
* disable chatty sensors by default
* remove binary sensor_platform for next PR
* time is much nicer than counter
* Add suggested_unit_of_measurement attribute to sensors
* Lazy calculation of initial entity options
* Add type alias for entity options
* Small tweak
* Add tests
* Store suggested_unit_of_measurement in its own option key
* Adapt to renaming of IMPERIAL_SYSTEM
* Fix rebase mistakes
* Apply suggestions from code review
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
* Move advanced broker settings to entry
* Add repair issue for deprecated settings
* Split CONFIG_SCHEMA
* Do not store certificate UI flags in entry
* Keep entered password in next dialog
* Do not process yaml config in flow
* Correct typo
* Use distance device class for sensors
* Change sensor name casing and unique_id
* Migrate sensor entity unique_id
* Match title-cased unique_id when migrating
* Remove unneeded regex to find '_' delimited id suffix
* Incorporate PR review comments
* Add check to prevent extra odometer entity migration
Move default options to config_flow
Signed-off-by: Kevin Stillhammer <kevin.stillhammer@gmail.com>
Signed-off-by: Kevin Stillhammer <kevin.stillhammer@gmail.com>
* Add binary_sensor platform, with test.
* Applied suggestions by @epenet
* refactor: as @epenet suggested, passing entity_description to init
* Update homeassistant/components/blebox/binary_sensor.py
@epenet suggestion, moved refactored logic of create_blebox_entities into BleBoxBinarySensorEntity init
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
* refactor: as @epenet class selector and entity creation moved to binary_sensor
* refactor: list comprehension in entity list setup in binary sensor
* Update homeassistant/components/blebox/binary_sensor.py
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
* Bump aioshelly to 4.0.0
* Remove leftover
* Fix number platform
* Set last_update_success to false upon failure in number and climate
* Set last_update_success upon failurie in entity
* Migrate Broadlink to new entity naming style
Signed-off-by: Patrick ZAJDA <patrick@zajda.fr>
* Add some tests
Signed-off-by: Patrick ZAJDA <patrick@zajda.fr>
Signed-off-by: Patrick ZAJDA <patrick@zajda.fr>
* Streamline Enphase Envoy config flow tests
* Don't test data results using constants
* Add diagnostics to Enphase Envoy
* Use whole config entry
* Redact serial number
* One call
* Update bsblan integration
Update the integration to current standards
* removed unused code
update coverage
* some cleanup
* fix conflicts due upstream changes
* fix prettier json files
* fix remove comment code
* use dataclass instead of tuple
* fix spelling
* Set as class attribute
main entity doesn't need to give own name
* fix requirements
* Reduce missed coverage in zwave_js.climate and cover
* Add switch platform coverage
* Add select platform
* Add lock platform
* Remove one line of coverage from number platform
* update docstring
If we saw the non-connectable scanner advertisement first we would reject
the connectable scanner advertisement because it had worse signal strength.
In this case we need to check both
* Display and log google_travel_time errors
* Rename is_valid_config_entry to validate_config_entry
Signed-off-by: Kevin Stillhammer <kevin.stillhammer@gmail.com>
Signed-off-by: Kevin Stillhammer <kevin.stillhammer@gmail.com>
* Only reload modified automations
* Update tests
* Adjust spelling
* Improve efficiency of matching automations and configurations
* Reload automations without an alias if they have been moved
* Add test
* Add test
* Add test
* try serializing cluster command schemas
* use min and max value from zigpy type
* different type assignments
* initial command execution changes
* cleanup
* cleanup and typing
* typing
* typing
* add tests
* mypy
* handle raw values too
* check for None responses
* make backwards compatible
* update yaml for svc change
* Bump Wallbox package
* remove debug message
* Force update of auth token by emptying it first
* Force token refresh by emptying token
Improve exception handling
* include tests
* Update __init__.py
* Removed the clearing ot jwt token, issue is fixed by upstream fix in wallbox package.
* Catch connectionerror
* Update homeassistant/components/wallbox/__init__.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Run black
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Cleanup unused option in google travel time
* Adjust tests
* Adjust to use local constant
* Tweak logic
* Reduce size of PR
* Add tests
* Use system compare
* Use is not ==
* Adjust to use local constant again
* merge upstream/dev
* remove comment
* coverage increase
* merge upstream/dev
* refactor
* wait for another PR
* remove left overs
* wait for next PR
* only remove on successful unload
Co-authored-by: Shay Levy <levyshay1@gmail.com>
Co-authored-by: Shay Levy <levyshay1@gmail.com>
* Add reauth flow
* Cover cases without existing password
* Add test to verify upgrading from older versions
* Connect to the device first
* Use Mapping for async_step_reauth
* Set empty password for user step and remove unneeded update of unique_id
* Do not write old state sharing availability topic
* Add a test
* Support for all availability topics
* delay async_write_ha_state till last callback
* Process write req after processing callback jobs
* Do not count subscription callbacks
* Simplify
* Stale docsting
* No topic needed for delays state write
* No need to clear when reloading
* Move test to test_mixins.py
* Only set up sensor platform for test
* Update Config Flow to show cozytouch unsupported hardware error
* Apply feedback
* Remove vague unknown user exception
* Fix test
* Code coverage back to 100%
* Add visual preview during setup of generic camera
* Code review: standardize preview url
* Fix slug test
* Refactor to use HomeAssistantView
* Code review: simplify
* Update manifest
* Don't illegally access protected member
* Increase test coverage
* Prevent browser caching of preview images.
* Code review:move incrementor to ?t=X + simplify
* Discard old flow preview data
* Increase test coverage
* Code review: rename variables for clarity
* Add timeout for image previews
* Fix preview timeout tests
* Simplify: store cam image preview in config_flow
* Call step method to transition between flow steps
* Only store user_input in flow, not CameraObject
* Fix problem where test wouldn't run in isolation.
* Simplify test
* Don't move directly to another step's form
* Remove unused constant
* Simplify test
Co-authored-by: Dave T <davet2001@users.noreply.github.com>
* Fix bluetooth diagnostics on macos
The pyobjc objects cannot be pickled which cases dataclasses
asdict to raise an exception when trying to do the deepcopy
We now implement our own as_dict to avoid this problem
* add cover
* Use uuid as clientid/nickname
* Fixes after rebase
* Move gen_instance_ids() to utils
* Store client_id and nickname in config_entry
* Update tests
* Clean names
* Rename consts
* improve device_automation trigger validation
Validates the trigger configuration against the device_trigger schema before trying to access any of the properties in order to provide better error messages.
Updates the error message to include an explicit indication that the error is coming from a trigger configuration. The inner error message from the validator can be accessed by viewing the stack trace.
Add test case for trigger missing domain.
Make action and condition validation consistent with trigger. This is not strictly necessary, but should be helpful for certain use cases that bypass some of the outer validation.
Removed redundant schema elements from humidifier device_trigger.
**Blueprint with missing `domain`**
```
2022-07-12 06:02:18.351 ERROR (MainThread) [homeassistant.setup] Error during setup of component automation
Traceback (most recent call last):
File "/workspaces/core/homeassistant/setup.py", line 235, in _async_setup_component
result = await task
File "/workspaces/core/homeassistant/components/automation/__init__.py", line 241, in async_setup
if not await _async_process_config(hass, config, component):
File "/workspaces/core/homeassistant/components/automation/__init__.py", line 648, in _async_process_config
await async_validate_config_item(hass, raw_config),
File "/workspaces/core/homeassistant/components/automation/config.py", line 74, in async_validate_config_item
config[CONF_TRIGGER] = await async_validate_trigger_config(
File "/workspaces/core/homeassistant/helpers/trigger.py", line 59, in async_validate_trigger_config
conf = await platform.async_validate_trigger_config(hass, conf)
File "/workspaces/core/homeassistant/components/device_automation/trigger.py", line 67, in async_validate_trigger_config
hass, config[CONF_DOMAIN], DeviceAutomationType.TRIGGER
KeyError: 'domain'
```
**Blueprint with missing `property` (specific to zwave_js event schema)**
```
2022-07-12 06:09:54.206 ERROR (MainThread) [homeassistant.components.automation] Blueprint Missing Property generated invalid automation with inputs OrderedDict([('control_switch', '498be56d796836a67406e9ad373d23db')]): required key not provided @ data['property']. Got None
```
**Blueprint with missing `domain`**
```
2022-07-12 06:12:16.080 ERROR (MainThread) [homeassistant.components.automation] Blueprint Missing Domain generated invalid automation with inputs OrderedDict([('control_switch', '498be56d796836a67406e9ad373d23db')]): invalid trigger configuration: required key not provided @ data['domain']. Got <homeassistant.components.blueprint.models.BlueprintInputs object at 0x7f581e097820>
```
**Blueprint with missing `property` (specific to zwave_js event schema)**
```
2022-07-12 06:12:16.680 ERROR (MainThread) [homeassistant.components.automation] Blueprint Missing Property generated invalid automation with inputs OrderedDict([('control_switch', '498be56d796836a67406e9ad373d23db')]): invalid trigger configuration: required key not provided @ data['property']. Got <homeassistant.components.blueprint.models.BlueprintInputs object at 0x7f581c0dc9d0>
```
* Revert humifidier TRIGGER_SCHEMA change.
* Update sensor.py
* Change "EV Time to Fully Charged" type to datetime object (HA 2022.2)
* Validate types before accessing dict entries
* Test handling of invalid data from Subaru
* Bump to subarulink 0.4.2
* Incorporate style suggestion
* Update sensor.py to use SensorEntity
* isort tests
* Remove SubaruSensor.current_value
* Fix isort errors
* Resolve conflict from previous PR (add locks)
* Fix linting errors in config_flow.py
* Incorporate PR review comments for sensor
* Incorporate PR review comments for sensor
* Make 3rd party library responsible for API data parsing
* Add type annotations to sensor.py
* Incorporate PR review comments
* Incorporate PR review comments
* Set _attr_has_entity_name = True for sensors