Commit Graph

101 Commits

Author SHA1 Message Date
Daniel Høyer Iversen 5a2528b0f1
Tibber config flow (#34469)
* tibber config, wip

* read config from yaml

* sync requirements

* style

* add model property

* unique id

* unique id

* Tibber config, unique id

* test doc

* tibber config, update title

* append _el_price

* Update homeassistant/components/tibber/__init__.py

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>

* unique id

* tibber config flow

* tibber config flow

* fix test for python 3.8

* update test imports

* move _async_current_entries

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2020-05-03 14:40:19 +02:00
Martin Hjelmare aeb891649e
Add zwave mqtt (#34987) 2020-05-03 02:54:16 +02:00
Jason Hunter 850b5cb02b
Config flow for ONVIF (#34520) 2020-04-30 23:15:40 -07:00
J. Nick Koston 793592b2b8
Config flow for homekit (#34560)
* Config flow for homekit

Allows multiple homekit bridges to run

HAP-python state is now stored at .storage/homekit.{entry_id}.state
aids is now stored at .storage/homekit.{entry_id}.aids

Overcomes 150 device limit by supporting
multiple bridges.

Name and port are now automatically allocated
to avoid conflicts which was one of the main
reasons pairing failed.

YAML configuration remains available in order to offer entity
specific configuration.

Entries created by config flow can add and remove
included domains and entities without having to restart

* Fix services as there are multiple now

* migrate in executor

* drop title from strings

* Update homeassistant/components/homekit/strings.json

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>

* Make auto_start advanced mode only, add coverage

* put back title

* more references

* delete port since manual config is no longer needed

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-04-30 23:05:06 -05:00
J. Nick Koston 6c18a2cae2
Config flow for hunterdouglas_powerview (#34795)
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
2020-04-29 14:24:57 -07:00
starkillerOG e46f1b69ba
Add Xiaomi miio Alarm Control Panel (#32091)
Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>
2020-04-29 01:44:31 +02:00
MatsNl ccc3ce81f9
Add Atag One thermostat integration (#32361)
* add atag integration

* ignore

* generated

* Update .gitignore

* requirements update

* update coveragerc

* Revert "update coveragerc"

* make entity_types more readable

* add DOMAIN to listener

* entity name

* Use DataUpdateCoordinator

* fix translations

* enable preset_modes

* fix water_heater

* update coveragerc

* remove scan_interval

Co-Authored-By: J. Nick Koston <nick@koston.org>

* Apply suggestions from code review

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

* fixes review remarks

* fix flake8 errors

* ensure correct HVACmode

* add away mode

* use write_ha_state instead of refresh

* remove OFF support, add Fahrenheit

* rename test_config_flow.py

Co-authored-by: J. Nick Koston <nick@koston.org>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-04-22 18:09:51 +02:00
escoand c87ecf0ff6
Add config flow and device registry to fritzbox integration (#31240)
* add config flow

* fix pylint

* update lib

* Update config_flow.py

* remote devices layer in config

* add default host

* avoid double setups of entities

* remove async_setup_platform

* store entities in hass.data

* pass fritz connection together with config_entry

* fritz connections try no4 (or is it even more)

* fix comments

* add unloading

* fixed comments

* Update config_flow.py

* Update const.py

* Update config_flow.py

* Update __init__.py

* Update config_flow.py

* Update __init__.py

* Update __init__.py

* Update config_flow.py

* Update __init__.py

* Update __init__.py

* Update __init__.py

* Update config_flow.py

* add init tests

* test unloading

* add switch tests

* add sensor tests

* add climate tests

* test target temperature

* mock config to package

* comments

* test binary sensor state

* add config flow tests

* comments

* add missing tests

* minor

* remove string title

* deprecate yaml

* don't change yaml

* get devices async

* minor

* add devices again

* comments fixed

* unique_id fixes

* fix patches

* Fix schema

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-04-20 15:00:07 +02:00
Rami Mosleh 2a6948e696
Add Islamic Prayer Times config flow (#31590)
* Add Islamic Prayer Times config_flow

* Add Islamic Prayer Times config_flow

* handle options update and fix tests

* fix sensor update handling

* fix pylint

* fix scheduled update and add test

* update test_init

* update flow options to show drop list

* clean up code

* async scheduling and revert state to timestamp

* fix update retry method

* update strings

* keep title as root key
2020-04-20 14:22:48 +02:00
João Gabriel 42b6ec2fb5
Add config flow to panasonic_viera component (#33829)
* Updating the panasonic_viera component

* Updating .coveragerc

* Removing testplatform

* Updating strings.json

* Commit before rebase

* Commit before rebase

* Commit before rebase

* Commit before rebase

* Commit before rebase

* Adding tests and stuff

* Fixing permission issues

* Ignoring Pylint warnings

* Fixing one more Pylint warning

* Refactoring

* Commiting changes - part 1

* Commiting changes: part 2

* Turning unknown error logs into exception logs

* Update strings.json

* Rebasing

* Updating the panasonic_viera component

* Removing testplatform

* Updating strings.json

* Commit before rebase

* Commit before rebase

* Commit before rebase

* Commit before rebase

* Commit before rebase

* Adding tests and stuff

* Fixing permission issues

* Ignoring Pylint warnings

* Fixing one more Pylint warning

* Refactoring

* Commiting changes - part 1

* Commiting changes: part 2

* Turning unknown error logs into exception logs

* Adding pt-BR translation

* Removing Brazilian Portugues translations

* Modifying error handling

* Adding SOAPError to except handling

* Updating translation

* Refactoring async_step_import

* Fixing indentation

* Fixing requirements after rebase

* Fixing translations

* Fixing issues after rebase

* Routing import step to user step

* Adding myself as a codeowner
2020-04-18 05:19:01 +02:00
MatthewFlamm 6d812bd957
Add config flow to nws and remove yaml configuration (#34267)
* add config flow to nws and remove yaml

* Don't duplicate scan_time

Co-Authored-By: J. Nick Koston <nick@koston.org>

* Use _abort_if_unique_id_configured

Co-Authored-By: J. Nick Koston <nick@koston.org>

* fix abort

* Add unavailable tests

* update and use better strings

* lint

Co-authored-by: J. Nick Koston <nick@koston.org>
2020-04-16 09:15:55 -05:00
Maciej Bieniek 6dc6f2d099
Add config flow for braviatv integration (#33774)
* Run scripts

* Improvement strings

* Fix FlowOptions update listener

* Update .ceveragerc

* Add tests

* Better strings

* Add test for OptionsFlow

* Run gen_requirements_all.py once again

* Fix pylint errors

* Log error when there is no bravia.conf file during import

* Improvement strings

* Use braviarc object from hass.data in options flow

* Use async_add_executor_job for IO

* Fix options flow test

* Fix tests

* Remove host_reachable method

* Remove dependencies

* Change setup_platform method to async

* Remove calling system_info

* Save mac in the config entry

* Fix get ignore sources

* Fix read config from file

* Remove the side effect from init

* Fix user_input for user step

* Switch OrderedDict to dict

* New config_entry instance for each test

* Revert change

* Patch async_setup_entry in test_import

* Change a way to create source list

* Consolidate repeated block of code

* Update tests

* Suggested change

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

* Suggested channge

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

* Suggested change

* Patch async_setup_entry

* Remove unnecesary if

* suggested change

* Suggested change

* Fix tests

* Fix pylint error

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-04-15 01:04:06 +02:00
Austin Mroczek c7ab5de07c
Add Totalconnect config flow (#32126)
* Bump skybellpy to 0.4.0

* Bump skybellpy to 0.4.0 in requirements_all.txt

* Added extra states for STATE_ALARM_TRIGGERED to allow users to know if
it is a burglar or fire or carbon monoxide so automations can take
appropriate actions.  Updated TotalConnect component to handle these new
states.

* Fix const import

* Fix const import

* Fix const imports

* Bump total-connect-client to 0.26.

* Catch details of alarm trigger in state attributes.

Also bumps total_connect_client to 0.27.

* Change state_attributes() to device_state_attributes()

* Move totalconnect component toward being a multi-platform integration.  Bump total_connect_client to 0.28.

* add missing total-connect alarm state mappings

* Made recommended changes of MartinHjelmare at
https://github.com/home-assistant/home-assistant/pull/24427

* Update __init__.py

* Updates per MartinHjelmare comments

* flake8/pydocstyle fixes

* removed . at end of log message

* added blank line between logging and voluptuous

* more fixes

* Adding totalconnect zones as HA binary_sensors

* fix manifest.json

* flake8/pydocstyle fixes.  Added codeowner.

* Update formatting per @springstan guidance.

* Fixed pylint

* Add zone ID to log message for easier troubleshooting

* Account for bypassed zones in update()

* More status handling fixes.

* Fixed flake8 error

* Another attempt at black/isort fixes.

* Bump total-connect-client to 0.50.  Simplify code using new functions in
total-connect-client package instead of importing constants.  Run black
and isort.

* Fix manifest file

* Another manifest fix

* one more manifest fix

* more manifest changes.

* sync up

* fix indent

* one more pylint fix

* Hopefully the last pylint fix

* make variable names understandable

* create and fill dict in one step

* Fix name and attributes

* rename to logical variable in alarm_control_panel

* Remove location_name from alarm_control_panel attributes since it is
already the name of the alarm.

* Multiple fixes to improve code per @springstan suggestions

* Update homeassistant/components/totalconnect/binary_sensor.py

Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com>

* Multiple changes per @MartinHjelmare review

* simplify alarm adding

* Fix binary_sensor.py is_on

* Move DOMAIN to .const in line with examples.

* Move to async_setup

* Simplify code using new features of total-connect-client 0.51

* First crack at config flow for totalconnect

* bump totalconnect to 0.52

* use client.is_logged_in() to avoid total-connect-client details.

* updated generated/config_flow.py

* use is_logged_in()

* Hopefully final touches for config flow

* Add tests for config flow

* Updated requirements for test

* Fixes to test_config_flow

* Removed leftover comments and code

* fix const.py flake8 error

* Simplify text per @Kane610 https://github.com/home-assistant/home-assistant/pull/32126#pullrequestreview-364652949

* Remove .get() to speed things up since the required items should always
be available.

* Move CONF_USERNAME and CONF_PASSWORD into .const to eliminate extra I/O
to import from homeassistant.const

* Fix I/O async issues

* Fix flake8 and black errors

* Mock the I/O in tests.

* Fix isort error

* Empty commit to re-start azure pipelines (per discord)

* bump total-connect-client to 0.53

* Update homeassistant/components/totalconnect/__init__.py

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

* Update homeassistant/components/totalconnect/config_flow.py

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

* Fixes per @balloob comments

* Fix imports

* fix isort error

* Fix async_unload_entry

It still referenced CONF_USERNAME instead of entry.entity_id

* Added async_setup so not breaking change.  Fixed imports.

* Update tests/components/totalconnect/test_config_flow.py

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

* Remove TotalConnectSystem() per @MartinHjelmare suggestion

* Moved from is_logged_in() to is_valid_credentials()

The second is more accurate for what we are checking for, because is_logged_in() could return False due to connection error.

* Fix import in test

* remove commented code and decorator

* Update tests/components/totalconnect/test_config_flow.py

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

* fix test_config_flow.py

* bump total-connect-client to 0.54

* remove un-needed import of mock_coro

* bump to total-connect-client 0.54.1

* re-add CONFIG_SCHEMA

* disable pylint on line 10 to avoid pylint bug

Co-authored-by: springstan <46536646+springstan@users.noreply.github.com>
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-04-12 21:29:57 -05:00
J. Nick Koston 4b1626a748
Config flow for tado (#33677)
* Config flow for tado

* Add homekit models

* self review fixes

* reduce since the loop is gone

* Update homeassistant/components/tado/water_heater.py

Co-Authored-By: Michaël Arnauts <michael.arnauts@gmail.com>

* Change identifier

* Ensure fallback mode is on by default

* unique ids much be str

Co-authored-by: Michaël Arnauts <michael.arnauts@gmail.com>
2020-04-12 13:42:36 -05:00
Save me 8c4a139aeb
Add config_flow for Roomba (#33302)
* Add config_flow for roomba

* Get options to connect

* Fix options in config flow

* Fix syntax in config_flow

* Remove name (not necessary)

* Add bin sensor

* Add Battery sensor

* Add async_connect

* Fix typo

* Add Model and Software version

* Update Roombapy 1.5.0

* Add validate_input

* Add connect and disconnect functions

* Remove test config flow

* Add variables after loop

* Fix translate

* Fix typo

* Fix state of bin

* Update homeassistant/components/roomba/__init__.py

Co-Authored-By: J. Nick Koston <nick@koston.org>

* Update homeassistant/components/roomba/config_flow.py

Co-Authored-By: J. Nick Koston <nick@koston.org>

* Update homeassistant/components/roomba/config_flow.py

Co-Authored-By: J. Nick Koston <nick@koston.org>

* Update homeassistant/components/roomba/config_flow.py

Co-Authored-By: J. Nick Koston <nick@koston.org>

* Update homeassistant/components/roomba/config_flow.py

Co-Authored-By: J. Nick Koston <nick@koston.org>

* Update homeassistant/components/roomba/config_flow.py

Co-Authored-By: J. Nick Koston <nick@koston.org>

* Update homeassistant/components/roomba/__init__.py

Co-Authored-By: J. Nick Koston <nick@koston.org>

* Update homeassistant/components/roomba/__init__.py

Co-Authored-By: J. Nick Koston <nick@koston.org>

* Update homeassistant/components/roomba/__init__.py

Co-Authored-By: J. Nick Koston <nick@koston.org>

* Update homeassistant/components/roomba/config_flow.py

Co-Authored-By: J. Nick Koston <nick@koston.org>

* Remove invalid auth

* Add call function reported_state

* Add options reload

* Fix tracelog

* Set entry_id for config_entry

* Fix DOMAIN unsed-import

* Update homeassistant/components/roomba/config_flow.py

Co-Authored-By: J. Nick Koston <nick@koston.org>

* Update homeassistant/components/roomba/config_flow.py

Co-Authored-By: J. Nick Koston <nick@koston.org>

* Add unique_id for entry

* Fix device info

* Add config_flow for roomba

* Get options to connect

* Fix options in config flow

* Fix syntax in config_flow

* Remove name (not necessary)

* Add bin sensor

* Add Battery sensor

* Add async_connect

* Fix typo

* Add Model and Software version

* Update Roombapy 1.5.0

* Add validate_input

* Add connect and disconnect functions

* Remove test config flow

* Add variables after loop

* Fix translate

* Fix typo

* Fix state of bin

* Update homeassistant/components/roomba/__init__.py

Co-Authored-By: J. Nick Koston <nick@koston.org>

* Update homeassistant/components/roomba/config_flow.py

Co-Authored-By: J. Nick Koston <nick@koston.org>

* Update homeassistant/components/roomba/config_flow.py

Co-Authored-By: J. Nick Koston <nick@koston.org>

* Update homeassistant/components/roomba/config_flow.py

Co-Authored-By: J. Nick Koston <nick@koston.org>

* Update homeassistant/components/roomba/config_flow.py

Co-Authored-By: J. Nick Koston <nick@koston.org>

* Update homeassistant/components/roomba/config_flow.py

Co-Authored-By: J. Nick Koston <nick@koston.org>

* Update homeassistant/components/roomba/__init__.py

Co-Authored-By: J. Nick Koston <nick@koston.org>

* Update homeassistant/components/roomba/__init__.py

Co-Authored-By: J. Nick Koston <nick@koston.org>

* Update homeassistant/components/roomba/__init__.py

Co-Authored-By: J. Nick Koston <nick@koston.org>

* Update homeassistant/components/roomba/config_flow.py

Co-Authored-By: J. Nick Koston <nick@koston.org>

* Remove invalid auth

* Add call function reported_state

* Add options reload

* Fix tracelog

* Set entry_id for config_entry

* Fix DOMAIN unsed-import

* Update homeassistant/components/roomba/config_flow.py

Co-Authored-By: J. Nick Koston <nick@koston.org>

* Update homeassistant/components/roomba/config_flow.py

Co-Authored-By: J. Nick Koston <nick@koston.org>

* Add unique_id for entry

* Fix device info

* syntax for mac (pyupgrade)

* Change single key to BLID

* Resolve dict conflict

* Update homeassistant/components/roomba/binary_sensor.py

Co-Authored-By: J. Nick Koston <nick@koston.org>

* Update homeassistant/components/roomba/sensor.py

Co-Authored-By: J. Nick Koston <nick@koston.org>

* Update homeassistant/components/roomba/.translations/en.json

Co-Authored-By: J. Nick Koston <nick@koston.org>

* Update homeassistant/components/roomba/strings.json

Co-Authored-By: J. Nick Koston <nick@koston.org>

* Add description

* Revert "Remove test config flow"

This reverts commit 26a89422e8.

* Add tests

* Remove check if user none

* Replace CONF_USERNAME to CONF_BLID (breaking change)

* Update test_config_flow.py

* Add code owners

* Remove CONF_USERNAME (unused)

* Add multiple vacuum

* Add multiple vacuum

* Update homeassistant/components/roomba/__init__.py

Co-Authored-By: J. Nick Koston <nick@koston.org>

* Update homeassistant/components/roomba/__init__.py

Co-Authored-By: J. Nick Koston <nick@koston.org>

* Update homeassistant/components/roomba/__init__.py

Co-Authored-By: J. Nick Koston <nick@koston.org>

* Update homeassistant/components/roomba/__init__.py

Co-Authored-By: J. Nick Koston <nick@koston.org>

* Update homeassistant/components/roomba/__init__.py

Co-Authored-By: J. Nick Koston <nick@koston.org>

* Fix syntax name

* Update homeassistant/components/roomba/__init__.py

Co-Authored-By: J. Nick Koston <nick@koston.org>

* Update homeassistant/components/roomba/__init__.py

Co-Authored-By: J. Nick Koston <nick@koston.org>

* Update homeassistant/components/roomba/__init__.py

Co-Authored-By: J. Nick Koston <nick@koston.org>

* Update homeassistant/components/roomba/__init__.py

Co-Authored-By: J. Nick Koston <nick@koston.org>

* Remove CONF_PREFIX (unused)

* Update homeassistant/components/roomba/sensor.py

Co-Authored-By: J. Nick Koston <nick@koston.org>

* Add import UNIT_PERCENTAGE

* Update homeassistant/components/roomba/__init__.py

Co-Authored-By: J. Nick Koston <nick@koston.org>

* Update homeassistant/components/roomba/__init__.py

Co-Authored-By: J. Nick Koston <nick@koston.org>

Co-authored-by: J. Nick Koston <nick@koston.org>
2020-04-11 10:55:00 -05:00
J. Nick Koston ac9429988b
Add a config flow for flume (#33419)
* Add a config flow for flume

* Sensors no longer block Home Assistant startup
since the flume api can take > 60s to respond on
the first poll

* Update to 0.4.0 to resolve the blocking startup issue

* Missed conversion to FlumeAuth

* FlumeAuth can do i/o if the token is expired, wrap it

* workaround async_add_entities updating disabled entities

* Fix conflict
2020-04-08 16:29:59 -05:00
Quentame d99e228983
Add config flow to Synology DSM (#32704)
* Add config flow to Synology DSM

* Use proper sensor unique ID from flow + sensor name

* Add description to api_version

* Add authentication flow check

* Add device_info

* Add test_login_failed test

* Bump python-synology to 0.5.0

* 0.5.0 test updates

* Use NAS S/N as config_flow unique_id

* Add missed conf disks + volumes

* Review: async_unload the async_track_time_interval

* Fix NoneType for disks or volumes

* Keep all disks and volumes forever

* Update homeassistant/components/synology_dsm/.translations/en.json

Co-Authored-By: J. Nick Koston <nick@koston.org>

* Update homeassistant/components/synology_dsm/strings.json

Co-Authored-By: J. Nick Koston <nick@koston.org>

* Fix "Keep all disks and volumes forever" for empty import

* Fix prettier

* Remove useless LOGGER in config flow

* Fix Synology DSM tests doing I/O

Co-authored-by: J. Nick Koston <nick@koston.org>
2020-04-05 17:50:52 -05:00
Robert Van Gorkom ae22b5187a
Add vera config entries support (#29880)
* Adding vera config entries support.

* Fixing lint error.

* Applying minimal changes necessary to get config entries working.

* Addressing PR feedback by further reducing the scope of the change.

* Addressing PR feedback.

* Fixing pyvera import to make it easier to patch.
Addressing PR feedback regarding creation of controller and scheduling of async config flow actions.

* Updating code owners file.

* Small fixes.

* Adding a user config flow step.

* Adding optional configs for user config flow.

* Updating strings to be more clear to the user.

* Adding options flow.
Fixing some PR feedback.

* Better handling of options.
PR feedback changes.

* Using config registry to update config options.

* Better managing config from file or config from UI
Disabling config through UI if config is provided from a file.
More tests to account for these adjustments.

* Address PR feedback.

* Fixing test, merging with master.

* Disabling all Vera UI for configs managed by configuration.yml.
Adding more tests.

* Updating config based on unique_id.
Addressing additional PR feedback.

* Rebasing off dev.
Addressing feedback.

* Addressing PR feedback.
2020-04-03 09:49:50 +02:00
Aaron Bach cb058ff6c0
Add config entry for Flu Near You (#32858)
* Add config flow for Flu Near You

* Cleanup

* Cleanup

* Add tests

* Add test requirements

* Code review

* Reduce unnecessary async-ness

* Handle API registration

* Cleanup

* Update homeassistant/components/flunearyou/.translations/en.json

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

* Code review

* Ensure config schema allows additional keys

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-04-02 16:54:11 -07:00
J. Nick Koston cc443ff37a
Add config flow for nut (#33457)
* Convert nut to config flow

* Add a test for importing

* lint

* Address review items (part 1)

* Address review items (part 1)

* Cleanup unique id handling

* Update tests for new naming scheme

* No unique id, no device_info

* Remove sensor types

* Update tests to use resources that still exist
2020-03-31 19:08:27 -07:00
Chris Talkington 98f68f4798
Add Internet Printing Protocol (IPP) integration (#32859)
* Create __init__.py

* Create manifest.json

* Update zeroconf.py

* more work on integration

* more work on integration.

* add more sensor tests.

* Update const.py

* Update sensor.py

* more work on ipp.

* Update test_config_flow.py

* more work on ipp.

* Update config_flow.py

* Update config_flow.py
2020-03-30 16:13:47 -07:00
J. Nick Koston 18a4829314
Config flow for elkm1 (#33297)
* Config flow for elkm1

* As entity ids can now be changed, the “alarm_control_panel”
attribute “changed_by_entity_id” is now “changed_by_keypad”
and will show the name of the Elk keypad instead of the entity id.

* An auto configure mode has been introduced which avoids the
need to setup the complex include and exclude filters.  This
functionality still exists when configuring from yaml for power
users who want more control over which entities elkm1 generates.

* restore _has_all_unique_prefixes

* preserve legacy behavior of creating alarm_control_panels that have no linked keypads when auto_configure is False

* unroll loop
2020-03-27 15:38:35 -05:00
J. Nick Koston f9a7c64106
Config flow for doorbird (#33165)
* Config flow for doorbird

* Discoverable via zeroconf

* Fix zeroconf test

* add missing return

* Add a test for legacy over ride url (will go away when refactored to cloud hooks)

* Update homeassistant/components/doorbird/__init__.py

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

* without getting the hooks its not so useful

* Update homeassistant/components/doorbird/config_flow.py

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

* fix copy pasta

* remove identifiers since its in connections

* self review fixes

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-03-23 10:14:21 +01:00
J. Nick Koston b09a9fc81a
Add config flow for Nuheat (#32885)
* Modernize nuheat for new climate platform

* Home Assistant state now mirrors the
  state displayed at mynewheat.com

* Remove off mode as the device does not implement
  and setting was not implemented anyways

* Implement missing set_hvac_mode for nuheat

* Now shows as unavailable when offline

* Add a unique id (serial number)

* Fix hvac_mode as it was really implementing hvac_action

* Presets now map to the open api spec
  published at https://api.mynuheat.com/swagger/

* ThermostatModel: scheduleMode

* Revert test cleanup as it leaves files behind.

Its going to be more invasive to modernize the tests so
it will have to come in a new pr

* Config flow for nuheat

* codeowners

* Add an import test as well

* remove debug
2020-03-23 00:29:45 -05:00
Eugenio Panadero 8d2e72cdf6
Add pvpc electricity prices integration (#32092)
* Add new integration: pvpc_hourly_pricing

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

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

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

* Update requirements and add to codeowners

* Avoid passing in hass as a parameter to the entity

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

* Fix lint issues

* Add tests for config & options flow

* Add tests for manual yaml config

with entity definition as integration and also as a sensor platform

* Fix placement of PLATFORM_SCHEMA and update generated config_flows

* Store prices internally linked to UTC timestamps

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

* Add availability to sensor

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

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

* Add more tests

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

* fix linter

* Better handling of sensor availability and minor enhancements

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

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

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

* Change API endpoint to retrieve JSON data

and remove xmltodict from reqs.

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

* Adapt tests to new API endpoint

* Translate tariff labels to plain English

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

* Relax logging levels to meet silver requirements

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

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

* Fix requirements

* Mod tests to work with timezone Atlantic/Canary

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

* Try to fix CI tests

* Externalize pvpc data and simplify sensor.py

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

* Simplify tests for pvpc_hourly_pricing

* Fix updater for options flow

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

* Fix lint

* Bump aiopvpc

* Remove options flow and platform setup

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

* Fix docstring on test

and rename SENSOR_SCHEMA to SINGLE_SENSOR_SCHEMA to avoid confusion

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

* Simplify tests

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

* Fix possible duplicated update

when source is not available.

* Do not access State last_changed for log messages

* Do not update until entity is added to hass

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

* minor changes

* Rename method to select current price and make it a callback
2020-03-22 14:25:31 -05:00
On Freund e8bd1b9216
Config Flow and Entity registry support for Monoprice (#30337)
* Entity registry support for monoprice

* Add test for unique_id

* Add unique id namespace to monoprice

* Config Flow for Monoprice

* Update monoprice tests

* Remove TODOs

* Handle entity unloading

* Fix update test

* Streamline entity handling in monoprice services

* Increase coverage

* Remove devices cache

* Async validation in monoprice config flow
2020-03-21 18:12:32 -07:00
J. Nick Koston 37687561c0
Add config flow for myq (#32890)
* Add a config flow for myq

* Discovered by homekit

* Fix gates being treated as garage doors

* Offline devices now show as unavailable

* Homekit flow

* strip out icon

* return -> raise
2020-03-20 15:28:14 -05:00
J. Nick Koston f275b7e5ed
Add Nexia thermostat support (Trane / American Standard) (#32826)
* Merge nexia

* Restore original work

* Merge cleanups

* config flow

* Add config flow

* Add missing files

* Fix import of old yaml config

* More cleanups from self review

* Additional self review

* Update homeassistant/components/nexia/services.yaml

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

* fix io in event loop

* Update homeassistant/components/nexia/climate.py

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

* avoid using ternary statements if they span multiple

* Cleanup strings and remove unneeded attributes

* more cleanup

* more cleanup of yaml

* remove coordinator boiler plate

* nuke services for now for the inital pr, add back later

* remove copy pasta

* this can be reduced more

* Update homeassistant/components/nexia/config_flow.py

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

* Update homeassistant/components/nexia/config_flow.py

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

* Update homeassistant/components/nexia/__init__.py

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

* Update homeassistant/components/nexia/__init__.py

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

* Update homeassistant/components/nexia/__init__.py

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

* Update homeassistant/components/nexia/__init__.py

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

* review

* comments

* Update homeassistant/components/nexia/climate.py

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

* Update homeassistant/components/nexia/climate.py

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

* Update homeassistant/components/nexia/climate.py

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

* more review adjustments

* nuke unused constants

* Update homeassistant/components/nexia/config_flow.py

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

* map states

* add update

* zone id is unique

* Fix humidfy check

* target_humidity should be a property instead of in attributes

* remove aux heat as its already there

Co-authored-by: Ryan Nazaretian <ryannazaretian@gmail.com>
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-03-19 21:03:51 -05:00
J. Nick Koston d33a3ca90f
Config flow for harmony (#32919)
* Config flow for harmony

* Fixes unique ids when using XMPP

Co-authored-by: Bram Kragten <mail@bramkragten.nl>

* Find the unique id for the config flow

* move shutdown to init

* Add test for ssdp (still failing)

* Fix ssdp test

* Add harmony to MIGRATED_SERVICE_HANDLERS (this is a breaking change)

* more cleanups

* use unique id for the config file

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
2020-03-19 11:29:51 -05:00
J. Nick Koston 5b4d2aed64
Add Powerwalls integration (#32851)
* Create an integration for Powerwalls

* Self review :: remove unused code

* Remove debug

* Update homeassistant/components/powerwall/__init__.py

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

* _call_site_info to module level

* Update homeassistant/components/powerwall/binary_sensor.py

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

* Update homeassistant/components/powerwall/sensor.py

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

* Update homeassistant/components/powerwall/binary_sensor.py

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

* Update homeassistant/components/powerwall/binary_sensor.py

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

* Update tests/components/powerwall/test_binary_sensor.py

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

* Update homeassistant/components/powerwall/binary_sensor.py

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

* Update homeassistant/components/powerwall/binary_sensor.py

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

* remove sensors that I added tests for from the comment

* Update homeassistant/components/powerwall/config_flow.py

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

* Update homeassistant/components/powerwall/sensor.py

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

* Update homeassistant/components/powerwall/sensor.py

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

* Update homeassistant/components/powerwall/sensor.py

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

* Switch to UNIT_PERCENTAGE

* reduce code

* Add test for import

* Adjust tests

* Add missing file

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-03-19 10:50:17 -05:00
Chris Talkington cf8dfdae47
Add config flow to roku (#31988)
* create a dedicated const.py

* add DEFAULT_PORT to const.py

* work on config flow conversion.

* remove discovery.

* work on config flow and add tests. other cleanup.

* work on config flow and add tests. other cleanup.

* add quality scale to manifest.

* work on config flow and add tests. other cleanup.

* review tweaks.

* Update manifest.json

* catch more specific errors

* catch more errors.

* impprt specific exceptions

* import specific exceptions

* Update __init__.py

* Update config_flow.py

* Update media_player.py

* Update remote.py

* Update media_player.py

* Update remote.py

* Update media_player.py

* Update remote.py

* Update config_flow.py

* Update config_flow.py

* Update media_player.py

* Update __init__.py

* Update __init__.py

* Update config_flow.py

* Update test_config_flow.py

* Update config_flow.py

* Update __init__.py

* Update test_config_flow.py

* Update remote.py

* Update test_init.py

* Update test_init.py

* Update media_player.py

* Update media_player.py

* Update media_player.py
2020-03-15 21:13:04 -07:00
J. Nick Koston 7737387efe
Add config flow for rachio (#32757)
* Do not fail when a user has a controller with shared access on their account

* Add config flow for rachio

Also discoverable via homekit

* Update homeassistant/components/rachio/switch.py

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

* Split setting the default run time to an options flow

Ensue the run time coming from yaml gets imported into the option flow

Only get the schedule once at setup instead of each zone (was hitting rate limits)

Add the config entry id to the end of the webhook so there is a unique hook per config entry

Breakout the slew of exceptions rachiopy can throw into RachioAPIExceptions

Remove the base url override as an option for the config flow

Switch identifer for device_info to serial number

Add connections to device_info (mac address)

* rename to make pylint happy

* Fix import of custom_url

* claim rachio

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-03-13 22:46:17 -07:00
Quentame 19be4a5d6d
Refactor Freebox : add config flow + temperature sensor + signal dispatch (#30334)
* Add config flow to Freebox

* Add manufacturer in device_tracker info

* Add device_info to sensor + switch

* Add device_info: connections

* Add config_flow test + update .coveragerc

* Typing

* Add device_type icon

* Remove one error log

* Fix pylint

* Add myself as CODEOWNER

* Handle sync in one place

* Separate the Freebox[Router/Device/Sensor] from __init__.py

* Add link step to config flow

* Make temperature sensors auto-discovered

* Use device activity instead of reachablility for device_tracker

* Store token file in .storage

Depending on host if list of Freebox integration on the future without breaking change

* Remove IP sensors + add Freebox router as a device with attrs : IPs, conection type, uptime, version & serial

* Add sensor should_poll=False

* Test typing

* Handle devices with no name

* None is the default for data

* Fix comment

* Use config_entry.unique_id

* Add async_unload_entry with asyncio

* Add and use bunch of data size and rate related constants (#31781)

* Review

* Remove useless "already_configured" error string

* Review : merge 2 device & 2 sensor classes

* Entities from platforms

* Fix unload + add device after setup + clean loggers

* async_add_entities True

* Review

* Use pathlib + refactor get_api

* device_tracker set + tests with CoroutineMock()

* Removing active & reachable from tracker attrs

* Review

* Fix pipeline

* typing

* typing

* typing

* Raise ConfigEntryNotReady when HttpRequestError at setup

* Review

* Multiple Freebox s

* Review: store sensors in router

* Freebox: a sensor story
2020-03-11 22:15:59 +01:00
Chris Talkington bb666b9ac6
Add config flow to directv (#32162)
* initial work on config flow.

* more work on config flow.

* work on config flow and add tests. other cleanup.

* cleanup tests.

* fix test.

* isort

* Update .coveragerc

* Update test_init.py

* Update test_init.py

* Update test_init.py

* Update test_config_flow.py

* Update test_config_flow.py

* Update test_config_flow.py

* correct upnp serial format.

* improve config flow coverage.

* review tweaks.

* further review tweaks

* simplify dtv data gathering job

* lint

* black

* Update test_init.py

* Update test_init.py

* Simplify exception handling.

* Simplify exception handling.

* Update media_player.py

* Update test_media_player.py

* Update test_media_player.py

* Update test_media_player.py

* Update test_media_player.py

* Update test_media_player.py

* fix failing test.

* restore change made during debug.

* isort.

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-03-11 12:28:38 -07:00
J. Nick Koston 908ae23738
Add griddy integration (#32591)
* Add griddy integration

* Griddy is a wholesale power provider in Texas

* Supports all four load zones in Texas

* Provides real time power price which is useful for automations to handle demand response

* Update homeassistant/components/griddy/sensor.py

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

* Update homeassistant/components/griddy/config_flow.py

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

* Add ability request updated via entity update service.

* Improve error message about already configured

* Remove DEVICE_CLASS_POWER since we do not have a device class for cost

* remove setdefault that was left from previous refactor

* More detail on data naming

* Bump translation for testing

* git add the config flow tests

* s/PlatformNotReady/ConfigEntryNotReady/

* Review items

* git add the other missing file

* Patch griddypower

* reduce

* adjust target

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-03-10 23:00:30 +01:00
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