Commit Graph

3760 Commits (cff7fd0ef3bb314455455b0fca07420a8c9c2fb6)

Author SHA1 Message Date
Robert Svensson cff7fd0ef3
deCONZ - Increase bridge discovery robustness in config flow (#26911) 2019-09-25 21:50:14 +02:00
Rami Mosleh d1adb28c6b Add google_assistant alarm_control_panel (#26249)
* add alarm_control_panel to google_assistant

* add cancel arming option

* raise error if requested state is same as current

* rework executing command logic

* Add tests

* fixed tests

* fixed level synonyms
2019-09-25 10:13:31 -07:00
Robert Svensson 4582b6e668
deCONZ - Improve ssdp discovery by storing uuid in config entry (#26882)
* Improve ssdp discovery by storing uuid in config entry so discovery can update any deconz entry, loaded or not
2019-09-25 18:56:31 +02:00
Gil Peeters cd976b65ae Add availability_template to Template Switch platform (#26513)
* Added availability_template to Template Switch platform

* Fixed Entity discovery big and coverage

* flake8

* Cleaned template setup

* I'll remember to run black every time one of these days...

* Updated AVAILABILITY_TEMPLATE Rendering error

* Moved const to package Const.py

* Fix import order (pylint)

* Refactored availability_tempalte rendering to common loop

* Cleaned up const and compare lowercase result to 'true'

* reverted _available back to boolean

* Fixed tests (async, magic values and state checks)

* Fixed Enity Extraction
2019-09-24 21:30:48 -07:00
tleegaard 2ffbe5b99f Inverting states for opening/closing Homekit covers (#26872)
* Update cover.py

* Update test_cover.py
2019-09-24 21:16:08 -07:00
Franck Nijhof 9c9c921922 Use Python3 new super syntax sugar (#26890) 2019-09-24 15:38:20 -07:00
Paulus Schoutsen 6fdff9ffab
Reorg device automation (#26880)
* async_trigger -> async_attach_trigger

* Reorg device automations

* Update docstrings

* Fix types

* Fix extending schemas
2019-09-24 14:57:05 -07:00
David F. Mulcahey 18873d202d Add device automation support to ZHA (#26821)
* beginning ZHA device automations

* add cube

* load triggers from zigpy devices

* cleanup

* add face_any for aqara cube

* add endpoint id to events

* add cluster id to events

* cleanup

* add device tilt

* add test

* fix copy paste error

* add event trigger test

* add test for no triggers for device

* add exception test

* better exception tests
2019-09-24 08:54:41 -07:00
Gil Peeters 161c8aada6 Add availability_template to Template Sensor platform (#26516)
* Added availability_template to Template Sensor platform

* Added to test for invalid values in availability_template

* Updated AVAILABILITY_TEMPLATE Rendering error

* Moved const to package Const.py

* Fix import order (pylint)

* Moved availability_template rendering to common loop

* Removed 'Magic' string

* Cleaned up const and compare lowercase result to 'true'

* Device is unavailbale if value template render fails

* Converted test ot Async and fixed states

* Comverted back to using boolean for _availability

* Fixed state check in test
2019-09-24 16:05:19 +02:00
Alexei Chetroi 9c0fbfd101
Bump up ZHA dependencies (#26746)
* Update ZHA to track zigpy changes.
* Update ZHA dependencies.
* Update tests.
* Make coverage happy again.
2019-09-23 13:35:27 -04:00
Abílio Costa 61634d0a64 Store ZHA light brightness when fading off to turn on at the correct brightness (#26680)
* Use light's on_level in ZHA to turn on at the correct brightness

Previously, if the light is turned off with a time transition, the
brightness level stored in the light will be 1. The next time the light
is turned on with no explicit brightness, it will be at 1.

This is solved by storing the current brightness in on_level before
turning off, and then using that when turning on (by calling the
onOff cluster 'on' command).

* store off light level locally to avoid wearing device's flash memory

* store off brightness in HA attributes

* improve set/clear of off_brightness

* fix device_state_attributes; clear off_brightness when light goes on

* fix tests
2019-09-23 09:08:44 -04:00
Franck Nijhof 9fd9ccc2a3 Remove deprecated srp_energy integration (ADR-0004) (#26826) 2019-09-23 12:13:12 +02:00
Kevin Eifinger 5c0fa35d4a Add here_travel_time (#24603)
* Add here_travel_time

* Bump herepy version to 0.6.2

* Update requirements_all.txt

* Disable pylint and catch errors

* Add herepy to requirements_test_all

* Correctly place test req for herepy

* use homeassistant.const.LENGTH_METERS

* Implemented Requested Changes

* Better error message for cryptic error code

* add requested changes

* add_entities instead of async

* Add route attr and distance in km instead of m

* fix linting errors

* attribute duration in minutes instead of seconds

* Correct pattern for longitude

* dont split attribute but rather local var

* move strings to const and use travelTime

* Add tests

* Add route for pedestrian and public

* fix public transport route generation

* remove print statement

* Standalone pytest

* Use hass fixture and increase test cov
_resolve_zone is redundant

* Clean up redundant code

* Add type annotations

* Readd _resolve_zone and add a test for it

* Full test cov

* use caplog

* Add origin/destination attributes
According to https://github.com/home-assistant/home-assistant/pull/24956

* Add mode: bicycle

* black

* Add mode: publicTransportTimeTable

* Fix error for publicTransportTimeTable
Switch route_mode and travel_mode in api request.

* split up config options

* More type hints

* implement *_entity_id

* align attributes with google_travel_time

* route in lib
apply requested changes

* Update requirements_all.txt

* remove DATA_KEY

* Use ATTR_MODE

* add attribution

* Only add attribution if not none

* Add debug log for raw response

* Add _build_hass_attribution

* clearer var names in credentials check

* async _are_valid_client_credentials
2019-09-23 11:50:18 +02:00
jjlawren 5914475fe5 Add manual step to Plex config flow (#26773)
* Add manual config step

* Pass token to manual step

* Fix for no token

* Show error

* Specify key location

* Cast discovery port to int
2019-09-23 00:23:14 +02:00
Erik Montnemery e5f6f33340 Add device automation support to binary_sensor entities (#26643)
* Add device automation support to binary_sensor entities

* turn_on -> turned_on

* Correct spelling of present

* Improve tests

* Fix strings

* Fix stale comment
2019-09-22 11:13:17 -07:00
bouni dc52b858a4 Fix spaceapi (#26453)
* fixed latitude/longitude keys to be conform with spaceapi specification

* version is now a string as required by the spaceapi specification

* add spacefed

* fixed lat/lon in spaceapi tests

* extended tests

* add feeds

* extended tests

* add cache

* add more tests

* add projects

* more tests

* add radio_show

* more tests

* add additional contact attributes

* corrected valid issue_repoer_channel options

* validate min length of contact/keymasters

* fixed location as address is not required by spec

* Update homeassistant/components/spaceapi/__init__.py

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

* Update homeassistant/components/spaceapi/__init__.py

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

* fixed issue with name change for longitude/latitude
2019-09-22 01:22:33 +02:00
Albert Gouws e394be7337 Mqtt binary sensor expire after (#26058)
* Added expire_after to mqtt binary_sensor. Updated mqtt test_binary_sensor test.

* Cleanup MQTT Binary Sensor and tests after suggestions

* Updated to not alter state at all

* Change to include custom expired variable, and override available property to check expired

* Added # pylint: disable=no-member
2019-09-21 20:42:03 +02:00
MatthewFlamm 0e15785602 Bump pynws version to 0.8.1 (#26770)
* Bump to version 0.8.1

Fixes #26753.

* gen_requirements.py changes

* fix default params change in tests
2019-09-21 15:56:40 +02:00
Askarov Rishat aaf0f9890d Add transport data from maps.yandex.ru api (#26766)
* adding feature obtaining Moscow transport data from maps.yandex.ru api

* extracting the YandexMapsRequester to pypi

* fix code review comments

* fix stop_name, state in datetime, logger formating

* fix comments

* add docstring to init

* rename, because it works not only Moscow, but many another big cities in Russia

* fix comments

* Try to solve relative view in sensor timestamp

* back to isoformat

* add tests, update external library version

* flake8 and black tests for sensor.py

* fix manifest.json

* update tests, migrate to pytest, async, Using MockDependency

* move json to tests/fixtures

* script/lint fixes

* fix comments

* removing check_filter function

* fix typo

* up version on manifest.json

* up version to 0.3.7 in requirements_all.txt
2019-09-20 18:12:36 +02:00
Pascal Vizeli 9e44d1af19
Revert "Add transport data from maps.yandex.ru api (#26252)" (#26762)
This reverts commit 9e2cd5116a.
2019-09-20 15:55:43 +02:00
Robert Svensson f5d12669a5 deCONZ improve gateway tests (#26709)
* Improve gateway tests

* Harmonize all tests to use the same gateway initialization method

* Improve scene tests

* Add gateway resync call to platform tests

* Forgot to change switch tests to use common gateway method

* Improve event tests
2019-09-19 14:44:09 -07:00
Askarov Rishat 9e2cd5116a Add transport data from maps.yandex.ru api (#26252)
* adding feature obtaining Moscow transport data from maps.yandex.ru api

* extracting the YandexMapsRequester to pypi

* fix code review comments

* fix stop_name, state in datetime, logger formating

* fix comments

* add docstring to init

* rename, because it works not only Moscow, but many another big cities in Russia

* fix comments

* Try to solve relative view in sensor timestamp

* back to isoformat

* add tests, update external library version

* flake8 and black tests for sensor.py

* fix manifest.json

* update tests, migrate to pytest, async, Using MockDependency

* move json to tests/fixtures

* script/lint fixes

* fix comments

* removing check_filter function

* fix typo
2019-09-19 23:41:44 +02:00
Penny Wood b68b8430a4 Izone component (#24550)
* iZone component

* Rename constants to const.

* Changes as per code review.

* Stop listening if discovery times out.

* Unload properly

* Changes as per code review

* Climate 1.0

* Use dispatcher instead of listener

* Free air settings

* Test case for config flow.

* Changes as per code review

* Fix error on shutdown

* Changes as per code review

* Lint fix

* Black formatting

* Black on test

* Fix test

* Lint fix

* Formatting

* Updated requirements

* Remaining patches

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

* Log error on failed connection

* Review comments

* Unused errors

* Move form to step

* Use instance var instead of passing argument

* Only share servers created by component

* Return errors early to avoid try:else

* Separate debug for validation vs setup

* Unnecessary

* Unnecessary checks

* Combine import flows, move logic to component

* Use config entry discovery handler

* Temporary lint fix

* Filter out servers already configured

* Remove manual config flow

* Skip discovery if a config exists

* Swap conditional to reduce indenting

* Only discover when no configs created or creating

* Un-nest function

* Proper async use

* Move legacy file import to discovery

* Fix, bad else

* Separate validate step

* Unused without manual setup step

* Async oops

* First attempt at tests

* Test cleanup

* Full test coverage for config_flow, enable tests

* Lint

* Fix lint vs black

* Add test init

* Add test package requirement

* Actually run script

* Use 'not None' convention

* Group exceptions by result

* Improve logic, add new error and test

* Test cleanup

* Add more asserts
2019-09-19 23:29:26 +02:00
Paulus Schoutsen 1e5de9e9e4 Bump TRADFRI (#26731)
* Bump TRADFRI

* Fix test
2019-09-19 20:49:47 +02:00
Franck Nijhof a8a485abf7 Bumps aiohttp to 3.6.0 (#26728) 2019-09-19 20:34:41 +02:00
Andrew Rowson 770eeaf82f Encode prometheus metric names per the prom spec (#26639)
Referencing issue #26418.

Prometheus metric names can only contain chars a-zA-Z0-9, : and _
(https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).

HA currently generates invalid prometheus names, e.g. if the unit for a
sensor is a non-ASCII character containing  ° or μ. To resolve, we need
to sanitize the name before creating, replacing non-valid characters
with a valid representation. In this case, I've used
"u{unicode-hex-code}".

Also updated the test case to make sure that the ° case is handled.
2019-09-19 12:51:49 +02:00
Robert Svensson 886d8bd6e2 deCONZ rewrite sensor tests (#26679)
* Improve binary sensor tests

* Fix sensor tests

* Improve readability of binary sensor

* Fix climate tests
Fix sensor platform not loading climate devices as sensors

* Add test to verify adding new sensor after start up
2019-09-18 10:07:32 -07:00
Robert Svensson 8a39924b37
deCONZ improve light tests (#26697)
* Improve light tests
* Small improvements on light and group classes
2019-09-18 12:47:26 +02:00
Paulus Schoutsen c6fc677f5b
Verify withings config (#26698) 2019-09-17 13:45:48 -07:00
Maikel Punie 9114ed36cd Fix cert expiry config flow check and update (#26638)
* Fix typo in translations

* Work on bug #26619

* readd the homeassistant.start event

* Remove the callback

* Added the executor_job for _test_connection

* Update test_config_flow.py
2019-09-17 13:39:46 -07:00
Erik Montnemery 504b8c7685
Fix translation, adjust trigger names (#26635) 2019-09-17 21:55:01 +02:00
Paulus Schoutsen 0ef79da281 Use Nabu Casa url if no https url set (#26682)
* Use Nabu Casa url if no https url set

* Update test_home_assistant_cast.py
2019-09-17 09:23:31 +02:00
Robert Svensson 5116d02747 deCONZ - Improve service tests (#26663)
* Improve configure service tests

* Add refresh device service test

* Add tests for setup and unload services

* Remove refresh device test from test_init

* Extra verification of deconz services existance in hass.data
2019-09-16 10:08:13 +02:00
Bryan York f45f8f2f3d Emulate color temperature for non-ct lights in light groups (#23495)
* Emulate color temperature for non-ct lights in light groups

* fix tests

* Address review comments

* Fix black formatting

* Fix for pylint

* Address comments

* Fix black formatting

* Address comments
2019-09-15 20:53:05 +02:00
Erik Montnemery 6a60ebdb30
Rename MockToggleDevice to MockToggleEntity (#26644)
* Rename MockToggleDevice to MockToggleEntity

* Fix tests
2019-09-15 09:50:17 +02:00
Robert Svensson 9c2053a251
deCONZ - Remove mechanisms to import a configuration from configuration.yaml (#26648) 2019-09-14 22:53:59 +02:00
Robert Svensson fb1acfccc9
deCONZ - create deconz_events through sensor platform (#26592)
* Move event creation into sensor platform where it belongs
* Fixed the weird failing test observed during device automation PR
2019-09-14 00:16:37 +02:00
Robert Svensson 0221d136de Remove support of UniFi device tracker configuration import (#26587) 2019-09-11 13:35:30 -06:00
Paulus Schoutsen adaa200935
Home Assistant Cast (#26566)
* Add backend support for Home Assistant Cast

* Update test reqs
2019-09-11 12:34:10 -06:00
Pascal Vizeli f3fa073045
Bump UPC connect / fix auth issue (#26570)
* Bump UPC connect / fix auth issue

* Fix lint

* Fix platform schema

* Fix config value

* Address comment / add session cleanup

* Fix device handling
2019-09-11 13:17:07 +02:00
Robert Svensson c680c07c65 deCONZ device automations (#26366)
* Early draft

* Getting there

* Working fully with Hue dimmer remote

* Fix Balloobs comments

* No side effects in constructor

* Improve hue dimmer

* Add Ikea remote control

* Add xiaomi button support

* Refactor getting deconz event

* Added xiaomi devices and tradfri wireless dimmer

* Resolve unique id from device id

* Add Hue Tap and Tradfri on off switch

* More triggers for ikea on off switch and Aqara double wall switch

* Add support for Tradfri open close remote

* Fix changes after rebase

* Initial test

* Change id to event_id

* Fix translations and add subtypes

* Try if tests pass without the new tests

* Revert disabling tests
Add new exception InvalidDeviceAutomationConfig

* Ignore places calling remotes

* Enable all gateway tests

* Found the issue, now to identify which test creates it

* Remove block till done

* See if device automation test passes in azure

* Register event to device registry

* Enable test sensors

* Skip deconz event tests currently failing

* Added reason why skipping tests
2019-09-10 16:56:28 -07:00
Paulus Schoutsen 6f27c5ae46 Fix tests 2019-09-10 13:07:55 -07:00
Paulus Schoutsen 7468cc21be
Refactor Cast (#26550)
* Refactor Cast

* Fix tests & address comments

* Update reqs
2019-09-10 13:05:46 -07:00
lifeisafractal 5d5102e1a2 Add zwave application version (#26205)
* Set application version in zwave

* update tests for more coverage
2019-09-09 23:59:40 +02:00
Erik Montnemery 02ded7a4a8 Remove device from device action schema (#26536) 2019-09-09 10:40:22 -07:00
Erik Montnemery b14b14c3c9
Add device automation support to switch entities (#26466)
* Add device automation support to switch entities

* Update switch translations

* Address review comments
2019-09-09 16:55:47 +02:00
David F. Mulcahey fec6706bf7 use newly added is_server for cluster reporting (#26533) 2019-09-09 09:21:34 -04:00
Maikel Punie 28beebac61 Enable SolarEdge config entries (#26282)
* Initial commit for the solaredge configflow

* rerun the hassfest script

* Adding testcases

* Rerun hassfest, problem with black?

* Requirements for the tests

* Remove CONF_MONITORED_CONDITIONS from configuration.yaml

* Remove the options flow strings

* Resolve some comments

* Comments

* More comments

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

* More comments

* More comments

* Added solaredge __init__

* Added more test to increase coverage
2019-09-08 21:49:20 +02:00
Ville Skyttä 33e1b44b3a
Use PEP 526 type annotations, add some type hints (#26464)
* Add some more type hints to helpers.event

* Change most type comments to variable types

* Remove some superfluous type hints
2019-09-07 09:48:58 +03:00