* Prevent powerwall from switching addresses if its online
If the wifi interface was discovered we would switch the
ip address in the entry to the wifi ip even if it was
connected via ethernet
* cover
* more cover
* Switch entity
* adding missing function for tests
* Apply suggestions from code review
Co-authored-by: Sebastian Lövdahl <slovdahl@hibox.fi>
* Review
* fix
* Update homeassistant/components/vallox/switch.py
Co-authored-by: Andre Richter <andre-richter@users.noreply.github.com>
* Apply suggestions from code review
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Adding a separate parameter for the expected state
Co-authored-by: Sebastian Lövdahl <slovdahl@hibox.fi>
Co-authored-by: Andre Richter <andre-richter@users.noreply.github.com>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Offload platform specific bluetooth code to bluetooth-adapters
* adjust
* fix some more patch targets
* more test fixes
* almost there
* may not be setup yet
* more fixes
* fixes
* fix test
* fix merge
* Use parameterized test for better code readability
* Use parameterized test for better code readability
* Update tests/components/fibaro/test_config_flow.py
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
* Addition of battery level sensor. Correction of pylint errors
* Review improvement for typing
* Review improvement for typing
* Correction following review
* Use HERE API v8
Signed-off-by: Kevin Stillhammer <kevin.stillhammer@gmail.com>
* Add migration
Signed-off-by: Kevin Stillhammer <kevin.stillhammer@gmail.com>
* Catch correct voluptuous error
Signed-off-by: Kevin Stillhammer <kevin.stillhammer@gmail.com>
* Use list comprehension for transit values
* Add migration alternative
Signed-off-by: Kevin Stillhammer <kevin.stillhammer@gmail.com>
* Add Picnic services for searching products and adding products to the cart
* Improve the Picnic services implementation and add unit tests
* Fix pre-commit check issues
* Fix comments and example product name
* Remove search service, update add_product service schema
* Fix pylint suggestion
* Add more tests and removed unused code
* Remove code needed for the removed service, clean tests from obvious comments and add type hints
* Remove unused import
* Remove unnecessary comments and simplify getting the config entry id
Co-authored-by: Allen Porter <allen.porter@gmail.com>
* Don't use hass.data in tests, make device id mandatory for service
* Rewrite all service tests so using lru.cache is not needed
* Add test for uncovered line in _product_search()
* Require a config entry id as service parameter instead of device id
* Use explicit check in get_api_client() and raise HomeAssistantError
* Fix HomeAssistantError import, fix services tests
* Change HomeAssistantError to ValueError when config entry is not found
Co-authored-by: Allen Porter <allen.porter@gmail.com>
* Add option to include attachments from remote URL to Discord notifications
* Use aiohttp instead of requests for Discord Notify URL retrieval
* Refactor discord notifications code
* Remove unecessary images check in discord notifier
* Implemented RestoreEntity
Merged commit conflict
* removed accidental change
* Update homeassistant/components/dynalite/dynalitebase.py
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* added tests for the state
* added tests for switch state
* moved to ATTR_x and STATE_x instead of strings
some fixes to test_cover
* moved blind to DEVICE_CLASS_BLIND
* used correct constant instead of deprecated
* Implemented RestoreEntity
* removed accidental change
* added tests for the state
* added tests for switch state
* moved to ATTR_x and STATE_x instead of strings
some fixes to test_cover
* fixed isort issue from merge
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Revert google calendar back to old API for free/busy readers
* Update homeassistant/components/google/calendar.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Bump gcal_sync to 4.0.1
This reverts test chagnes from PR #81562 that were actually incorrect given
the calendar "get" API returns less information that the "CalendarList" api.
* deconz: Use partition instead of split where possible
With a smattering of code deduplication
Split out of #81493
* Update homeassistant/components/deconz/util.py
Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>
Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>
* Initial support for modbus
* Complete test coverage of config flow
* Bump to 1.1.0 with corrected numbers
* Handle missing mapping for reset-alarm
* Fixup type checks after library bump
* Adjust coil number
* Move word_swap to nibegw
* Adjust to 1.1.2 with fixes
* Add series property
* Add S series models
* Correct test for invalid host
* Apply suggestions from code review
Co-authored-by: J. Nick Koston <nick@koston.org>
* Move some things into library
* Adjust strings somewhat
* Correct black
* Correct test after validation change
Co-authored-by: J. Nick Koston <nick@koston.org>
* 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