Commit Graph

66 Commits

Author SHA1 Message Date
Tom Schneider 8f2567f30d
Add config_flow to shopping_list (#32388)
* Add config_flow to shopping_list

* Fix pylint unused import error

* Use _abort_if_unique_id_configured

* Remove SHOPPING_LIST const

* Use const.py for DOMAIN and CONF_TYPE

* Fix tests

* Remove unchanged variable _errors

* Revert CONF_TYPE (wrong usage)

* Use consts in test

* Remove import check

* Remove data={}

* Remove parameters and default values

* Re-add data={}, because it's needed

* Unique ID checks and reverts for default parameters

* remove pylint comment

* Remove block till done

* Address change requests

* Update homeassistant/components/shopping_list/strings.json

Co-Authored-By: Quentame <polletquentin74@me.com>

* Update homeassistant/components/shopping_list/strings.json

Co-Authored-By: Quentame <polletquentin74@me.com>

* Update tests/components/shopping_list/test_config_flow.py

Co-Authored-By: Quentame <polletquentin74@me.com>

* Update tests/components/shopping_list/test_config_flow.py

Co-Authored-By: Quentame <polletquentin74@me.com>

* Update tests/components/shopping_list/test_config_flow.py

Co-Authored-By: Quentame <polletquentin74@me.com>

* Update tests/components/shopping_list/test_config_flow.py

Co-Authored-By: Quentame <polletquentin74@me.com>

* Only test config_flow

* Generate translations

* Move data to end

* @asyncio.coroutine --> async def, yield from --> await

* @asyncio.coroutine --> async def, yield from --> await (tests)

* Remove init in config flow

* remove if not hass.config_entries.async_entries(DOMAIN)

* Add DOMAIN not in config

* Fix tests

* Update homeassistant/components/shopping_list/config_flow.py

Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>

* Fix tests

* Update homeassistant/components/shopping_list/__init__.py

Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>

Co-authored-by: Quentame <polletquentin74@me.com>
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-03-06 10:17:30 -08:00
Paulus Schoutsen 1603f7ac21
Add coronavirus integration (#32413)
* Add coronavirus integration

* Update homeassistant/components/coronavirus/manifest.json

Co-Authored-By: Franck Nijhof <git@frenck.dev>

Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2020-03-02 13:40:11 -08:00
Aaron Bach e9a7b66df6
Add config entry for AirVisual (#32072)
* Add config entry for AirVisual

* Update coverage

* Catch invalid API key from config schema

* Rename geographies to stations

* Revert "Rename geographies to stations"

This reverts commit 5477f89c24cb3f58965351985b1021fc5fc794a5.

* Update strings

* Update CONNECTION_CLASS

* Remove options (subsequent PR)

* Handle import step separately

* Code review comments and simplification

* Move default geography logic to config flow

* Register domain in config flow init

* Add tests

* Update strings

* Bump requirements

* Update homeassistant/components/airvisual/config_flow.py

* Update homeassistant/components/airvisual/config_flow.py

* Make schemas stricter

* Linting

* Linting

* Code review comments

* Put config flow unique ID logic into a method

* Fix tests

* Streamline

* Linting

* show_on_map in options with default value

* Code review comments

* Default options

* Update tests

* Test update

* Move config entry into data object (in prep for options flow)

* Empty commit to re-trigger build
2020-02-28 20:14:17 -07:00
J. Nick Koston 3e702c8ca4
Add Config Flow for sense (#32160)
* Config Flow for sense

* Fix unique ids so they are actually unique (and migrate the old ones)

* Fix missing solar production

* Do not mark sensors available until they have data

* Address review items

* Address review round #2
2020-02-25 16:37:41 -07:00
J. Nick Koston 2925e0617c
Add Config flow to august (#32133)
* Add battery sensors for August devices

* Additional tests and cleanup in prep for config flow
  and device registry

* pylint

* update name for new style guidelines - https://developers.home-assistant.io/docs/development_guidelines/#use-new-style-string-formatting

* Config Flow for august push

* Update homeassistant/components/august/__init__.py

Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>

* Address review items

* Update tests

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-02-25 10:18:15 -08:00
Emanuel Winblad 3e05fc1c11
Add initial version of Vilfo Router integration (#31177)
* Initial implementation of Vilfo router integration.

This commit is a combination of several commits, with commit messages in bullet form below.

* Added additional files to Vilfo integration.
* Added generated files.
* Fixed alphabetic order in generated config_flows.
* Continued implementation of config flow for Vilfo integration.
* Continued work on config_flow for Vilfo.
* Updated requirements in manifest for Vilfo Router integration.
* Some strings added to Vilfo Router integration.
* Vilfo Router integration updated with sensor support.
* Code style cleanup.
* Additional cleanup of config flow.
* Added additional UI strings for Vilfo Router
* Updated tests of config flow and fixed formatting
* Updated requirement upon vilfo-api-client.
* Sensor refactoring including support for icons
* Code style changes for Vilfo Router integration
* Code cleanup
* Fixed linting issues in Vilfo Router integration
* Fixed import order in test for Vilfo integration.

* Updates to Vilfo Router integration based on feedback

Based on the feedback received, updates have been made to the Vilfo Router integration.

A couple of the points mentioned have not been addressed yet, since the appropriate action has not yet been determined. These are:

* https://github.com/home-assistant/home-assistant/pull/31177#discussion_r371124477
* https://github.com/home-assistant/home-assistant/pull/31177#discussion_r371202896

This commit consists of:

    * Removed unused folder/submodule
    * Fixes to __init__
    * Fixes to config_flow
    * Fixes to const
    * Refactored sensors and applied fixes
    * Fix issue with wrong exception type in config flow
    * Updated tests for Vilfo integration config_flow
    * Updated dependency upon vilfo-api-client to improve testability
    * Import order fixes in test
    * Use constants instead of strings in tests

* Updated the VilfoRouterData class to only use the hostname as unique_id when it is the default one (admin.vilfo.com).

* Refactored based on feedback during review.

* Changes to constant names,
* Blocking IO separated to executor job,
* Data for uptime sensor changed from being computed to being a timestamp,
* Started refactoring uptime sensor in terms of naming and unit.
* Updated constants for boot time (previously uptime) sensor.
* Refactored test of Vilfo config flow to avoid patching code under test.
* UI naming fixes and better exception handling.

* Removed unused exception class.

* Various changes to Vilfo Router integration.

* Removed unit of measurement for boot time sensor,
* Added support for a sensor not having a unit,
* Updated the config_flow to handle when the integration is already configured,
* Updated tests to avoid mocking the code under test and also to cover the aforementioned changes.

* Exception handling in Vilfo Router config flow refactored to be more readable.

* Refactored constant usage, fixed sensor availability and fix API client library doing I/O in async context.

* Updated signature with hass first

* Update call to constructor with changed order of arguments
2020-02-12 19:11:15 +01:00
Kit Klein 3435281bd1
Support Konnected Pro alarm panel, embrace async, leverage latest HA features/architecture (#30894)
* fix unique_id computation for switches

* update konnected component to use async, config entries, registries. Pro board support and tests

* clean up formatting comments from PR

* use standard interfaces in tests

* migrate config flow to use options

* address latest pr feedback

* format for import as part of config schema validation

* address pr feedback

* lint fix

* simplify check based on pr feedback

* clarify default schema validation

* fix other schema checks

* fix translations

Co-authored-by: Nate Clark <nate@nateclark.com>
2020-02-11 22:04:42 +01:00
Ziv 4467409e5c
Dynalite Integration (#27841)
* Initial commit

* ran hassfest and gen_requirements_all scripts

* fixes per request from Paulus Schoutsen

* ran gen_requirements_all

* updated library version - removed some debug leftover

* get_requirements again...

* added documentation URL

* ran isort

* changed storage in hass.data[DOMAIN] to use entry_id instead of host

* adopted unit tests to latest fix

* Update const.py

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-02-10 13:16:04 -08:00
Vilppu Vuorinen b78d156f0e
Add MELCloud integration (#30712)
* Add MELCloud integration

* Provides a climate and sensor platforms. Multiple platforms on one go
is not the best option, but it does not make sense to remove them and
commit them later either.

* Email and access token are stored to the ConfigEntry. The token can be
updated by adding the integration again with the same email address. The
config flow is aborted and the update is performed on the background.

* Run isort

* Fix pylint errors

* Run black

* Increase coverage

* Update pymelcloud dependency

* Add HVAC_MODE_OFF emulation

* Remove print

* Update pymelcloud to enable device type filtering

* Collapse except blocks and chain ClientNotReadys

* Add preliminary documentation URL

* Use list comp for creating model info

Filters out empty model names form units.

* f-string galore

Dropped 'HVAC' from AtaDevice name template.

* Delegate fan mode mapping to pymelcloud

* Fix type annotation

* Access AtaDevice through self._device

* Prefer list comprehension

* Update pymelcloud to leverage device type grouping

The updated backend lib returns devices in a dict grouped by the device
type. The devices do not necessarily need to be in a single list and
this way isinstance is not required to extract devices by type.

* Remove DOMAIN presence check

This does not seem to make much sense after all.

* Fix async_setup_entry

Entry setup used half-baked naming from few experimentations back.
The naming conventiens were unified to match the platforms.

A redundant noneness check was also removed after evaluating the
possible return values from the backend lib.

* Simplify empty model name check

* Improve config validation

* Use config_validation strings.

* Add CONF_EMAIL to config schema. The value is not strictly required
when configuring through configuration.yaml, but having it there makes
things more consistent.

* Use dict[key] to access required properties.

* Add DOMAIN in config check back to async_setup. This is required if an
integration is configured throught config_flow.

* Remove unused manifest properties

* Remove redundant ClimateDevice property override

* Add __init__.py to coverage exclusion

* Use CONF_USERNAME instead of CONF_EMAIL

* Use asyncio.gather instead of asyncio.wait

* Misc fixes

* any -> Any

* Better names for dict iterations

* Proper dict access with mandatory/known keys

* Remove unused 'name' argument

* Remove unnecessary platform info from unique_ids

* Remove redundant methods from climate platform

* Remove redundant default value from dict get

* Update ConfigFlow sub-classing

* Define sensors in a dict instead of a list

* Use _abort_if_unique_id_configured to update token

* Fix them tests

* Remove current state guards

* Fix that gather call

* Implement sensor definitions without str manipulation

* Use relative intra-package imports

* Update homeassistant/components/melcloud/config_flow.py

Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-02-10 22:09:12 +01:00
elmurato 699d6ad658
Add Minecraft Server Integration (#30992)
* Add Minecraft Server integration

* Add unit test for config flow

* Fixed some review findings and increased unit test coverage

* Fixed docstrings of new test cases

* Removed unnecessary debug log messages

* Added unique IDs and device infos and removed duplicate name validation

* Attempt to fix unit test on CI

* Return state OFF instead of UNAVAILABLE in case connection to server drops

* Added property decorator to server properties, even less debug messages, improved sensor dispatcher connection and other review findings fixed

* Moved special property handling to sensors, fixed name confusion in sensor entity, switch to HA const for scan_interval, simplified building players list string

* Improved periodic update, speeded up unit tests

* Added type hints, added callback decorator to entity update callback, added const.py to unit test exclusions

* Changed state sensor to binary sensor, removed empty unit test file, added constants for icons and units

* Let HA handle unknown state, check for None in description and players list sensor

* Removed periods at end of log messages, removed constant for default host

* Updated requirements_test_pre_commit.txt, fixed codespell findings

* Use localhost as default host

* Removed passing hass to entities, moved log message from init, moved host lower to vol, use proper patch library, patch library instead of own code

* Replaced server properties with global instance attributes, removed config option scan_interval, switch back to async_track_time_interval

* Removed description and players list sensors, added players list as state attributes to online players sensor, raise OSError instead of deprecated IOError, other minor review findings fixed

* Use MAC address for unique_id in case of an IP address as host, added getmac to manifest.json, added invalid_ip to strings.json, added new test cases for changes in config_flow, replace all IOError's with OSError, other review findings fixed

* Removed double assignment

* Call get_mac_address async safe

* Handle unavailable and unknown states to reach silver quality scale, added quality scale to manifest.json
2020-02-08 09:28:35 +01:00
Malte Franken 8d429d7676
Add GDACS feed integration (#31235)
* initial version of gdacs integration

* updated translations

* generated files

* added abbreviation

* bumped library version

* small feed entry attribute fixes

* add unit tests

* need to use original mdi name

* bumped library version

* improved entity name for earthquakes

* round vulnerability number

* typo

* support for categories

* testing support for categories

* tie longitude and latitude together

* validating categories

* simplifying setup

* passing domain as parameter

* simplified test setup

* moved test code

* simplified test code

* removed superfluous code

* changed approach to unique identifier

* changed code structure

* simplified unit system handling

* made schema a constant

* comment added

* simplifying code

* added message if location already configured

* removed unnecessary code

* simplified test code

* avoid mocking __init__

* pylint

* simplified code

* fetch categories from integration library

* setting PARALLEL_UPDATES

* setting PARALLEL_UPDATES to zero/unlimited

* added quality scale
2020-02-06 11:32:30 +01:00
Quentame 201ea2557e
Add config flow to Meteo-France (#29927)
* Add config flow to Meteo-France

* Review 1

* Use config_entry.unique_id

* Fix config_flow _show_setup_form + init

* Remove empty *_setup_platform()

* Avoid HomeAssistantError: Entity id already exists: sensor.[city_name]_[sensor_type]. Platform meteo_france does not generate unique IDs

- when multiple district in one city

* Review + abort when API error

* Fix I/O

* Remove monitored_conditions

* Add async_unload_entry

* Review 3

* Fix pipe

* alert_watcher is already None

* Review 4

* Better fix for "Entity id already exists"

* Whoops, fix tests

* Fix string
2020-02-04 22:37:59 +01:00
Rami Mosleh 9432054066
Rework Mikrotik device scanning following Unifi (#27484)
* rework device scanning, add tests

* update requirements and coverage

* fix description comments

* update tests, fix disabled entity updates

* rework device scanning, add tests

* update requirements and coverage

* fix description comments

* update tests, fix disabled entity updates

* update librouteros to 3.0.0

* fix sorting

* fix sorting 2

* revert to 2.3.0 as 3.0.0 requires code update

* fix requirements

* apply fixes

* fix tests

* update hub.py and fix tests

* fix test_hub_setup_failed

* rebased on dev and update librouteros to 3.0.0

* fixed test_config_flow

* fixed tests

* fix test_config_flow
2020-01-30 10:21:51 -08:00
Ron Klinkien 4e2737bfb7 Add Garmin Connect integration (#30792)
* Added code files

* Correctly name init file

* Update codeowners

* Update requirements

* Added code files

* Correctly name init file

* Update codeowners

* Update requirements

* Black changes, added to coveragerc

* Removed documentation location for now

* Added documentation url

* Fixed merge

* Fixed flake8 syntax

* Fixed isort

* Removed false check and double throttle, applied time format change

* Renamed email to username, used dict, deleted unused type, changed attr name

* Async and ConfigFlow code

* Fixes

* Added device_class and misc fixes

* isort and pylint fixes

* Removed from test requirements

* Fixed isort checkblack

* Removed host field

* Fixed coveragerc

* Start working test file

* Added more config_flow tests

* Enable only most used sensors by default

* Added more default enabled sensors, fixed tests

* Fixed isort

* Test config_flow  improvements

* Remove unused import

* Removed redundant patch calls

* Fixed mock return value

* Updated to garmin_connect 0.1.8 fixed exceptions

* Quick fix test patch to see if rest is error free

* Fixed mock routine

* Code improvements from PR feedback

* Fix entity indentifier

* Reverted device identifier

* Fixed abort message

* Test fix

* Fixed unique_id MockConfigEntry
2020-01-27 09:12:18 -08:00
Franck Nijhof 7e4b9adc3d
Rewrite of Spotify integration (#30717)
* Rewrite of Spotify integration

* Update homeassistant/components/spotify/config_flow.py

Co-Authored-By: Paulus Schoutsen <balloob@gmail.com>

* Remove configurator dependency

* Strip whitespace from device model in case Spotify product is missing

* Ensure domain dict exists in hass data on setup entry

* Simply config validation for client id and secret

* Abort flow on any exception from spotipy

* Add tests for config flow

* Gen requirements all

* Add test package __init__

* Remove Spotify from coveragerc

* Made alias handling more robuust

* Fix supported_features for Spotify free and open accounts

* Improve error message in the logs

* Re-implement Spotify media_player

* Change media content type when play a playlist

* Process review suggestions

* Move Spotify init, static current user and supported_features

* Remove unneeded me call

* Remove playlist content type due to frontend issues

* Improve playlist handling, when context is missing

* Handle entity disabled correctly

* Handle being offline/unavailable correctly

* Bump Spotipy to 2.7.1

* Update coverage RC, mark integration silver

* Remove URI limitation, lib supports all Spotify URI's now

* Final cleanup

* Addresses Pylint error

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-01-24 18:47:22 +01:00
Paulus Schoutsen 0fba9e44ed
Migrate zone to use collection helpers (#30774) 2020-01-22 12:36:25 -08:00
Raman Gupta ac771addc1 Add Config Flow support, Device Registry support, available property to vizio component (#30653)
* add config flow support, device registry support, available property

* raise PlatformNotReady if HA cant connect to device

* remove test logging statement and fix integration title

* store import and last user input values so user can see errors next to value that caused error

* add PARALLEL_UPDATES

* add missing type hints

* add missing type hints to tests

* fix options config flow title

* changes based on review

* better key name for message when cant connect

* fix missed update to key name

* fix comments

* remove logger from test which was used to debug and update test function names and docstrings to be more accurate

* add __init__.py to vizio tests module

* readded options flow and updated main component to handle options updates, set unique ID to serial, fixes based on review

* pop hass.data in media_player unload instead of in __init__ since it is set in media_player

* update requirements_all and requirements_test_all

* make unique_id key name a constant

* remove additional line breaks after docstrings

* unload entries during test_user_flow and test_import_flow tests to hopefully reduce teardown time

* try to speed up tests

* remove unnecessary code, use event bus to track options updates, move patches to pytest fixtures and fix patch scoping

* fix comment

* remove translations from commit

* suppress API error logging when checking for device availability as it can spam logs

* update requirements_all and requirements_test_all

* dont pass hass to entity since it is passed to entity anyway, remove entity unload from tests, other misc changes from review

* fix clearing listeners

* use config_entry unique ID for unique ID and use config_entry entry ID as update signal

* update config flow based on suggested changes

* update volume step on config import if it doesn't match config_entry volume step

* update config_entry data and options with new volume step value

* copy entry.data and entry.options before updating when updating config_entry

* fix test_import_entity_already_configured
2020-01-15 11:43:55 +01:00
cgtobi e793ed9ab0 Refactor Netatmo integration (#29851)
* Refactor to use ids in data class

* Use station_id

* Refactor Netatmo to use oauth

* Remove old code

* Clean up

* Clean up

* Clean up

* Refactor binary sensor

* Add initial light implementation

* Add discovery

* Add set schedule service back in

* Add discovery via homekit

* More work on the light

* Fix set schedule service

* Clean up

* Remove unnecessary code

* Add support for multiple entities/accounts

* Fix MANUFACTURER typo

* Remove multiline inline if statement

* Only add tags when camera type is welcome

* Remove on/off as it's currently broken

* Fix camera turn_on/off

* Fix debug message

* Refactor some camera code

* Refactor camera methods

* Remove old code

* Rename method

* Update persons regularly

* Remove unused code

* Refactor method

* Fix isort

* Add english strings

* Catch NoDevice exception

* Fix unique id and only add sensors for tags if present

* Address comments

* Remove ToDo comment

* Add set_light_auto back in

* Add debug info

* Fix multiple camera issue

* Move camera light service to camera

* Only allow camera entities

* Make test pass

* Upgrade pyatmo module to 3.2.0

* Update requirements

* Remove list comprehension

* Remove guideline violating code

* Remove stale code

* Rename devices to entities

* Remove light platform

* Remove commented code

* Exclude files from coverage

* Remove unused code

* Fix unique id

* Address comments

* Fix comments

* Exclude sensor as well

* Add another test

* Use core interfaces
2020-01-11 12:20:00 +01:00
Paulus Schoutsen 3f29c234b8
Add Ring config flow (#30564)
* Add Ring config flow

* Address comments + migrate platforms to config entry

* Migrate camera too

* Address comments

* Fix order config flows

* setup -> async_setup
2020-01-10 21:35:31 +01:00
escoand ef05aa2f39 Add Samsung TV config flow (#28306)
* add config flow

* add tests

* add user step error handling

* remove unload function

* add missing test file

* handle authentication correctly

* remove old discovery mode

* better handling of remote class

* optimized abort messages

* add already configured test for user flow

* Import order

* use ip property instead context

* Black

* small syntax

* use snake_case

* Revert "use ip property instead context"

This reverts commit 91502407eb216f8a0b1b90e3e6fb165b81406f8f.

* disable wrong pylint errors

* disable wrong no-member

* Try to fix review comments

* Try to fix review comments

* Fix missing self

* Fix ip checks

* methods to functions

* simplify user check

* remove user errors

* use async_setup for config

* fix after rebase

* import config to user config flow

* patch all samsungctl

* fix after rebase

* fix notes

* remove unused variable

* ignore old setup function

* fix after merge

* pass configuration to import step

* isort

* fix recursion

* remove timeout config

* add turn on action (dry without testing)

* use upstream checks

* cleanup

* minor

* correctly await async method

* ignore unused import

* async call send_key

* Revert "async call send_key"

This reverts commit f37057819f.

* fix comments

* fix timeout test

* test turn on action

* Update media_player.py

* Update test_media_player.py

* Update test_media_player.py

* use async executor

* use newer ssdp data

* update manually configured with ssdp data

* dont setup component directly

* ensure list

* check updated device info

* Update config_flow.py

* Update __init__.py

* fix duplicate check

* simplified unique check

* move method detection to config_flow

* move unique test to init

* fix after real world test

* optimize config_validation

* update device_info on ssdp discovery

* cleaner update listener

* fix lint

* fix method signature

* add note for manual config to confirm message

* fix turn_on_action

* pass script

* patch delay

* remove device info update
2020-01-10 03:19:10 +01:00
Maciej Bieniek 21029b1d7b Add Brother Printer integration (#30359)
* Init entities as unavailable when offline

* Initial commit

* Fix CODEOWNERS

* CODEOWNERS

* Run script.hassfest

* Add initial test

* Bump library

* More tests

* Tests

* Add new sensors and fix KeyError

* Fix unique_id and device_info

* Fix check for configured device

* More tests

* Bump library version

* Add uptime sensor

* Use config entry unique ID

* Run python3 -m script.gen_requirements_all

* Fix pylint error

* Remove pysnmp dependency

* Raise ConfigEntryNotReady when device offline at HA start

* Remove period from logging message

* Generator simplification

* Change raise_on_progress

* Rename data to printer

* Move update state to async_update

* Remove unused _unit_of_measurement

* Remove update of device_info

* Suggested change for tests

* Remove unnecessary argument

* Suggested change
2020-01-06 11:06:16 -06:00
David Cramer 3033dbd86c Add Sentry component (#30422) 2020-01-03 21:34:20 +01:00
Issac 3f570245aa Add local_ip component (#29973)
* Added localip component

* Split config and core logic, and migrate to sensor platform (requested by @MartinHjelmare)
Also allow overriding the sensor name via the config

* Tweak docstring

Co-Authored-By: Fabian Affolter <mail@fabian-affolter.ch>

* Initial support for config entries

* Rename localip to local_ip (1/2)

* Rename localip to local_ip (2/2)

* Add test for config_flow

* Split and rename tests

* Remove unneeded code from config_flow

* Implement configuration as config entry import.  Other misc requested changes from code review.

* Fix tests

* minor code review fixes

* remove unneeded code

Co-authored-by: Fabian Affolter <mail@fabian-affolter.ch>
2019-12-31 14:34:53 +01:00
Maciej Bieniek 2c1a7a54cd Add GIOS integration (#28719)
* Initial commit

* Add gios to requirements

* Add tests

* Update .coveragerc file

* Run gen_requirements_all.py

* Change DEFAULT_SCAN_INTERVAL

* Better strings

* Bump library version

* run script.hassfest

* run isort

* Add icons mapping

* Remove unnecessary f-string

* Remove unnecessary listener

* Refactoring config_flow

* Add unique_id to config entry

* Change AQI states to consts in English

* Remove unused init

* Remove unused exception

* Remove private instance attribute

* Remove overwrite state property

* Fix pylint error

* Add SCAN_INTERVAL for air_quality entity

* Add _abort_if_unique_id_configured()
2019-12-31 13:05:31 +01:00
Alan Tse 3aa2ae1700 Enable config flow for Tesla (#28744)
* build: bump teslajsonpy to 0.2.0

* Remove tests

* feat: add config flow

* feat: add async

* perf: convert unnecessary async calls to sync

* feat: add charger voltage and current sensor

* feat: add options flow

* build: bump teslajsonpy to 0.2.0

* Remove icon property

* Revert climate mode change

* Remove charger sensor

* Simplify async_setup_platform

* Update homeassistant/components/tesla/sensor.py

Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>

* Update homeassistant/components/tesla/binary_sensor.py

Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>

* Address requested changes

* Fix pylint error

* Address requested changes

* Update codeowners

* Fix pylint error

* Address requested changes

* Address requested change

* Remove unnecessary check for existing config entry

* Load scan_interval in async_setup_entry

* Include coverage of config_flow

* Add tests for full coverage

* Address requested test changes

* Remove unnecessary init lines

* Remove unnecessary init

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2019-12-23 21:54:25 +01:00
Quentame c804f8f961 Add config flow to iCloud (#28968)
* iCloud: setup ConfigFlow and prepare for more platforms

- add config flow + tests
- fix existing services
- add play_sound & display_message services
- document services
- can use devices with the same name
- prepare to add sensor platform

* Review : not copy account conf

* Review: Safer test patch

* Review: remove reset_account

* Review: Use executor_job while IO

* Review: Use executor_job while IO 2

* Review: use hass.helpers.storage.Store()

* Review: no IO in tests

* Remove reset from services.yaml

* Review: remove authenticate.return_value = Mock()

* Review: do not initialize the api with the mocked service

* isort

* Review: @MartinHjelmare Test config flow with all steps

* Review: Fix failed tests names

* Codevov: Add one missing test
2019-12-09 17:19:42 +01:00
Franck Nijhof cc9589cff2 Add Elgato Key Light integration (#29592)
* Add Elgato Key Light integration

* Remove passing in of hass loop

* Tweaks a comment

* Tweaks a function name

* Ensure domain namespace in data exists in entry setup
2019-12-08 09:26:31 +01:00
Nikolay Vasilchuk a37260faa9 StarLine integration (#27197)
* Device Tracker works

* Device Tracker works

* Binary Sensor

* Sensor

* Lock

* Switch and service

* New switches

* Update interval options

* WIP

* Translation errors

* Check online state

* WIP

* Move to aiohttp

* Some checks

* CI

* CI

* .coveragerc

* Black

* icon_for_signal_level test

* update_interval renamed to scan_interval

* async logic

* Fix cookie read

* Requirement starline

* Reformat

* Requirements updated

* ConfigEntryNotReady

* Requirement starline

* Lint fix

* Requirement starline

* available status

* Translations

* Expiration to config

* CI

* Linter fix

* Small renaming

* Update slnet token

* Starline version bump

* Fix updates

* Black

* Small fix

* Removed unused fields

* CI

* set_scan_interval service

* deps updated

* Horn switch

* Starline lib updated

* Starline lib updated

* Black

* Support multiple integrations

* Review

* async_will_remove_from_hass

* Deps updated

* Test config flow

* Requirements

* CI

* Review

* Review

* Review

* Review

* Review

* CI

* pylint fix

* Review

* Support "mayak" devices

* Icons removed

* Removed options_flow

* Removed options_flow test

* Removed options_flow test
2019-11-26 11:17:11 -08:00
Malte Franken 4e9e9efa43 GeoNet NZ Volcanic Alert Level sensor (#26901)
* first version of new integration

* moved icon to shared consts

* added unit tests

* transformed from geolocation to sensor integration

* alert level is now the state of the sensor

* adopted unit tests

* fixed comment

* keep all sensors registered even if the feed update fails intermittently

* bumped version of upstream library

* bumped version of integration library

* regenerated requirements

* bumped version of integration library

* bumped version of integration library

* fixed generated file

* removed commented out code

* regenerated config flow file

* update to latest integration library version

* simplified code

* removed debug log statement

* simplified code structure

* defined constant

* use core interfaces

* moved test and fixture

* sorted imports

* simplified patching

* moved fixture to central config file
2019-11-19 14:00:59 +01:00
Davide Varricchio d796053d9f Add support for Hisense AEH-W4A1 wifi module (AC remote control) (#28641)
* First commit

* First working release, but there's a lot to do

* Added support for preset_modes

* Refined logic

* Added translations for config_flow

* Updated translations

* modified:   homeassistant/components/hisense_aehw4a1/climate.py

* modified:   climate.py

* Updated library to latest version

* Small changes

* Null states when AC off

* Minor fixes

* Latest updates for TOX

* First commit

* First working release, but there's a lot to do

* new file:   requirements_test_all.txt

* Added support for preset_modes

* Refined logic

* Added translations for config_flow

* Updated translations

* modified:   homeassistant/components/hisense_aehw4a1/climate.py

* modified:   climate.py

* Updated library to latest version

* Small changes

* Null states when AC off

* Minor fixes

* Latest updates for TOX

* new file:   requirements_test_all.txt

* Fighting with tox

* vs Tox round 2

* Isort and updated requirements_test_all.txt

* Fighting with lint

* Implemented available state

* Changed exception type after Travis-ci pylint fails

* Support entry in configuration.yaml

* Removed commented code

* Switched to async

* Minor changes

* Updated library and fixed pylint errors

* Code optimization

* Implemented static ip addresses in configuration.yaml

* Reverted to existing constant

* Corrected pylint wrong-import-order

* Recovery from nuke event (messing all while rebase)

* Resolved Ci error

* Changes for PR

* Corrected temp scale for frontend

* Added test for config entry from configuration.yaml

* Updated dependency

* Check on manual config

* Imported custom exceptions and modified import config

* Optimized

* Change based on PR revision

* Added logging for failure event on manual config

* Tests added but to be corrected

* Edited tests

* Tests updated to ensure no I/O

* Working on tests

* Cheanges based on revision for PR

* Setting librey exception as direct side_effect in test

* Final changes for PR

* Redundand on command solved

* Improved AC logic
2019-11-15 21:22:24 +01:00
Franck Nijhof 78b83c653a
Add WLED integration (#28542)
* Add WLED integration

* Use f-string for uniq id in sensor platform

* Typing improvements

* Removes sensor & light platform

* Remove PARALLEL_UPDATES from integration level

* Correct type in code comment 'themselves'

* Use async_track_time_interval in async context

* Remove stale code

* Remove decorator from Flow handler

* Remove unused __init__ from config flow

* Move show form methods to sync

* Only wrap lines that can raise in try except block

* Remove domain and platform from uniq id

* Wrap light state in bool object in is_on method

* Use async_schedule_update_ha_state in async context

* Return empty dict in device state attributes instead of None

* Remove unneeded setdefault call in setup entry

* Cancel update timer on entry unload

* Restructure config flow code

* Adjust tests for new uniq id

* Correct typo AdGuard Home -> WLED in config flow file comment

* Convert internal package imports to be relative

* Reformat JSON files with Prettier

* Improve tests based on review comments

* Add test for zeroconf when no data is provided

* Cleanup and extended tests
2019-11-06 23:55:39 +01:00
Paulus Schoutsen 79ac77a93d
Almond integration (#28282)
* Initial Almond integration

* Hassfest

* Update library

* Address comments

* Fix inheritance issue py36

* Remove no longer needed check

* Fix time
2019-10-28 23:47:31 -07:00
Ville Skyttä fc09702cc3
Modernize Huawei LTE (#26675)
* Modernization rework

- config entry support, with override support from huawei_lte platform in YAML
- device tracker entity registry support
- refactor for easier addition of more features
- internal code cleanups

* Remove log level dependent subscription/data debug hack

No longer needed, because pretty much all keys from supported
categories are exposed as sensors.

Closes https://github.com/home-assistant/home-assistant/issues/23819

* Upgrade huawei-lte-api to 1.4.1

https://github.com/Salamek/huawei-lte-api/releases

* Add support for access without username and password

* Use subclass init instead of config_entries.HANDLERS

* Update huawei-lte-api to 1.4.3 (#27269)

* Convert device state attributes to snake_case

* Simplify scanner entity initialization

* Remove not needed hass reference from Router

* Return explicit None from unsupported old device tracker setup

* Mark unknown connection errors during config as such

* Drop some dead config flow code

* Run config flow sync I/O in executor

* Parametrize config flow login error tests

* Forward entry unload to platforms

* Async/sync fixups

* Improve data subscription debug logging

* Implement on the fly add of new and tracking of seen device tracker entities

* Handle device tracker entry unload cleanup in component

* Remove unnecessary _async_setup_lte, just have code in async_setup_entry

* Remove time tracker on unload

* Fix to not use same mutable default subscription set for all routers

* Pylint fixes

* Remove some redundant defensive device tracker code

* Add back explicit get_scanner None return, hush pylint

* Adjust approach to set system_options on entry create

* Enable some sensors on first add instead of disabling everything

* Fix SMS notification recipients default value

* Add option to skip new device tracker entities

* Fix SMS notification recipient option default

* Work around https://github.com/PyCQA/pylint/issues/3202

* Remove unrelated type hint additions

* Change async_add_new_entities to a regular function

* Remove option to disable polling for new device tracker entries
2019-10-24 19:31:49 +03:00
On Freund 1412862f2a Config entry and device for Coolmaster integration (#27925)
* Config entry and device for Coolmaster integration

* Lint/isort/flake/etc...

* Black formatting

* Code review fixes

* Config flow tests for coolmaster

* Add pycoolmaster requirement to test

* Remove port selection from Coolmaster config flow

* Update config_flow.py

* More idoimatic hash concat
2019-10-23 12:47:00 -07:00
Ernst Klamer acc3646ef3 Add Solar-Log platform (#27036)
* Add Solar-Log sensor

* Codeowners update

* Update homeassistant/components/solarlog/manifest.json

Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>

* remove sunwatcher from gen_requirements_all.py

* remove sunwatcher from requirements_test_all.txt

* Remove scan_interval as configuration variable

I've set it to a fixed scan_interval of 1 minute. Removed the configuration option.

* Fix black format

* Config flow added (__init__.py)

* Config flow added (manifest.json)

* Config flow added (const.py)

* Config flow added (config_flow.py)

* Config flow added (strings.json)

* Config flow added (en.json translation)

* Config flow added (sensor.py rewritten)

* Config flow added (sensor.py)

* Config flow added (config_flows.py)

* resolve conflict config_flows.py

* Add tests

* add tests

* add tests

* Update .coverage to include all files for solarlog

* Fix await the unload

* Adjust icons, add http:// to default host

* Change icons

* Add http:// to host if not provided, fix await

* Add http:// to host if not provided, fix await

* Adjust tests for http:// added to host

* remove line

* Remove without http:// requirement

* Remove without http;// requirement
2019-10-22 23:31:43 -07:00
Rami Mosleh 09f9875ccf Glances config flow (#27221)
* Glances Integration with config flow

* Glances Integration with config flow

* fix description texts

* Glances Integration with config flow

* Glances Integration with config flow

* fix description texts

* update .coverage.py

* add codeowner

* add test_options

* Fixed typos, Added import, fixed tests

* sort imports

* remove commented code
2019-10-21 10:17:21 +02:00
shred86 1774a1427b Add abode config entries and device registry (#26699)
* Adds support for config entries and device registry

* Fixing string formatting for logger

* Add unit test for abode config flow

* Fix for lights, only allow one config, add ability to unload entry

* Fix for subscribing to hass_events on adding abode component

* Several fixes from code review

* Several fixes from second code review

* Several fixes from third code review

* Update documentation url to fix branch conflict

* Fixes config flow and removes unused constants

* Fix for switches, polling entry option, improved tests

* Update .coveragerc, disable pylint W0611, remove polling from UI

* Multiple fixes and edits to adhere to style guidelines

* Removed unique_id

* Minor correction for formatting error in rebase

* Resolves issue causing CI to fail

* Bump abodepy version

* Add remove device callback and minor clean up

* Fix incorrect method name

* Docstring edits

* Fix duplicate import issues from rebase

* Add logout_listener attribute to AbodeSystem

* Add additional test for complete coverage
2019-10-13 20:01:04 +02:00
Santobert bd6bbcd5af Neato config flow (#26579)
* initial commit

* Minor changes

* add async setup entry

* Add translations and some other stuff

* add and remove entry

* use async_setup_entry

* Update config_flows.py

* dshokouhi's changes

* Improve workflow

* Add valid_vendors

* Add entity registry

* Add device registry

* Update entry from configuration.yaml

* Revert unneccesary changes

* Update .coveragerc

* Prepared tests

* Add dshokouhi and Santobert as codeowners

* Fix unload entry and abort when already_configured

* First tests

* Add test for abort cases

* Add test for invalid credentials on import

* Add one last test

* Add test_init.py with some tests

* Address reviews, part 1

* Update outdated entry

* await instead of add_job

* run IO inside an executor

* remove faulty test

* Fix pylint issues

* Move IO out of constructur

* Edit error translations

* Edit imports

* Minor changes

* Remove test for invalid vendor

* Async setup platform

* Edit login function

* Moved IO out if init

* Update switches after added to hass

* Revert update outdated entry

* try and update new entrys from config.yaml

* Add test invalid vendor

* Default to neato
2019-10-06 13:05:51 +02:00
mvn23 6ae908b883 Add opentherm_gw config flow (#27148)
* Add config flow support to opentherm_gw.
Bump pyotgw to 0.5b0 (required for connection testing)
Existing entries in configuration.yaml will be converted to config entries and ignored in future runs.

* Fix not connecting to Gateway on startup.
Pylint fixes.

* Add tests for config flow.
Remove non-essential options from config flow.
Restructure config entry data.

* Make sure gw_id is slugified
2019-10-04 17:38:26 -07:00
Maciej Bieniek 8ba4ee1012 Add Airly integration (#26375)
* Add Airly integration

* Update .coveragerc file

* Remove AVAILABLE_CONDITIONS and fix device_class

* Don't create client on every update

* Rename client to session

* Rename state_attributes to device_state_attributes

* Remove log latitude and longitude

* Fix try...except

* Change latitude and longitude to HA defaults

* _show_config_form doesn't need coroutine

* Simplify config_flow errors handlig

* Preetier

* Remove unnecessary condition

* Change sensor platform to air_quality

* Remove PM1

* Make unique_id more unique

* Remove ,

* Add tests for config_flow

* Move conf to CONFIG

* Remove domain from unique_id

* Change the way update of attrs

* Language and attrs

* Fix attrs

* Add aiohttp error handling

* Throttle as decorator

* Suggested change

* Suggested change

* Invert condition

* Cleaning

* Add tests

* Polish no sesnor error handling

* Better strings

* Fix test_invalid_api_key

* Fix documentation url

* Remove unnecessary test

* Remove language option

* Fix test_invalid_api_key once again

* Sort imports

* Remove splits in strings
2019-10-04 13:58:29 +02:00
Tiit Rätsep 48d07467d9 Add support for SOMA Smartshades devices (#26226)
* Add Soma integration

* Fixed cover position get/set

* Try to list devices before creating config entries to see if Soma Connect can be polled

* Style fixes

* Updated requirements

* Updated .coveragerc to ignore Soma component

* Fixed linter errors

* Implemented stop command

* Test coverage fixes according to feedback

* Fixes to code according to feedback

* Added error logging and tested config from yaml

* Indentation fix

* Removed unnecessary method

* Wrong indentation

* Added some tests

* Added test for import step leading to entry creation

* Added feedback to user form in case of connection error

* Minor fixes according to feedback

* Changed exception type in error handling for connection to Connect

* To keep API consistent for Google Home and Alexa we swapped the open/closed position values back and I reversed them in this integration as well

* regenerated requirements, ran black, addde __init__.py to ignore file

* Added pysoma library to gen_requirements_all.py

* Added missing test case

* removed useless return value
2019-09-30 14:23:08 +02:00
Rami Mosleh 82b77c2d29 Add config flow to transmission (#26434)
* Add config flow to transmission

* Reworked code to add all sensors and switches

* applied fixes

* final touches

* Add tests

* fixed tests

* fix get_api errors and entities availabilty update

* update config_flows.py

* fix pylint error

* update .coveragerc

* add codeowner

* add test_options

* fixed test_options
2019-09-26 11:14:57 +02:00
Mark Coombes f6995b8d17 Add config flow to ecobee (#26634)
* Add basic config flow

* Fix json files

* Update __init__.py

* Fix json errors

* Move constants to const.py

* Add ecobee to generated config flows

* Update config_flow for updated API

* Update manifest to include new dependencies

Bump pyecobee, add aiofiles.

* Update constants for ecobee

* Modify ecobee setup to use config flow

* Bump dependency

* Update binary_sensor to use config_entry

* Update sensor to use config_entry

* Update __init__.py

* Update weather to use config_entry

* Update notify.py

* Update ecobee constants

* Update climate to use config_entry

* Avoid a breaking change on ecobee services

* Store api key from old config entry

* Allow unloading of config entry

* Show user a form before import

* Refine import flow

* Update strings.json to remove import step

Not needed.

* Move third party imports to top of module

* Remove periods from end of log messages

* Make configuration.yaml config optional

* Remove unused strings

* Reorganize config flow

* Remove unneeded requirement

* No need to store API key

* Update async_unload_entry

* Clean up if/else statements

* Update requirements_all.txt

* Fix config schema

* Update __init__.py

* Remove check for DATA_ECOBEE_CONFIG

* Remove redundant check

* Add check for DATA_ECOBEE_CONFIG

* Change setup_platform to async

* Fix state unknown and imports

* Change init step to user

* Have import step raise specific exceptions

* Rearrange try/except block in import flow

* Convert update() and refresh() to coroutines

...and update platforms to use async_update coroutine.

* Finish converting init to async

* Preliminary tests

* Test full implementation

* Update test_config_flow.py

* Update test_config_flow.py

* Add self to codeowners

* Update test_config_flow.py

* Use MockConfigEntry

* Update test_config_flow.py

* Update CODEOWNERS

* pylint fixes

* Register services under ecobee domain

Breaking change!

* Pylint fixes

* Pylint fixes

* Pylint fixes

* Move service strings to ecobee domain

* Fix log message capitalization

* Fix import formatting

* Update .coveragerc

* Add __init__ to coveragerc

* Add option flow test

* Update .coveragerc

* Act on updated options

* Revert "Act on updated options"

This reverts commit 56b0a859f2e3e80b6f4c77a8f784a2b29ee2cce9.

* Remove hold_temp from climate

* Remove hold_temp and options from init

* Remove options handler from config flow

* Remove options strings

* Remove options flow test

* Remove hold_temp constants

* Fix climate tests

* Pass api key to user step in import flow

* Update test_config_flow.py

Ensure that the import step calls the user step with the user's api key as user input if importing from ecobee.conf/validating imported keys fails.
2019-09-25 22:38:21 +02:00
Penny Wood b68b8430a4 Izone component (#24550)
* iZone component

* Rename constants to const.

* Changes as per code review.

* Stop listening if discovery times out.

* Unload properly

* Changes as per code review

* Climate 1.0

* Use dispatcher instead of listener

* Free air settings

* Test case for config flow.

* Changes as per code review

* Fix error on shutdown

* Changes as per code review

* Lint fix

* Black formatting

* Black on test

* Fix test

* Lint fix

* Formatting

* Updated requirements

* Remaining patches

* Per code r/v
2019-09-19 23:31:54 +02:00
jjlawren 2d12bac0e2 Add Plex config flow support (#26548)
* Add config flow support

* Log error on failed connection

* Review comments

* Unused errors

* Move form to step

* Use instance var instead of passing argument

* Only share servers created by component

* Return errors early to avoid try:else

* Separate debug for validation vs setup

* Unnecessary

* Unnecessary checks

* Combine import flows, move logic to component

* Use config entry discovery handler

* Temporary lint fix

* Filter out servers already configured

* Remove manual config flow

* Skip discovery if a config exists

* Swap conditional to reduce indenting

* Only discover when no configs created or creating

* Un-nest function

* Proper async use

* Move legacy file import to discovery

* Fix, bad else

* Separate validate step

* Unused without manual setup step

* Async oops

* First attempt at tests

* Test cleanup

* Full test coverage for config_flow, enable tests

* Lint

* Fix lint vs black

* Add test init

* Add test package requirement

* Actually run script

* Use 'not None' convention

* Group exceptions by result

* Improve logic, add new error and test

* Test cleanup

* Add more asserts
2019-09-19 23:29:26 +02:00
Paulus Schoutsen 7d71976e01
Do not complain about automatic generated files (#26540)
* Do not complain about automatic generated files

* Update generated files
2019-09-09 12:01:49 -07:00
Maikel Punie 28beebac61 Enable SolarEdge config entries (#26282)
* Initial commit for the solaredge configflow

* rerun the hassfest script

* Adding testcases

* Rerun hassfest, problem with black?

* Requirements for the tests

* Remove CONF_MONITORED_CONDITIONS from configuration.yaml

* Remove the options flow strings

* Resolve some comments

* Comments

* More comments

* Move the config from the sensor platform to the component itself

* More comments

* More comments

* Added solaredge __init__

* Added more test to increase coverage
2019-09-08 21:49:20 +02:00
Florent Thoumie 0abb2f3eb8 Add new integration for Jandy iAqualink pool control (#26034)
* Import new iaqualink component with climate platform.

* Style and unittest changes, fix async_step_import.

* Reorder imports.

* Fix stale doctstrings and add unittest.
2019-09-06 22:21:56 +02:00
Quentame b4058b5c7f Add config flow to linky (#26076)
* Linky: setup ConfigFlow

* async_track_time_interval

* Review from @MartinHjelmare 1

* Review from @MartinHjelmare 2

* Review from @MartinHjelmare 3

* Review from @MartinHjelmare 4

* black --fast homeassistant tests

* Bump pylinky to 0.4.0 and add error user feedback

* Fix .coveragerc

* Linky platform moved to integration in config.yml and with multiple accounts

* Remove useless logs

* Review from @MartinHjelmare 5

* Add config flow tests

* Add config flow tests : login + fetch on failed
2019-09-04 07:04:26 +02:00
Robert Van Gorkom 614cf74225 Add Withings support (#25154)
* Rebasing with a clean branch.
Addressing PR feedback.
Cleaning up some static code checks.
Fixing bug with saving credentials.

* Removing unecessary change.

* Caching data manager.

* Removing configurable measures.

* Using import step in config flow.

* Updating config flows.

* Addressing PR feedback.

* Formatting source.

* Addressing PR feedback and rebasing.
2019-08-31 14:30:59 +02:00