Commit Graph

5030 Commits (a4c9446b8d75d1b36b1ca97c9f62e005a091ca45)

Author SHA1 Message Date
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
Quentame 01dc81d8fb
Fetch iCloud family devices only when wanted (#32644)
* Fetch iCloud family devices only when wanted

* Review: form data_schema as init schema
2020-03-11 20:43:37 +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
chiefdragon 3e8728ad5f
Fix issue #23758 - Restore Canary sensors and ensure alarm con… (#32627)
* Fixed missing Canary sensors and Canary alarm control panel that was not updating correctly

* Resolved pylinting warnings in original tests
2020-03-11 11:58:42 -07:00
jjlawren 44c7743351
Rewrite and add Plex tests (#32633)
* Rewrite and add Plex tests

* Remove unnecessary mocks

* Explicitly import constants for readability
2020-03-11 09:37:02 -07:00
Erik Montnemery f7ddbc7e1e
Remove duplicated config from MQTT tests (#32689) 2020-03-11 09:34:19 -07:00
Florian Werner 5216dc0ae1
Fix rate of change calculation of statistics sensor (#32597)
* Fix rate of change of statistics sensor

* Fix test
2020-03-11 09:33:00 -07:00
Alexei Chetroi 440c837eb6
Allow sw_version update of a device registry entry. (#32630) 2020-03-11 09:31:02 -07:00
Bram Kragten 4c4e5f3fa9
Fix demos (#32086)
* Fixes for demos

* Update vacuum.py

* Comment

* Fix tests
2020-03-11 08:16:22 -07:00
David F. Mulcahey 7127492767
Additional ZHA cleanup (#32678)
* fix double device loading in tests

* change imports

* None is default
2020-03-11 13:37:28 +01:00
David F. Mulcahey 4248893007
Clean up custom polling in ZHA device and light (#32653)
* cleanup timer handle when device is removed

* separate unavailable times for mains vs battery

* better name

* remove light refresh handle when removing light

* remove unused parallel updates

* don't steal HA const for different purpose

* don't flood network every hour for lights

* update test to test both intervals

* add test for light refresh interval

* fix tests

* update test

* put parallel updates back for now...

* fix async_schedule_update_ha_state usage

* review comment

* review comment

* update test - review conversation

* review comments

* await count not call count

* flip some state
2020-03-11 07:17:53 -04:00
Diogo Gomes 16336bf902
Add entity_service calibrate_meter to utility_meter (#32658)
* add calibrate service
2020-03-11 09:42:22 +01:00
J. Nick Koston 048f9e7daa
Throw ConfigEntryNotReady when august servers are offline or u… (#32635)
* Throw ConfigEntryNotReady when august servers are offline

* august has tests now and its nearing 100%

* Adjust per review

* define in init
2020-03-10 17:10:00 -07:00
J. Nick Koston ae147fd9c7
Lock operation sensors for August (#32593)
* adkj

* reduce

* Convert august to async

Async io was added to py-august 0.24

* Fix lint

* Lock operation sensors for august

* Tracking lock operation method allows user presence detection at the lock

* revert lock changes

* fix activity count merge conflict reversion

* Fix revert that come back with the conflict
2020-03-10 17:09:49 -07:00
Bram Kragten bbe0f75336
input_datetime guard for unexpected state on restore (#32652)
* input_datetime guard for unexpected state

If state is a time and has_date = true, or the other way around, restore state would error

* Update __init__.py

* Add test
2020-03-10 15:15:11 -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
Aaron Bach 21cff003f8
Add options flow for AirVisual (#32634)
* Add options flow for AirVisual

* Code review

Co-Authored-By: Robert Svensson <Kane610@users.noreply.github.com>

Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>
2020-03-10 14:16:25 -06:00
Paolo Tuninetto a8758ed3a1
Add support for newer SamsungTV models (#31537)
* Added support for newer SamsungTV models

* Fixed legacy port

* store token in HA config directory

* Change token name

* rebasing and exception handling

* implement update

* fix error creating mediaplayer

* Debug logging

* Increase timeout

* Restore update timeout

* Store token_file path in config_entry

* Introduction of samsung bridge class

* Added bridge class functions

* Code cleanup

* more fixes

* Begin testing

* samsungtvws 1.2.0

* Config flow tests 0.1

* Fixed some mediaplayer tests

* Fixed fixture in media player

* use of constants and turn off

* more media player tests

* samsungtvws 1.3.1 and other fixes

* WS tv update rewritten

* more tests

* test_init

* fixed tests

* removed reset mock

* tests reset mock

* close_remote and tests

* deprecate port config

* deprecate port config 2

* deprecate port config 3

* save token only if needed

* cleanup

* better websocket protocol detection

* config removal
2020-03-10 11:48:09 +01:00
Quentame 2e802c88f8
Add devices check to iCloud config flow (#31950)
* Add devices check to iCloud config flow

* Some test rename

* Bump pyicloud to catch KeyError
2020-03-10 11:42:04 +01:00
Michaël Arnauts 8c52e2c923
Revert "Breakout tado zone code into a single place (#32564)" (#32639)
This reverts commit c2b03332a0.
2020-03-10 09:32:56 +01:00
Paul Enright ac9c9377c2
Add tests for workday sensor (#31832)
* Workday Fix

* fix pylint errors

* Update binary_sensor.py

* Update test_binary_sensor.py

Added tests to match the document new configuration examples
2020-03-10 08:53:06 +01:00
Erik Montnemery 324dfe07b4
Clear discovery topic for MQTT device triggers (#32617) 2020-03-09 21:59:38 -07:00
Thomas Hollstegge f3c07a5653
Alexa: Add support for starting and cancelling timers (#32616) 2020-03-09 21:59:06 -07:00
Aaron Bach f4561891ae
Ensure AirVisual import config flow checks API key correctness (#32624)
* Add small improvements to AirVisual config flow tests

* Code review comments

* Code review comments
2020-03-09 21:39:42 -06:00
J. Nick Koston c2b03332a0
Breakout tado zone code into a single place (#32564)
* Breakout tado zone code into a single place

* Resolve various incorrect states and add tests for known tado zone states

* Fix home and away presets

* Upgrade to PyTado 0.4.0 which improves http performance and fixes setting fan speed.

* Write state instead of calling for an update

* adjust codeowners

* Add tests for michael's tado and fix heatingPower.value

* Guards are much cleaner

* Adjust per review

* Remove hass passing
2020-03-09 17:44:34 -07:00
J. Nick Koston 3a680bf7b7
Add a commit interval setting to recorder (#32596)
* Add a commit interval setting to recorder

* Make the default every 1s instead of immediate

* See attached py-spy flamegraphs for why 1s

* This avoids disk thrashing during event storms

* Make Home Assistant significantly more responsive on busy systems

* remove debug

* Add commit forces for tests that expect commits to be immediate

* Add commit forces for tests that expect commits to be immediate

* make sure _trigger_db_commit is in the right place (all effective "wait_recording_done" calls)

* De-duplicate wait_recording_done code
2020-03-09 17:43:26 -07:00
Paulus Schoutsen 8a46d93be4
Upgrade hass_nabucasa to 0.32.2 (#32522)
* Upgrade hass_nabucasa to 32.1

* Fix tests

* Update hass-nabucasa to 0.32.2

Co-authored-by: Pascal Vizeli <pvizeli@syshack.ch>
2020-03-09 17:42:26 -07:00
Alexei Chetroi 87b770be08
Add PollControl cluster support to ZHA (#32618)
* Poll control channel

Set check-in interval to 55min.
Set long-poll interval to 6s.

* Update tests.

* Don't use magic numbers.
2020-03-09 19:55:25 -04:00
Aaron Bach 9a3c58213b
Validate WWLLN window size in config schema (#32621)
* Validate WWLLN window size in config schema

* Cleanup

* Clean up imports

* Fix tests
2020-03-09 17:18:39 -06:00
Paulus Schoutsen d4615fd432
Freeze config entry data (#32615)
* Freeze config entry data

* Fix mutating entry.data

* Fix config entry options tests
2020-03-09 14:07:50 -07:00
J. Nick Koston 3318e65948
Convert august to async (#32586)
* Convert august to async

Async io was added to py-august 0.24

* Fix lint
2020-03-09 13:54:05 -07:00
Erik Montnemery 4bb9f1800d
Deduplicate MQTT mixin tests (#32563)
* Deduplicate MQTT mixin tests

* Remove test of not yet merged function
2020-03-09 09:40:00 -07:00
Alexei Chetroi 743833e5f3
Bump up ZHA dependencies. (#32609)
* Bump up ZHA dependencies.

* Update tests to match library changes.
2020-03-09 12:39:41 -04:00
David Nielsen 988b400a9c
Fix TypeError Exception in AlexaSpeaker (#32318)
* alexa/capabilities.py: Fix TypeError Exception

    - Remove division by zero try/catch -- there is no division
    - Handle TypeError exception when current_volume = None
    - Simplify math and return logic

* Add test for Alexa.Speaker's valid volume range
2020-03-09 09:38:31 -07:00
Jc2k 19faf06ce7
homekit_controller fixes from testing with an LG TV: (#32610)
* Bump aiohomekit to get better reconnection handling and cleaner shutdowns.
 * Read the ACTIVE characteristic and set ok/problem state

Also gets test coverage to 100%.
2020-03-09 12:19:17 -04:00
Thomas Hollstegge 22b5690607
Alexa: Support vacuums without turn_on/turn_off feature (#32570)
* Alexa: Support vacuums without turn_on/turn_off feature
2020-03-09 11:58:47 -04:00
ochlocracy fa4f27f78e
Remove AlexaPowerController from device_class garage covers in… (#32607) 2020-03-09 08:25:33 -07:00
Franck Nijhof c0c5c33b20
Fix Withings timezone test (#32602) 2020-03-09 13:45:39 +01:00
Anders Melchiorsen 17215709e1
Simplify logbook duplicate handling (#32572) 2020-03-07 20:27:51 -08:00
Alexei Chetroi 7e781946fa
Refactor ZHA device keep alive checker (#32561)
* Refactor zha core device _check_available().
Make it async, so we don't run it in a sync worker.

* Use random keep alive interval for zha device pings.
* Update tests.
2020-03-07 13:52:45 -05:00
Ivan Belokobylskiy 1f510389b8
Fix Yandex transport after API change (#32500)
* Update Yandex transport after API change (home-assistant#32431)

* Update mocked response for test (home-assistant#32431)

* Codestyle fixes (home-assistant#32431)
2020-03-07 18:26:35 +01:00
David F. Mulcahey e52542c4d7
Allow multiple attribute reads in ZHA (#32498)
* multi attribute reads for lights

* catch specific exceptions

* get attributes

* fix mains powered update

* add guards and use get_attributes

* use debug for read failures

* cleanup

* update return value for read_attributes

* fix on with timed off
2020-03-07 07:33:59 -05:00
Alexei Chetroi dd91b51435
Make ZHA Scene channel an eventable channel. (#32546) 2020-03-06 17:32:26 -05: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
Jc2k 2879081772
Implement source switching for homekit_controller televisions (#32526) 2020-03-06 15:47:40 +00:00
Paulus Schoutsen e02042b33e
Send messages conforming new facebook policy (#32516) 2020-03-05 17:19:30 -08:00
Paulus Schoutsen a579fcf248
Add app support for TVs to Vizio integration (#32432)
* add app support

* code cleanup, add additional test, add CONF_APPS storage logic for import

* simplify schema defaults logic

* remove unnecessary lower() and fix docstring

* remove default return for popping CONF_APPS during import update because we know entry data has CONF_APPS due to if statement

* further simplification

* even more simplification

* fix type hints

* move app configuration to separate step, fix tests, and only make app updates if device_type == tv

* remove errors variable from tv_apps and move tv_apps schema out of ConfigFlow for consistency

* slight refactor

* remove unused error from strings.json

* set unique id as early as possible

* correct which dictionary to use to set unique id in pair_tv step
2020-03-05 13:34:12 -08:00
Paulus Schoutsen 873bf887a5
Add OwnTracks Friends via person integration (#27303)
* Returns an unencrypted location of all persons with device trackers

* Handle encrypted messages and exclude the poster's location

* Friends is by default False. Reformats with Black

* Updates the context init to account for the Friends option

* Fix Linter error

* Remove  as a config option

* No longer imports encyrption-related functions in encrypt_message

* Fix initialization in test

* Test the friends functionality

* Bugfix for persons not having a location

* Better way to return the timestamp

* Update homeassistant/components/owntracks/__init__.py

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

* Linting and tid generation

* Fix test

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-03-05 12:55:48 -08:00
Paulus Schoutsen 4717d072c9
Remove discovery and legacy config file loading for Plex (#32510) 2020-03-05 12:36:18 -08:00
Paulus Schoutsen 8aea538662
Allow teaching logbook about events (#32444)
* Allow teaching logbook about events

* Use async_add_executor_job

* Fix tests
2020-03-05 11:55:50 -08:00
Paulus Schoutsen 7c51318861
Require title, separate show sidebar option (#32479)
* Require title, separate show sidebar option

* Fix list command not updating

* Some more test checks
2020-03-05 11:52:12 -08:00
Paulus Schoutsen d885853b35
Make it possible to fetch proxy media player album art (#32471) 2020-03-05 11:45:36 -08:00
Paulus Schoutsen 6a21afa2a8
Improve script validation (#32461) 2020-03-05 11:44:42 -08:00
Jc2k 007d934214
Initial support for HomeKit enabled televisions (#32404)
* Initial support for HomeKit enabled televisions

* Fix nit from review
2020-03-05 13:49:56 +00:00
Paulus Schoutsen 521cc7247d
Add Dynalite switch platform (#32389)
* added presets for switch devices

* added channel type to __init and const

* ran pylint on library so needed a few changes in names

* removed callback

* bool -> cv.boolean
2020-03-04 22:05:39 -08:00
Paulus Schoutsen d216c1f2ac
UniFi - Add block network access control to config option (#32004)
* Add block network access control to config option

* Clean up
2020-03-04 21:55:56 -08:00
Paulus Schoutsen 1615a5ee81
Use unique_id in Plex config entries (#32489) 2020-03-04 21:42:48 -08:00
Paulus Schoutsen 81f99efda1
Mock all invocations of coronavirus.get_cases (#32487) 2020-03-04 21:42:07 -08:00
Paulus Schoutsen 81810dd920
Modernize WWLLN config flow (#32194)
* Modernize WWLLN config flow

* Code review

* Update tests
2020-03-04 18:23:00 -08:00
Paulus Schoutsen b848c97211
Add soundtouch attributes exposing multiroom zone info (#28298)
* [soundtouch] workaround for API bug when removing multiple slaves from a zone at once

* [soundtouch] added additional attributes exposing multiroom zone info

* Fix update with slave entities

* Add zone attributes test

* Fix and clean up tests

* Fix typo

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-03-04 17:53:15 -08:00
Paulus Schoutsen eac1f029e5
Allow string values on zwave.set_node_value (#31061)
* Allow string values on zwave.set_node_value

This allows for:

* Accessing longer value_ids. In some cases, value ids in z-wave nodes are very large (17 digits in my case). Passing them as int does not seem to work well (python probably truncates the number), but passing them as string works fine
* Changing color values, which are represented as hex string

reformat test

* update services.yaml with string set_node_value
2020-03-04 17:40:58 -08:00
Paulus Schoutsen 3ca97a0517
Add sighthound timestamped file (#32202)
* Update image_processing.py

Adds save timestamp file and adds last_detection attribute

* Update test_image_processing.py

Adds test

* Adds assert pil_img.save.call_args

* Test timestamp filename

* Add test bad data

* Update test_image_processing.py

* Fix bad image data test

* Update homeassistant/components/sighthound/image_processing.py

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

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-03-04 17:31:54 -08:00
Alexei Chetroi e416f17e4d
ZHA: Successful pairing feedback (#32456) 2020-03-04 19:27:37 -05:00
Paulus Schoutsen 2abdfc9da6
GeoNet NZ Quakes code improvements (#32338)
* code quality improvements

* code quality improvements and fixed tests

* explicitly set unique ids

* improve unique id creation

* remove entities from entity registry

* added test for removing entities from entity registry

* revert entity registry handling from sensor and test code

* check for entity registry removal in geolocation test case

* make import absolute; isort

* change quality scale
2020-03-04 14:52:16 -08:00
Paulus Schoutsen dd7d8d4792
Remove 'show all controls' option for Plex (#32391) 2020-03-04 14:42:50 -08:00
Paulus Schoutsen 0763dc6089
Fix filter sensor processing states that aren't numbers (#32453)
* lint

* only_numbers flag
2020-03-04 12:47:53 -08:00
Alexei Chetroi 20333703c5
Remove ZHA attribute listening channel (#32468)
* remove AttributeListeningChannel
* pull sleeps
* update signature to fix pylint
2020-03-04 13:11:53 -05:00
J. Nick Koston 7f91501a36
Use a requests Session for rest sensors (#32463)
This avoids the ssl setup overhead for each request
2020-03-04 08:32:38 -08:00
Paulus Schoutsen b27c46750c
Update error handling in update coordinator (#32452) 2020-03-04 08:05:46 -08:00
Raman Gupta 4f619691df
Add is_volume_muted property to vizio integration (#32332)
* add is_muted property and update tests

* black

* manually set is_muted on async_mute_volume calls to set state early

* combine two lines into one

* set is_muted to None when device is not on
2020-03-04 10:04:52 +01:00
Paulus Schoutsen 7678d66464
Fix device tracker TrackerEntity defaults (#32459) 2020-03-04 09:43:52 +01:00
Paulus Schoutsen 4cf86262af
Numeric state trigger: validate that above is not above below (#32421)
* Numeric state trigger: validate that above is not above below

* Lint
2020-03-03 17:26:44 -08:00
Paulus Schoutsen fed23030d6
Filter out duplicate logbook states (#32427) 2020-03-03 13:56:32 -08:00
Paulus Schoutsen 8f6651af3d
Update system log grouping (#32367) 2020-03-03 13:55:15 -08:00
Alexei Chetroi 896df9267a
Fix ZHA device healthcheck pings (#32425) 2020-03-03 13:37:17 -05:00
Maciej Bieniek 2f8381b1bf
Bump brother library (#32436) 2020-03-03 16:59:02 +01:00
Paulus Schoutsen c62961f40c
Add unique ID to coronavirus (#32423) 2020-03-02 18:10:38 -08:00
Paulus Schoutsen fcbea47c74
Coronavirus updates (#32417)
* Sort countries alphabetically

* Update sensor name

* Add migration to stable unique IDs

* Update sensor.py
2020-03-02 17:59:32 -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
jjlawren df3f7687d4
Refactor Certificate Expiry Sensor (#32066)
* Cert Expiry refactor

* Unused parameter

* Reduce delay

* Deprecate 'name' config

* Use config entry unique_id

* Fix logic bugs found with tests

* Rewrite tests to use config flow core interfaces, validate created sensors

* Update strings

* Minor consistency fix

* Review fixes, complete test coverage

* Move error handling to helper

* Subclass exceptions

* Better tests

* Use first object reference

* Fix docstring
2020-03-02 07:44:24 -06:00
J. Nick Koston 7ca4665711
Move keypad battery implementation details into py-august (#32349)
* Move keypad battery implementation details into py-august

* Upgrade to py-august 0.22.0 which also adds gen2 doorbell battery data

* remove cruft from previous refactor
2020-03-01 23:22:28 -08:00
J. Nick Koston 924c313c8a
Add application/xml as an XML to JSON auto converted mime type… (#32289)
* Resolves issue #32280
2020-03-01 23:22:01 -08:00
Ziv e13d5bdc10
Refactor dynalite integration for multi-platform (#32335)
* refactoring for multi platform

* adopted test_bridge to refactoring

* refactoring tests for multi-platform
additional coverage in config and init

* comment for clarity

* more specific imports from lib

* library version bump

* removed async_update

* changed parameter order to start with hass

* removed pylint disable

* unsubscribe from signal dispatcher
inherit from Entity

* use device.unique_id

* changed hass_obj to hass

* added test for remove entity
bug fix from the test

* removed the polling try_connect. hate polling... it is now part of the async_setup()
significantly makes the code clearer and simplifies the tests

* removed leftover debug logs in the library

* changed tests to get the entry_id from hass

* changed place to assign hass.data only after success

* fixes for test_init

* removed assert

* removed device_info

* removed bridge internal from common

* modified test_bridge to work without the bridge directly

* removed bridge from test_existing_update

* changed update to not use bridge internals

* dyn_bridge fixture no longer used - removed
2020-03-01 22:44:24 +01:00
Paulus Schoutsen c6e85cac0b
Require IFTTT to send data as dictionary (#32317)
* Require IFTTT to send data as dictionary

* Update logging
2020-02-29 20:37:06 -08:00
Robert Chmielowiec 8e3492d4f5
ZHA: Support light flashing (#32234) 2020-02-29 18:37:06 -05:00
Erik Montnemery c4ac3155e4
Add brightness to light device turn_on action (#32219)
* Add support for setting brightness

* Remove default brightness
2020-02-29 13:33:20 +01:00
J. Nick Koston be14b94705
Restore august lock changed_by state on restart (#32340)
* Various code review items from previous PRs

* Add a test for fetching the doorbell camera image

* Switch to using UNIT_PERCENTAGE for battery charge unit

* Add tests for changed_by
2020-02-29 12:12:50 +01: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
Alexei Chetroi 0670b4f457
Use collection helpers for counter integration (#32295)
* Refactor counter to use config dict.

* Use collection helpers for counter integration.

* Update tests.

* Use callbacks were applicable.
2020-02-28 14:06:39 -08:00
Paulus Schoutsen deda2f86e7
Allow managing Lovelace storage dashboards (#32241)
* Allow managing Lovelace storage dashboards

* Make sure we do not allow duplicate url paths

* Allow setting sidebar to None

* Fix tests

* Delete storage file on delete

* List all dashboards
2020-02-28 12:43:17 -08:00
springstan f1a0ca7cd3
Add and use percentage constant (#32094)
* Add and use percentage constant

* Fix pylint error and broken test
2020-02-28 11:46:48 -08:00
J. Nick Koston c7f128f286
Ensure rest sensors are marked unavailable when http requests… (#32309) 2020-02-28 11:41:41 -08:00
Paulus Schoutsen 601f2c693d
Prevent saving/deleting Lovelace config in safe mode (#32319) 2020-02-28 11:12:16 -08:00
springstan 157f972d72
Use f-strings in integrations starting with "H" - "L" (#32265)
* Use f-strings in integrations starting with "H"

* Use f-strings in integrations starting with "I"

* Use f-strings in integrations starting with "J"

* Use f-strings in integrations starting with "K"

* Use f-strings in integrations starting with "L"

* Fix lint error

* Use join instead of f-string in homekit_controller

* Use local variables with f-strings

* Fix lint error

* Escape the characters in f-string

* Sort imports with isort in homeworks light

* Fix pylint error

* Fix broken tests

* Fix broken tests v2
2020-02-28 12:39:29 +01:00
Ziv 02c170b961
Dynalite listener for config entry update (#32116)
* added entry listener that reloads the component

* fixed update with existing entry

* fixed import in test

* fixes

* library version

* removed unique_id

* fix

* fixed for no entries in hass.data

* fixed return value on abort

* moved to use async_entries

* removed unused import
2020-02-27 22:05:55 -08:00
Raman Gupta b9fa32444a
Support vizio pairing through config flow (#31520)
* support pairing through config flow

* simplify import failure log messages

* remove unnecessary list comprehension

* bump pyvizio to add passing ClientSession in where it was missed

* show different message if user completes pairing through import

* remove dupe failure message since reasons for failure are the same in both instances

* remove extra constant

* add host reachability check during pairing workflow

* revert redundant connection check since check is implicitly done during pairing process

* fix rebase errors

* fix string

* updates based on review

* update docstring

* missed commit

* update import confirmation message to be less wordy

* use ConfigFlow _abort_if_unique_id_configured

* fix test
2020-02-27 22:04:59 -08:00
Erik Montnemery 3b17e570df
Add device actions to cover (#28064)
* Add device actions to cover

* Remove toggle action, improve tests

* lint

* lint

* Simplify actions

* Update homeassistant/components/cover/device_action.py

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

* Improve tests

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-02-27 21:05:43 -08:00
J. Nick Koston 223c01d842
Coordinate all august detail and activity updates (#32249)
* Removing polling from august

* Now using subscribers to the detail and activity

* Fix hash to list keys

* continue to the next house if one fails

* Add async_signal_device_id_update

* Fix double initial update

* Handle self.hass not being available until after async_added_to_hass

* Remove not needed await

* Fix regression with device name
2020-02-27 19:44:22 -08:00
Jens Nistler ecd076c5e4
Mark clients away if they have never been seen. (#32222) 2020-02-27 11:50:34 -08:00
Yuki Ueda 0eb5ca67cd
Make heos and transmission config flow tests more robust (#31783)
* async_step_user to async_configure

* fix for lint

* fix for pylint

* fix isort and black

* fix miss-fixed black

* fixing for the python37 coverage

* fix transmission definition

* fix for Black formatting

* fix type to abort

* clean up

* clean up for the test

* fix for the test

* refactor

* split test_flow_works to three tests

* revert the assert

* remove whitespaces for flake8

* apply patch function

* fix for the patch

* fix for the black

* remove mock_coro

* fix for the black

* hue to heos

* try to fix import

* fix for the black

* revert try to fix import

* Add a pytest fixture

* fix for the black
2020-02-27 12:19:54 +01:00
J. Nick Koston 4c5e364d90
Centralize august activity updates (#32197)
* Reduce August doorbell detail updates

* Doorbell images now get updates from the activity feed

* Tests for activity updates

* py-august now provides bridge_is_online for available state

* py-august now provides is_standby for available state

* py-august now provides get_doorbell_image (eliminate requests)

* remove debug

* black after merge conflict

* Centralize august activity updates

* Updates appear significantly more responsive

* Should address the community complaints about "lag"

* Reduce detail updates (device end points) to one hour interval

* Signal entities to update via dispatcher when new activity arrives

* Resolves out of sync state (skipped test is now unskipped)

* pylint

* fix merge conflict

* review comments

* Remove stray

* Address review items that can be done without refactor
2020-02-26 18:48:44 -08:00
Jc2k d207c37c33
Address homekit_controller feedback on #32212 and #32213 (#32228) 2020-02-26 17:10:05 -08:00
dupondje f26826d949
Fix DSMR 5 (#32233)
DSMR 5 was broken because some wrong if.
if dsmr_version in ("5B"):
-> this checks dsmr_version against 5 and B. Not if its 5B.
2020-02-26 17:02:42 -08:00
Paulus Schoutsen 483d822272
Lovelace resource mgmt (#32224)
* Add websockets commands for resource management

* Add LL resource management

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
2020-02-26 16:43:34 -08:00
Paulus Schoutsen 2a88ae559e
Improve debounce cooldown (#32161) 2020-02-26 11:27:37 -08:00
Jc2k 853d6cda25
Make homekit_controller a local push integration (#32213) 2020-02-26 10:35:53 -08:00
Jc2k 92a47f14bb
homekit_controller test cleanups (#32212) 2020-02-26 09:44:04 -08:00
J. Nick Koston 638a3025df
Reduce August doorbell detail updates (#32193)
* Reduce August doorbell detail updates

* Doorbell images now get updates from the activity feed

* Tests for activity updates

* py-august now provides bridge_is_online for available state

* py-august now provides is_standby for available state

* py-august now provides get_doorbell_image (eliminate requests)

* remove debug

* black after merge conflict
2020-02-26 08:43:41 +01:00
J. Nick Koston 4c33a9d732
Add model to august device_info (#32187)
* Add model to august device_info

* Address review comments from PR#32125

* Fix test name
2020-02-25 18:34:31 -08: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
Jc2k 4a89fba6f9
Add homekit_controller occupancy sensor (#32188) 2020-02-25 22:01:03 +00:00
Jc2k dd13e99967
Add missing device class attributes to homekit_controller sensors (#32175)
* Add some missing device class attributes to homekit_controller sensors

* Add classes for binary sensors
2020-02-25 21:43:14 +01:00
Jc2k 1ddc1ebc6b
Refactor away deprecated homekit_controller test helpers (#32177) 2020-02-25 21:19:04 +01:00
Paulus Schoutsen 536b31305a
Support multiple Lovelace dashboards (#32134)
* Support multiple Lovelace dashboards

* Mark collection maintenance as unfinished

* Fix import

* Add websockets commands for resource management

* Revert "Add websockets commands for resource management"

This reverts commit 7d140b2bcc.

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
2020-02-25 11:18:21 -08:00
Erik Montnemery 2d6b80470f
Improve error handling (#32182) 2020-02-25 10:44:24 -08: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
Kit Klein 5488389244
Dedup and clarify imported konnected config flows (#32138)
* dedup config flows

* use default (imported) options until user goes thru options flow

* address pr feedback

* correct key used to distinguish pro model
2020-02-25 13:55:06 +01:00
Jc2k c9d78aa78c
Refactor homekit_controller config flow tests (#32141)
* Config flow test refactor

* Add a service and characteristic to the accessory so its more realistic

* Feedback from review

* Missing apostrophe
2020-02-25 12:06:35 +01:00
Aaron Bach ba4cc373c8
Modernize Ambient PWS config flow (#32164)
* Modernize Ambient PWS config flow

* Linting
2020-02-24 21:37:38 -08:00
Aaron Bach c97b1c60b0
Modernize Notion config flow (#32167)
* Modernize Notion config flow

* Linting
2020-02-24 21:36:58 -08:00
paolog89 0e6a48c688
Add observed entities to bayesian sensor (#27721)
* Add observed entities to bayesian sensor

* Update binary_sensor.py to comply with style guidelines and test_binary_sensor.py to verify the entity_id

* Update binary_sensor.py and test_binary_sensor.py to include an additional attribute for observed entities

* Use of ATTR_ENTITY_ID and numeric key of observed entity

* Update binary_sensor.py

* Update test_binary_sensor.py to verify behavior

* Update to return a list without duplicates in the state attribute

* Update binary_sensor.py: rename of ATTR_ENTITY_ID into ATTR_OBSERVED_ENTITIES

* Rename new attribute into ATTR_OCCURRED_OBSERVATION_ENTITIES and fix test
2020-02-24 21:27:59 -08:00
Paulus Schoutsen 5776b9f17d
Fix flaky coverage in UK transport test (#32053) 2020-02-24 21:27:07 -08:00
Aaron Bach 7c2765fbff
Remove unused SimpliSafe config flow function (#32166)
* Remove unused SimpliSafe config flow function

* Code review comments from other PR

* Linting
2020-02-24 22:02:20 -07:00
Aaron Bach 75f465bf7e
Remove unused RainMachine config flow function (#32165)
* Remove unused RainMachine config flow function

* Remove test we don't need

* Code review comments

* Linting
2020-02-24 22:01:55 -07:00
Erik Montnemery 7e387f93d6
Add MQTT WS command to remove device (#31989)
* Add MQTT WS command to remove device

* Review comments, fix test

* Fix tests
2020-02-24 20:46:02 -08:00
springstan ad102b3840
Use f-strings in integrations starting with "F"and"G" (#32150)
* Use f-strings in integrations starting with F

* Use f-strings in tests for integrations starting with F

* Use f-strings in integrations starting with G

* Use f-strings in tests for integrations starting with G

* Fix pylint error

* Fix broken test
2020-02-24 17:54:20 -08:00
Ville Skyttä 496bd3dddf
Add and use more unit constants (#32122)
* Add and use speed constants

* Add and use meter based volume and area constants

* Add and use more mass unit constants

* Add and use concentration unit constants

* Add and use watts per square meter constant

* Use more time constants

* Use more data constants
2020-02-24 17:52:14 -08:00
Phil Bruckner b2d7bc40dc
Add support for simultaneous runs of Script helper (#31937)
* Add tests for legacy Script helper behavior

* Add Script helper if_running and run_mode options

- if_running controls what happens if Script run while previous run
  has not completed. Can be:
  - error: Raise an exception
  - ignore: Return without doing anything (previous run continues as-is)
  - parallel: Start run in new task
  - restart: Stop previous run before starting new run
- run_mode controls when call to async_run will return. Can be:
  - background: Returns immediately
  - legacy: Implements previous behavior, which is to return when done,
            or when suspended by delay or wait_template
  - blocking: Returns when run has completed
- If neither is specified, default is run_mode=legacy (and if_running
  is not used.) Otherwise, defaults are if_running=parallel and
  run_mode=background. If run_mode is set to legacy then if_running must
  be None.
- Caller may supply a logger which will be used throughout instead of
  default module logger.
- Move Script running state into new helper classes, comprised of an
  abstract base class and two concrete clases, one for legacy behavior
  and one for new behavior.
- Remove some non-async methods, as well as call_from_config which has
  only been used in tests.
- Adjust tests accordingly.

* Change per review

- Change run_mode default from background to blocking.
- Make sure change listener is called, even when there's an unexpected
  exception.
- Make _ScriptRun.async_stop more graceful by using an asyncio.Event for
  signaling instead of simply cancelling Task.
- Subclass _ScriptRun for background & blocking behavior.

Also:

- Fix timeouts in _ScriptRun by converting timedeltas to float seconds.
- General cleanup.

* Change per review 2

- Don't propagate exceptions if call from user has already returned
  (i.e., for background runs or legacy runs that have suspended.)
- Allow user to specify if exceptions should be logged. They will still
  be logged regardless if exception is not propagated.
- Rename _start_script_delay and _start_wait_template_delay for
  clarity.
- Remove return value from Script.async_run.
- Fix missing await.
- Change call to self.is_running in Script.async_run to direct test of
  self._runs.

* Change per review 3 and add tests

- Remove Script.set_logger().
- Enhance existing tests to check all run modes.
- Add tests for new features.
- Fix a few minor bugs found by tests.
2020-02-24 14:56:00 -08:00
Raman Gupta 309989be89
Fix vizio bug to use 'get' to get volume_step since it is optional (#32151)
* use get to get volume_step since it is optional

* always set volume_step to default in options and data if its not included
2020-02-24 23:37:54 +01:00
Aaron Bach 6b0d7c77f0
Clean up RainMachine config entry data (#32132) 2020-02-24 13:07:18 -07:00
Aaron Bach edf44f4158
Modernize RainMachine config flow (#32131)
* Modernize RainMachine config flow

* Update strings
2020-02-24 13:05:54 -07:00
Aaron Bach f7e336eaa6
Modernize SimpliSafe config flow (#32130)
* Modernize SimpliSafe config flow

* Fix tests
2020-02-24 13:03:08 -07:00
springstan 9801810552
Use f-strings in integrations starting with "B"-"E" (#32121)
* Use f-strings in integrations starting with B

* Use f-strings in integrations starting with C

* Use f-strings in integrations starting with D

* Use f-strings in integrations starting with E

* Fix pylint errors

* Fix pylint errors v2

* Fix tests

* Fix tests v2
2020-02-24 08:47:52 -08:00
Paulus Schoutsen 07fa844c43
Speed up validate_entity_id (#32137)
* Speed up validate_entity_id

* Add some more invalid entity IDs

* Adjust regular expression

* Extend and sort test cases

* Update regular expression, more cases, faster

* Adjust tests, allow start with number, disallow double underscore

Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2020-02-24 08:35:02 -08:00
Ruslan Sayfutdinov 15b4975681
Use ciso8601 library to parse datetime faster (#32128) 2020-02-24 08:33:10 -08:00
Jc2k df9363610c
Refactor homekit_controller to be fully asynchronous (#32111)
* Port homekit_controller to aiohomekit

* Remove succeed() test helper

* Remove fail() test helper
2020-02-24 10:55:33 +01:00
Paulus Schoutsen ca01e9a537
Improve condition validation error msg (#32135) 2020-02-24 09:59:34 +01:00
J. Nick Koston 693441e56f
Deduplicate code in the august integration (#32101)
* Deduplicate code in the august integration

* Add additional tests for august (more coming)

* Door state is now updated when a lock or unlock call returns
  as the state is contained in the response which avoids
  the confusing out of sync state

* revert

* document known issue with doorsense and lock getting out of sync (pre-existing)

* Address review comments

* Additional review comments
2020-02-23 13:54:34 -08:00
Kit Klein d2d788631e
0.106 Beta - provide correctly formatted placeholders (#32119) 2020-02-23 13:54:18 -08:00
springstan 524a1a7587
Use f-strings in integrations starting with "A" (#32110)
* Use f-strings in integrations starting with A

* Use f-strings in tests for integrations starting with A

* Fix pylint by renaming variable

* Fix nested for loop in f-string for aprs device_tracker

* Break long lines into multiple short lines

* Break long lines into multiple short lines v2
2020-02-23 13:38:05 -08:00
springstan a85808e325
Add and use time related constants (#32065)
* Add and use time related constants

* Sort time constants and reuse them in data rate constants

* Fix greeneyemonitor import

* Fix greeneyemonitor import V2

* Fix failing here_travel_time test

* Add TIME_MONTHS and TIME_YEARS

* Use TIME_MINUTES in opentherm_gw and isy994

* Add and use TIME_MILLISECONDS

* Change inconsistent ones

* Add TIME_MICROSECONDS and TIME_WEEKS

* Use constants in apcupsd and travisci

* Fix import error in upnp sensor.py

* Fix isy994 sensor.py using TIME_YEARS

* Fix dyson tests

* Use TIME_SECONDS in more places

* Use TIME_DAYS in google wifi
2020-02-23 22:09:24 +02:00
Chris Talkington 8dd80e0e3c
Add unique_id to directv entities (#31838)
* add unique_id to directv entities.

* add addiitional debug and fix tests.

* fix lint error.

* rework unique_id and flow a bit.

* review adjustments.

* review adjustments

* review adjustments

* review adjustments.

* review adjustments

* review adjustments

* review adjustments

* review adjustments

* lint

* use serial number for host unit and mac address for client units

* fix elsif

* update test with realistic client id

* lint
2020-02-23 19:26:34 +01:00
Robin 4cc4f070f5
Add sighthound save image (#32103)
* Adds save_image

* Update test_image_processing.py

* Update test

* Tidy test

* update image_processing with reviewer comments

* Update test_image_processing.py

* Ammend tests

not passing

* Patch convert

* remove join

* Use valid_config_save_file
2020-02-23 19:11:05 +01:00
Paulus Schoutsen f975654ae7
Mock setup_entry in oauth2 tests (#32102)
* Mock setup_entry in oauth2 tests

* Fix scaffold constant
2020-02-23 12:23:21 +01:00
Bram Kragten fcaabb3d33
Change get_entity to return a extended entry, add inputs to de… (#32083)
* Change get_entity to return a extended entry + add inputs to default config

For https://github.com/home-assistant/home-assistant-polymer/pull/4940

* Fix tests, simplify code, update to return extended

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-02-22 15:18:10 -08:00
Paulus Schoutsen ced870c588
Remove YAML config from Ring integration (#32039) 2020-02-21 17:36:19 -08:00
springstan b41cbe9885
Add www. to all documentation links (#32063)
* Add www. to all documentation links

* Fix broken redirect uri test
2020-02-21 16:10:02 -08:00
Alexei Chetroi 3385893b77
ZHA device channel refactoring (#31971)
* Add ZHA core typing helper.
* Add aux_channels to ZHA rule matching.
* Add match rule claim_channels() method.
* Expose underlying zigpy device.
* Not sure we need this one.
* Move "base" channels.
* Framework for channel discovery.
* Make DEVICE_CLASS and REMOTE_DEVICE_TYPE default dicts.
* Remove attribute reporting configuration registry.
* Refactor channels.
- Refactor zha events
- Use compound IDs and unique_ids
- Refactor signal dispatching on attribute updates

* Use unique id compatible with entities unique ids.
* Refactor ZHA Entity registry.
Let match rule to check for the match.

* Refactor discovery to use new channels.
* Cleanup ZDO channel.
Remove unused zha store call.

* Handle channel configuration and initialization.
* Refactor ZHA Device to use new channels.
* Refactor ZHA Gateway to use new discovery framework.
Use hass.data for entity info intermediate store.

* Don't keep entities in hass.data.
* ZHA gateway new discovery framework.
* Refactor ZHA platform loading.
* Don't update ZHA entities, when restoring from zigpy.
* ZHA entity discover tests.
* Add AnalogInput sensor.
* Remove 0xFC02 based entity from Keen smart vents.
* Clean up IAS channels.
* Refactor entity restoration.
* Fix lumi.router entities name.
* Rename EndpointsChannel to ChannelPool.
* Make Channels.pools a list.
* Fix cover test.
* Fix FakeDevice class.
* Fix device actions.
* Fix channels typing.
* Revert update_before_add=False
* Refactor channel class matching.
* Use a helper function for adding entities.
* Make Pylint happy.
* Rebase cleanup.
* Update coverage for ZHA device type overrides.
* Use cluster_id for single output cluster registry.
* Remove ZHA typing from coverage.
* Fix tests.
* Address comments.
* Address comments.
2020-02-21 18:06:57 -05:00
Ziv 36db302cc8
Enhance Dynalite Integration after review (#31760)
* fixes per Martin Hjelmare

* pylint fix

* final fixes per request

* fixed unit tests for new config flow

* Added unit-tests to increase coverage. at 97% now

* Added unit tests for 100% coverage of component

* removed configured_host function and updated config_flow unit tests

* added a pylint directive since it tells me by mistake DOMAIN is not used

* fixed path (removed __init__)

* Update homeassistant/components/dynalite/light.py

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

* Update homeassistant/components/dynalite/light.py

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

* fixed the test as we moved from schedule_update_... to async_schedule

* Update homeassistant/components/dynalite/bridge.py

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

* removed context from config_flow
changed test_init to use the core methods

* moved test_light to also use the core interfaces

* moved to config_entries.async_unload

* additional fixes for the tests

* pylint fix and removed unnecessary code

* Update tests/components/dynalite/test_light.py

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

* Update tests/components/dynalite/test_light.py

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

* Update tests/components/dynalite/test_light.py

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

* Update tests/components/dynalite/test_light.py

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

* Update tests/components/dynalite/test_light.py

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

* Update tests/components/dynalite/test_light.py

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

* Update tests/components/dynalite/test_light.py

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

* Update tests/components/dynalite/test_light.py

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

* Update tests/components/dynalite/test_light.py

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

* added break in loop

* removed last mock_coro reference
pylint fix

* added coverage for try_connect

* added check for a successful connection before bridge.async_setup succeeds
also added a "nowait" config option (default False) that avoids this check

* changed log level

* fixed accidental chmod I did

* fixed accidental change

* not storing config in bridge

* not patching asyncio

* moved CONFIG_SCHEMA into component

* moved all logs to start capitalized (and revised some of them)

* moved test_config_flow to not patch the DynaliteBridge

* also took DynaliteBridge patching out of test_init

* removed NO_WAIT

* fixes to SCHEMA

* changed _ in multi-word CONF
moved imports to component const.py

* removed tries

* removed redundant tests

* fixed some small change i broke in the library. only version update

* fixed rewuirements

* Update tests/components/dynalite/test_config_flow.py

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

* Update tests/components/dynalite/test_light.py

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

* Update tests/components/dynalite/test_config_flow.py

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

* removed HIDDEN_ENTITY
removed hass in test fixture

* black fixes

* removed final piece of hidden_entity from light
fix in the library
updated config flow so if the entry is already set but with a different config, calls async_update_entry

* removed DATA_CONFIGS - no longer necessary

* pylint fixes

* added coverage

* use abort in config_flow

* test update

* removed logs

* test that update actually updates the entry

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-02-21 23:29:59 +01:00
Patrick Kishino f32411e394
Add asuswrt interface and dnsmasq location configuration (#29834)
* Added interface and dnsmasq location configuration

* Updated aioasuswrt requirement to latest 1.2.1 release

* Updated to working aioasus library and fixed correct conf formatting
2020-02-21 17:01:57 +01:00
J. Nick Koston d4075fb262
Significantly reduce code in august integration (#32030)
* Significantly reduce code in august integration

* Activity updates can now be processed by py-august
  this allows us to eliminate the activity sync
  code for the door sensors and locks

* Lock and door state can now be consumed from
  the lock detail api which allows us to
  remove the status call apis and reduce
  the number of API calls to august

* Refactor the testing method for locks (part #1)

* Update homeassistant/components/august/binary_sensor.py

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

* Switch to asynctest instead of unittest for mock.patch

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-02-20 21:06:24 -08:00
Paulus Schoutsen ce710f1e0b
Template platform tweaks (#32037)
* Remove unnecessary boolean return from platform setup

* Fix template cover validation
2020-02-20 12:14:31 -08:00
Franck Nijhof 1c81e8ad68
Remove history_graph integration (#32028)
* Remove history_graph integration

* Update codeowners file
2020-02-20 09:01:29 -08:00
Paulus Schoutsen 1c2bce9292
Fix recursion bug (#32009)
* Fix recursion bug

* Remove shield
2020-02-20 08:51:00 -08:00
Franck Nijhof 5c5f839119
Remove weblink integration (#32024) 2020-02-20 08:50:40 -08:00
Raman Gupta 7a6b13cb0d
Update vizio dependency and integration name (#31975)
* bump pyvizio version and clean up code

* fix requirements

* update parameter to optional per review in docs PR
2020-02-20 08:43:29 -08:00
Paulus Schoutsen 51b2d0b4f8
Add entity ID to input_number warning (#32012)
* Add entity ID to warning

* Input Number flexibility
2020-02-20 08:30:24 -08:00
Franck Nijhof 2ad1f7fd02
Remove states UI options in group integration (#32021) 2020-02-20 08:26:41 -08:00
Paulus Schoutsen e71c7e1f5e Fix hue test 2020-02-20 08:11:27 -08:00
Paulus Schoutsen 4e765398cc
Only check frontend for safe mode if frontend wanted to be loa… (#31969)
* Only check frontend for safe mode if frontend wanted to be loaded

* Update test
2020-02-19 15:56:46 +01:00
David F. Mulcahey 8255bdf3d5
Bump ZHA quirks and add skip configuration support (#31982)
* add skip configuration
* Bump quirks
* add skip configuration to FakeDevice
2020-02-19 09:19:26 -05:00
SukramJ da4c08de12
Fix test for HMIPC (#31981) 2020-02-19 12:41:14 +01:00
SukramJ 0d874902cc
Add shutter group to HomematicIP Cloud (#31916) 2020-02-19 10:59:49 +01:00
SukramJ f4f01cb23a
Add new devices to HomematicIP Cloud (#31914)
* Add new devices to HomematicIP Cloud

Adds:
- HMIP-WTH-B (Wall Thermostat Basic)
- ALPHA-IP-RBG (Alpha IP Wall Thermostat Display)
- ALPHA-IP-RBGa (ALpha IP Wall Thermostat Display analog)

* Update homeassistant/components/homematicip_cloud/sensor.py

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

Co-authored-by: springstan <46536646+springstan@users.noreply.github.com>
2020-02-19 10:43:12 +01:00
Vladimír Záhradník 32cd58e03d
Modbus remove unnecessary get calls (#31966) 2020-02-18 19:41:12 -08:00
jjlawren 0213f43f10
Add options to ignore shared/managed Plex clients (#31738)
* Add option to ignore shared/managed Plex clients

* Start to allow user selection

* hass object not ready during init

* Don't bother sorting

* Plex account multi-select, handle new users not matching config

* Fix/add tests

* Lint simplifications

* Review cleanup

* Oops

* Rename options attributes, fix/add tests
2020-02-18 16:46:45 -08:00
Robert Svensson a745134128
deConz - Use proper mechanisms for options flow tests (#31965)
Generic clean up
2020-02-18 23:52:56 +01:00
Robert Svensson 774c892ee6
UniFi config option SSID filter (#31842)
* Draft

* Use new multi_select config validation

* Bump dependency to v13

* Improve options flow

* Add title to config options

* Add config option descriptions

* Fix martins comment
2020-02-18 23:24:21 +01:00
Erik Montnemery 60ae85564e
Add support for MQTT device triggers (#31679)
* Add support for MQTT device triggers

* Fix test, tweaks

* Improve test coverage

* Address review comments, improve tests

* Tidy up exception handling

* Fix abbreviations

* Rewrite to handle update of attached triggers

* Update abbreviation test

* Refactor according to review comments

* Refactor according to review comments

* Improve trigger removal

* Further refactoring
2020-02-18 13:51:10 -08:00
Robert Svensson b5df2ba853
deCONZ - Directly reflect changes to config entry options (#31661)
* Directly reflect changes to config entry options

* Remove print

* Add tests

* Add title to config options
2020-02-18 13:24:25 -08:00
J. Nick Koston 17f3332c89
Audit state handling off august bridges and sensors (#31935)
* Audit state handling of august bridges and sensors

This addresses issue #29980

* Prevent setting up august locks that do not have a bridge as they will never work

* Prevent locks showing available when their bridge is offline

* Prevent door sensors from showing available when their bridge is offline

* Prevent creating door sensors for locks that do not have them

* Prevent doorbells showing unavailable when they are in standby mode

* Set SCAN_INTERVAL for binary_sensors to 5 seconds as
  data comes in from the activity endpoint more frequently

* Update homeassistant/components/august/__init__.py

raise if the detail is missing when checking doorsense

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

* Handle another place where the lock detail could not exist

* Address review comments

* Handle lock detail update failing and add test

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-02-18 12:11:05 -08:00
Paulus Schoutsen beee1298c5
Extend safe mode (#31927)
* Extend safe mode

* Add safe mode boolean to config JSON output and default Lovelace

* Add safe mode to frontend

* Update accent color
2020-02-18 11:52:38 -08:00
Markus Pöschl 245482d802
Add Twitch subscription and additional stats (#31122)
* add oauth functionality and additional attributes

* Add tests WIP

* Make mocks work the correct way

* Use CONF_TOKEN constant for config

* Remove twitch from .coveragerc

* Update homeassistant/components/twitch/sensor.py

Lets be consistent

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

Co-authored-by: springstan <46536646+springstan@users.noreply.github.com>
2020-02-18 11:51:37 -08:00
Paulus Schoutsen 7be3a4cd37
Fix entity registry not saving name/icon (#31932) 2020-02-18 08:32:34 -08:00
Paulus Schoutsen a6b5d73f1c
Report which data causes JSON serialization error (#31901) 2020-02-17 10:49:42 -08:00
J. Nick Koston 00ac7a7d70
Provide user consumable errors when lock operations fail (#31864)
* Provide user consumable errors when lock operations fail

This resolves issue #26672

* include from in raise

* pylint

* Cleanup of mocking.
2020-02-17 10:30:14 -08:00
Victor Guimarães 93a844b1d5
Hue Group features based on the bulbs in it (#31897)
* Computes the features of a hue group as the union of the features of the bulbs in the group

* Moved create item to a function

* Added test for hue group features
2020-02-17 10:22:34 -08:00
Paulus Schoutsen 81701f7e4c
Start safe mode if invalid core conf (#31904) 2020-02-17 10:20:05 -08:00
Paulus Schoutsen 1b7dd6c603
Add icons to scripts (#31899) 2020-02-17 08:44:36 -08:00
Paulus Schoutsen c788946430
Allow specifying an icon for a scene (#31898) 2020-02-17 08:41:33 -08:00
Paulus Schoutsen 3da136b034
Add logger name to system log (#31902) 2020-02-17 17:26:25 +01:00
Martin Hjelmare 2ce7561343
Clean soundtouch (#31888)
* Clean up soundtouch tests

* Remove not needed updates
2020-02-16 15:34:44 -08:00
Martin Hjelmare e3adbc336d
Fix check_real location guard (#31890) 2020-02-16 15:33:09 -08:00
SukramJ 32f25a8484
Adjust tests after speed up to restore coverage for HomematicIP Cloud (#31836)
* Adjust tests after speed up to restore coverage for HomematicIP Cloud

* Fix test data

* Fixes after review

* remove duplicate cade

* remove service marker
2020-02-16 10:09:26 +01:00
J. Nick Koston 096e7cceed
Support XML conversion for RESTful sensors (#31809)
* Support XML conversion for RESTful sensors

Many devices continue to use XML for RESTful
APIs.  Interfacing with these APIs requires custom
integrations or command line fork()/exec() overhead
which many of these devices can work with as if
they were JSON using xmltojson via this spec:
https://www.xml.com/pub/a/2006/05/31/converting-between-xml-and-json.html

This change implements converting XML output to
JSON via xmltojson so it can work with the existing
rest sensor component.  As the attributes that
usually need to be scraped are deeper in the document
support for passing in a template to find the
JSON attributes that have been added.  JSON APIs that
do not have their attributes at the top level
can also benefit from this change.

* Auto convert xml, change out the template for jsonpath

* Address review items and potentially unexpected normalize behavior with jsonpath

* Revert "Address review items and potentially unexpected normalize behavior with jsonpath"

This reverts commit fe9e179092.

* json_dict[0] turned out to be needed
2020-02-15 21:10:23 -08:00
J. Nick Koston f6d9e6b6c5
Convert august to async so a token refresh lock can be used (#31848)
* Convert august to async so a token refresh lock can be used

* Update comment since we now have a lock

* Do not mock the lock

* Address review items
2020-02-15 21:08:52 -08:00
Philip Rosenberg-Watt fb8cbc2e93
Fix CalDAV recurring events (#31805)
* Fix CalDAV parsing of recurring events

Some CaDAV servers (see: SOGo) return the original event that contains
the recurrence rules. The CalDAV calendar component sorts and filters
events based on their start and end dates, and was failing to properly
show recurring events based on these recurrence rules.

This this change checks if an event has recurrence rules and changes the
start/end dates of the event to today if the event is set to occur
today. This allows the rest of the component logic to function properly.

* Use date from nextmost occurence

* Adding unit tests

* Add endless event unit test

* Create new vevent for each event recurrence today

* Remove redundant unit test

* Add timezone to events that have none

Python cannot compare them otherwise.

* Simplify code, add comments & guard clause

* Add test for recurring all day event

* Account for all-day events

* Remove redundant code

* Remove redundant code

* Remove unnecessary deepcopy

* Add hourly recurring tests

* Add tests for hourly repeating event

* Fix unit test

* Use event.copy()
2020-02-15 19:31:36 -08:00
Moshe Kaplan 7dff5e79d1
Add support for displaying Daf Yomi (#30628)
* Add support for displaying Daf Yomi

* Ran black --fast

* Added docstring to get_daf

* Further lint fixes

* Remove unnecessary else

* clarify code

* Use fstrings

* pull daf yomi from hdate

* Update manifest version for daf_yomi support

* fix variable usage

* Update requirements

* Also pass in today's date as well

* Rename date variable to daytime_date

* Add tests for daf yomi sensor

* Update stale test IDs
2020-02-16 00:00:17 +01:00
Paulus Schoutsen 4501471b8c
Google Assistant: Remove speaker type and earlier filter out devices from being locally exposed (#31830)
* Remove speaker type

* Do not expose locks or alarms to Google Local
2020-02-14 15:28:11 -08:00
Paulus Schoutsen 52b045ed30
Fix person device_trackers null (#31829) 2020-02-14 15:27:31 -08:00
Robert Svensson 043d36f7c6
Change multi_select config validator to class (#31828)
* Move multi_select to class

* Fix serializer and add test

* Serializer should also return options
2020-02-14 11:09:40 -08:00
Abílio Costa e6148d223a
Allow hourly forecast in IPMA (#30979)
* update ipma component for pyipma 2.0
* fix wind speed; refactor forecast
* update requirements*.txt
* fix tests; update CODEOWNERS; update pyipma to 2.0.1
* minor changes as suggested in PR
* make lint happy
* fix mocking coroutines
* restore old unique id
* fix station lat/lon; update pyipma version
* add hourly forecast option to IPMA
* add forecast tests
* use for instead of lambda
2020-02-14 12:04:41 -05:00
SukramJ 9eb0415234
Speed up tests of HomematicIP Cloud (#31810)
* Speed up tests of HomematicIP Cloud

* load the json once
2020-02-13 22:56:17 -08:00
jjlawren 408b41ea02
Add device registry support for Plex (#31797)
* Add device registry support for Plex

* Fix model

* Use Plex server as sensor device identifier
2020-02-13 16:37:52 -08:00
SukramJ 2f3ab15268
Remove force from async_schedule_update_ha_state for HMIPC (#31796)
* remove force from async_schedule_update_ha_state if HMIPC

* Fix lint
2020-02-13 16:24:43 -08:00
Paulus Schoutsen fbbb29a6ec
Catch unexpected exceptions when validating config (#31795) 2020-02-13 22:43:07 +01:00
Robert Svensson 6211a2bb98
Add multi select support to config validation and to custom serializer (#31798) 2020-02-13 13:12:09 -08:00
Paulus Schoutsen 9e7185c676
Write state if schedule update state from async context (#31758)
* Write state if schedule update state from async context

* Fix most tests

* Fix test and PS4 I/O in event loop

* Fix ps4 better
2020-02-13 10:22:06 -08:00
Ville Skyttä 3e23a3a860
Add and use bunch of data size and rate related constants (#31781)
Also fix a few units to match the corresponding data.
2020-02-13 08:52:57 -08:00
Franck Nijhof 0173c61fee
Spelling: Config(uration) (#31782) 2020-02-13 08:27:00 -08:00
Robert Svensson 4cac0443e2
UniFi - Change handling of updated options (#31762)
* Change handling of updated options

* Add tests
2020-02-12 16:15:08 -08:00
J. Nick Koston 6879105b14
Cleanup August activity processing and add tests (#31774)
* Update py-august to 0.12.0

* Upstream update also resolves issue #28960
2020-02-12 15:35:07 -08:00
Alexei Chetroi 52fe1328f6
ZHA tests refactoring (#31744)
* Refactor ZHA fixtures.
Patch Zigpy radio libs instead of ZHA when setting up fixtures.
Use new fixtures for binary_sensor.zha platform.

* Update ZHA api tests.
* Update ZHA channels and discovery tests.
* Update ZHA cover tests.
* Update device action/trigger tests.
* Update device_tracker.zha platform tests.
* Update fan.zha platform tests.
* Update ZHA gateway tests.
* Update lock.zha platform tests.
* Update switch.zha platform tests.
* Update sensor.zha platform tests.
* Update light.zha platform tests.
* Use MockConfigEntry.
* Address PR comments.
2020-02-12 16:12:14 -05:00
Daniel Shokouhi 43256ebd83
Add device name to sensor name for mobile_app (#31756)
* Add device name to sensor name

* Update test to include device name
2020-02-12 11:40:39 -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
jjlawren 1b2f4fa19f
Improve Plex media_player entity naming (#31755) 2020-02-12 09:55:18 -08:00
Bas Nijholt 8498ca37cd
Fix moving average test for discrete derivative sensor (#31750)
* fix test_data_moving_average_for_discrete_sensor

After https://github.com/home-assistant/home-assistant/pull/31717 the test
didn't actually test anything anymore.

This fixes that.

* make the test faster
2020-02-12 09:53:06 -08:00
Robbie Trencheny 0700d38d1f
Add new webhook action to allow enabling encryption in an exis… (#31743)
* Add new webhook action to allow enabling encryption in an existing registration

* Harden tests

* Make requested fixes
2020-02-11 23:56:22 -08:00
J. Nick Koston f5be9ef7fb
Refresh the august access token when needed (#31735)
* Refresh the august access token
when needed.

Currently august will stop working when the token
expires about every six month.

This resolves issue #23788

* Make refresh_access_token_if_needed private since we do not want additional callers

* Add init
2020-02-11 22:13:54 -08: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
Paulus Schoutsen 51c35ab9a8
Entity Registry to store and restore name/icon (#31714)
* Entity Registry to store and restore name/icon

* Update test_entity_registry.py

* Add original name/icon to JSON result
2020-02-11 09:40:50 -08:00
Paulus Schoutsen 81b159f424
Disable Hue groups for new setups (#31713) 2020-02-11 08:50:07 -08:00
Paulus Schoutsen 6fcf5472a5
Limit derivative test (#31717) 2020-02-11 09:03:52 +01:00
Paulus Schoutsen 5a0f21cbe3
Adjust entity slow warning for custom component (#31711) 2020-02-10 16:32:47 -08:00
Rami Mosleh c66106ee98
Add Glances sensors dynamically (#28639)
* Add temp_sensors to glances dynamically

* unsub from updates when sensor is disabled

* dynamicall add sensors

* change "device_name" to "mnt_point"

* remove unnecessary logging

* update sensor.py

* update test_config_flow.py

* remove commented code
2020-02-10 15:02:14 -08:00
Raman Gupta 284fd46ea8
For vizio integration, set unique ID early to prevent multiple zeroconf discovery items for the same device to appear (#31686)
* set unique ID early to prevent multiple zeroconf discovery items for the same device to appear

* add test
2020-02-10 14:54:52 -08: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
Quentame 9e41ee49cb
Fix Météo-France I/O while testing (#31695)
* Fix Météo-France I/O while testing

* Review
2020-02-10 17:00:22 +01:00
Paulus Schoutsen 5092971452
Add brightness light device actions (#31567) 2020-02-09 19:47:59 -08:00
Paulus Schoutsen 12de3f1e47 Clean up frontend services and events (#31654)
* Clean up frontend services and events

* Fix bug in core instead

* Add test that core works correctly with callback marked async funcs
2020-02-09 19:47:16 -08:00
Alexei Chetroi 28eeed1db3
ZHA tests refactoring (#31682)
* Fixtures for restoring/joning a device.

* binary_sensor.zha tests.

* cover.zha platform tests.

* device_tracker.zha platform tests.

* fan.zha platform tests.

* switch.zha platform tests.

* Update light.zha platform tests.

* Update sensor.zha platform tests.

* ZHA api tests refactoring.

* Update lock.zha platform tests.

* Update ZHA gateway tests.

* Update zha device action tests.

* Update zha device trigger tests.

* Cleanup.
2020-02-09 21:45:35 -05:00
Jonathan Østrup 150b376cf9
Add recorder vars db_max_retries and db_retry_wait (#31561)
* added recorder vars db_max_retries and db_retry_wait

* fixed test_recorder_setup_failure

I failed because it was missing the two new variables. I simply added these with default values.

* fixed syntax error in test_recorder_setup_failure

* fixed formatting error in test_init_py for recorder component

* fixed typo in test case

* Updated the way the default keys for db_,max_wait and db_retry_wait is set

Implemented based on suggestions from @springstan

* Updated config_schema call to adhere to Black

* changed conf.get to conf[dict] for var retrieval

* removed 2 blank lines
2020-02-09 17:43:09 +01:00
Paulus Schoutsen 989dd32258
Hue to retry if hub errors out (#31616)
* Respect semaphore

* Add retries when connection reset

* Also catch OSError from aiohttp when authenticating
2020-02-08 13:20:37 -08:00
Paulus Schoutsen 111050bea9
Clean up core services (#31509)
* Clean up core services

* Fix conversation test
2020-02-08 13:10:59 +01:00
escoand 0823ee4385
Fix exceptions when using newer Samsung TVs (#31602)
* try to fix websocket problems

* use tuple

* catch websocket exceptions

* typo
2020-02-08 12:03:35 +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
Paulus Schoutsen 0d474e1183
Update the update coordinator API to make it easier to use (#31471)
* Update the update coordinator API to make it easier to use

* failed_last_update -> last_update_success
2020-02-06 09:29:29 -08:00
Franck Nijhof 7233048fea
Limit OAuth scopes for Netatmo and Home Assistant Cloud (#31538)
* Limit OAuth scopes for Netatmo and Home Assistant Cloud

* Fix tests by making order of scopes predictable
2020-02-06 17:00:27 +01:00
Paulus Schoutsen a3b3924e21
Update link when IO in event loop (#31519) 2020-02-06 11:37: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
Paulus Schoutsen 8d2086d076
Sonos services to work without admin access (#31506) 2020-02-05 15:50:20 -08:00
Paulus Schoutsen 481ea0aa5b
Check for known Hue vulnerability (#31494) 2020-02-05 13:57:17 -08:00
dupondje 557f5763df
Add belgian meter and rename some dsmr sensors (#30121)
* Add support for belgian meter and rename some sensors

* DSMR Fixes

* Add test

* More tests

* Adjust test to latest dev

* Remove unused code

* Depend on dsmr_parser 0.18
2020-02-05 22:14:03 +01:00
Paulus Schoutsen 472fe7a0fa
Fix Google API key test (#31492) 2020-02-05 09:50:00 -08:00
Paulus Schoutsen 84cbcb4d16
Remove tests for deprecated key (#31491) 2020-02-05 09:00:20 -08:00
Paulus Schoutsen 67680bcfa8
Automation device/entity extraction to include triggers + conditions (#31474)
* Add support for extracting triggers

* Add support for extracting triggers

* Fix test
2020-02-05 16:52:21 +01:00
Franck Nijhof 431a3a6b44
Re-branding of Hass.io panel to Supervisor (#31480) 2020-02-05 11:04:17 +01:00
Paulus Schoutsen c85a7934ed
Add brightness_step to light.turn_on (#31452)
* Clean up light turn on service

* Add brightness_step to turn_on schema

* Fix import

* Fix imports 2

* Fix RFLink test
2020-02-04 16:13:29 -08:00
Paulus Schoutsen e970177eeb
Use entity.async_request_call in service helper (#31454)
* Use entity.async_request_call in service helper

* Clean up semaphore handling

* Address comments

* Simplify call entity service helper

* Fix stupid rflink test
2020-02-04 15:30:15 -08:00
Paulus Schoutsen f41623ca64
Log warning when entities referenced in service call not found (#31427)
* Raise entities not found error

* Make it a warning, not an error

* Add support for MATCH_ENTITY_NONE

* Fix lint

* Fix tests
2020-02-04 14:42:07 -08: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
Raman Gupta 1efea50654
Update vizio host check to handle entries that don't have port (#31463)
* Update vizio host check to handle entries that don't have port

* add comment explaining no_port test for future

* remove _name_is_same function and support user updating name in config

* Update strings.json

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-02-04 11:31:03 -08:00
ochlocracy 4602d7370c
Remove Alexa.InputController from devices without supported inputs in Alexa (#31450)
* Yield Alexa.InputController only for supported inputs.

* Add Comment.

* Comment fix.
2020-02-03 16:19:40 -08:00
Bas Nijholt 119566f280
Keep track of the derivative for unit_time (#31397)
* keep track of the derivative for unit_time

In this way, you will get a better estimate of the derivate during
the timescale that is relavant to the sensor.

This solved a problem where sensors have a low output resolution.
For example a temperature sensor that can only be integer numbers.

It might report many values that are the same and then suddenly go up one value.
Only in that moment (with the current implementation) the derivative will be finite.

With my proposed implementation, this problem will not occur, because it takes the average
derivative of the last `unit_time`.

* only loop as much as needed

* treat the special case of 1 entry

* add option time_window

* use cv.time_period

* fix comment

* set time_window=0 by default

* rephrase comment

* use timedelta for time_window

* fix the "G" unit_prefix and add more prefixes

https://en.wikipedia.org/wiki/Unit_prefix

* add debugging lines

* simplify logic

* fix bug where the there was a division of unit_time instead of multiplication

* simplify tests

* add test_data_moving_average_for_discrete_sensor

* fix test_dataSet6

* improve readability of the tests

* better explain the test

* remove debugging log lines
2020-02-03 14:22:47 -08:00
ochlocracy c8d9b83b24
Update StepSpeaker and Speaker interfaces in Alexa (#31444)
* Yield only one Speaker interface.

* Yield PowerController only is supported.

* Revert "Yield PowerController only is supported."

This reverts commit c0dbf7e4

* Add Alexa.Speaker interface properties.

* Refactor tests for Alexa.Speaker and Alexa.StepSpeaker.

* Code Smell Change.

* Fix R1705: Unnecessary "elif" after "return".
2020-02-03 14:20:39 -08:00
escoand 4550968316
Samsung TV refinements (#31248)
* use st not deviceType

* show model in flow title

* Update strings.json

* add re-auth to entity

* add re-auth to config_flow

* handle auth popup better

* use media player domain const

* fix tests

* rename not_found to not_successful

* authz not authn

* Update media_player.py

* Update config_flow.py

* Update media_player.py

* Update test_media_player.py

* finalize re-auth

* fix ssd tests

* better naming

* fix ip-address-mock serialization

* fix turn_on_action serialization

* add type of hass object

* fix acces denied test

* remove half-added typing

* async get ip address

* fix pylint
2020-02-03 20:34:02 +01:00
tetienne 8bc77f0421
Add color to light template (#31435)
* Add color support to light template

* Add tests about color support
2020-02-03 08:27:01 -08:00
Raman Gupta ee927fbc9e
Bump pyvizio version and add additional device info (#31417)
* bump pyvizio version and add additional device info

* add patches for get_model and get_version

* change keywrod argument to positional for _test_service
2020-02-03 08:41:58 +01:00
Paulus Schoutsen 7687ac8b91
Fix service annotations (#31402)
* Fix service annotations

* Filter area_id from service data

* Fix services not accepting entities

* Typo
2020-02-02 15:36:39 -08:00
Paulus Schoutsen 81dbdc6b9c
Add dump service to MQTT integration (#31370)
* Add dump service to MQTT integration

* Lint
2020-02-02 15:01:51 -08:00
Martin af105d2d61
Emulated Hue + Alexa: Fix devices not discovered and error response (#30013 & #29899) (#31413)
* Revert "Emulated Hue: changed the reported fallback device-type to fix Alexa compatibility issues (#30013)"

This reverts commit ddc8d9e25c.

* Revert "Emulated Hue: updated tests (#30013)"

This reverts commit 90df461e75.

* Emulated Hue + Alexa: changed the fallback device-type again to "Dimmable Light" (#30013) after collective debugging; fixed brightness for on/off-devices and scripts to prevent "device malfunction" response from Alexa (#29899)

* Emulated Hue + Alexa: lint (#30013, #29899)
2020-02-02 14:52:00 -08:00
Franck Nijhof 826433b680
Fix device name Google Assistant when using aliases (#31416)
* Fix device name Google Assistant when using aliases

* Adjust cloud tests
2020-02-02 14:48:13 -08:00
Robert Svensson 883b8f21ce
deCONZ - Library cleanup (#31410)
* Follow library changes

* Bump dependency to v70

* Fix test
2020-02-02 19:07:20 +01:00
Paulus Schoutsen 7127310f10
Catch device not found in device automations (#31401) 2020-02-02 07:13:07 -08:00
FrengerH 704cfcf235
deCONZ - Fix magic cube awake gesture (#31403) 2020-02-02 12:54:59 +01:00
ochlocracy e796de6c59
Filter int in fan speed_list when yielding RangeController in Alexa (#31375)
* Allow for int in fan speed_list.

* Test for int in fan speed_list.

* prevent yielding preset for int labels.
2020-02-01 16:44:40 -08:00
Bernhard B 294c6a713f
Support multiple attachments in signal messenger integration (#31141)
* added support for multiple attachments to signal_messenger integration

* updated pysignalclirestapi version in requirements_all.txt

* reworked multiple attachments feature in signal_messenger integration

* stay backwards compatible by both allowing the "attachment" and
  the "attachments" attribute.

* reworked multiple attachments feature in signal_messenger integration

* stay backwards compatible by both allowing the "attachment" and
  the "attachments" attribute.

* small change in signal_messenger integration

* added deprecation warning for 'attachment' attribute

* small changes in signal_messenger integration

* use 'warning' instead of 'warn' when logging the warning message

* re-generated requirements_test_pre_commit.txt

* added tests for signal_messenger integration

* regenerated requirements_test_all.txt for signal_messenger integration

* added more signal_messenger tests

* remove signal_messenger integration files from .coveragerc
2020-02-01 14:21:16 -08:00
Paulus Schoutsen c67f53dc43
Remove hour delay before checking for updates (#31368)
* Check for updates at startup

* Add 100% test coverage for update_coordinator

* Address comments
2020-02-01 08:14:28 -08:00
Robert Svensson b373c202c9
deCONZ - Add support for new switch type (#31362) 2020-02-01 17:08:49 +01:00
Paulus Schoutsen 166d770ddd
Update Hue data fetching (#31338)
* Refactor Hue Lights to use DataCoordinator

* Redo how Hue updates data

* Address comments

* Inherit from Entity and remove pylint disable

* Add tests for debounce
2020-01-31 14:47:40 -08:00
Robert Svensson 44f0728c60
Axis - Use core to start component tests (#31328)
* Fix test according to Martins comment in 31286

* Use core features rather than integration specific

* Fix populate options test
2020-01-31 20:23:51 +01:00
Robert Svensson 958a867c11
UniFi integration move to push messaging (#31086)
* Rewrite UniFi integration to use push messaging

* Add signalling for new clients/devices

* Update list of known wireless clients when we get events of them connecting

* Reconnection logic for websocket

* Fix failing tests

* Bump requirement to v12

* Add new tests

* Update homeassistant/components/unifi/controller.py

Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>
2020-01-31 20:23:25 +01:00
Christian Clauss df7d2b3aeb
Fix typos found by codespell (#31243)
* Fix typos found by codespell

* Fix typos found by codespell

* codespell: Furture  ==> Future

* Update test_config_flow.py

* Update __init__.py

* Spellcheck: successfull  ==> successful

* Codespell: unsuccesful  ==> unsuccessful

* Codespell: cant  ==> can't

* Codespell: firware ==> firmware

* Codespell: mimick  ==> mimic
2020-01-31 08:33:00 -08:00
Martin b22dfa119b
Emulated Hue: changed fallback device-type to fix Alexa compatibility issues (#30013) (#31330)
* Emulated Hue: changed the reported fallback device-type to fix Alexa compatibility issues (#30013)

* Emulated Hue: updated tests (#30013)
2020-01-30 23:30:13 -08:00
Robert Svensson a8374cf423
UniFi - Try to discover local controller (#31326)
* Its working

* Use "unifi" as default host if a controller can be found

* Fix tests

* Make a fixture of patching the discovery function
2020-01-30 23:06:43 +01:00
Robert Svensson 56657fa859
Axis - config flow use new helper functions (#31286)
* Make use of new config flow helpers
Simplify Axis entry config to work with config flow helpers

* Keep old device data for rollback purposes
2020-01-30 22:20:30 +01:00
Raman Gupta 73ea34e417
Update media_player and add tests to qualify vizio integration for platinum quality score (#31187)
* add media player test and update media player logic to qualify vizio for platinum quality score

* add SCAN_INTERVAL and log message once when device goes from available to unavailable and vice versa

* move test constants into one file to avoid defining dupes in each test file

* move constant to shrink diff

* move pytest fixtures to conftest.py

* remove commented out code

* move unload test to test_init

* updates to tests and logging based on review

* bypass notification service

* add fixture so component setup makes it through config flow

* split failure tests into two

* fix setup and entity check for test_init and setup failures in test_media_player

* make domain references consistent across test files

* remove logging steps that were introduced to help debug

* move common patches out to new fixture and use config entry everywhere appropriate

* fix docstring

* add test for update options to increase code coverage

* add one more assert

* refactor test_media_player to move boiler plate logic out of each test into _test_init function

* final refactor of test_media_player to move repeat logic into separate function

* update docstrings

* refactor setup failure tests to move shared logic into private function

* fix last new functions code to use variable instead of static config variable

* remove trailing comma

* test that volume_step gets properly passed to Vizio volume function

* fix comment language

* assert with unittest.mock.call in _test_service and use config_entries.async_setup instead of config_entries.async_add

* replace config_entries.async_add with config_entries.async_setup everywhere

* simplify if statement for argument assertion

* fix logging based on style guide

* remove accidentally committed changes

* update scan interval to something more reasonable and add tests for availability changes

* change filter function to list comprehension, simplify log messages, remove default entity id from logs since it is user configurable, fix docstrings
2020-01-30 22:13:45 +01:00
Rick 3718b25bd9
Add opening and closing states to MQTT covers (#31259)
* Added support for the opening and closing states to MQTT covers

* Processed PR feedback on MQTT cover changes

* Add missing MQTT abbreviation to fix failing tests

* Fixed typo in MQTT abbreviations

* Added mqtt set cover position optimistic test
2020-01-30 21:14:46 +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
Paulus Schoutsen 33361f8580
Fix HTTP config serialization (#31319) 2020-01-30 09:47:16 -08:00
Paulus Schoutsen d24e397a80
Handle service calls that do not refer entity IDs (#31317) 2020-01-30 09:28:06 -08:00
Paulus Schoutsen da14e2927f
Removes I/O from linky tests (#31299) 2020-01-29 21:59:24 -08:00
Alan Tse cf0e467150
Change scan_interval defaults for Tesla (#31194) 2020-01-29 20:15:47 -05:00
Paulus Schoutsen 01dad31adc
Fix service helper not handling sync methods (#31254)
* Fix service helper not handling sync methods

* Add legacy support for returning coroutine objects

* Fix tests

* Fix tests

* Convert demo cover to async
2020-01-29 16:27:25 -08:00
Robert Svensson 111fc1fa8e
Use all new helper functions (#31278) 2020-01-29 16:21:23 -08:00
Paulus Schoutsen 424e15c7a7
Find related items scripts/automations (#31293)
* Find related items scripts/automations

* Update manifest
2020-01-29 16:19:13 -08:00
Paulus Schoutsen 881437c085
Catch error when searching for scenes or automations (#31288) 2020-01-29 14:46:48 -08:00
Paulus Schoutsen e9e44dbd97
Fix callback and async (#31281)
* Fix callback and async

* Fix a return

* Fix test

* Fix mqtt tests

* Fix some more callbacks
2020-01-29 13:59:45 -08:00
Jeff Irion 31dc2ad284
Allow filtering of sources for Android TV (#30994) 2020-01-29 14:13:09 -06:00
David F. Mulcahey f4a4c6bea5
ZHA group and device cleanup (#31260)
* add dispatching of groups to light
* added ha device registry device id
* added zha group object
* add group event listener
* add and remove group members
* get group by name
* api cleanup
* clean up get device info
* create and remove zigpy groups
* clean up create and remove group api
* use device id
* use device id
* cleanup
* update test
* update tests to allow group events to flow
2020-01-29 12:24:43 -05:00
Pascal Vizeli 6bbb713013
Fix tests for opnsense (#31277) 2020-01-29 18:18:24 +01:00
ochlocracy 83dff16e1e
Add support for rangeValueDeltaDefault in Alexa AdjustRangeValue directive (#31258)
* Update tests with rangeValue and rangeValueDelta to use int.

* Add support for rangeValueDeltaDefault for covers.

* Update tests for range changes.

* Test for AdjustRangeValue with rangeValueDeltaDefault True.

* Update tilt error.
2020-01-29 09:04:57 -08:00
ochlocracy 7116c7404a
Add PowerController to covers in Alexa (#31265)
* Add PowerController to covers.

* Comment Fix.

* Update test device_class.

* Update Comment.
2020-01-29 09:03:20 -08:00
Matthew Treinish 85dbf1ffad
Add OPNSense device tracker (#26834)
* Add OPNSense device_tracker

This commit adds a new component for using an OPNSense router as a
device tracker. It uses pyopnsense to query the api to look at the
arptable for a list of devices on the network.

* Run black formatting locally to appease azure

* Apply suggestions from code review

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

* Fix issues identified during code review

This commit updates several issues found in the module during code
review.

* Update homeassistant/components/opnsense/__init__.py

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

* Update CODEOWNERS for recent changes

* Fix lint

* Apply suggestions from code review

Co-Authored-By: Martin Hjelmare <marhje52@kth.se>

* More fixes from review comments

This commit fixes several issues from review comments, including
abandoning all the use of async code. This also completely reworks the
tests to be a bit clearer.

* Revert tests to previous format

* Add device detection to opnsense device_tracker test

This commit adds actual device detection to the unit test for the setup
test. A fake api response is added to mocks for both api clients so that
they will register devices as expected and asserts are added for that.

The pyopnsense import is moved from the module level to be runtime in
the class. This was done because it was the only way to make the
MockDependency() call work as expected.

* Rerun black

* Fix lint

* Move import back to module level

* Return false on configuration errors in setup

This commit updates the connection logic to return false if we're unable
to connect to the configured OPNsense API endpoint for any reason.
Previously we would not catch if an endpoint was incorrectly configured
until we first tried to use it. In this case it would raise an unhandled
exception. To handle this more gracefully this adds an api call early in
the setup and catches any exception raised by that so we can return
False to indicate the setup failed.

* Update tests

* Add pyopnsense to test requirements

* Rerun gen_requirements script

* Fix failing isort lint job step

Since opening the PR originally yet another lint/style checker was added
which failed the PR in CI. This commit makes the adjustments to have
this pass the additional tool's checks.

* Fix comment

* Update manifest.json

Co-authored-by: Fabian Affolter <mail@fabian-affolter.ch>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Pascal Vizeli <pascal.vizeli@syshack.ch>
2020-01-29 16:20:43 +01:00
Quentame ec4ccb10ec
Bump iCloud to 0.9.2 + fix setup log (#31273)
- pyicloud to 0.9.2
- fix log `ERROR (MainThread) [homeassistant.config_entries] icloud.async_setup_entry did not return boolean`
2020-01-29 15:16:54 +01:00
Rafał Słota 080827fb62
Fix light.turn_on for emulated_hue (#31195)
* Fix light.turn_on for emulated_hue

HarmonyHub sends `{'xy': [0, 0], 'on': True, 'bri': 0}` when turning on lights that do not support brightness control. Unfortunately current logic always uses  brightness value to control on/off state which makes no sense for lights that don't support brightness at all. This change fixes that behavior, making light without brightness control usable with HarmonyHub and probably some other remotes.

* Test 'no_brightness' lights
2020-01-29 12:11:22 +01:00
Alexei Chetroi 37af2170ec
Mark device unavailable when it leaves Zigbee network. (#31264) 2020-01-28 21:21:33 -05:00
Franck Nijhof fd4f8d92d2
Upgrade dsmr_parser to 0.18, re-enable tests (#31256) 2020-01-28 23:35:28 +01:00
Paulus Schoutsen 8ceef72853
Google Assistant: Track if request is local (#31226)
* Track if request is local

* Cancel early if 2FA disabled

* Allow disabling 2FA for ack

* Do not mark devices with 2FA as reachable

* Add request source to GA events
2020-01-28 10:54:39 -08:00
SukramJ ec2d378a19 Add test for adding a device to HomematicIP Cloud (#31224)
* Add test for adding a hmip device

* refactor get_mock_hap to use config_entry setup

* remove unused parameters
2020-01-28 08:44:30 +01:00
Alexei Chetroi 9d8b4de09c Update ZHA entity discovery tests (#31191)
* ZHA registry test fixtures refactoring.

* Update ZHA test devices list.

* Use channel.id for event relay channels test.

* Add zigpy_device factory fixture.

* Add node descriptor to mock zigpy devices.

* Use node descriptor for ZHA device tests.

* Update ZHA discovery test.

check for unique_id and channels passed into each entity.

* Address comments.
2020-01-27 19:43:26 -05:00
Paul Daumlechner ed970797be Fix attribute in Alexa service call for cover tilt (#31223)
* Update attribute in Alexa service call for cover tilt

* Update Tests to fix Tilt Position call.

Co-authored-by: ochlocracy <5885236+ochlocracy@users.noreply.github.com>
2020-01-27 19:28:40 -05:00
SukramJ 1dbfc66669 Cleanup of HomematicIP Cloud tests (#31181)
* CleanUp tests for HomematicIP_Cloud

* Remove not required CoroutineMock

* remove None return in mocks, add asserts

* rewrite test
2020-01-27 21:34:15 +01:00
Christian Clauss 1d537ad416 Fix typo: serivce --> service (#31217) 2020-01-27 19:56:26 +01: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
Quentame a73a1a4489 Use config_entry.unique_id in Linky (#31051)
* Use config_entry.unique_id in Linky

* Reviews

* _show_setup_form not async
2020-01-27 08:57:36 -08:00
ktnrg45 d3ac3e48a3 Fix ps4 errors if pin begins with a 0 (#31198)
* Fix errors if pin begins with a 0

* Test PIN leading with zero

* Edit tests
2020-01-27 10:32:14 -05:00
Ron Klinkien 50b0e938e1 Added missing file (#31189) 2020-01-27 12:52:58 +01:00
Franck Nijhof 050e4afdc0
Disable failing dsmr tests (#31202)
* Disable failing dsmr tests

* Disable module, disable import of missing dep
2020-01-27 11:13:36 +01:00