Commit Graph

930 Commits (a47f73244c0b3fbe4210ffd7731be69b3984fbbd)

Author SHA1 Message Date
Ville Skyttä f259ff17d5
Type hint additions (#26831)
* Type hint additions

* Remove optional from sidebar_icon comment

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

* Remove optional from sidebar_title comment

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

* Fix issues after rebase and mypy 0.730
2019-09-29 20:07:49 +03:00
Ville Skyttä fde128d66c
Upgrade mypy to 0.730, address raised issues (#26959)
https://mypy-lang.blogspot.com/2019/09/mypy-730-released.html
2019-09-27 22:57:59 +03:00
Erik Montnemery e57e7e8449
Improve validation of device trigger config (#26910)
* Improve validation of device trigger config

* Remove action and condition checks

* Move config validation to own file

* Fix tests

* Fixes

* Fixes

* Small tweak
2019-09-27 17:48:48 +02:00
Bram Kragten b75639d9d1 Remove lamps and groups from ha when removed from Hue (#26881)
* Remove light when removed from hue

* add remove_config_entry_id

* Review + bump aiohue

* lint

* Add tests
2019-09-25 14:00:18 -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
Franck Nijhof b52cfd3409 Add comment for clarity to helper.entity.enabled() (#26793)
* Fixes entity enabled expression

* Ensure True is returned when there is no registry_entity

* Add comment for clarity to helper.entity.enabled()
2019-09-24 14:21:00 -07:00
Franck Nijhof 6f9ccb5434 Add and corrects typehints in Entity helper & core class (#26805)
* Add and corrects typehints in Entity class

* Adjust state type based on comments
2019-09-24 14:20:04 -07:00
Franck Nijhof b1118cb8ff Removes unnecessary else/elif blocks (#26884) 2019-09-24 13:53:03 -07:00
Ville Skyttä 54242cd65c Type hint additions (#26765) 2019-09-20 08:23:34 -07: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
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
Erik Montnemery b1c2a5fa08 Add device automation action (#26455)
* Add support for device actions, with light as example.

* Add translation; return list
2019-09-05 16:26:22 -07:00
Erik Montnemery f7dc537275
Add device automation condition (#26313)
* Add support for device conditions

* Lint

* Update test case

* Make and+or conditions async, adjust tests

* Cleanup tests

* Remove non callback versions of conditions, correct typing

* Correct typing

* Update light/strings.json

* Address review comments

* Make device automation lists simple lists, not dicts

* Add device_automation/const.py

* Use IS_ON/IS_OFF everywhere for conditions
2019-09-05 16:49:32 +02:00
Penny Wood 4004879ae0 Entity registry doesn't overwrite with None (#24275) 2019-09-04 09:49:22 -07:00
Franck Nijhof 2f0eb07624 Migrate legacy typehints in core to PEP-526 (#26403)
* Migrate legacy typehints in core to PEP-526

* Fix one type
2019-09-03 20:36:04 -07:00
Paulus Schoutsen 0cffd61481 Allow passing dictionaries to async_register_entity_service (#26370) 2019-09-03 09:50:24 +02:00
SukramJ cf3bb300e6 Fix for 0.98: Don't update disabled entities (Homematic IP Cloud) (#26236)
* Homematic IP Cloud Fix: Don't update disabled entities

* Added enabled to entity.py

* Update test for enabled

* Update entity.py
2019-08-28 13:38:20 -07:00
Franck Nijhof decf13b948 Use literal string interpolation in core (f-strings) (#26166) 2019-08-23 09:53:33 -07:00
Paulus Schoutsen f704a8e90e Reload config entry when entity enabled in entity registry, remove entity if disabled. (#26120)
* Reload config entry when disabled_by updated in entity registry

* Add types

* Remove entities that get disabled

* Remove unnecessary domain checks.

* Attach handler in async_setup

* Remove unused var

* Type

* Fix test

* Fix tests
2019-08-22 19:32:43 -05:00
Paulus Schoutsen aa56b4dd30
Log warning if disabled entities receive updates. (#26143)
* Log warning if disabled entities receive updates.

* Fix test

* Always set entity ID on disabled entities
2019-08-22 14:12:24 -07:00
Jeff Irion 7090970436 Add descriptive fields to script config (#26056)
* Add descriptive fields to script config

* Add script descriptions to hass.data["service_description_cache"]

* Import SERVICE_DESCRIPTION_CACHE

* Register script descriptions via async_set_service_schema

* Add scripts test for loading and reloading service descriptions

* Minor cleanup

* Clean up script schema
2019-08-21 14:08:46 -07:00
Robert Svensson a2589f56e1 Add system options to config entries (#25926)
* Add system options to config entries

* For feedback

* Follow most of balloobs comments

* Fix balloobs comments

* Improvements

* Fix second round of Balloobs comments

* Fix third round

* Add system options to mock config entry

* Fix integration tests

* Fix the last failing tests

* Fix disabled string

* Fix failing disabled_by tests

* New tests

* Config entry WS API tests

* Fix comments
2019-08-17 21:34:11 -07:00
Paulus Schoutsen eba6caf8a1
Entity registry api update disable (#26015)
* Clean up entity registry WS commands

* Allow updating disabled_by in entity registry

* Allow changing disabled_by via API

* Update tests/components/config/test_entity_registry.py

Co-Authored-By: Robert Svensson <Kane610@users.noreply.github.com>
2019-08-16 16:22:45 -07:00
Paulus Schoutsen 8b66c11706
Fix config entry has options check (#25976)
* Fix config entry has options check

* Register webhook/discovery config flows with classes

* Fix types

* Apply suggestions from code review

Co-Authored-By: Martin Hjelmare <marhje52@kth.se>
2019-08-16 16:19:19 -07:00
Paulus Schoutsen 6c292846be
Allow entities to indicate they should be disabled by default (#26011) 2019-08-16 16:17:16 -07:00
Erik Montnemery fad54cd6d8
Ensure sun conditions are using the right date (#23664)
* Ensure sun conditions are using the right date
2019-08-16 17:34:56 +02:00
Ville Skyttä aa508b5106 Complete some incomplete type hints in helpers (#25953) 2019-08-15 08:53:25 -07:00
Paulus Schoutsen cf90e49b50
Make reproduce state use platform instead of rely on function (#25856)
* Make reproduce state use platform instead of rely on function

* Fix types

* address comment Martin.
2019-08-11 20:03:21 -07:00
Johann Kellerman 8b9d0593b1 Allow components with empty list config (i.e. person) in packages (#25827)
* Fix #23424

* mypy Lists
2019-08-10 16:30:33 -07:00
Tomi Lehto 5b516fc0cd Add arcus trigonometry functions to templates (#25510) 2019-08-09 11:16:47 -07:00
Joakim Plate d1b9ebc7b2 Integration requirement check refactor (#25626)
* Factor out code getting requirements for integration

* Have process requirements raise an exception

* One more lint fix

* Blackify

* Catch new exception

* Let RequirementsNotFound be a HomeAssistantError

* Correct another test

* Split catching of exceptions and avoid complete log
2019-08-07 15:35:50 -07:00
Paulus Schoutsen 7a90808e52 Add service to reload scenes from configuration.yaml (#25680)
* Allow reloading scenes

* Update requirements

* address comments

* fix typing

* fix tests

* Update homeassistant/components/homeassistant/scene.py

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

* Address comments
2019-08-05 23:04:19 +02:00
Ville Skyttä a54ade1189 Spelling fixes (#25666) 2019-08-02 23:20:06 +02:00
Paulus Schoutsen 620cb74050 Type 2019-07-31 13:08:31 -07:00
Paulus Schoutsen 4de97abc3a Black 2019-07-31 12:25:30 -07:00
Joakim Plate 3d11c45edd Log platform import errors and correct reqs for config check (#25425)
* Log failures to load plaforms

* Drop unused exception variable

* Also load pip requirements with check config

* Fix lint

* More lint

* Drop invalid parameters for error call
2019-07-31 09:09:00 -07:00
aschamberger 3512d05467 Add ord() to template filters (#25398)
* Add ord() to template filters

* Remove trailing whitespace

* add test
2019-07-25 15:06:51 -07:00
Ville Skyttä 17d754dbbf Optional and Union simplifications (#25365) 2019-07-21 10:59:51 -07:00
Ville Skyttä d64f1e767c Type check all helpers (#25373)
* Type check all helpers, add inline exclusions for work in progress

* Remove unused Script._template_cache

* Add some missing type hints

* Remove unneeded type: ignore

* Type hint fixes

* Mypy assistance tweaks

* Don't look for None in deprecated config "at most once" check

* Avoid None name slugify attempt when generating entity id

* Avoid None state store attempt on entity remove
2019-07-21 09:59:02 -07:00
David F. Mulcahey 0653f57fb4 change and condition to or condition (#25374) 2019-07-21 09:57:40 -07:00
nierob 979f801488 Avoid creating temporary lists (#25317)
That gives nano performance improvements as *() is slightly faster
then *[].
2019-07-19 13:36:18 -07:00
Ville Skyttä 56841da2d3 Upgrade mypy to 0.720, turn on unreachability warnings (#25157)
* Upgrade mypy to 0.720

* Turn on mypy unreachability warnings, address raised issues
2019-07-16 15:11:38 -07:00
Paulus Schoutsen 7aae490a85
Allow area ID in service call schemas (#25121)
* Allow area ID in service call schemas

* Remove ATTR_ENTITY_ID from service light turn off schcema
2019-07-15 11:31:53 -07:00
Paulus Schoutsen 27d750db1c Guard module being None (#25077) 2019-07-11 09:38:58 +02:00
Paulus Schoutsen cde3f670c2 pylint 2019-07-10 20:47:27 -07:00
Paulus Schoutsen 073327831f
Correctly store removed entities for restore state (#25073)
* Correctly store removed entities for restore state

* Lint

* Do not assume about set encoding
2019-07-10 20:41:03 -07:00
Johann Kellerman 2e26f0bd2b Add check_config helper (#24557)
* check_config

* no ignore

* tests

* try tests again
2019-07-10 11:56:50 -07:00
Joakim Plate 2fbbcafaed
Support config flow on custom components (#24946)
* Support populating list of flows from custom components

* Re-allow custom component config flows

* Add tests for custom component retrieval

* Don't crash view if no handler exist

* Use get_custom_components instead fo resolve_from_root

* Switch to using an event instead of lock

* Leave list of integrations as set

* The returned list is not guaranteed to be ordered

Backend uses a set to represent them.
2019-07-09 01:19:37 +02:00
Pascal Vizeli 84cf76ba36
Climate 1.0 (#23899)
* Climate 1.0 / part 1/2/3

* fix flake

* Lint

* Update Google Assistant

* ambiclimate to climate 1.0 (#24911)

* Fix Alexa

* Lint

* Migrate zhong_hong

* Migrate tuya

* Migrate honeywell to new climate schema (#24257)

* Update one

* Fix model climate v2

* Cleanup p4

* Add comfort hold mode

* Fix old code

* Update homeassistant/components/climate/__init__.py

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

* Update homeassistant/components/climate/const.py

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

* First renaming

* Rename operation to hvac for paulus

* Rename hold mode to preset mode

* Cleanup & update comments

* Remove on/off

* Fix supported feature count

* Update services

* Update demo

* Fix tests & use current_hvac

* Update comment

* Fix tests & add typing

* Add more typing

* Update modes

* Fix tests

* Cleanup low/high with range

* Update homematic part 1

* Finish homematic

* Fix lint

* fix hm mapping

* Support simple devices

* convert lcn

* migrate oem

* Fix xs1

* update hive

* update mil

* Update toon

* migrate deconz

* cleanup

* update tesla

* Fix lint

* Fix vera

* Migrate zwave

* Migrate velbus

* Cleanup humity feature

* Cleanup

* Migrate wink

* migrate dyson

* Fix current hvac

* Renaming

* Fix lint

* Migrate tfiac

* migrate tado

* Fix PRESET can be None

* apply PR#23913 from dev

* remove EU component, etc.

* remove EU component, etc.

* ready to test now

* de-linted

* some tweaks

* de-lint

* better handling of edge cases

* delint

* fix set_mode typos

* apply PR#23913 from dev

* remove EU component, etc.

* ready to test now

* de-linted

* some tweaks

* de-lint

* better handling of edge cases

* delint

* fix set_mode typos

* delint, move debug code

* away preset now working

* code tidy-up

* code tidy-up 2

* code tidy-up 3

* address issues #18932, #15063

* address issues #18932, #15063 - 2/2

* refactor MODE_AUTO to MODE_HEAT_COOL and use F not C

* add low/high to set_temp

* add low/high to set_temp 2

* add low/high to set_temp - delint

* run HA scripts

* port changes from PR #24402

* manual rebase

* manual rebase 2

* delint

* minor change

* remove SUPPORT_HVAC_ACTION

* Migrate radiotherm

* Convert touchline

* Migrate flexit

* Migrate nuheat

* Migrate maxcube

* Fix names maxcube const

* Migrate proliphix

* Migrate heatmiser

* Migrate fritzbox

* Migrate opentherm_gw

* Migrate venstar

* Migrate daikin

* Migrate modbus

* Fix elif

* Migrate Homematic IP Cloud to climate-1.0 (#24913)

* hmip climate fix

* Update hvac_mode and preset_mode

* fix lint

* Fix lint

* Migrate generic_thermostat

* Migrate incomfort to new climate schema (#24915)

* initial commit

* Update climate.py

* Migrate eq3btsmart

* Lint

* cleanup PRESET_MANUAL

* Migrate ecobee

* No conditional features

* KNX: Migrate climate component to new climate platform (#24931)

* Migrate climate component

* Remove unused code

* Corrected line length

* Lint

* Lint

* fix tests

* Fix value

* Migrate geniushub to new climate schema (#24191)

* Update one

* Fix model climate v2

* Cleanup p4

* Add comfort hold mode

* Fix old code

* Update homeassistant/components/climate/__init__.py

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

* Update homeassistant/components/climate/const.py

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

* First renaming

* Rename operation to hvac for paulus

* Rename hold mode to preset mode

* Cleanup & update comments

* Remove on/off

* Fix supported feature count

* Update services

* Update demo

* Fix tests & use current_hvac

* Update comment

* Fix tests & add typing

* Add more typing

* Update modes

* Fix tests

* Cleanup low/high with range

* Update homematic part 1

* Finish homematic

* Fix lint

* fix hm mapping

* Support simple devices

* convert lcn

* migrate oem

* Fix xs1

* update hive

* update mil

* Update toon

* migrate deconz

* cleanup

* update tesla

* Fix lint

* Fix vera

* Migrate zwave

* Migrate velbus

* Cleanup humity feature

* Cleanup

* Migrate wink

* migrate dyson

* Fix current hvac

* Renaming

* Fix lint

* Migrate tfiac

* migrate tado

* delinted

* delinted

* use latest client

* clean up mappings

* clean up mappings

* add duration to set_temperature

* add duration to set_temperature

* manual rebase

* tweak

* fix regression

* small fix

* fix rebase mixup

* address comments

* finish refactor

* fix regression

* tweak type hints

* delint

* manual rebase

* WIP: Fixes for honeywell migration to climate-1.0 (#24938)

* add type hints

* code tidy-up

* Fixes for incomfort migration to climate-1.0 (#24936)

* delint type hints

* no async unless await

* revert: no async unless await

* revert: no async unless await 2

* delint

* fix typo

* Fix homekit_controller on climate-1.0 (#24948)

* Fix tests on climate-1.0 branch

* As part of climate-1.0, make state return the heating-cooling.current characteristic

* Fixes from review

* lint

* Fix imports

* Migrate stibel_eltron

* Fix lint

* Migrate coolmaster to climate 1.0 (#24967)

* Migrate coolmaster to climate 1.0

* fix lint errors

* More lint fixes

* Fix demo to work with UI

* Migrate spider

* Demo update

* Updated frontend to 20190705.0

* Fix boost mode (#24980)

* Prepare Netatmo for climate 1.0 (#24973)

* Migration Netatmo

* Address comments

* Update climate.py

* Migrate ephember

* Migrate Sensibo

* Implemented review comments (#24942)

* Migrate ESPHome

* Migrate MQTT

* Migrate Nest

* Migrate melissa

* Initial/partial migration of ST

* Migrate ST

* Remove Away mode (#24995)

* Migrate evohome, cache access tokens (#24491)

* add water_heater, add storage - initial commit

* add water_heater, add storage - initial commit

delint

add missing code

desiderata

update honeywell client library & CODEOWNER

add auth_tokens code, refactor & delint

refactor for broker

delint

* Add Broker, Water Heater & Refactor

add missing code

desiderata

* update honeywell client library & CODEOWNER

add auth_tokens code, refactor & delint

refactor for broker

* bugfix - loc_idx may not be 0

more refactor - ensure pure async

more refactoring

appears all r/o attributes are working

tweak precsion, DHW & delint

remove unused code

remove unused code 2

remove unused code, refactor _save_auth_tokens()

* support RoundThermostat

bugfix opmode, switch to util.dt, add until=1h

revert breaking change

* store at_expires as naive UTC

remove debug code

delint

tidy up exception handling

delint

add water_heater, add storage - initial commit

delint

add missing code

desiderata

update honeywell client library & CODEOWNER

add auth_tokens code, refactor & delint

refactor for broker

add water_heater, add storage - initial commit

delint

add missing code

desiderata

update honeywell client library & CODEOWNER

add auth_tokens code, refactor & delint

refactor for broker

delint

bugfix - loc_idx may not be 0

more refactor - ensure pure async

more refactoring

appears all r/o attributes are working

tweak precsion, DHW & delint

remove unused code

remove unused code 2

remove unused code, refactor _save_auth_tokens()

support RoundThermostat

bugfix opmode, switch to util.dt, add until=1h

revert breaking change

store at_expires as naive UTC

remove debug code

delint

tidy up exception handling

delint

* update CODEOWNERS

* fix regression

* fix requirements

* migrate to climate-1.0

* tweaking

* de-lint

* TCS working? & delint

* tweaking

* TCS code finalised

* remove available() logic

* refactor _switchpoints()

* tidy up switchpoint code

* tweak

* teaking device_state_attributes

* some refactoring

* move PRESET_CUSTOM back to evohome

* move CONF_ACCESS_TOKEN_EXPIRES CONF_REFRESH_TOKEN back to evohome

* refactor SP code and dt conversion

* delinted

* delinted

* remove water_heater

* fix regression

* Migrate homekit

* Cleanup away mode

* Fix tests

* add helpers

* fix tests melissa

* Fix nehueat

* fix zwave

* add more tests

* fix deconz

* Fix climate test emulate_hue

* fix tests

* fix dyson tests

* fix demo with new layout

* fix honeywell

* Switch homekit_controller to use HVAC_MODE_HEAT_COOL instead of HVAC_MODE_AUTO (#25009)

* Lint

* PyLint

* Pylint

* fix fritzbox tests

* Fix google

* Fix all tests

* Fix lint

* Fix auto for homekit like controler

* Fix lint

* fix lint
2019-07-08 14:00:24 +02:00
Aaron Bach a491f97eb9 Allow updating of via_device in device registry (#24921)
* Allow updating of via_device in device registry

* Added test
2019-07-04 19:10:23 -04:00
Penny Wood 23dd644f4a Update IDs for rename node/value (#24646)
* Update IDs for rename node/value

* Rename devices and entities

* Improved coverage
2019-07-01 15:54:19 -07:00
Paulus Schoutsen 06af6f19a3
Entity to handle updates via events (#24733)
* Entity to handle updates via events

* Fix a bug

* Update entity.py
2019-06-26 09:22:51 -07:00
David F. Mulcahey d9420c1f73 Remove device and entity registry entries when removing a ZHA device (#24369)
* cleanup when device is removed

fixes

* cleanup
2019-06-24 11:26:44 -07:00
Penny Wood 22d9bee41a Template: Expand method to expand groups, and closest as filter (#23691)
* Implement expand method

* Allow expand and closest to be used as filters

* Correct patch

* Addresses review comments
2019-06-22 00:32:32 -07:00
Tomer Figenblat fe8a330a45 Update requirement version and add switcher_kis services (#23477)
* Update aioswitcher requirement to 2019.4.26.

* Removed unnecessary legacy function call.

* Fixed log message capital first letter.

* Replaced None argument with empty dict.

* Replaced guard.

* Added ServiceCallType.

* Added set_auto_off and update_device_name services to the component.

* Added test cases for service calls.

* Conditioned the component services registry with the platform discovery.

* Update homeassistant/components/switcher_kis/__init__.py

Co-Authored-By: TomerFi <tomer.figenblat@gmail.com>

* Update homeassistant/components/switcher_kis/__init__.py

Co-Authored-By: TomerFi <tomer.figenblat@gmail.com>

* Resolved change requests.

* Added ContextType.

* Addes permission verification for service calls.

* Added test cases for permision verification and more.

* Replaced POLICY_CONTROL with the more suited POLICY_EDIT.

* More appropriate function name.

* Added domain and entity_id validation for calling services.

* Removed service for setting the vendor's device name.
2019-06-14 15:48:21 -07:00
Paulus Schoutsen 236c5deeee
Sun listener to adapt to core config updates (#24464)
* Adaptable sun listener

* Lint
2019-06-10 16:05:32 -07:00
Penny Wood 84e6813779 Rename via_hub to via_device (#24360)
* Rename via_hub to via_device

* Fixed registry interactions
2019-06-10 09:10:44 -07:00
Penny Wood b30f4b8fc0 Improve boolean validator (#24294)
* Improve boolean validator

* Remove extra throw

* Remove None test as discussed

* Fix for tests depending on None == False
2019-06-07 22:18:02 -07:00
Paulus Schoutsen 3c1cdecb88
Add manifest support for homekit discovery (#24225)
* Add manifest support for homekit discovery

* Add a space after model check

* Update comment
2019-05-31 11:58:48 -07:00
Paulus Schoutsen 440e4289e4
Instantiate lock inside event loop (#24203) 2019-05-31 11:26:05 -07:00
Paulus Schoutsen f32d1c0dea
Allow discovery flows to be discovered via zeroconf/ssdp (#24199) 2019-05-30 14:08:05 -07:00
Paulus Schoutsen 59ce31f44f No longer allow invalid slugs or extra keys (#24176)
* No longer allow slugs

* Lint

* Remove HASchema

* Lint

* Fix tests
2019-05-30 13:33:26 +02:00
Paulus Schoutsen 6947f8cb2e
Cloud: Websocket API to manage Google assistant entity config (#24153)
* Extract exposed devices function

* Add might_2fa info to trait

* Do not filter with should_expose in Google helper func

* Cloud: allow setting if Google entity is exposed

* Allow disabling 2FA via config

* Cloud: allow disabling 2FA

* Lint

* More changes

* Fix typing
2019-05-29 08:39:12 -07:00
Paulus Schoutsen f995ab9d54
Don't pass in loop (#23984)
* Don't pass in loop

* Revert some changes

* Lint + Axis revert

* reinstate loop

* Fix a test

* Set loop

* Update camera.py

* Lint
2019-05-22 21:09:59 -07:00
Penny Wood f991ec15f2 Delete devices / entities when we remove a config entry. (#23983)
* Remove device when last config entry removed

* Remove entities when config entry removed

* Update tests to use new behaviour
2019-05-19 11:41:39 +02:00
Penny Wood 9da74dda43
Quiet the chatty sun.sun (#23832)
* Split up method to allow caching event

* Lower frequency of updates.

* Code review patches.

* Minor changes to test

* Skip end of period at fixed multiple of delta.
Improved documentation.
2019-05-15 15:02:29 +08:00
Paulus Schoutsen 1e22c8daca
Automatically generate config flow list (#23802)
* Add config flow to manifest.json

* Still load config flows via config flow platform

* Fix typo

* Lint

* Update config_flows.py"

* Catch import error when setting up entry

* Lint

* Fix tests

* Fix imports

* Lint

* Fix Unifi tests

* Fix translation test

* Add homekit_controller config flow
2019-05-13 01:16:55 -07:00
Paulus Schoutsen 5888e32360 Add support for an external step in config flow (#23782)
* Add support for an external step in config flow

* Types

* Lint
2019-05-10 14:33:49 +02:00
Paulus Schoutsen 07ee3b2eb9
Add update events to registries (#23746)
* Add update events to registries

* Add to websocket
2019-05-07 20:04:57 -07:00
Penny Wood 5b9d01139d
render_with_collect method for template (#23283)
* Make entity_filter be a modifiable builder

* Add render_with_collect method

* Use sync render_with_collect and non-class based test case

* Refactor: Template renders to RenderInfo

* Freeze with exception too

* Finish merging test changes

* Removed unused sync interface

* Final bits of the diff
2019-05-01 10:54:25 +08:00
Andrew Sayre cfaaae661a Add core APIs to migrate device identifiers and entity unique_id (#23481)
* Add device identifiers migration

* Add entity unique_id migration

* Update per arch issue

* Move to existing update methods
2019-04-30 10:04:37 -07:00
Erik Montnemery 8d775caaac Always print invalid configuration data (#21972)
* Always print invalide configuration data

* Print offending data as yaml

* Revert "Print offending data as yaml"

This reverts commit 01721a21a9ff918ed2c8595151ebfe55eb2f7d36.

* Do not print sensitive data

* Print MQTT topic

* Add line break

* Review comments

* review comments
2019-04-29 13:45:53 -07:00
Andrew Sayre b5725f8f19 Fix supported features gates in media_player volume up/down services (#23419)
* Correct media player feature gates

* Fix failing test

* Lint...
2019-04-25 21:42:39 -07:00
Tomer Figenblat 9d8d8afa82 Added component named switcher_kis switcher water heater integration. (#22325)
* Added component named switcher_kis switcher water heater integration.

* Fixed conflicts.

* Updated requirements.

* Added manifest.json file and updated CODEOWNERS.

* Fixed requirements_all.txt.

* Better component tests.

* Removed unnecessary parameter from fixture function.

* Removed tests section from mypy.ini.

* Remove unused ENTITY_ID_FORMAT.

* Stop udp bridge when failed to setup the component.

* Replace DISCOVERY_ constants prefix with DATA_.

* Various change requests.

* Fixed constant name change remifications.

* Added explicit name to fixture.

* Various change requests.

* More various change requests.

* Added EventType for homeassistant.core.Event.

* Switched from event driven data distribution to dispatcher type plus clean-ups.

* Removed name and icon keys from the component configuration.

* Various change requests.

* Various change reqeusts and clean-ups.

* Removed unnecessary DEPENDENCIES constant from swith platform.

* Replaced configuration data guard with assert.

* Removed unused constants.

* Removed confusing type casting for mypy sake.

* Refactor property device_name to name.

* Removed None guard effecting mypy only.

* Removed unnecessary function from switch entity.

* Removed None guard in use by mypy only.

* Removed unused constant.

* Removed unnecessary context manager.

* Stopped messing around with mypy.ini.

* Referring to typing.TYPE_CHECKING for non-runtime imports.

* Added test requierment correctyly.

* Replaced queue.get() with queue.get_nowait() to avoid backing up intervals requests.

* Revert changes in mypy.ini.

* Changed attributes content to device properties instead of entity properties.

* Fixed typo in constant name.

* Remove unnecessary async keyword from callable.

* Waiting for tasks on event loop to end.

* Added callback decorator to callable.
2019-04-19 16:54:48 -05:00
Paulus Schoutsen fda483f482
Don't load component when fetching translations (#23196) 2019-04-18 11:11:43 -07:00
Paulus Schoutsen ce8ec3acb1
Don't warn for missing services (#23182) 2019-04-17 22:27:11 -07:00
Penny Wood 7a9c9031af I think this is a potential bug (#23157) 2019-04-17 09:52:08 -07:00
Paulus Schoutsen 6b0180f753
Fix demo (#23087)
* Fix demo

* Fix types

* Fix all the things

* Fix type

* Fix test

* Lint
2019-04-14 16:59:06 -07:00
Paulus Schoutsen 3368e30279
Migrate packages and check config (#23082)
* Migrate packages and check config

* Fix typing

* Fix check config script
2019-04-14 07:23:01 -07:00
Aaron Bach 46ee7d7b22 Fix test (#23081) 2019-04-13 14:32:07 -07:00
Aaron Bach fc481133e7
Create decorator to check service permissions (#22667)
* Create decorator to check service permissions

* Typing

* Linting

* Member comments

* Linting

* Member comments

* Updated import

* Owner comments

* Linting

* Linting

* More work

* Fixed tests

* Removed service helper tests in RainMachine

* Linting

* Owner comments

* Linting

* Owner comments

Co-Authored-By: bachya <bachya1208@gmail.com>
2019-04-13 13:54:29 -06:00
Paulus Schoutsen 3f69d0283d
Convert translation helper to use async_get_integration (#23054)
* Convert translation helper to use async_get_integration

* Simplify after comments

* Lint

* Fix typing

* Typo
2019-04-12 17:10:19 -07:00
Paulus Schoutsen f7d4c48199
Convert service helper to use async_get_integration (#23023)
* Convert service helper to use async_get_integration

* Fix tests
2019-04-12 10:09:17 -07:00
ehendrix23 7862fdd27e Fix myq increasing number of network connections (#22432)
* Fix for network issues

Fix for network issues

* Further changes to network connection

* websession is created in pymyq

websession is created in pymyq instead.
Added call on stop event to close web session.

* Updated requirements file

* Added comment

* Changed back to use aiohttp_client

* Cleanup closed sockets in aiohttp

Enable automatic cleanup of closed sockets in aiohttp client helper.

* Updated manifest & requirements

* Updated comment block
2019-04-10 14:24:12 -07:00
Andrew Sayre 7624d0e79f Check for supported features in media_player services (#22878)
* Add check for supported features

* Move logic to service helper

* Fix hacked in test for seek

* Test for service required features
2019-04-10 09:44:58 -07:00
Johann Kellerman 3453d67cfe Person schema for merge_packages #21307 (#21703)
* Person schema for merge_packages #21307

* empty list

* skip empty persons

* hound

* test schema

* ensure_none

* remove any test changes

* remove_falsy validator

* nice!

* coretests
2019-04-02 19:43:06 -07:00
Paulus Schoutsen e00ae35e07
Admin service to automatically add empty schema (#22637)
* Admin service to automatically add empty schema

* Lint
2019-04-02 09:34:11 -07:00
Paulus Schoutsen 42e3e878df Cloudhooks for webhook config flows (#22611) 2019-04-01 14:07:12 +02:00
Paulus Schoutsen 95a7077b41
Move core services.yaml file to Home Assistant integration (#22489)
* Move services.yaml to correct dir

* Remove special case for HA servicesgs
2019-03-29 20:48:45 -07:00
Jason Hu 6ba2891604 Add trusted_users in trusted networks auth provider (#22478) 2019-03-27 21:53:11 -07:00
Penny Wood 646c4a7137
Bootstrap to start registry loading early (#22321)
* Registries store directly in data on loading.

* Loading registries concurent with stage 1.

* Removed comments
2019-03-27 22:06:20 +08:00
Jason Hu e85b089eff
Set default parallel_update value should base on async_update (#22149)
* Set default parallel_update value should base on async_update

* Set default parallel_update value should base on async_update

* Delay the parallel_update_semaphore creation

* Remove outdated comment
2019-03-25 23:53:36 -07:00
Moritz Fey f272ed3b91 Add 'method' parameter to forgiving_round method (#21708)
* Add 'method' parameter to forgiving_round method

Fixes #21707

* fix rounding behavior in round() filter

* add test cases for new rounding behaviour
2019-03-24 18:10:49 -07:00
uchagani c5f4aa0466 show which component is causing translation errors (#22340) 2019-03-23 23:06:55 -07:00
Paulus Schoutsen c15f433c3e
Add a service require_admin wrapper (#21953)
* Add a service require_admin wrapper

* Allow it to be used as a decorator

* Lint

* Add comment

* Add docstring

* Update syntax
2019-03-12 22:09:50 -07:00
Paulus Schoutsen 4f5446ff02
Add area permission check (#21835) 2019-03-11 11:02:37 -07:00
Brad Dixon 9ab543ab3d Add as_timestamp() to Jinja filters. (#21910)
Add as_timestamp() to Jinja filters
2019-03-11 13:21:22 +05:30
emontnemery fc81826763 Introduce Entity.async_write_ha_state() to not miss state transition (#21590)
* Copy state in schedule_update_ha_state

* Lint

* Fix broken test

* Review comment, improve docstring

* Preserve order of state updates

* Rewrite

* Break up async_update_ha_state

* Update binary_sensor.py

* Review comments

* Update docstring

* hass -> ha

* Update entity.py

* Update entity.py
2019-03-09 09:52:22 -08:00
Paulus Schoutsen 8213016eaf
Allow targeting areas in service calls (#21472)
* Allow targeting areas in service calls

* Lint + Type

* Address comments
2019-03-04 09:51:12 -08:00
Paulus Schoutsen 48a2e50f84 Fix calc next (#21630) 2019-03-03 21:36:13 -07:00
Jason Hu f1b867dccb Re-thrown exception occurred in the blocking service call (#21573)
* Rethrown exception occurred in the actual service call

* Fix lint and test
2019-03-01 23:09:31 -08:00
emontnemery cd89809be5 Make time trigger data trigger.now local (#21544)
* Make time trigger data trigger.now local

* Make time pattern trigger data trigger.now local

* Lint

* Rework according to review comment

* Lint
2019-03-01 23:09:12 -08:00
Daniel Høyer Iversen 519315f9c8 pylint 2.3.0 (#21485)
* pylint 2.3.0

* remove const

*  disable=syntax-error
2019-02-27 16:10:40 -05:00
David F. Mulcahey c4400be62a Add friendly name to devices in the device registry (#21318)
* add friendly name to devices in the device registry

* switch to name_by_user

* review comments
2019-02-26 12:20:16 -08:00
Paulus Schoutsen f1b84962ed
Add legacy PLATFORM_SCHEMA config validation (#21072)
* Add legacy PLATFORM_SCHEMA config validation

* Fix tests

* Lint

* Add persistent notification

* Update bootstrap.py
2019-02-16 23:05:06 -08:00
Rohan Kapoor 481439d387 Deprecate conf_update_interval (#20924)
* Deprecate update_interval and replace with scan_interval

* Update tests

* Fix Darksky tests

* Fix Darksky tests correctly

This reverts commit a73384a223ba8a93c682042d9351cd5a7a399183.

* Provide the default for the non deprecated option

* Don't override default schema for sensors
2019-02-17 06:23:09 +01:00
Otto Winter 06f2aa93a4
Add persistent notification 2019-02-15 18:40:46 +01:00
Otto Winter f6ae054e9f
Lint 2019-02-15 10:57:02 +01:00
Otto Winter 9c09a98c9e
Add legacy PLATFORM_SCHEMA config validation 2019-02-14 20:55:51 +01:00
Joakim Plate c5de32e7b1 Climate const.py move (#20945)
* Move constants to const.py

* Import from const instead of climate
2019-02-14 20:34:43 +01:00
Paulus Schoutsen 987b5cd905
Person component: add storage and WS commands (#20852)
* Forbid duplicate IDs

* Allow loading persons from storage

* Convert to PersonManager

* Add storage support and WS commands to Person component

* Convert list command to differentiate types

* Allow loading person component without defining persons

* Fix cleanups after update/delete

* Address comments

* Start tracking when HA started
2019-02-09 10:41:40 -08:00
Rohan Kapoor d5fad33599 Add better handling of deprecated configs (#20565)
* Add better handling of deprecated configs

* Embed the call to has_at_most_one_key in deprecated

* Add tests for checking the deprecated logs

* Add thoroughly documented tests

* Always check has_at_most_one_key

* Fix typing

* Move logging helpers to homea new logging helper

* Lint

* Rename to KeywordMessage instead of BraceMessage

* Remove unneeded KeywordStyleAdapter

* Lint

* Use dict directly rather than dict.keys() when creating set

* Patch the version in unit tests, update logging and use parse_version

* Re-add KeywordStyleAdapter and fix tests

* Lint

* Lint
2019-02-08 11:14:50 +01:00
Ville Skyttä d45f25ce2c Add more type hints to helpers (#20811)
* Add type hints to helpers.aiohttp_client

* Add type hints to helpers.area_registry
2019-02-07 13:34:14 -08:00
Paulus Schoutsen 59393ab085
Prevent template changing options (#20775)
* Prevent complex template validation changing input value

* Remove deprecation warnings
2019-02-06 11:15:27 -08:00
Joakim Plate 3bb5caabe2 Reproduce states by letting each component opt in on handling state recovery itself (#18700)
* Move group to it's own setup

* Let each component to handle restore of state

* Move constants for climate into const.py

For now import all into __init__.py to keep backword compat

* Move media plyaer constants to const.py file

For now import all constants into __init__.py to keep
backword compatibility

* Move media player to it's own file

* Move climate to it's own file

* Remove ecobee service from common components

BREAKING CHANGE

* Add tests for climate

* Add test for media_player

* Make sure we clone timestamps of state

* Add tests for groups

* Remove old tests for media player, it's handled by other tests

* Add tests for calls to component functions

* Add docstring for climate const

* Add docstring for media_player const

* Explicitly import constants in climate

* Explicitly import constants in media_player

* Add period to climate const

* Add period to media_player const

* Fix some lint errors in climate

* Fix some lint errors in media_player

* Fix lint warnings on climate tests

* Fix lint warnings on group tests

* Fix lint warnings on media_player tests

* Fix lint warnings on state tests

* Adjust indent for state tests
2019-02-05 17:25:27 -08:00
emontnemery b1faad0a50 Use PLATFORM_SCHEMA_BASE as base schema for additional components. (#20578)
* Disable extra=vol.ALLOW_EXTRA for additional platforms.

* Remove PLATFORM_SCHEMA_2

* Add entity_namespace to base platform schema
2019-02-04 21:52:19 -08:00
emontnemery bada9b5e0b
Add entity_namespace to PLATFORM_SCHEMA (#20693)
* Add entity_namespace to base platform schema

* Add test

* Fix
2019-02-02 18:31:28 +01:00
Paulus Schoutsen e2d3c27e85
Embed all platforms into components (#20677)
* Consolidate all components with platforms

* Organize tests

* Fix more tests

* Fix Verisure tests

* one final test fix

* Add change

* Fix coverage
2019-02-02 07:13:16 -08:00
Paulus Schoutsen cb07ea0d60
RFC: Add system health component (#20436)
* Add system health component

* Remove stale comment

* Fix confusing syntax

* Update test_init.py

* Address comments

* Lint

* Move distro check to updater

* Convert to websocket

* Lint

* Make info callback async

* Fix tests

* Fix tests

* Lint

* Catch exceptions
2019-01-30 10:57:53 -08:00
Paulus Schoutsen 8062f48973
Add remove commmand to entity registry (#20597) 2019-01-30 09:50:32 -08:00
emontnemery d7ba2aad1d Add COMPONENT_SCHEMA and use it in alarm_control_panel (#20224)
* Add COMPONENT_SCHEMA and use in alarm and mqtt

* Revert MQTT changes

* Lint

* Small tweak

* Add tests

* Rename COMPONENT_SCHEMA to PLATFORM_SCHEMA_BASE

* Fix tests

* Improve tests
2019-01-28 16:14:55 -08:00
Robert Svensson bd335e1ac1 Area registry (#20435)
* First draft of area registry

* Refactor based on input

* Add tests for areas
Add tests for updating device

* Updating a device shouldn't require area

* Fix Martins comment

* Require admin

* Save after deleting

* Rename read to list_areas
Fix device entry_dict
Remove area id from device when deleting area

* Fix tests
2019-01-28 15:52:42 -08:00
Rohan Kapoor 38c33bd01e Fix linting error (#20488) 2019-01-26 17:11:09 -08:00
Paulus Schoutsen 87316c4e83
Warn for old slugs/entity ids (#20478)
* Warn for old slugs/entity ids

* add comments

* Lint

* LInt

* Lint

* Lint
2019-01-26 14:09:41 -08:00
Anders Melchiorsen 70c5807976 Improve deprecation warnings (#20391) 2019-01-24 13:37:30 -08:00
Paulus Schoutsen af3afb673a
Fix restore state crashing invalid entity ID (#20367) 2019-01-23 21:12:38 -08:00
Paulus Schoutsen 0300ef2040
Fix entity registry comments (#20357) 2019-01-23 16:33:21 -08:00
Paulus Schoutsen e964750ac1
Fix invalid entity ID in entity registry (#20328) 2019-01-22 14:07:17 -08:00
Johann Kellerman 6511e11ec9 Config Validator: schema_with_slug_keys (#20298)
* schema_with_slug_keys

* Update config_validation.py

* Update config_validation.py
2019-01-21 16:36:04 -08:00
Johann Kellerman c36c708068 Align valid_entity_id with new slugify (#20231)
* slug

* ensure a dot

* fix

* schema_with_slug_keys

* lint

* test
2019-01-21 09:45:11 -08:00
Phil Bruckner 935e5c67a3 Handle non-string values in JSON renderer (#20233)
Handle the case of async_render_with_possible_json_value's value argument
being something other than a string. This can happen, e.g., when using the
SQL sensor to extract a datetime column such as last_changed and also using
its value_template to convert that datetime to another format. This was
causing a TypeError from json.loads, but async_render_with_possible_json_value
was only catching ValueError's.
2019-01-20 16:46:14 -08:00
Anders Melchiorsen 62844e237c Allow 'all' entity_id in service schema (#20278) 2019-01-20 16:33:39 -08:00
Anders Melchiorsen 1218127d83 Fix 'all' entity_id in service call extraction (#20281) 2019-01-20 16:33:11 -08:00
Ville Skyttä 58bb6f2e99 Add type hints to helpers.condition (#20266) 2019-01-21 00:03:12 +01:00
emontnemery 6800871c13 Log exceptions thrown by signal callbacks (#20015)
* Log exceptions thrown by signal callbacks

* Fix unsub

* Simplify traceback print

* Typing

* Add test

* lint

* Review comments

* Rework MQTT test case

* Fix bad merge

* Fix bad merge
2019-01-17 14:44:57 -08:00
Paulus Schoutsen 9fd21d20ae
Fix loading translations for embedded platforms (#20122)
* Fix loading translations for embedded platforms

* Update doc string

* Lint
2019-01-15 16:06:04 -08:00
Paulus Schoutsen 99c2e4ac44
Fix warning (#19946)
* Fix warning

* Update service.py
2019-01-11 11:52:07 -08:00
Paulus Schoutsen 64b4c8f43a
Fix deprecation warning (#19882) 2019-01-08 21:09:47 -08:00
Thomas Lovén f73bda1218 Allow other icon prefixes than mdi: (#19872) 2019-01-08 20:08:20 -08:00
Steven Looman 501b3f9927 Disable creating port mappings from UI, add discovery from component (#18565)
* Disable creating port mappings from UI, add discovery from component

* Remove unused constant

* Upgrade to async_upnp_client==0.13.6 and use manufacturer from device

* Upgrade to async_upnp_client==0.13.7
2018-12-21 17:25:23 +00:00
Paulus Schoutsen 1281da024c Remove check if base url is local (#19494) 2018-12-21 11:23:05 +01:00
emontnemery b97f0c0261 Make variable `entity_id` available to value_template for MQTT binary sensor (#19195)
* MQTT binary_sensor: Make variable `entity_id` available to value_template

* Review comments

* Add testcase
2018-12-14 13:00:37 +01:00
emontnemery 7a7c2ad416 Fix race in entity_platform.async_add_entities (#19222) 2018-12-14 10:33:37 +01:00
Paulus Schoutsen 9d9e11372b
Make automations log errors (#18965) 2018-12-13 12:21:16 +01:00
Paulus Schoutsen 8ea0a8d40b
RFC: Deprecate auto target all for services and introduce entity_id: * (#19006)
* Deprecate auto target all

* Match on word 'all'
2018-12-13 10:07:59 +01:00
Ville Skyttä 1be440a72b Upgrade pylint to 2.2.2 (#18750)
* Upgrade to 2.2.0

* simplifiable-if-expression fixes

* duplicate-string-formatting-argument fixes

* unused-import fixes

* Upgrade to 2.2.1

* Remove no longer needed disable

* Upgrade to 2.2.2
2018-12-06 11:54:44 +01:00
Paulus Schoutsen 3928d034a3 Allow checking entity permissions based on devices (#19007)
* Allow checking entity permissions based on devices

* Fix tests
2018-12-05 11:41:00 +01:00
Paulus Schoutsen d028236bf2
Refactor script helper actions into their own methods (#18962)
* Refactor script helper actions into their own methods

* Lint

* Lint
2018-12-03 15:46:25 +01:00
Adam Mills a10cbadb57 Restore states when removing/adding entities (#18890) 2018-12-02 10:51:15 +01:00
emontnemery bbb40fde84 Optionally do not log template rendering errors (#18724) 2018-12-02 10:31:46 +01:00
Joakim Sørensen 558504c686 Fix ordinal filter in template (#18878) 2018-12-01 14:49:34 +01:00
Mahasri Kalavala c23792d1fb Added new filters for templates (#18125)
* added additional filters

Added base64_encode, base64_decode and ordinal filters.

* added test cases

added test cases for base64_encode, base64_decode and ordinal filters.

* forgot to add filters :)
2018-12-01 10:38:10 +01:00
Adam Mills 22f27b8621 Store state last seen time separately (#18806)
* Store state last seen time separately

This ensures that infrequently updated entities aren't accidentally
dropped from the restore states store

* Fix mock restore cache
2018-11-30 08:26:19 +01:00
Adam Mills 5c3a4e3d10 Restore states through a JSON store instead of recorder (#17270)
* Restore states through a JSON store

* Accept entity_id directly in restore state helper

* Keep states stored between runs for a limited time

* Remove warning
2018-11-28 13:16:43 +01:00
Paulus Schoutsen 8b8629a5f4 Add permission checks to Rest API (#18639)
* Add permission checks to Rest API

* Clean up unnecessary method

* Remove all the tuple stuff from entity check

* Simplify perms

* Correct param name for owner permission

* Hass.io make/update user to be admin

* Types
2018-11-25 18:04:48 +01:00
Paulus Schoutsen 36c31a6293
Add permissions check in service helper (#18596)
* Add permissions check in service helper

* Lint

* Fix tests

* Lint

* Typing

* Fix unused impoert
2018-11-21 12:26:08 +01:00
Phil Bruckner 83b4e56978 Log delay and wait_template steps in scripts (#18448)
* Log delay and wait_template steps in scripts

Help improve script debugging by logging delay and wait_template steps in scripts.

* Update tests

* Fix lint issue
2018-11-19 11:14:00 +01:00
emontnemery f241becf7f Avoid race in entity_platform.async_add_entities() (#18445)
This avoids a race between multiple concurrent calls to
entity_platform.async_add_entities() which may cause
entities to be created with non-unique entity_id
2018-11-19 10:13:50 +01:00
Ville Skyttä 9411fca955 Add more type hints to helpers (#18350)
* Add type hints to helpers.entityfilter

* Add type hints to helpers.deprecation
2018-11-11 17:39:50 +01:00
Paulus Schoutsen 43ae57cc59 Lint 2018-11-06 19:27:52 +01:00
Paulus Schoutsen bde02afe4f Normalize MAC addresses (#16916)
* Normalize MAC addresses

* Handle all mac formats
2018-11-06 16:33:31 +01:00
Matthias Urlichs b506aafbb4 docstring fix (#18257) 2018-11-06 12:41:15 +01:00
Paulus Schoutsen bf54582d76 Cloud conf (#18216)
* Add original config to entityfilter

* Add alexa/google config to cloud status call

* Lint
2018-11-05 13:21:03 +01:00
Ville Skyttä 922f34f72d Add more type hints to helpers (#18196)
* Test typing for helpers.__init__ and temperature

* Add type hints to helpers.sun

* Add type hints to helpers.signal

* Add type hints to helpers.entity_values

* Add type hints to helpers.dispatcher
2018-11-04 22:46:42 +01:00
Ville Skyttä 9c840f93f0 Use const.SUN_EVENT_* more (#18039) 2018-10-31 09:10:28 +01:00
Neil Crosby 865ea82432 Allow jinja namespace command to work. (#18011) 2018-10-30 19:13:20 +01:00
Ville Skyttä 4d9ef9e795
Import homeassistant domain instead of hardcoding it (#17985) 2018-10-30 17:38:09 +02:00
Anders Melchiorsen 3de822a0e2 RFC: Static templates match no entities, not all (#17991)
* Static templates match no entities, not all

* Clean up test values
2018-10-30 12:03:27 +01:00
Paulus Schoutsen 6ae345b01c
Pass hass_config to load_platform (#17952)
* Pass hass_config to load_platform

* Fix tests

* Lint
2018-10-29 19:21:21 +01:00
Ville Skyttä c9c707e368
Start type annotating/testing helpers (#17858)
* Add type hints to helpers.intent and location

* Test typing for helpers.icon, json, and typing

* Add type hints to helpers.state

* Add type hints to helpers.translation
2018-10-28 21:12:52 +02:00
Ville Skyttä 43048962f2
Upgrade flake8 to 3.6.0 (#17770)
* Upgrade flake8 to 3.6.0

* flake8/pylint comment tweaks

* flake8 F841 fixes

* flake8 W605 fix

* Ignore pyflakes bug #373 false positives

https://github.com/PyCQA/pyflakes/issues/373

* pycodestyle bug #811 workaround

https://github.com/PyCQA/pycodestyle/issues/811
2018-10-25 23:15:20 +03:00
Paulus Schoutsen 77bf10e37c
Fix unloading an entry can leave states around (#17786)
* Add test that tests unloading on remove

* Add more test things

* Untangle entity remove code from entity platform

* Don't add default implementation of async_will_remove

* Keep entity weakref alive
2018-10-25 19:57:36 +02:00
Paulus Schoutsen b5284aa445 Fix device reg considered changed (#17764)
* Fix device reg considered changed

* Better syntax
2018-10-25 16:43:11 +02:00
Aaron Bach bd23145331
Fixed an incorrect reference in the entity registry (#17775) 2018-10-24 21:53:18 -06:00
Rohan Kapoor d5a5695411 Migrate Mailgun to use the webhook component (#17464)
* Switch mailgun to use webhook api

* Generalize webhook_config_entry_flow

* Add tests for webhook_config_entry_flow

* Add tests for mailgun

* Remove old mailgun file from .coveragerc

* Refactor WebhookFlowHandler into config_entry_flow

* Remove test of helper func from IFTTT

* Lint
2018-10-23 11:14:46 +02:00
Markus Nigbur 670c75e844 Added resolve_state to template distance function (#17290)
_resolve_state was already used in the "closest" function, to allow for states and entity ids
2018-10-10 11:49:24 +02:00
Paulus Schoutsen e903f7ffda Manual updates (#17278) 2018-10-09 16:54:38 +02:00
Otto Winter 26cf5acd5b Make async_track_time_change smarter (#17199)
* Make async_track_time_change smarter

* Move to util/dt

* Remove unnecessary check

* Lint

* Remove tzinfo check

* Remove check

* Add comment about async_track_point_in_utc_time

* Fix typing check

* Lint
2018-10-09 10:14:18 +02:00
Anders Melchiorsen 5db7d702c8 Remove warning on script delay (#17264)
* Remove warning on script delay

* Use suppress
2018-10-09 10:06:42 +02:00
Paulus Schoutsen d5f5273c31
Guard for bad device info (#17238) 2018-10-08 12:53:51 +02:00
Paulus Schoutsen 4b7f85518f
Prevent accidental device reg override (#17136) 2018-10-08 09:30:40 +02:00
Anders Melchiorsen 6e81ae096e Disallow list/dict for string configuration (#17202) 2018-10-07 12:35:44 +02:00
Paulus Schoutsen a559c06d6b
Make it easier for auth to consume newer formats (#17127) 2018-10-04 10:41:13 +02:00
Adam Mills 3abdf217bb Homekit controller reconnect (#17060)
* Add threaded call_later helper

* Reconnect to device when connection fails

* Consolidate connection logs and warn on first
2018-10-04 09:25:05 +02:00
cdce8p 3b5e5cbcd6 Async syntax 5, light & lock & remote & scene & telegram & helpers (#17019) 2018-10-01 08:56:50 +02:00
Anders Melchiorsen 720b05c301 Fix race between script delay and turn_off (#16923) 2018-09-27 22:08:09 -06:00
cdce8p f879ac0993 Remove service helper (6) (#16920)
* Update automation

* Update group

* Async_create_task
2018-09-27 23:14:09 +02:00
Paulus Schoutsen da3342f1aa
Update new values coming in for dev registry (#16852)
* Update new values coming in for dev registry

* fix Lint+Test;2C
2018-09-27 11:26:58 +02:00
Paulus Schoutsen 9ab8f78b19
Don't pass use_env=True (#16896) 2018-09-26 17:20:34 +02:00
Blake Blackshear f13f723a04 Add bitwise operations as template helpers (#16833) 2018-09-26 11:57:16 +02:00
Nicko van Someren e5861241c7 Added support for private storage. (#16878)
* Addded support for private storage.

Include 'private' flag parameters to the Store class and save_json function.
Updated various authentication and onboarding classes to use private stores.
Fixed unit test for emulated_hue which used a mock patch on save_json().

* Fixed Hound formatting issues not detected by local linting.
2018-09-26 10:24:32 +02:00
Martin Mois 672fc61bb2 aiohttp.ClientSession gets proxy information from HTTP_PROXY/HTTPS_PROXY (#16874) 2018-09-26 08:43:09 +02:00
Paulus Schoutsen 5613816476
Fix Windows loop (#16737)
* Fix Windows loop

* Fix windows Ctrl+C

* Move windows restart handler out of setup_and_run_hass
2018-09-22 09:54:37 +02:00
Paulus Schoutsen 8b42d0c471 Add confirmation to Cast/Sonos/iOS config entries (#16769)
* Add confirmation to Cast/Sonos/iOS config entries

* Remove redundant code
2018-09-21 16:34:37 +02:00
Rohan Kapoor 3d1c8ee467 Implement support for complex templates in script delays (#16442)
* Implement support for complex templates in script delays

* Swap out dict instead of collections.Mapping
2018-09-21 11:57:01 +02:00
Charles Garwood da882672bd Save disabled_by in entity registry (#16699)
* Save disabled_by in entity registry

* Add trailing comma
2018-09-20 00:52:10 +02:00
Matthias Urlichs 0121e3cb04 Remove usage of "run_until_complete" (#16617)
* De-run_forever()-ization

* Use asyncio.run (or our own implementation on Python <3.7)
* hass.start is only used by tests
* setup_and_run_hass() is now async
* Add "main" async hass.run method
* move SIGINT handling to helpers/signal.py
  * add flag to .run to disable hass's signal handlers
* Teach async_start and async_stop to not step on each other
  (more than necessary)

* shorten over-long lines

* restore missing "import asyncio"

* move run_asyncio to homeassistant.util.async_

* LOGGER: warn => warning

* Add "force" flag to async_stop

only useful for testing

* Add 'attrs==18.2.0' to requirements_all.txt

Required for keeping requirements_test_all.txt in sync, where it is in
turn required to prevent auto-downgrading "attrs" during "pip install"

* Fixes for mypy

* Fix "mock_signal" fixture

* Revert mistaken edit

* Flake8 fixes

* mypy fixes

* pylint fix

* Revert adding attrs== to requirements_test*.txt

solved by using "pip -c"

* Rename "run" to "async_run", as per calling conventions
2018-09-19 15:40:02 +02:00
Paulus Schoutsen b8257866f5
Clean up device update, add via-hub (#16659)
* Clean up device update, add via-hub

* Test loading/saving data

* Lint

* Add to Hue"

* Lint + tests
2018-09-17 13:39:30 +02:00
Paulus Schoutsen 201fd4afee Add config entries to connection class (#16618) 2018-09-17 10:12:46 +02:00
Ville Skyttä ee696643cd Isort preparations (#16555)
* Don't treat typing as an "in-between" module for import order

That was a < 3.5 era thing.

* Tighten scope of some pylint unused-import disables

To avoid isort moving a top level one around, undesirably broadening its
scope.
2018-09-11 11:21:48 +02:00
Paulus Schoutsen 746f4ac158 Add context to scripts and automations (#16415)
* Add context to script helper

* Update script component

* Add context to automations

* Lint
2018-09-04 21:16:24 +02:00
Robert Svensson 7a6facc875 Device and entity registry remove config entry on unload (#16247)
* Test

* Ability to remove device

* Don't remove devices, instead remove config entry from device and entity registries

* Remove print

* Remove is not the same as unload

* Add tests

* Fix hound comment
2018-09-04 09:00:14 +02:00
Robert Svensson 8ab31fe139 Store devices as dict instead of list (#16229)
* Store devices as dict instead of list

* Use OrderedDict
2018-08-28 00:37:04 +02:00
Robert Svensson 97173f495c Device registry store config entry (#16152)
* Allow device registry to optionally store config entries

* Connections and identifiers are now sets with tupels

* Make config entries mandatory

* Fix duplicate keys in test

* Rename device to device_info

* Entity platform should only create device entries if config_entry_id exists

* Fix Soundtouch tests

* Revert soundtouch to use self.device

* Fix baloobs comments

* Correct type in test
2018-08-25 10:59:28 +02:00
Nate Clark 84365cde07 fix error message for cv.matches_regex (#16175) 2018-08-24 23:27:12 +02:00
Robert Svensson e91a1529e4
deCONZ - Support device registry (#16115)
Add support for device registry in deCONZ component
2018-08-24 19:37:22 +02:00
Ville Skyttä dd9d53c83e Update pydocstyle to 2.1.1 and flake8-docstrings to 1.3.0 (#14557)
* Update pydocstyle to 2.1.1 and flake8-docstrings to 1.3.0

* Pydocstyle D401 fixes
2018-08-24 10:28:43 +02:00
Robert Svensson 0009be595c Device Registry (#15980)
* First draft

* Generate device id

* No obscure registry

* Dont store config_entry_id in device

* Storage

* Small mistake on rebase

* Do storage more like entity registry

* Improve device identification

* Add tests

* Remove deconz device support from PR

* Fix hound comments, voff!

* Fix comments and clean up

* Fix proper indentation

* Fix pydoc issues

* Fix mochad component to not use self.device

* Fix mochad light platform to not use self.device

* Fix TankUtilitySensor to not use self.device

* Fix Soundtouch to not use self.device

* Fix Plex to not use self.device

* Fix Emby to not use self.device

* Fix Heatmiser to not use self.device

* Fix Wemo lights to not use self.device

* Fix Lifx to not use self.device

* Fix Radiotherm to not use self.device

* Fix Juicenet to not use self.device

* Fix Qwikswitch to not use self.device

* Fix Xiaomi miio to not use self.device

* Fix Nest to not use self.device

* Fix Tellduslive to not use self.device

* Fix Knx to not use self.device

* Clean up a small mistake in soundtouch

* Fix comment from Ballob

* Fix bad indentation

* Fix indentatin

* Lint

* Remove unused variable

* Lint
2018-08-22 10:46:37 +02:00
Paulus Schoutsen 7bb5344942
Remove homeassistant.remote (#16099)
* Remove homeassistant.remote

* Use direct import for API

* Fix docstring
2018-08-21 15:49:58 +02:00
Paulus Schoutsen 1be61df9c0
Add recent context (#15989)
* Add recent context

* Add async_set_context to components not using new services
2018-08-20 17:39:53 +02:00
Ville Skyttä dbd0763f83 Grammar and spelling fixes (#16065) 2018-08-19 22:29:08 +02:00
Paulus Schoutsen 8ec550d6e0 Storage entity registry (#16018)
* Split out storage delayed write

* Update code using delayed save

* Fix tests

* Fix typing test

* Add callback decorator

* Migrate entity registry to storage helper

* Make double loading protection easier

* Lint

* Fix tests

* Ordered Dict
2018-08-18 13:34:33 +02:00
Paulus Schoutsen 2ad0bd4036
Split out storage delay save (#16017)
* Split out storage delayed write

* Update code using delayed save

* Fix tests

* Fix typing test

* Add callback decorator
2018-08-17 20:18:21 +02:00
Paulus Schoutsen 834077190f
Clean up input-datetime (#16000) 2018-08-16 22:17:14 +02:00
Paulus Schoutsen b682e48e12
Entity service (#15991)
* Add entity service helper

* Use entity service helper

* Context
2018-08-16 09:50:11 +02:00
Hovo (Luke) 6aee535d7c Allow wait template to run the remainder of the script (#15836)
* Adding new feature to allow a wait template to run the remainer of the script on timeout

* Styling changes

* Fixing file permissions, adding test for new code

* changed variable name, refactored script to pass information into async_set_timeout

* Changing the default behaviour to continue to run the script after timeout
2018-08-13 11:23:27 +02:00
Jason Hu f58425dd3c Refactor data entry flow (#15883)
* Refactoring data_entry_flow and config_entry_flow

Move SOURCE_* to config_entries
Change data_entry_flow.FlowManager.async_init() source param default
 to None
Change this first step_id as source or init if source is None
_BaseFlowManagerView pass in SOURCE_USER as default source

* First step of data entry flow decided by _async_create_flow() now

* Lint

* Change helpers.config_entry_flow.DiscoveryFlowHandler default step

* Change FlowManager.async_init source param to context dict param
2018-08-09 13:24:14 +02:00
Ville Skyttä 3246b49a45 Upgrade pylint to 2.1.0 (#15811)
* Upgrade pylint to 2.1.0

* Remove no longer needed pylint disables
2018-08-04 15:22:22 +02:00
Andrey 8ee3b535ef Add disallow_untyped_calls to mypy check. (#15661)
* Add disallow_untyped_calls to mypy check.

* Fix generator
2018-07-31 15:00:17 +01:00
Paulus Schoutsen c7f4bdafc0 Context (#15674)
* Add context

* Add context to switch/light services

* Test set_state API

* Lint

* Fix tests

* Do not include context yet in comparison

* Do not pass in loop

* Fix Z-Wave tests

* Add websocket test without user
2018-07-28 17:53:37 -07:00
Ville Skyttä eee9b50b70 Upgrade pylint to 2.0.1 (#15683)
* Upgrade pylint to 2.0.1

* Pylint 2 bad-whitespace fix

* Pylint 2 possibly-unused-variable fixes

* Pylint 2 try-except-raise fixes

* Disable pylint fixme for todoist for now

https://github.com/PyCQA/pylint/pull/2320

* Disable pylint 2 useless-return for now

https://github.com/PyCQA/pylint/issues/2300

* Disable pylint 2 invalid-name for type variables for now

https://github.com/PyCQA/pylint/issues/1290

* Disable pylint 2 not-an-iterable for now

https://github.com/PyCQA/pylint/issues/2311

* Pylint 2 unsubscriptable-object workarounds

* Disable intentional pylint 2 assignment-from-nones

* Disable pylint 2 unsupported-membership-test apparent false positives

* Disable pylint 2 assignment-from-no-return apparent false positives

* Disable pylint 2 comparison-with-callable false positives

https://github.com/PyCQA/pylint/issues/2306
2018-07-26 08:55:42 +02:00
Paulus Schoutsen d9cf8fcfe8
Allow changing entity ID (#15637)
* Allow changing entity ID

* Add support to websocket command

* Address comments

* Error handling
2018-07-24 14:12:53 +02:00
Paulus Schoutsen 3204501174
Cast/Sonos: create config entry if manually configured (#15630)
* Cast/Sonos: create config entry if manually configured

* Add test for helper
2018-07-23 15:08:03 +02:00
Pascal Vizeli f3dfc433c2 Fix aiohttp connection reset errors (#15577)
* Fix aiohttp connection reset errors

* Update aiohttp_client.py

* Update aiohttp_client.py

* Update __init__.py

* Update mjpeg.py

* Update mjpeg.py

* Update ffmpeg.py

* Update ffmpeg.py

* Update ffmpeg.py

* Update proxy.py

* Update __init__.py

* Update aiohttp_client.py

* Update aiohttp_client.py

* Update proxy.py

* Update proxy.py

* Fix await inside coroutine

* Fix async syntax

* Lint
2018-07-23 14:36:36 +02:00
Paulus Schoutsen ea2ff6aae3
Use async_create_task (#15633)
* Use async_create_task

* Fix test
2018-07-23 14:05:38 +02:00
Ville Skyttä b7c336a687 Pylint cleanups (#15626)
* Pylint 2 no-else-return fixes

* Remove unneeded abstract-class-not-used pylint disable
2018-07-23 10:16:05 +02:00
Ville Skyttä 2f7b79764a More pylint 2 fixes (#15565)
## Description:

More fixes flagged by pylint 2 that don't hurt to have before the actual pylint 2 upgrade (which I'll submit soon).

## Checklist:
  - [ ] The code change is tested and works locally.
  - [x] Local tests pass with `tox`. **Your PR cannot be merged unless tests pass**
2018-07-20 11:45:20 +03:00
Paulus Schoutsen 8b04d48ffd
Update config entry id in entity registry (#15531) 2018-07-19 08:37:13 +02:00
Ville Skyttä bf17ed0917 More pylint 2 fixes (#15516)
* Pylint 2 useless-import-alias fixes

* Pylint 2 chained-comparison fixes

* Pylint 2 consider-using-get fixes

* Pylint 2 len-as-condition fixes
2018-07-18 11:54:27 +02:00
Ville Skyttä 2781796d9c Remove some unused imports (#15529) 2018-07-18 10:46:14 +02:00
Ville Skyttä e31dd4404e Pylint 2 fixes (#15487)
* pylint 2 inline disable syntax fixes

* pylint 2 logging-not-lazy fixes

* pylint 2 consider-using-in fixes

* Revert pylint 2 inline disable syntax fixes addressing unused-imports

Will have a go at removing more unused imports altogether first.
2018-07-17 19:34:29 +02:00
Paulus Schoutsen ad4cba70a0
Extract SSL context creation to helper (#15483)
* Extract SSL context creation to helper

* Lint
2018-07-16 10:32:07 +02:00
Andrey c2fe0d0120
Make typing checks more strict (#14429)
## Description:

Make typing checks more strict: add `--strict-optional` flag that forbids implicit None return type. This flag will become default in the next version of mypy (0.600)

Add `homeassistant/util/` to checked dirs.

## Checklist:
  - [x] The code change is tested and works locally.
  - [x] Local tests pass with `tox`. **Your PR cannot be merged unless tests pass**
2018-07-13 13:24:51 +03:00
Klaudiusz Staniek d3df96a8de Added setting cover tilt position in scene (#15255)
## Description:
This feature adds possibly of setting tilt_position in scene for covers.

**Related issue (if applicable):** fixes #<home-assistant issue number goes here>

**Pull request in [home-assistant.github.io](https://github.com/home-assistant/home-assistant.github.io) with documentation (if applicable):** home-assistant/home-assistant.github.io#<home-assistant.github.io PR number goes here>

## Example entry for `configuration.yaml` (if applicable):
```yaml
scene:
  - name: Close Cover Tilt
    entities:
      cover.c_office_north:
        tilt_position: 0

  - name: Open Cover Tilt
    entities:
      cover.c_office_north:
        tilt_position: 100
```

## Checklist:
  - [x] The code change is tested and works locally.
  - [x] Local tests pass with `tox`. **Your PR cannot be merged unless tests pass**

If user exposed functionality or configuration variables are added/changed:
  - [ ] Documentation added/updated in [home-assistant.github.io](https://github.com/home-assistant/home-assistant.github.io)

If the code communicates with devices, web services, or third-party tools:
  - [ ] New dependencies have been added to the `REQUIREMENTS` variable ([example][ex-requir]).
  - [ ] New dependencies are only imported inside functions that use them ([example][ex-import]).
  - [ ] New or updated dependencies have been added to `requirements_all.txt` by running `script/gen_requirements_all.py`.
  - [ ] New files were added to `.coveragerc`.

If the code does not interact with devices:
  - [ ] Tests have been added to verify that the new code works.

[ex-requir]: https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/keyboard.py#L14
[ex-import]: https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/keyboard.py#L54
2018-07-02 12:44:36 +03:00
Ville Skyttä 6f582dcf24 Lint cleanups (#15243)
* Remove some unused imports

* Fix a flake8 E271
2018-07-01 11:57:01 -04:00
David Thulke 136cc1d44d allow extra slot values in intents (#15246) 2018-07-01 11:51:40 -04:00
Paulus Schoutsen 2205090795
Storage auth (#15192)
* Support parallel loading

* Add storage mock

* Store auth

* Fix tests
2018-06-28 22:14:26 -04:00
Paulus Schoutsen c79c94550f
Return None to indicate no config found (#15147)
* Return None to indicate no config found

* Fix tests
2018-06-25 17:21:38 -04:00
Ville Skyttä b92350fb55 Lint cleanup (#15103)
* Remove unneeded inline pylint disables

* Remove unneeded noqa's

* Use symbol names instead of message ids in inline pylint disables
2018-06-25 13:05:07 -04:00
Paulus Schoutsen ae51dc08bf
Add storage helper and migrate config entries (#15045)
* Add storage helper

* Migrate config entries to use the storage helper

* Make sure tests do not do I/O

* Lint

* Add versions to stored data

* Add more instance variables

* Make migrator load config if nothing to migrate

* Address comments
2018-06-25 12:53:49 -04:00
Raoul Teeuwen 27873b4457 Update condition.py (#15021)
* Update condition.py

Added code that writes to warning-log what entity causes a problem when 'value cannot be processed as a number', making troubleshooting easier.

* Make a one-line warning
2018-06-19 13:26:52 +02:00
Pascal Vizeli 62f970e486 Bugfix empty entity lists (#15035)
* Bugfix empty entity lists

* Add tests

* Update test_entity_platform.py

* Update entity_platform.py
2018-06-18 09:22:52 -04:00
Paulus Schoutsen 1128104281 Adhere to scan_interval in platforms when setup via config entry (#14969) 2018-06-15 16:59:13 +02:00
Paulus Schoutsen 2c6e6c2a6f
Add config entry for Sonos + Cast (#14955)
* Add config entry for Sonos

* Lint

* Use add_job

* Add Cast config entry

* Lint

* Rename DOMAIN import

* Mock pychromecast in test
2018-06-14 15:17:54 -04:00
Paulus Schoutsen 90a51160c4
Don't run unnecessary methods in executor pool (#14853)
* Don't run unnecessary methods in executor pool

* Lint

* Lint 2
2018-06-07 15:31:21 -04:00
Paulus Schoutsen 67d137cfd5 Store config entry id in entity registry (#14851)
* Store config entry id in entity registry

* Lint
2018-06-07 20:23:09 +02:00
Andrey d1228d5cf4 Look at registry before pulling zwave config values (#14408)
* Look at registry before deciding on ID for zwave values

* Reuse the new function
2018-05-12 17:45:36 -04:00
Paulus Schoutsen 5ec7fc7ddb Backend tweaks to make authorization work (#14339)
* Backend tweaks to make authorization work

* Lint

* Add test

* Validate redirect uris

* Fix tests

* Fix tests

* Lint
2018-05-10 10:38:11 +02:00
Lukas Barth af8cd63838 Matrix Chatbot (#13355)
* Add first version of the Matrix bot

* It's a stupid but necessary change…

* Dont list it twice

* All hail the linter!

* More linter-pleasing

* Use the correct user ID

* Add expression commands

* Add tests for new validators

* Fix room alias handling

* Wording

* Defer setup

* Simplify commands

* Handle exceptions

* Update requirements

* Review

* Move login back to constructor

* Fix review comments
2018-05-05 10:00:36 -04:00
Paulus Schoutsen 83d300fd11 Custom component loading cleanup (#14211)
* Clean up custom component loading

* Fix some tests

* Fix some stuff

* Make imports work again

* Fix tests

* Remove debug print

* Lint
2018-05-01 20:57:30 +02:00
Paulus Schoutsen cdd45e7878 Foundation for users (#13968)
* Add initial user foundation to Home Assistant

* Address comments

* Address comments

* Allow non-ascii passwords

* One more utf-8 hmac compare digest

* Add new line
2018-05-01 18:20:41 +02:00
Kane610 4b06392442 Zone component config entry support (#14059)
* Initial commit

* Add error handling to config flow
Change unique identifyer to name
Clean up hound comments

* Ensure hass home zone is created with correct entity id
Fix failing tests

* Fix rest of tests

* Move zone tests to zone folder
Create config flow tests

* Add possibility to unload entry

* Use hass.data instead of globas

* Don't calculate configures zones every loop iteration

* No need to know about home zone during setup of entry

* Only use name as title

* Don't cache hass home zone

* Add new tests for setup and setup entry

* Break out functionality from init to zone.py

* Make hass home zone be created directly

* Make sure that config flow doesn't override hass home zone

* A newline was missing in const

* Configured zones shall not be imported
Removed config flow import functionality
Improved tests
2018-04-26 17:59:22 -04:00
Paulus Schoutsen 534aa0e4b5 Add data entry flow helper (#13935)
* Extract data entry flows HTTP views into helper

* Remove use of domain

* Lint

* Fix tests

* Update doc
2018-04-17 11:44:32 +02:00
Benedict Aas 9677bc081e Add more math functions to templates (#13915)
We make `sin`, `cos`, `tan`, and `sqrt` functions, and the `pi`, `tau`,
and `e` constants available in templates.
2018-04-15 18:51:45 +02:00
Paulus Schoutsen f47572d3c0 Allow platform unloading (#13784)
* Allow platform unloading

* Add tests

* Add last test
2018-04-12 14:28:54 +02:00
Paulus Schoutsen 73de749411
Use config entry to setup platforms (#13752)
* Use config entry to setup platforms

* Rename to async_forward_entry

* Add tests

* Catch if platform not exists for entry
2018-04-09 10:09:08 -04:00
Paulus Schoutsen 40d7857f3b
Prepare entity component for config entries (#13730)
* Prepare entity component for config entries

* Return in time
2018-04-07 23:04:50 -04:00
mountainsandcode 032d6963d8 Add regex functions as templating helpers (#13631)
* Add regex functions as templating helpers

* Add regex functions as templating helpers - Style fixed

* Templating filters, third time lucky?
2018-04-04 15:34:01 +02:00
Mikael Svensson bdb4d754ae Adds template function state_attr to get attribute from a state (#13378)
* Adds template function state_attr to get attribute from a state
Refactored is_state_attr to use new function
Adds tests for state_attr

* Fixes line too long and test bug

* Fixes pylint error

* Fixes tests and D401 lint error
2018-03-28 00:04:18 -07:00
Anders Melchiorsen 55daea5169 Improve detection of entity names in templates (#13432)
* Improve detection of entity names in templates

* Only test variables
2018-03-25 12:51:11 +02:00
Anders Melchiorsen 7166d53e2b Log invalid templates in script delays (#13423)
* Log invalid templates in script delays

* Abort on error

* Remove unused import
2018-03-25 01:12:26 +01:00
Paulus Schoutsen fb1fafefab
Include all config flow translations with backend translations (#13394) 2018-03-22 12:21:33 -07:00
Otto Winter 3442b6741d
Fix WUnderground duplicate entity ids (#13285)
* Fix WUnderground duplicate entity ids

* Entity Namespace
2018-03-17 13:14:53 +01:00
Otto Winter f5093b474a
Python 3.5 async with (#13283) 2018-03-17 12:27:21 +01:00
Paulus Schoutsen 5a9013cda5
Refactor Hue: phue -> aiohue (#13043)
* phue -> aiohue

* Clean up

* Fix config

* Address comments

* Typo

* Fix rebase error

* Mark light as unavailable when bridge is disconnected

* Tests

* Make Throttle work with double delay and async

* Rework update logic

* Don't resolve host to IP

* Clarify comment

* No longer do unnecessary updates

* Add more doc

* Another comment update

* Wrap up tests

* Lint

* Fix tests

* PyLint does not like mix 'n match async and coroutine

* Lint

* Update aiohue to 1.2

* Lint

* Fix await MagicMock
2018-03-16 20:27:05 -07:00
Paulus Schoutsen 89a19c89a7 Fix aiohttp deprecation warnings (#13240)
* Fix aiohttp deprecation warnings

* Fix Ring deprecation warning

* Lint
2018-03-15 21:49:49 +01:00
Matthias Urlichs f5cc40024d Rename homeassistant.util.async to .async_ (#13088)
"async" is (going to be) a reserved word.
2018-03-11 10:01:12 -07:00
mueslo 3ba19c52d5 Add consider_home and source_type to device_tracker.see service (#12849)
* Add consider_home and source_type to device_tracker.see service

* Use schema instead of manual validation

* Extend schema to validate all keys

* Fix style

* Set battery level to int
2018-03-08 23:57:21 -08:00
Paulus Schoutsen 6a5c7ef43f
Upgrade to aiohttp 3 (#12921)
* Upgrade aiohttp to 3.0.6

* Fix tests

* Fix aiohttp client stream test

* Lint

* Remove drain
2018-03-05 13:28:41 -08:00
Paulus Schoutsen 67c49a7662
Add config flow for Hue (#12830)
* Add config flow for Hue

* Upgrade to aiohue 0.2

* Fix tests

* Add tests

* Add aiohue to test requirements

* Bump aiohue dependency

* Lint

* Lint

* Fix aiohttp mock

* Lint

* Fix tests
2018-03-03 21:28:04 -08:00
Anders Melchiorsen e2e10b91a7 Grammar fix 'an unique' (#12870) 2018-03-03 19:23:55 +01:00
Paulus Schoutsen 491b3d707c
Add optional words to conversation utterances (#12772)
* Add optional words to conversation utterances

* Conversation to handle singular/plural

* Remove print

* Add pronounce detection to shopping list

* Lint

* fix tests

* Add optional 2 words

* Fix tests

* Conversation: coroutine -> async/await

* Replace \s with space
2018-03-01 07:35:12 -08:00
Adam Mills b434ffba2d Support serving of backend translations (#12453)
* Add view to support backend translation fetching

* Load backend translations from component json

* Translations for season sensor

* Scripts to merge and unpack Lokalise translations

* Fix copy paste error

* Serve post-lokalise translations to frontend

* Linting

* Auto-deploy translations with Travis

* Commit post-lokalise translation files

* Split logic into more helper functions

* Fall back to English for missing keys

* Move local translation copies to `.translations`

* Linting

* Initial tests

* Remove unnecessary file check

* Convert translation helper to async/await

* Convert translation helper tests to async/await

* Use set subtraction to find missing_components

* load_translation_files use component->file mapping

* Remove duplicated resources fetching

Get to take advantage of the slick Python 3.5 dict merging here.

* Switch to live project ID
2018-02-28 19:31:38 -08:00
Otto Winter c1aaef28a9
MQTT Static Typing (#12433)
* MQTT Typing

* Tiny style change

* Fixes

I should've probably really sticked to limiting myself to static typing...

* Small fix 😩

Ok, this seriously shouldn't have happened.
2018-02-28 22:59:14 +01:00
Paulus Schoutsen f7e9215f5e
Fix when 2 states match with same name (#12771) 2018-02-28 13:39:01 -08:00
Philip Rosenberg-Watt e82b358831 Round humidity for display purposes (#12766)
Humidity was not being rounded as temperature was. This change fixes
that.
2018-02-28 10:59:47 -08:00
Paulus Schoutsen efd155dd3c
Intent: Set light color (#12633)
* Make color_name_to_rgb raise

* Add Light Set Color intent

* Move some methods around

* Cleanup

* Prevent 1 more func call

* Make a generic Set intent for light

* Lint

* lint
2018-02-27 18:02:21 -08:00
cdce8p 6e6ae173fd Added config validator for future group platforms (#12592)
* Added cv.EntitiesDoamin(domain) validator

* Check if all entities in string or list belong to domain
* Added tests

* Use factory function and entity_ids

* Different error message

* Typo

* Added entity_domain validator for a single entity_id

* Image_processing platform now uses cv.entity_domain for source validation
2018-02-25 23:48:21 -08:00
Julius Mittenzwei 16cb7388ee Removing asyncio.coroutine syntax from HASS core (#12509)
* changed asyncio.coroutine syntax to new async def/await

* removed py34 from tox environment

* reverted some changes within entity.py

* -

* reverted changes within bootstrap.py

* reverted changes within discovery.py

* switched decorators

* Reverted change within aiohttp_client.py

* reverted change within logging.py

* switched decorators

* Await lock properly

* removed asyncio.coroutine from test
2018-02-25 03:38:46 -08:00
Paulus Schoutsen 6d431c3fc3
Allow renaming entities in entity registry (#12636)
* Allow renaming entities in entity registry

* Lint
2018-02-24 10:53:59 -08:00
Otto Winter 3077444d62 Fix numeric_state condition spamming on unavailable (#12550) 2018-02-20 17:02:27 +01:00
Paulus Schoutsen d2cea84254 Allow disabling entities in the registry (#12360) 2018-02-13 13:33:15 +01:00
Paulus Schoutsen eb7adc74ef
Respect entity namespace for entity registry (#12313)
* Respect entity namespace for entity registry

* Lint
2018-02-11 20:55:38 -08:00
Paulus Schoutsen 2e3524147c
Remove unique ID from netatmo (#12317)
* Remove unique ID from netatmo

* Shame platform in error message
2018-02-11 19:33:37 -08:00
Tod Schmidt 26209de2f2 Move HassIntent handler code into helpers/intent (#12181)
* Moved TurnOn/Off Intents to component

* Removed unused import

* Lint fix which my local runs dont catch apparently...

* Moved hass intent code into intent

* Added test for toggle to conversation.

* Fixed toggle tests

* Update intent.py

* Added homeassistant.helpers to gen_requirements script.

* Update intent.py

* Update intent.py

* Changed return value for _match_entity

* Moved consts and requirements

* Removed unused import

* Removed http view

* Removed http import

* Removed fuzzywuzzy dependency

* woof

* A few cleanups

* Added domain filtering to entities

* Clarified class doc string

* Added doc string

* Added test in test_init

* woof

* Cleanup entity matching

* Update intent.py

* removed uneeded setup from tests
2018-02-11 09:33:19 -08:00
Otto Winter 678f284015 Upgrade pylint to 1.8.2 (#12274)
* Upgrade pylint to 1.8.1

* Fix no-else-return

* Fix bad-whitespace

* Fix too-many-nested-blocks

* Fix raising-format-tuple

See https://github.com/PyCQA/pylint/blob/master/doc/whatsnew/1.8.rst

* Fix len-as-condition

* Fix logging-not-lazy

Not sure about that TEMP_CELSIUS though, but internally it's probably just like if you concatenated any other (variable) string

* Fix stop-iteration-return

* Fix useless-super-delegation

* Fix trailing-comma-tuple

Both of these seem to simply be bugs:
 * Nest: The value of self._humidity never seems to be used anywhere
 * Dovado: The called API method seems to expect a "normal" number

* Fix redefined-argument-from-local

* Fix consider-using-enumerate

* Fix wrong-import-order

* Fix arguments-differ

* Fix missed no-else-return

* Fix no-member and related

* Fix signatures-differ

* Revert "Upgrade pylint to 1.8.1"

This reverts commit af78aa00f125a7d34add97b9d50c14db48412211.

* Fix arguments-differ

* except for device_tracker

* Cleanup

* Fix test using positional argument

* Fix line too long

I forgot to run flake8 - shame on me... 🙃

* Fix bad-option-value for 1.6.5

* Fix arguments-differ for device_tracker

* Upgrade pylint to 1.8.2

* 👕 Fix missed no-member
2018-02-11 09:20:28 -08:00
Paulus Schoutsen 17e5740a0c
Allow overriding name via entity registry (#12292)
* Allow overriding name via entity registry

* Update requirements
2018-02-11 09:16:01 -08:00
Paulus Schoutsen f2296e1ff8 Retry keyset cloud (#12270)
* Use less threads in helpers.event tests

* Add helpers.event.async_call_later

* Cloud: retry fetching keyset
2018-02-10 11:40:24 +01:00
Paulus Schoutsen 5601fbdc7a Entity layer cleanup (#12237)
* Simplify entity update

* Split entity platform from entity component

* Decouple entity platform from entity component

* Always include unit of measurement again

* Lint

* Fix test
2018-02-08 12:16:51 +01:00
Tod Schmidt f5030d9ebf Services (small_pr)(fix): Added missing return on data template error (#12184)
* Added return on data template error

* Rebased so not sure why spelling errors returned...
2018-02-05 09:19:56 +01:00
Ville Skyttä 13ec8b143d Spelling fixes (#12138) 2018-02-02 22:35:34 +01:00
Paulus Schoutsen e51427b284 Entity registry (#11979)
* Entity#unique_id defaults to None

* Initial commit entity registry

* Clean up unique_id property

* Lint

* Add tests to entity component

* Lint

* Restore some unique ids

* Spelling

* Remove use of IP address for unique ID

* Add tests

* Add tests

* Fix tests

* Add some docs

* Add one more test

* Fix new test…
2018-01-30 10:39:39 +01:00
Otto Winter 8dcfd35b8b Spelling fixes (#12041)
* Spelling fixes

*Lots* of them.

* Spelling breaking changes

* Fix lint errors
2018-01-29 23:37:19 +01:00
Ville Skyttä 55ee8959ba Spelling fixes (#11940) 2018-01-27 11:58:27 -08:00
akloeckner 68d2851ecf Map media_stop to idle state (#11819)
adresses #11813
2018-01-26 12:57:54 +01:00
Paulus Schoutsen 183e0543b4
Clean up entity component (#11691)
* Clean up entity component

* Lint

* List -> Tuple

* Add Entity.async_remove back

* Unflake setting up group test
2018-01-22 22:54:41 -08:00
Fabian Affolter 47e31dc9ee Fixes for PEP257 (#11810)
* Fixes for PEP257

* More updates
2018-01-20 22:35:38 -08:00
tschmidty69 48619c9d7c Implemented event_data_template (new) (#11057)
* Implemented event_data_template

* The hound does not like my indentation

* Added passed variables to tests for event and svc template calls

* Moved recursive function to template.py

* Update template.py

* Update template.py

* Cleaned up service.py and fixed unit tests

* Blank lines

* Removed stray logger statement

* Blank lines again
2018-01-18 22:13:14 -08:00