Compare commits

..

1585 Commits
0.25.2 ... 0.34

Author SHA1 Message Date
Paulus Schoutsen
94b719e150 Merge pull request #4626 from home-assistant/dev
0.34
2016-12-03 12:17:02 -08:00
Paulus Schoutsen
69d3a3dd32 Version bump to 0.34 2016-12-03 12:16:18 -08:00
Paulus Schoutsen
4904653b70 Yarl has been fixed (#4694) 2016-12-03 11:59:05 -08:00
Fabian Affolter
dddf4d1460 Style 0.34 (#4689)
* Minor style updates

* Minor style updates

* Update validation and logger messages

* Update ordering

* Fix lint issue

* Fix line too long

* Update ordering

* update logger messages
2016-12-03 20:46:04 +01:00
GadgetReactor
9a6c9cff30 Update reference to correct tplink switch (#4670) 2016-12-03 11:38:14 -08:00
Paulus Schoutsen
d3b62e1fe1 Requirements use zip instead of git (#4692) 2016-12-03 10:18:00 -08:00
Paulus Schoutsen
f63a79ee8f Remove not dev related scripts (#4690) 2016-12-03 09:59:20 -08:00
Paulus Schoutsen
898ba56d9f Fix aiohttp build (#4691) 2016-12-03 09:49:10 -08:00
Josh Nichols
64a5bff5b2 Nest further improvements (#4655)
* Further improvements on nest platform

- fix binary sensor
- add deprecations for monitored_conditions
- better names for sensors (includes device type)

* lint

* Remove unused weather sensor

* Fix to python-nest to a specific commit

* lint

* lint

* lint

* lint
2016-12-03 09:26:47 -08:00
Paulus Schoutsen
af7de8d5ae Merge remote-tracking branch 'origin/master' into dev 2016-12-03 09:11:47 -08:00
Pascal Vizeli
754d98bcd5 Cleanups on homematic climate (#4685) 2016-12-03 14:06:08 +01:00
Paulus Schoutsen
4874030b70 Have api_streams sensor also monitor websocket connections (#4668) 2016-12-02 18:17:46 -08:00
Paulus Schoutsen
84c89686a9 Update __init__.py 2016-12-02 09:13:39 -08:00
Brent Hughes
48fd8f1f63 InfluxDB: Fixed attributes that are lists causing invalid syntax (#4642)
* Fixed attributes that are lists cuasing invalid influx syntax

* Added bool and fixed mixed data type issue

* Fixed changing nearly all data types to float causing some worse influxdb errors. whoops

* Added line to end of file
2016-12-01 23:02:58 -08:00
Lewis Juggins
83a108b20a Sonos specify IP for event subscription (#4177) 2016-12-01 22:22:03 -08:00
Alberto Arias Maestro
b0a800cc6d Update commands to match the strings in pynx584 (#4623)
The command string don't match the ones pynx584. See source code:

https://github.com/kk7ds/pynx584/blob/master/nx584/api.py#L68
2016-12-01 22:20:44 -08:00
Matt N
1f5f4e7a89 zoneminder: Support excluding archived events (#4445) 2016-12-01 22:17:38 -08:00
Fabian Affolter
b1fbada02d Update throttle and add more attributes (#4644) 2016-12-01 22:15:48 -08:00
Lewis Juggins
08909ed420 (InfluxDB) Configuration for a default measurement value for events without a unit. (#4632) 2016-12-01 22:13:55 -08:00
Nick Touran
ec8969351d Prevent Pandora component from crashing or hanging during shutdown. (#4255)
* Prevent Pandora component from crashing or hanging during shutdown.

* Update pandora.py

* Update pandora.py
2016-12-01 22:06:23 -08:00
Javier González Calleja
801a69be3a Extending efergy component for get the amount of energy consumed (#4202)
* Extending efergy component for get the amount of energy consumed

* Changing units from kW to kWh

* Chaning units for Instant Consumption from kWh to kW

* Adding timeout for get and removing pylint config

* Update efergy.py
2016-12-01 22:00:17 -08:00
Fabian Affolter
51e20c92f9 WIP Fix pylint and PEP257 issues (tests) (#4120)
* Fix pylint and PEP257 issues

* More PEP257 fixes
2016-12-01 21:45:19 -08:00
Russell Cloran
443553ff16 Handle IPv6 in zeroconf (#4052) 2016-12-01 21:43:33 -08:00
Pascal Vizeli
2e6a48ff5f WIP: Migrate scene to async + homeassistant scene async (#4665)
* Migrate scene to async + homeassistant scene async

* fix lint

* Update state.py

* Fix tests
2016-12-01 21:38:12 -08:00
Paulus Schoutsen
49cfe38cca Demo platform to group climate instead of thermostat 2016-12-01 21:11:13 -08:00
Pascal Vizeli
8a042586f1 Migrate sensor to async (#4663) 2016-12-01 18:31:55 -08:00
Johan Bloemberg
08f8e540e3 Macvendor (#4468)
* Add MAC vendor lookup for device_tracker.

* Test vendor mac lookup and fix device attribute.

* Generate requirements.

* Style.

* Use hyphen instead of underscore to satisfy 'idna'.

https://github.com/kjd/idna/issues/17

* Resort imports.

* Refactor macvendor to use macvendors.com API instead of netaddr library.

* Test vendor lookup using macvendors.com api.

* Remove debugging.

* Correct description.

* No longer needed.

* Device tracker is now an async component. Fix ddwrt tests.

* Fix linting.

* Add test case for error conditions.

* There is no reason to retry failes vendor loopups as they won't be saved to the file anyways at that point.

* Sorry, bad assumption, this only made things worse.

* Wait for async parts during setup component to complete before asserting results.

* Fix linting.

* Is generated when running 'coverage html'.

* Undo isort.

* Make aioclient_mock exception more generic.

* Only lookup mac vendor string with adding new device to known_devices.yaml.

* Undo isort.

* Revert unneeded change.

* Adjust to use new websession pattern.

* Always make sure to cleanup response.

* Use correct function to release response.

* Fix tests.
2016-12-01 18:30:41 -08:00
Brandon Weeks
f09b888a8a Fixes #3511 - handle multiple return values (#4659) 2016-12-01 18:28:52 -08:00
lichtteil
279f82acc4 Mutate values for light color temperature and white value (#4660)
* Mutate values for light color temperature and white value

* Fix lenght of line

* Fix under-indented line

* Fix cgl
2016-12-01 18:26:53 -08:00
iandday
de6c5a503b Remote Component and Harmony Platform (#4254)
* Initial Harmony device support, working current activity sensor and switch for each activity
TODO: add new device per hub to send device specific activity

 Changes to be committed:
	new file:   homeassistant/components/harmony.py
	new file:   homeassistant/components/sensor/harmony.py
	new file:   homeassistant/components/switch/harmony.py

* ready for beta, I think

 Changes to be committed:
	modified:   homeassistant/components/harmony.py
	modified:   homeassistant/components/sensor/harmony.py
	modified:   homeassistant/components/switch/harmony.py

*  Changes to be committed:
	modified:   homeassistant/components/harmony.py
	new file:   homeassistant/components/remote/__init__.py
	new file:   homeassistant/components/remote/harmony.py
	new file:   homeassistant/components/remote/services.yaml
	modified:   homeassistant/components/sensor/harmony.py
	modified:   homeassistant/components/switch/harmony.py
Implemented remote component and harmony platform

* streamlined harmony support

* typo

* Initial Harmony device support, working current activity sensor and switch for each activity
TODO: add new device per hub to send device specific activity

 Changes to be committed:
	new file:   homeassistant/components/harmony.py
	new file:   homeassistant/components/sensor/harmony.py
	new file:   homeassistant/components/switch/harmony.py

* ready for beta, I think

 Changes to be committed:
	modified:   homeassistant/components/harmony.py
	modified:   homeassistant/components/sensor/harmony.py
	modified:   homeassistant/components/switch/harmony.py

*  Changes to be committed:
	modified:   homeassistant/components/harmony.py
	new file:   homeassistant/components/remote/__init__.py
	new file:   homeassistant/components/remote/harmony.py
	new file:   homeassistant/components/remote/services.yaml
	modified:   homeassistant/components/sensor/harmony.py
	modified:   homeassistant/components/switch/harmony.py
Implemented remote component and harmony platform

* streamlined harmony support

* typo

* reworked token generation

* delete

* Initial Harmony device support, working current activity sensor and switch for each activity
TODO: add new device per hub to send device specific activity

 Changes to be committed:
	new file:   homeassistant/components/harmony.py
	new file:   homeassistant/components/sensor/harmony.py
	new file:   homeassistant/components/switch/harmony.py

* Initial Harmony device support, working current activity sensor and switch for each activity
TODO: add new device per hub to send device specific activity

 Changes to be committed:
	new file:   homeassistant/components/harmony.py
	new file:   homeassistant/components/sensor/harmony.py
	new file:   homeassistant/components/switch/harmony.py

* ready for beta, I think

 Changes to be committed:
	modified:   homeassistant/components/harmony.py
	modified:   homeassistant/components/sensor/harmony.py
	modified:   homeassistant/components/switch/harmony.py

* ready for beta, I think

 Changes to be committed:
	modified:   homeassistant/components/harmony.py
	modified:   homeassistant/components/sensor/harmony.py
	modified:   homeassistant/components/switch/harmony.py

*  Changes to be committed:
	modified:   homeassistant/components/harmony.py
	new file:   homeassistant/components/remote/__init__.py
	new file:   homeassistant/components/remote/harmony.py
	new file:   homeassistant/components/remote/services.yaml
	modified:   homeassistant/components/sensor/harmony.py
	modified:   homeassistant/components/switch/harmony.py
Implemented remote component and harmony platform

* streamlined harmony support

* typo

* reworked token generation

* delete

* readded after rebase

* cleaning up style errors

* modified .coveragerc

* moved import statements

* added more debug logging

* Added URL encoding of token received from Logitech

* Corrected import for python 3

* new pyharmony version

* new pyharmony version

* remote tests

* only write config file if not present or sync service is called

* more tests

* more tests

* bumped pyharmony version to work with new auth

* bumped pyharmony version to work with new auth

* style corrections

* harmony local auth and remote demo platform

* style fix

* PR refinements and permission issues

* forgot a blank line

* removed sync test from test_init

* removed sync test from test_init

* visual indent

* send_command test in demo platform
2016-12-01 12:48:08 -08:00
Jesse Newland
898f89ffc7 Make trusted_networks iterable (#4649) 2016-12-01 12:28:59 -08:00
Jan Losinski
5c807c6bd9 MPD: Reconnect mpd client afetr OSError (#4651)
If the mpd client ran into an socket timeout, the socket will raise an
OSError on every further request. This adds OSError to the list of
excptions, that causes a client reconnect.

This fixes #4650

Signed-off-by: Jan Losinski <losinski@wh2.tu-dresden.de>
2016-12-01 12:28:31 -08:00
Jan Losinski
dd84b4e237 Mpd: Use "file" instead "id" for media_content_id (#4653)
In media_content_id() the "id" of the current song was returned. as
stated in bug #4652 the id is only the Tracklist-Id in the current
tracklist and is omitted if the track is not part of a tracklist (what
caused the bug in the first place).

To match the semantics described in the dockstring, to return a "Content
ID", this chooses the filename of the current song as id and returns
it.

It also uses get() instead of [] to prevent KeyError.

This fixes bug #4652

Signed-off-by: Jan Losinski <losinski@wh2.tu-dresden.de>
2016-12-01 12:20:42 -08:00
John Mihalic
6dfae7a259 Add support for NUT (Network UPS Tools) sensor. (#4551)
* Add support for NUT (Network UPS Tools) sensor.

* Address comments

* Fix issues

* Fix issues 2

* Fix unhandled exception
2016-12-01 08:58:16 +01:00
Johann Kellerman
c6c8cd4f51 Yr.no: New aiohttp client needs params to form websession URL (#4634)
* Yr.no: New aiohttp client needs params to form websession URL
* Support params in aiohttp mocking
2016-12-01 08:20:21 +02:00
Pascal Vizeli
bde7176b3c Migrate light component to async (#4635) 2016-11-30 13:33:38 -08:00
William Scanlon
4c03d670c1 Wink PubNub v4 (#4561)
* PubNub v4

* Updated to pubnubsub-handler 0.0.5

* Updated requirements_all.txt
2016-11-30 13:12:26 -08:00
Johan Bloemberg
406afbb369 Philips controls (#4441)
* Add channel switching for philips tvs.

* Disable track buttons when not watching tv.

* Undo isort config.

* Yes it does.

* Just testing some assumption on hound's flake8 behaviour.

* Revert "Just testing some assumption on hound's flake8 behaviour."

This reverts commit ff9940b39e.

* poke
2016-11-30 13:07:57 -08:00
Marcelo Moreira de Mello
9c6609cb79 Added support to Amcrest camera (#4573)
* Introduced support to Amcrest IP Cameras

* Fixed lint issues

* Fixed requirements test

* * Implemented test to verify crendentials during camera setup

* Added persistent_notification in case of error when during Amcrest setup
2016-11-30 13:07:17 -08:00
Paulus Schoutsen
e5504b39ec Close aiohttp responses (#4624)
* Close aiohttp responses

* Update generic.py
2016-11-30 13:05:58 -08:00
Paulus Schoutsen
b1ef5042f9 Make updater more robust (#4625) 2016-11-30 13:03:09 -08:00
Paulus Schoutsen
b35fa4f1c1 Finish all tasks before setup phase is done (#4606) 2016-11-30 13:02:45 -08:00
Martin Hjelmare
71da9d2f50 Fix mysensors ir switch overwriting devices (#4612) 2016-11-30 13:02:18 -08:00
Fabian Affolter
86388f5af2 Upgrade Sphinx to 1.4.9 (#4641) 2016-11-30 14:21:00 +01:00
Pascal Vizeli
17f0fb69bd Homematic update with HomematicIP/HomematicWired support and multible… (#4568)
* Homematic update with HomematicIP/HomematicWired support and multible connections

* fix bug in virtualkey service

* create new service & cleanups

* fix lint

* Pump pyhomematic 0.1.18
2016-11-29 20:53:02 +01:00
DaveSergeant
2d02baf3d0 Default dimmable brightness to 255 from 100 (#4621)
* Default dimmable brightness to 255 from 100

Full brightness for ISY dimmers is 255. The current 100 value turns dimmer switches on to just under half brightness.  Probably just an oversight from the Sept implementation.

* Brightness change for turn_on, ramp for turn_off.

Per discussion with Teagan42 and jbcodemonkey, the brightness should rightfully be None and not an explicit value.  There is a continuing issue that the ISY modules don't respect HA's brightness customization values.  A new issue will be opened for this.
Additionally, turn_off was using ISY's fastoff() which didn't respect the ramping time.  The default behavior should just be off().
2016-11-29 09:50:12 -07:00
Lewis Juggins
66473120ab Add test for delay on automations (#4630) 2016-11-29 08:45:04 -08:00
Christian Brædstrup
6ddbb4d568 Improved exception handling for D-Link switch (#4633) 2016-11-29 08:40:51 -08:00
Valentin Alexeev
154c69a454 Bump version of pwaqi module to 1.3. Fixes #4595. (#4610) 2016-11-28 23:11:21 -08:00
Charles Spirakis
ad4ec49f9c Update color names to follow w3.org list. (#4374)
The color names -> rgb dictionary now follows the
color names listed in the w3.org site for css3,
section 4.3. Extended color keywords:

https://www.w3.org/TR/2010/PR-css3-color-20101028/#svg-color
2016-11-28 22:59:46 -08:00
Fabian Affolter
e8367f245a Update ordering and sync logger messages (#4615) 2016-11-28 20:50:42 +01:00
Fabian Affolter
4bc37bd661 Add timeout to request, update ordering, make dev info message shorter, and (#4613)
update the other logger messages
2016-11-28 20:49:01 +01:00
Pascal Vizeli
b4841a17a6 Hotfix device_tracker yaml config (#4611) 2016-11-28 18:43:47 +01:00
Valentin Alexeev
3b9d5cdf73 DuneHD media player (#4588)
* Implement WAQI sensor

* Corrections based on CI check.

* Updated requirements_all.txt for pwaqi==1.2

* Require latest version of pwaqi

* Initial implementation of DuneHD media player component based on pdunehd.

* Major: avoid update() in property fetch,
Major: implement source support,
Major: single device per media player instance,
Major: support for volume / mute controls

* Pythonify pdunehd.
Support media_title.

* Fix pylint.

* Further pylint.

* docstring

* Formatting and indentation.

* Change indentation to spaces.

* Update coverage and recorded requirements before PR.

* Further pylint / fake8 / pydocstyle fixes.

* Implement next / prev track,
Properly decode blu-ray playback,
Attempt to decode media title

* Fix play / pause
Linting

* Update requirements.
Fix lint.

* Fix lint and syntax error

* Yet more linting.

* Yet more linting.

* Fix lint: line too long.

* Force update of HA state.
2016-11-27 23:42:57 -08:00
Daniel Perna
77d568dc47 Fixed incorrect event-order (#4605) 2016-11-27 22:29:21 -08:00
Paulus Schoutsen
9db1ff8cd4 Update frontend 2016-11-27 22:27:02 -08:00
Oliver
248a90b71d Added denon media player controls via denonavr library (#4580)
* Added denonavr module again

* Edited requirements_all.txt

* Edited .coveragerc

* Fixed error with AUX1 input source in library

* Adding device should not fail on connection timeout

* Changed method to select source

* Update requirements_all.txt
2016-11-27 22:13:22 -08:00
Mark King
d8c4af9c81 TEMPer component: reset devices on address change (#4596)
Fixes https://github.com/home-assistant/home-assistant/issues/4389

The USB address of these devices periodically changes, causing
home-assistant to fail to read the temperature data. This PR fixes this
by re-reading the available devices on failure. I've been running this
for several days and for the first time have consistent temperature
data without having to restart home-assistant.
2016-11-27 22:01:13 -08:00
Fabian Affolter
1e6c660f59 Threshold sensor (#4216)
* Add threshold sensor

* New config requirement, update async, other changes, and update tests

* Update threshold.py
2016-11-27 21:55:26 -08:00
Harris Borawski
44a508e86c Add exception handling to Sonarr (#4569)
* Add exception handling to request call to prevent
failure in setup_platform if host is down

* update for comments

* update test for state being none

* remove unused import
2016-11-27 21:11:49 -08:00
Bjarni Ivarsson
92c6cee2a1 Support for media_position property on media_player (#4172)
* Added support for media_position property to media_player + implementation for sonos.

* Pla yback progress now updates without needed state transitions in HA.

* Linting fixes

* media_position_update_at property is now a datetime.

* Minor fix.

* Linting fixes.
2016-11-27 17:45:49 -08:00
Paulus Schoutsen
d4bc8e23af Update frontend 2016-11-27 17:21:11 -08:00
Antoine Bertin
f0db698f75 Light effects (#4538)
* Add support for light effects

* Move PLATFORM_SCHEMA changes in light to mqtt_template

* Add effect validation

* Add unittests

* Add light effect to demo and unittests

* Use cv.string for config validation

* Use cv.ensure_list for config validation

* Fix typo

* Remove unused exception management for effect
2016-11-27 17:15:28 -08:00
Pascal Vizeli
cf57db919e Refactory aiohttp clientsession handling in HA (#4602)
* Refactory aiohttp clientsession handling in HA

* remove from core / update platforms / rename file
2016-11-27 16:26:46 -08:00
Josh Nichols
84b12ab007 Nest Cam support (#4292)
* start nestcam support

* start nestcam support

* introduce a access_token_cache_file

* Bare minimum to get nest thermostat loading

* occaisonally the image works

* switch to nest-aware interval for testing

* Add Nest Aware awareness

* remove duplicate error logging line

* Fix nest protect support

* address baloobot

* fix copy pasta

* fix more baloobot

* last baloobot thing for now?

* Use streaming status to determine online or not. online from nest means its on the network

* Fix temperature scale for climate

* Add support for eco mode

* Fix auto mode for nest climate

* update update current_operation and set_operation mode to use constant when possible. try to get setting something working

* remove stale comment

* unused-argument already disabled globally

* Add eco to the end, instead of after off

* Simplify conditional when the hass mode is the same as the nest one

* away_temperature became eco_temperature, and works with eco mode

* Update min/max temp based on locked temperature

* Forgot to set locked stuff during construction

* Cache image instead of throttling (which returns none), respect NestAware subscription

* Fix _time_between_snapshots before the first update

* WIP pin authorization

* Add some more logging

* Working configurator, woo. Fix some hound errors

* Updated pin workflow

* Deprecate more sensors

* Don't update during access of name

* Don't update during access of name

* Add camera brand

* Fix up some syntastic errors

* Fix ups ome hound errors

* Maybe fix some more?

* Move snapshot simulator url checking down into python-nest

* Rename _ready_to_update_camera_image to _ready_for_snapshot

* More fixes

* Set the next time a snapshot can be taken when one is taken to simplify logic

* Add a FIXME about update not getting called

* Call update during constructor, so values get set at least once

* Fix up names

* Remove todo about eco, since that's pretty nest

* thanks hound

* Fix temperature being off for farenheight.

* Fix some lint errors, which includes using a git version of python-nest with updated code

* generate requirements_all.py

* fix pylint

* Update nestcam before adding

* Fix polling of NestCamera

* Lint
2016-11-27 16:18:47 -08:00
Johan Bloemberg
601193b1d2 Expose isort preferences for tools. (#4481)
* Expose isort preferences for tools.

* Adhere to pylints sorted imports requirement.

* More documentation, set typing in between stdlib and 3rd party.
2016-11-27 14:33:30 -08:00
Sean Dague
038b1c1fc6 precision properties for climate components (#4562)
This lets components declare their precision for temperatures. If
nothing is declared, we assume 0.1 C and whole integer precision in
F. Currently this supports only WHOLE, HALVES, and TENTHS for
precision, but adding other precision levels is pretty straight
forward.

This also uses proliphix as an example of changing the precision for a
platform.

Closes bug #4350
2016-11-27 14:19:12 -08:00
Paulus Schoutsen
0d734303a4 HTTP: Fix registering views after start (#4604) 2016-11-27 14:01:12 -08:00
Lewis Juggins
ff4cb23f2a Update nginx docs (#4603) 2016-11-27 13:49:21 -08:00
Paulus Schoutsen
e94b4ec006 Tweak services return result (#4600)
* Tweak services return result

* Lint
2016-11-27 12:33:02 -08:00
Paulus Schoutsen
be91207830 Upgrade HBMQTT (#4599) 2016-11-27 12:21:20 -08:00
Ron Klinkien
ecf285105c Fixed unit_of_measurement functionality for knx sensor (#4594) 2016-11-27 12:21:05 -08:00
Paulus Schoutsen
767f3d58ff Add websocket_api as frontend dependency 2016-11-27 12:13:01 -08:00
Lewis Juggins
34097cda24 Allow generic thermostat tolerance to be customisable to determine the temperature difference required to turn switch on. (#4585) 2016-11-27 09:31:00 +00:00
Michaël Arnauts
0ce3703e30 Remove fixed throttle for binary_sensor.command_line and sensor.command_line since the scan_interval is configured trough YAML since #1059 (#4586)
* Remove fixed throttle for binary_sensor.command_line and sensor.command_line since the scan_interval is configured trough YAML since #1059

* Clean up imports

* Add SCAN_INTERVAL=60 to put default scan_inteval back to 60
2016-11-27 00:29:49 -08:00
Paulus Schoutsen
464e843186 Update frontend 2016-11-26 23:44:20 -08:00
Paulus Schoutsen
5d2b7a6e0b Add ping to websockets API (#4592) 2016-11-26 23:22:34 -08:00
Paulus Schoutsen
914a868fbd Add websocket API (#4582)
* Add websocket API

* Add identifiers to interactions

* Allow unsubscribing event listeners

* Add support for fetching data

* Clean up handling code websockets api

* Lint

* Add Home Assistant version to auth messages

* Py.test be less verbose in tox
2016-11-26 18:23:28 -08:00
Paulus Schoutsen
03e0c7c71c Prevent edimax from doing I/O in event loop (#4584) 2016-11-26 10:10:29 -08:00
Paulus Schoutsen
32ffd006fa Reorganize HTTP component (#4575)
* Move HTTP to own folder

* Break HTTP into middlewares

* Lint

* Split tests per middleware

* Clean up HTTP tests

* Make HomeAssistantViews more stateless

* Lint

* Make HTTP setup async
2016-11-25 13:04:06 -08:00
Fabian Affolter
58b85b2e0e Upgrade speedtest-cli to 1.0.0 (#4578) 2016-11-25 12:30:53 -08:00
Marcelo Moreira de Mello
61653a517d #4421 - Forced icons to be displayed via SSL to avoid Mixed Content warnings (#4544)
* #4421 - Forced icons to be displayed via SSL to avoid Mixed Content warnings

* Fixed houndci-bot whitespace

* Using regex to replace http:// for https://

* Created assert test to verify https translation
2016-11-25 20:03:12 +00:00
Vlad Korniev
2a7bc0e55c Advanced Ip filtering (#4424)
* Added IP Bans configuration

* Fixing warnings

* Added ban enabled option and unit tests

* Fixed py34 tox

* http: requested changes fix

* Requested changes fix
2016-11-24 21:52:10 -08:00
Lewis Juggins
95b439fbd5 Upgrade aiohttp to 1.1.5 (#4213) 2016-11-24 21:37:56 -08:00
Paulus Schoutsen
1872481f47 Merge pull request #4572 from home-assistant/release-0-33-4
0.33.4
2016-11-24 15:37:38 -08:00
Paulus Schoutsen
44b6d23e0f Version bump to 0.33.4 2016-11-24 14:57:12 -08:00
Paulus Schoutsen
58eb0ec52a Set executor pool size to 10 (#4571) 2016-11-24 14:56:59 -08:00
Paulus Schoutsen
febe16d700 Set executor pool size to 10 (#4571) 2016-11-24 14:56:33 -08:00
Pascal Vizeli
8c56091af7 Hotfix executor pool size (#4552) 2016-11-24 14:53:46 -08:00
Paulus Schoutsen
eacdce9ed9 Track tasks only during shutdown and tests (#4428)
* Track tasks only when needed

* Tweak async_block_till_done
2016-11-24 14:49:29 -08:00
Paulus Schoutsen
42c99b0ccb Pass hass object to ServiceRegistry constructor (#4570) 2016-11-24 14:02:39 -08:00
Jon Caruana
2a6c0cfc17 LiteJet: Unit tests and new trigger options held_more_than and held_less_than. (#4473)
* LiteJet: Unit tests and new trigger options held_more_than and held_less_than.
* Unit tests for the LiteJet component and associated platforms. Coverage is almost 100% -- just misses one line.
* The automation LiteJet trigger returns an empty "removal" function to ensure the automation base is happy with it. The pylitejet library doesn't actually support a real removal.
* The automation LiteJet trigger can detect hold time and act appropriately to support things like short tap or long hold.

* LiteJet: Fix indent in unit test source code.

* LiteJet: Fix test_include_switches_* unit tests on Python 3.5

* LiteJet: Remove wait for state existence from unit tests. Recent fixes to discovery make this no longer necessary.
2016-11-24 09:52:15 -08:00
Fabian Affolter
84040892df Remove globally disable pylint issue (#4565) 2016-11-24 12:25:01 +01:00
Fabian Affolter
345008c673 Fix docstring (#4564) 2016-11-24 10:15:00 +01:00
Matt N
14d1494cd2 systemmonitor: Support monitoring removable network interfaces (#4462) 2016-11-24 10:14:38 +01:00
Marcel030nl
f1d11e77ed Update pvoutput.py (#4557)
This addition could be usefull when working with the template sensor using the data of this sensor.
2016-11-24 09:58:38 +01:00
Fabian Affolter
b1b8715f7d Minor comment updates and ordering (#4554) 2016-11-24 00:27:31 +01:00
Fabian Affolter
b6d559da1f Add timeout to requests, use consts, and add link to docs (#4555) 2016-11-24 00:26:59 +01:00
Fabian Affolter
475c412ae4 Minor changes (switch.hook) (#4553)
* Use string formatting, add link to docs, and pylint

* Extent platform for validation
2016-11-24 00:21:48 +01:00
Pascal Vizeli
c04a002c55 Hotfix executor pool size (#4552) 2016-11-23 09:52:03 -08:00
dasos
5013a82655 Hook Smart Home support (#4392)
* Support for Hook (hooksmarthome.com)

* Linting

* Add asyncio

* Move to aiohttp

* Yield more
2016-11-23 14:52:14 +00:00
Johan Bloemberg
05181bf232 0.4 release upstream. (#4545) 2016-11-23 10:44:37 +00:00
Marcelo Moreira de Mello
c22a73e1d0 Removed raise statement to don't pollute the user log. (#4536)
* Removed raise statement to don't polute the user log.
Only the error message should be displayed.

Nov 22 11:28:32 tchellopi hass[20138]: 16-11-22 11:28:32 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Nov 22 11:28:32 tchellopi hass[20138]: Traceback (most recent call last):
Nov 22 11:28:32 tchellopi hass[20138]: File "/usr/local/lib/python3.5/asyncio/tasks.py", line 241, in _step
Nov 22 11:28:32 tchellopi hass[20138]: result = coro.throw(exc)
Nov 22 11:28:32 tchellopi hass[20138]: File "/home/hass/.virtualenvs/home_assistant/lib/python3.5/site-packages/homeassistant/helpers/entity_component.py", line 386, in _update_entity_states
Nov 22 11:28:32 tchellopi hass[20138]: yield from update_coro
Nov 22 11:28:32 tchellopi hass[20138]: File "/home/hass/.virtualenvs/home_assistant/lib/python3.5/site-packages/homeassistant/helpers/entity.py", line 213, in async_update_ha_state
Nov 22 11:28:32 tchellopi hass[20138]: yield from self.hass.loop.run_in_executor(None, self.update)
Nov 22 11:28:32 tchellopi hass[20138]: File "/usr/local/lib/python3.5/asyncio/futures.py", line 361, in __iter__
Nov 22 11:28:32 tchellopi hass[20138]: yield self  # This tells Task to wait for completion.
Nov 22 11:28:32 tchellopi hass[20138]: File "/usr/local/lib/python3.5/asyncio/tasks.py", line 296, in _wakeup
Nov 22 11:28:32 tchellopi hass[20138]: future.result()
Nov 22 11:28:32 tchellopi hass[20138]: File "/usr/local/lib/python3.5/asyncio/futures.py", line 274, in result
Nov 22 11:28:32 tchellopi hass[20138]: raise self._exception
Nov 22 11:28:32 tchellopi hass[20138]: File "/usr/local/lib/python3.5/concurrent/futures/thread.py", line 55, in run
Nov 22 11:28:32 tchellopi hass[20138]: result = self.fn(*self.args, **self.kwargs)
Nov 22 11:28:32 tchellopi hass[20138]: File "/home/hass/.homeassistant/custom_components/sensor/wunderground.py", line 187, in update
Nov 22 11:28:32 tchellopi hass[20138]: self.rest.update()
Nov 22 11:28:32 tchellopi hass[20138]: File "/home/hass/.virtualenvs/home_assistant/lib/python3.5/site-packages/homeassistant/util/__init__.py", line 296, in wrapper
Nov 22 11:28:32 tchellopi hass[20138]: result = method(*args, **kwargs)
Nov 22 11:28:32 tchellopi hass[20138]: File "/home/hass/.homeassistant/custom_components/sensor/wunderground.py", line 222, in update
Nov 22 11:28:32 tchellopi hass[20138]: ["description"])
Nov 22 11:28:32 tchellopi hass[20138]: ValueError: you must supply a key

* Updated unittest since we are just printing the error instead raising
2016-11-22 23:41:51 -08:00
Charles Blonde
c9b353f7a7 Add Bose SoundTouch device support - v2 (#4523)
* Add Bose SoundTouch device support

* Update soundtouch.py
2016-11-22 23:22:52 -08:00
Johan Bloemberg
64cfc4ff02 DSMR sensor (#4309)
* Initial implemenation of DSMR component.

* Fix linting

* Remove protocol V2.2 support until merged upstream.

* Generate requirements using script.

* Use updated dsmr-parser with protocol 2.2 support.

* Add tests.

* Isort and input validation.

* Add entities for gas and actual meter reading. Error handling. Use Throttle.

* Implement non-blocking serial reader.

* Improve logging.

* Merge entities into one, add icons, fix tests for asyncio.

* Add error logging for serial reader.

* Refactoring and documentation.

- refactor asyncio reader task to make sure it stops with HA
- document general principle of this component
- refactor entity reading to be more clear
- remove cruft from split entity implementation

* Use `port` configuration key.

* DSMR V2.2 seems to conflict in explaining which tariff is high and low.

http://www.netbeheernederland.nl/themas/hotspot/hotspot-documenten/?dossierid=11010056&title=Slimme%20meter&onderdeel=Documenten
> DSMR v2.2 Final P1
>> 6.1: table vs table note

    Meter Reading electricity delivered to client normal tariff) in 0,01 kWh - 1-0:1.8.1.255
    Meter Reading electricity delivered to client (low tariff) in 0,01 kWh - 1-0:1.8.2.255

    Note: Tariff code 1 is used for low tariff and tariff code 2 is used for normal tariff.

* Refactor to use asyncio.Protocol instead of loop+queue.

* Fix requirements

* Close transport when HA stops.

* Cleanup.

* Include as dependency for testing (until merged upstream.)

* Fix style.

* Update setup.cfg
2016-11-22 23:03:39 -08:00
Valentin Alexeev
bb46009efa World Air Quality Index sensor (#4434)
* Implement WAQI sensor

* Corrections based on CI check.

* Updated requirements_all.txt for pwaqi==1.2

* Require latest version of pwaqi

* Fix lint: single argument for .exception and no more pass statement.

* Further lint fixes.

* pydocstyle fix

* Implement rate throttle.
Data on WAQI is usually updated once an hour - make it refresh every thirty minutes.

* Implement schema validation with voluptuous.
Change exception handling scope.
Move messages to debug().

* Fix lint (empty indented line).

* Sort lines correctly.

* Fix last lint issue.

* Provide additional sensor data as received from WAQI.
Easier-to-read throttle timing.

* Additional object attributes to be unrolled later.
2016-11-22 22:59:27 -08:00
Paulus Schoutsen
3f9250415f Skip broken tests (#4543) 2016-11-22 22:58:14 -08:00
Pascal Vizeli
c294a534d0 Migrate binary_sensor to async (#4516) 2016-11-22 22:47:43 -08:00
Harris Borawski
85d6970df8 Add Sensor for Sonarr (#4496)
* Add sonarr sensor and tests for sensor

* Fixed some linting errors and removed unused import

* Add SSL option for those who use SSL from within Sonarr

* Add requirements to all requirements, and sensor to coveragerc

* remove unused variable

* move methods to functions, and other lint fixes

* linting fixes

* linting is clean now

* Remove double requirement

* fix linting for docstrings, this should probably be a part of the script/lint and not just travis
2016-11-22 22:32:45 -08:00
dainok
260a619a40 Added GPSLogger API (#4089)
* Added GPSLogger API, check https://goo.gl/eJnKw5 for details.

* Switched to debug severity and added to coveragerc

* Switched to debug severity for logs

* Updated .coveragerc

* Update .coveragerc

* Merged from sfiorini

* Merged from sfiorini

* Update .coveragerc
2016-11-22 22:19:57 -08:00
Michaël Arnauts
0c6ef3b7f9 Try to register a Chromecast anyway, even if it could not be detected by get_chromecasts(), since it might be on a other network. Fixes #4469. (#4470) 2016-11-22 22:16:01 -08:00
Thomas Friedel
0c47434aad Change Osram to use Github lightify dep (#4256)
* used MindrustUK's version ( https://github.com/MindrustUK/python-lightify/commits/master/osramlightify.py ) from Oct 2, 2016 and changed the REQUIRMENTS line to use the fixed lightify component with thread safety fixes

* reformatted long lines

* updated osramlightify requirements in requirements_all.txt

* ran script gen_requirements_all.py

* rerun requirements gen script on linux

* fixed some inspection warnings

* zip file points to a specific commit

* no requests to lights in properties, instead instance variables are update in update method

* regenerated requirements_all.txt

* removed call to update from is_on() property
2016-11-22 22:10:45 -08:00
Magnus Ihse Bursie
1d8a1df2c4 Refactor tellstick code (#4460)
* Refactor tellstick code for increased readability. Especially highlight if "device" is a telldus core device or a HA entity.

* Refactor Tellstick object model for increased clarity.

* Update comments. Unify better with sensors. Fix typo bug. Add debug logging.

* Refactor tellstick code for increased readability. Especially highlight if "device" is a telldus core device or a HA entity.

* Refactor Tellstick object model for increased clarity.

* Update comments. Unify better with sensors. Fix typo bug. Add debug logging.

* Fix lint issues.
2016-11-22 21:48:22 -08:00
Aaron Morris
65b85ec6c0 Fix missing space in error message between "accuracy" and "is" (#4542) 2016-11-22 20:45:06 -08:00
Paulus Schoutsen
b6b9da7e6e Merge pull request #4541 from home-assistant/release-0-33-3
0.33.3
2016-11-22 20:35:55 -08:00
Paulus Schoutsen
d18f2684fb Version bump to 0.33.3 2016-11-22 19:39:15 -08:00
Paulus Schoutsen
e93b079ef4 Fix platform discovery when platform discovered during discovery of a (#4529)
component
2016-11-22 19:38:34 -08:00
Paulus Schoutsen
356ad6e468 Bump netdisco (#4539) 2016-11-22 19:36:39 -08:00
Johann Kellerman
8f35212dd6 Yr.no update entities every hour (#4521) 2016-11-22 19:35:49 -08:00
Johann Kellerman
0827a26642 Yr.no update entities every hour (#4521) 2016-11-22 19:28:31 -08:00
Paulus Schoutsen
b4756e6dda Bump netdisco (#4539) 2016-11-22 18:36:10 -08:00
Paulus Schoutsen
4cc192e445 Disable broken google offset test (#4540) 2016-11-22 18:34:48 -08:00
mnestor
962e5315ab Mock call to google servers (#4532)
* Fix for #4520

* mock call to do_auth to prevent call to google servers
2016-11-22 18:19:32 -08:00
Paulus Schoutsen
2c7e895105 Entity and climate: do not convert temperature unnecessary (#4522)
* Climate: more consistent units

* Prevent unnecessary conversion in entity component

* int -> round

* Disable Google tests because they connect to the internet

* Remove default conversion rounding F->C

* Add rounding of temp to weather comp

* Fix equality

* Maintain precision when converting temp in entity

* Revert "Disable Google tests because they connect to the internet"

This reverts commit b60485dc19.
2016-11-22 17:38:04 -08:00
Paulus Schoutsen
00019b9ff0 Fix warning in test 2016-11-22 12:48:35 -08:00
Pascal Vizeli
8e776b4dc0 Fix wrong name handling in rfxtrx sensor (#4531) 2016-11-22 12:47:37 -08:00
mnestor
ce13b0989d Fix for #4520 (#4526)
* Fix for #4520

* fix lint
2016-11-22 10:15:39 -08:00
Paulus Schoutsen
c81735cc84 Fix platform discovery when platform discovered during discovery of a (#4529)
component
2016-11-22 08:21:08 -08:00
Fabian Affolter
5d18759146 Upgrade miflora to 0.1.13 (fixes #4479) (#4524) 2016-11-22 15:41:37 +01:00
Malte Franken
9cdcfae8f3 New config parameter for min_max sensor to specify number of digits for rounding mean value (#4237)
* new config parameter to specify number of digits for rounding average value

* fixed two `line too long` errors

* added three new tests for the mean sensor including test for precision of mean value
2016-11-22 15:36:29 +01:00
Gilles Margerie
547d93f631 Added source selection for Denon AVR Media Player (#4304)
* Added source selection for Denon AVR Media Player

* Update denon.py

* Update denon.py

* Update denon.py

* Update denon.py

* Update denon.py

slight format update (space issue and new line)

* Further update regarding formatting

* Updated the source name with lowercase

* Update denon.py
2016-11-21 23:45:17 -08:00
Paulus Schoutsen
d841ddc50b Merge pull request #4519 from home-assistant/release-0-33-2
0.33.2
2016-11-21 20:42:21 -08:00
Paulus Schoutsen
40b5824230 Skip google calendar offset test (#4520) 2016-11-21 20:16:50 -08:00
Paulus Schoutsen
86f3e2455d Skip google calendar offset test (#4520) 2016-11-21 20:16:34 -08:00
Paulus Schoutsen
9a065cc536 Version bump to 0.33.2 2016-11-21 19:40:19 -08:00
Richard Cox
8e4dbcaf21 Fixing 'Unknown' status for Nest Protect devices (#4475)
* Fixing 'Unknown' status for Nest Protect devices

* Fixing bad formatting
2016-11-21 19:39:38 -08:00
Richard Cox
6863d2e0af Fixing 'Unknown' status for Nest Protect devices (#4475)
* Fixing 'Unknown' status for Nest Protect devices

* Fixing bad formatting
2016-11-21 19:39:23 -08:00
John Arild Berentsen
c23809488b Neato Fixes (#4490)
* Fix, switch state. Move constants to hub

* Responsiveness

* Whitespace

* Delay was not needed as commands does not return until done.
2016-11-21 19:36:54 -08:00
John Arild Berentsen
248f5c0209 Neato Fixes (#4490)
* Fix, switch state. Move constants to hub

* Responsiveness

* Whitespace

* Delay was not needed as commands does not return until done.
2016-11-21 19:36:44 -08:00
Jack Chapple
e5aa40fa5d Fixes #4500 (#4502) 2016-11-21 19:35:49 -08:00
Jack Chapple
1f573b46a4 Fixes #4500 (#4502) 2016-11-21 19:35:36 -08:00
hexa-
0647bb7f6b switch.tplink: expect daily stats to be empty (#4504)
Signed-off-by: Martin Weinelt <hexa@darmstadt.ccc.de>
2016-11-21 19:34:58 -08:00
hexa-
a73fbbaf7a switch.tplink: expect daily stats to be empty (#4504)
Signed-off-by: Martin Weinelt <hexa@darmstadt.ccc.de>
2016-11-21 19:34:48 -08:00
Pascal Vizeli
755f5b61b7 Bugfix discovery use wrong time async (#4515)
* Bugfix discovery use wrong time async

* fix lint
2016-11-21 19:33:32 -08:00
Pascal Vizeli
6869c7401e Bugfix device_tracker init tracker scan (#4514) 2016-11-21 19:33:32 -08:00
Pascal Vizeli
835577b2bc Bugfix discovery use wrong time async (#4515)
* Bugfix discovery use wrong time async

* fix lint
2016-11-21 19:33:08 -08:00
Pascal Vizeli
859d0d5ad6 Bugfix device_tracker init tracker scan (#4514) 2016-11-21 19:32:21 -08:00
Fabian Affolter
aed797f438 Upgrade freesms to 0.1.1 (#4491) 2016-11-21 17:32:05 +01:00
Fabian Affolter
eb8093934f Upgrade python-hpilo to 3.9 (#4482) 2016-11-21 17:31:14 +01:00
Fabian Affolter
608b482906 Upgrade sqlalchemy to 1.1.4 (#4486) 2016-11-21 17:29:06 +01:00
Fabian Affolter
7207c2cca1 Upgrade sendgrid to 3.6.3 (#4485) 2016-11-21 17:28:31 +01:00
Fabian Affolter
ed1d0b4197 Upgrade astral to 1.3.2 (#4505) 2016-11-21 17:27:48 +01:00
Fabian Affolter
63461e9007 Upgrade slacker to 0.9.30 (#4484) 2016-11-21 17:27:15 +01:00
Fabian Affolter
40a2145558 Upgrade yahoo-finance to 1.4.0 (#4483) 2016-11-21 17:25:43 +01:00
Sean Dague
d883b18751 Merge pull request #4503 from sdague/pyvera_bump
Bump pyvera to 0.2.21
2016-11-21 06:09:54 -05:00
Sean Dague
b8e462cf5b Bump pyvera to 0.2.21
pyvera 0.2.21 fixes the fact that use of requests.get was not using a
timeout. Some times (after a few days of use) the pyvera poll loop
would hang indefinitely on a requests.get of the event interface. This
would cause the pyvera thread to hang completely. It would also
prevent graceful shutdown, as pyvera does a thread join.

The new version uses a timeout, so that we won't lock up any more.
2016-11-21 06:06:17 -05:00
Paulus Schoutsen
11df7becd3 Merge pull request #4492 from home-assistant/release-0-33-1
0.33.1
2016-11-20 13:58:01 -08:00
Paulus Schoutsen
99f5db8c02 Version bump to 0.33.1 2016-11-20 12:11:07 -08:00
John Arild Berentsen
19b08a975a ZWave lights: Not use super() (#4476)
* Not use super

* Review changes
2016-11-20 12:10:50 -08:00
John Arild Berentsen
123f4acfc1 ZWave lights: Not use super() (#4476)
* Not use super

* Review changes
2016-11-20 11:49:54 -08:00
Paulus Schoutsen
0f90426023 Version bump to 0.34.0.dev0 2016-11-19 16:06:42 -08:00
Paulus Schoutsen
8b6a94b0f5 Merge pull request #4446 from home-assistant/dev
0.33
2016-11-19 16:06:26 -08:00
Paulus Schoutsen
0a333230c1 Version bump to 0.33 2016-11-19 16:05:56 -08:00
Paulus Schoutsen
455e1df7cb Fix typo 2016-11-19 16:05:33 -08:00
Matt N
f71396c293 Fix nmap_tracker documentation link (#4471) 2016-11-19 15:31:45 -08:00
Paulus Schoutsen
d930c399fe Better locking while setting up components + discovery (#4463) 2016-11-19 08:18:33 -08:00
Bjarni Ivarsson
f3748ce535 Sonos line-in and tv source fixes + Sonos discovery fix. (#4440)
* Fixes line-in and tv sources on Sonos + Sonos discovery fixes.

* Style fix.
2016-11-19 15:29:00 +00:00
John Arild Berentsen
8beefcfc69 Switch did not update (#4466) 2016-11-19 15:52:42 +01:00
John Arild Berentsen
93747f2766 switch base cover did not appear (#4454)
Thanks for testing the PR @emilhetty 👍
2016-11-19 12:33:08 +01:00
John Arild Berentsen
7af438fa2f Hound for zwave climate (#4465) 2016-11-19 10:19:22 +01:00
Fabian Affolter
2b5fcd737b PVOutput sensor (#4203)
* Add PVOutput sensor

* Remove attributes

* Revert `verify_ssl` back to true
2016-11-19 10:04:03 +01:00
John Arild Berentsen
2b320f23fc Hound comments (#4464) 2016-11-19 09:46:02 +01:00
John Arild Berentsen
679d500e61 Neato refactor and support for sensors (#4319)
* Imporvements to neato

* Review changes
2016-11-19 00:14:40 -08:00
mnestor
613615433a Google Calendar round 2 (#4161)
* Google Calendar round 2

* Add google back to .coveragerc

* Update __init__.py
2016-11-18 22:29:20 -08:00
Fabian Affolter
f70ff66d11 Upgrade batinfo to 0.4.2 (#4452) 2016-11-18 22:04:15 -08:00
Paulus Schoutsen
d2bbc6ef70 Upgrade linter (#4461) 2016-11-18 21:47:59 -08:00
Paulus Schoutsen
37e28428c1 Merge remote-tracking branch 'origin/master' into dev 2016-11-18 18:39:11 -08:00
Pascal Vizeli
c56f99baaf Async migration device_tracker (#4406)
* Async migration device_tracker

* change location stuff to async

* address paulus comments

* fix lint & add async discovery listener

* address paulus comments v2

* fix tests

* fix test_mqtt

* fix test_init

* fix gps_acc

* fix lint

* change async_update_stale to callback
2016-11-18 23:35:08 +01:00
Erik Eriksson
265232af98 only check heater status if present (#4459) 2016-11-18 14:12:51 -08:00
Fabian Affolter
e6c4113c5b Fix lint issues for 0.33 (#4451)
* Fix PEP257 issues

* Fix ident

* Fix lint issues

* Update docstrings

* Fix indent

* Fix indent

* Fix lint issues

* Fix lint issue

* Again lint
2016-11-18 23:05:03 +01:00
Igor Shults
c86e1b31b3 Fix typo in OWM (#4458) 2016-11-18 22:54:46 +01:00
Lewis Juggins
5912316496 pywebpush update to 0.6.1 (#4449) 2016-11-18 13:03:44 -08:00
John Arild Berentsen
58f0655298 ZWave Light: Use Configurable refresh (#4437)
* Use Configurable refresh

* Use super instead of object
2016-11-18 21:59:01 +01:00
John Arild Berentsen
43a93fb345 ZWave: Fix missing battery_level, node_id and location (#4422)
* Fix missing battery_level, node_id and location

* use super instead of object
2016-11-18 21:42:30 +01:00
Daniel Høyer Iversen
36b338051b Merge pull request #4450 from home-assistant/flux_led_lib_09
Upgrade flux led lib
2016-11-18 14:18:12 +01:00
Daniel Hoyer Iversen
fc566309c1 Upgrade flux led lib 2016-11-18 13:20:51 +01:00
Sean Dague
23ce9949b1 Merge pull request #4447 from sdague/proliphix
bump proliphix library version
2016-11-18 06:56:04 -05:00
Sean Dague
275c80183c bump proliphix library version
This fixes an upstream bug with daylight savings time handling
2016-11-18 05:05:05 -05:00
Sean Dague
cd1655f43b create light.hue_activate_scene service (#4425)
* create light.hue_activate_scene service

This creates a light.hue_activate_scene service that takes group_name
and scene_name, and calls phue's bridge.run_scene with those
parameters. This allows calling hue bridge stored scene names by name
during automation.

This only currently works reliably in 1 hue hub configurations (which
is most of them). Phue will be further enhanced to display warnings
when it can't figure out what to do with the parameters passed in to HA.

* Update hue.py
2016-11-17 22:14:06 -08:00
jnimmo
1a117d0bea Add keypress & output control services to Envisalink component (#3932)
* Add keypress & output control services to Envisalink component

Add services to allow sending custom keypresses and activating
programmable outputs on an alarm control panel.
Implemented for the Envisalink alarm, and moving to new version of
pyenvisalink to support this.

Replicated the service handler mapping code from Cover component into
Alarm Control Panel to allow handling alternative schemas if required
by new services.

* Update requirements_all.txt

* Updated services.yaml

* Removed requirement to enter code in HA UI

Incorporated changes suggested by @sriram
https://github.com/srirams/home-assistant/commit/2f8deb70cb5f3621a69b6b9
acb72f8e29123650c

Including pending state for exit/entry delay

Clarified services to use the code passed to them as a first priority,
otherwise use the code from configuration

Swapped back to using NotImplementedError for the service definitions

* - Add support for alarm_keypress to manual alarm (functions like a standard alarm keypad where entering the code disarms or arms the alarm)
- Add tests for alarm_keypress to manual alarm
- Style corrections (too many returns, comment & whitespace issues)

* Removed alarm_output_control service as unable to incorporate in the demo/test in a meaningful way

* Add keypress & output control services to Envisalink component

Add services to allow sending custom keypresses and activating
programmable outputs on an alarm control panel.
Implemented for the Envisalink alarm, and moving to new version of
pyenvisalink to support this.

Replicated the service handler mapping code from Cover component into
Alarm Control Panel to allow handling alternative schemas if required
by new services.

* Update requirements_all.txt

* Updated services.yaml

* Removed requirement to enter code in HA UI

Incorporated changes suggested by @sriram
https://github.com/srirams/home-assistant/commit/2f8deb70cb5f3621a69b6b9
acb72f8e29123650c

Including pending state for exit/entry delay

Clarified services to use the code passed to them as a first priority,
otherwise use the code from configuration

Swapped back to using NotImplementedError for the service definitions

* - Add support for alarm_keypress to manual alarm (functions like a standard alarm keypad where entering the code disarms or arms the alarm)
- Add tests for alarm_keypress to manual alarm
- Style corrections (too many returns, comment & whitespace issues)

* Removed alarm_output_control service as unable to incorporate in the demo/test in a meaningful way

* Moved the Alarm_Keypress service into Envisalink component out of the generic

* Update envisalink.py

* Update services.yaml
2016-11-17 22:13:22 -08:00
Fabian Affolter
944bb8474f Change validation to optional (#4400) 2016-11-17 22:09:57 -08:00
Magnus Ihse Bursie
779f520c56 Make UI more responsive to power off for Samsung Smart TV (#4438) 2016-11-17 22:00:18 -08:00
Magnus Ihse Bursie
82ed7b6b08 Fix so shell script adheres to posix standards. (#4439) 2016-11-17 21:59:53 -08:00
Paulus Schoutsen
af77341494 Add sensor to show how many clients are connected. (#4430)
* Add sensor to show how many clients are connected.

* Lint

* Fix tests
2016-11-17 21:54:47 -08:00
Paulus Schoutsen
23fb8c4cdd Convert script component to async (#4427) 2016-11-17 21:50:01 -08:00
Paulus Schoutsen
726bc5b670 Do not report on shutting down errors (#4431)
* Do not report on shutting down errors

* Lint
2016-11-17 12:02:43 -08:00
Open Home Automation
b615b3349f Fix for Miflora 2.6.6 firmware (#4436) 2016-11-17 08:40:21 -08:00
Paulus Schoutsen
0f59bb208c Migrate callbacks to use schedule_update_ha_state (#4426)
* Migrate callbacks to use schedule_update_ha_state

* Migrate MQTT sensor callback to async

* Migrate wemo to not update inside schedule_update_ha_state

* Make MQTT switch async

* Fix nx584 test

* Migrate tellstick callback

* Migrate vera callback

* Alarm control panel - manual: use async callbacks

* Run the switch rest tests that work
2016-11-17 07:34:46 -08:00
Paulus Schoutsen
38d201a54a Increase logging level of errors while doing jobs (#4429) 2016-11-16 23:01:14 -08:00
Pascal Vizeli
c8bc1e3c5d change add_job to use call_soon_threadsafe (#4410)
* change add_job to use call_soon_threadsafe

* address comments from paulus

* Tweak core tests

* Fix tests Python 3.4.2
2016-11-16 20:00:08 -08:00
Lewis Juggins
a862bc4edc Fix DLink async I/O (#4301) 2016-11-16 18:55:58 -08:00
Magnus Ihse Bursie
b0e3d5a576 Better handling of accented characters in slugify (#4399) (#4423)
* Better handling of accented characters in slugify (#4399)

* Update __init__.py
2016-11-16 15:05:10 -08:00
Paulus Schoutsen
f006b00dc1 Fix spelling schedule_update_ha_state (#4415) 2016-11-16 08:26:29 -08:00
bestlibre
1fff6ce438 Deduplicate MQTT_PUBLISH_SCHEMA definition (#4411) 2016-11-16 08:19:00 -08:00
Sean Dague
c06c82905a dynamically fetch yamaha media playback support (#4385)
This makes it so that media playback support for inputs is dynamically
fetched from the receiver, instead of assuming that all playback
commands work for all inputs.

Tests are added for this, using a FakeYamaha class, which has some
sample data stubbed in for key methods that need to be called. We also
include an example of the desc.xml needed to dynamically parse these
features for these tests (as this is done in platform init).
2016-11-15 21:56:40 -08:00
Paulus Schoutsen
2b86d89bb4 Fix tplink test 2016-11-15 21:26:03 -08:00
Sean Dague
7bdb79bd54 bump phue to 0.9 (#4404)
This increases the phue library to 0.9, which includes some basic
Scene support that could be consumed from home assistant.
2016-11-15 21:14:54 -08:00
Pascal Vizeli
41aaeb715a Convert switch to AsnycIO (#4382)
* Convert switch to AsnycIO

* Move update entity to service

* use time better for faster handling

* Change to suggestion from paulus

* Use new shedule_update_ha_state

* fix lint

* minimize executor calls
2016-11-15 21:06:50 -08:00
Fabian Affolter
5d8a465c18 Add timeout to requests (#4398) 2016-11-15 21:02:17 -08:00
John Arild Berentsen
c6f5a5443f Make zwave climate entities contain it's respective setpoints (#4357)
* Make zwave entities contain it's respective setpoints

* Add fan state
2016-11-15 13:14:29 +01:00
Fabian Affolter
d6cb102f63 Merge pull request #4144 from dasos/squeezebox_name_fix
Squeezebox name
2016-11-15 10:06:10 +01:00
Fabian Affolter
edde76e544 Fix validation and use consts (mqtt) (#4396) 2016-11-15 08:33:42 +01:00
Fabian Affolter
d5fff2f94a Fix validation and use consts (mqtt) 2016-11-15 08:21:44 +01:00
bestlibre
0e0ba28249 support for last will and birth message for mqtt (#4381) 2016-11-14 22:18:33 -08:00
Paulus Schoutsen
6745e83a6c Merge pull request #4394 from home-assistant/release-0-32-4
0.32.4
2016-11-14 22:04:43 -08:00
Paulus Schoutsen
44bc057fdb Version bump to 0.32.4 2016-11-14 21:34:40 -08:00
hexa-
96b8d8fcfa http: reimplement X-Forwarded-For parsing (#4355)
This feature needs to be enabled through the `http.use_x_forwarded_for` option,
satisfying security concerns of spoofed remote addresses in untrusted network
environments.

The testsuite was enhanced to explicitly test the functionality of the
header.

Fixes #4265.

Signed-off-by: Martin Weinelt <hexa@darmstadt.ccc.de>
2016-11-14 21:33:34 -08:00
Sean Dague
fc2df34206 Pin versions on linters for tests
The linters really need to specify an exact version, because when
either flake8 or pylint release a new version, a whole lot of new
issues are caught, causing failures on the code unrelated to the
patches being pushed.

Pinning is a best practice for linters. This allows patches which move
forward the linter version to happen with any code fixes required for
it to pass.
2016-11-14 21:32:02 -08:00
Paulus Schoutsen
09c29737de Fix device tracker sending invalid event data 2016-11-14 21:31:17 -08:00
Paulus Schoutsen
4c01b47945 device_tracker.see should not call async methods (#4377) 2016-11-14 21:31:06 -08:00
Paulus Schoutsen
7aaf3a46db Fix device tracker sending invalid event data (#4393) 2016-11-14 21:28:57 -08:00
Paulus Schoutsen
d774ba46c7 Fix device tracker sending invalid event data 2016-11-14 20:59:29 -08:00
Lewis Juggins
4c37ee8884 Handle live content better in Kodi (#4388) 2016-11-14 20:11:22 -08:00
Paulus Schoutsen
7f5f458074 Faster async entity update on component. (#4384) 2016-11-14 18:54:38 -08:00
Paulus Schoutsen
479457d6ec device_tracker.see should not call async methods (#4377) 2016-11-14 18:35:58 -08:00
Paulus Schoutsen
7e73d27dd1 Do not serve HTTP requests while stopping (#4378) 2016-11-14 18:33:53 -08:00
Martin Wood
e7ffec87ac Squeezebox name fix #4019 2016-11-14 21:46:05 +00:00
Robbie Trencheny
2d47b187c5 notify.html5: decode bytes values in registration data (#4379)
Occassionally the values of `keys` and `p256h` are bytes objects instead of
strings. As JSON by default does not serialize bytes objects let's decode
bytes objects to unicode strings.

Resolves the registration issue mentioned in #4012.

Signed-off-by: Martin Weinelt <hexa@darmstadt.ccc.de>
2016-11-14 11:35:31 -08:00
Sean Dague
fe2103dedb Merge pull request #4386 from sdague/lint
Pin versions on linters for tests
2016-11-14 13:58:50 -05:00
Sean Dague
7bf5d1c662 Pin versions on linters for tests
The linters really need to specify an exact version, because when
either flake8 or pylint release a new version, a whole lot of new
issues are caught, causing failures on the code unrelated to the
patches being pushed.

Pinning is a best practice for linters. This allows patches which move
forward the linter version to happen with any code fixes required for
it to pass.
2016-11-14 13:50:27 -05:00
pvizeli
cb24282040 Faster async entity update on component. 2016-11-14 14:18:04 +01:00
Fabian Affolter
bd9429d3af Upgrade sendgrid to 3.6.2 (#4370) 2016-11-14 09:35:08 +01:00
Martin Weinelt
d7a005ad0f notify.html5: decode bytes values in registration data
Occassionally the values of `keys` and `p256h` are bytes objects instead of
strings. As JSON by default does not serialize bytes objects let's decode
bytes objects to unicode strings.

Resolves the registration issue mentioned in #4012.

Signed-off-by: Martin Weinelt <hexa@darmstadt.ccc.de>
2016-11-14 05:14:18 +01:00
Paulus Schoutsen
2e2a996a8e Do not serve HTTP requests while stopping 2016-11-13 18:12:50 -08:00
Paulus Schoutsen
0364498dee Add .hound.yml 2016-11-13 11:34:09 -08:00
Daniel Høyer Iversen
c5fdd4392a Merge pull request #4373 from home-assistant/flux_led_color_bright
support color and brightness in flux_led light
2016-11-13 20:33:48 +01:00
Daniel Hoyer Iversen
895454b6c3 support color and brightness in flux_led light 2016-11-13 11:10:27 +01:00
Nathan Henrie
2109b7a1b9 Use entity_id for backend, friendly name for frontend (#4343)
* Use entity_id for backend, friendly name for frontend

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

Command line switches had the option to set a `friendly_name` reportedly
for use in the front end. However, if set, it was also being used as the
`entity_id`.

This did not seem like obvious behavior to me. This PR changes the
behavior so the entity_id is the object_id, which must already be
unique, and is an obvious place to have a very predictable slug (even if
long or unsightly), and the friendly name (if set) is used for the
display.

Example:

```yaml
switch:
  platform: command_line
  switches:
    rf_kitchen_light_one:
      command_on: switch_command on kitchen
      command_off: switch_command off kitchen
      command_state: query_command kitchen
      value_template: '{{ value == "online" }}'
      friendly_name: "Beautiful bright kitchen light!"
```

If you were using in an automation or from dev tools, would use:
`switch.rf_kitchen_light_one`, but your front end would still show `Beautiful
bright kitchen light!`

* Add new arg to test_assumed_state_should_be_true_if_command_state_is_false

* Import ENTITY_ID _FORMAT from existing, rename device_name to object_id

* Rename `device_name` to `object_id`

* Test that `entity_id` and `name` are set as expected
2016-11-12 22:46:23 -08:00
Pascal Vizeli
71a305ea45 Hotfix deadlock on platform setup (#4354)
* Hotfix deadlock on platform setup

* fix wrong import
2016-11-12 16:19:13 -08:00
hexa-
e73634e6c7 http: reimplement X-Forwarded-For parsing (#4355)
This feature needs to be enabled through the `http.use_x_forwarded_for` option,
satisfying security concerns of spoofed remote addresses in untrusted network
environments.

The testsuite was enhanced to explicitly test the functionality of the
header.

Fixes #4265.

Signed-off-by: Martin Weinelt <hexa@darmstadt.ccc.de>
2016-11-12 16:14:39 -08:00
Pascal Vizeli
3d47ad5018 Use hass aiohttp connector for ssl connection (#4344) 2016-11-12 16:00:31 -08:00
Erik Eriksson
c823ea9f2a Don't fail if component name is None. Fixes (#4345)
https://github.com/home-assistant/home-assistant/issues/4326

Might fix https://github.com/home-assistant/home-assistant/issues/4326
2016-11-12 14:16:27 -08:00
Fabian Affolter
75bcb1ff0f Upgrade schiene to 0.18 (#4359) 2016-11-12 12:30:05 -08:00
Sean Dague
1663cc9084 Fix typo in generic thermostat (#4348)
It looks like a copy / paste error was made when doing the min/max
code. This fixes that.
2016-11-11 17:42:58 +01:00
Christian Brædstrup
17cfcc981d D-Link switch version bump of external library (#4351) 2016-11-11 17:38:12 +01:00
Hugo Dupras
60fabaec24 Add timeout for Netatmo binary sensor (#4280)
* Add time limit for Netatmo binary sensor

* Change limit to timeout

Signed-off-by: Hugo D. (jabesq) <jabesq@gmail.com>

* Update requirements_all.txt
2016-11-10 23:04:11 -08:00
Marcelo Moreira de Mello
5e44934e7e Added some extra options to Weather Underground component (#4306)
* Added some extra options to Weather Underground component

* Added Location and Elevation options

* Fixed if statement

* Fixed lint

* Updated tests including  elevation and location

* Update wunderground.py
2016-11-10 23:01:20 -08:00
Lewis Juggins
01a6c1c1c8 Add strptime template function (#3950) 2016-11-10 22:57:44 -08:00
Jeffrey Lin
cd1b0ac67d Added NVRAM-based MAC to IP mapping as backup to ARP tables (#4189) 2016-11-10 22:46:58 -08:00
Paulus Schoutsen
2bfded7153 MQTT.Server will use HASS eventloop (#3429) 2016-11-10 22:45:38 -08:00
Javier González Calleja
20af5cb5b4 Daily consumption information for HS110 (#4206)
* Add daily consumption information for HS110

* Fixing code review

* Fixing code review

* Fixing code review
2016-11-10 22:43:16 -08:00
Paulus Schoutsen
080f56e0f5 Merge pull request #4342 from home-assistant/release-0-32-3
0.32.3
2016-11-10 21:59:39 -08:00
Paulus Schoutsen
173e15e733 Version bump to 0.32.3 2016-11-10 21:50:05 -08:00
Paulus Schoutsen
72407c2f95 Make yr compatible with 0.32 2016-11-10 21:49:56 -08:00
Paulus Schoutsen
1b79722b69 Fix KNX async I/O (#4267) 2016-11-10 21:43:50 -08:00
Pascal Vizeli
cc5233103c Fix rest switch default template (#4331) 2016-11-10 21:43:50 -08:00
Daniel Høyer Iversen
2feea1d1eb Add support for rgb light in led flux, fixes issue #4303 (#4332) 2016-11-10 21:43:50 -08:00
Johann Kellerman
2c39c39d52 Improve async generic camera's error handling (#4316)
* Handle errors

* Feedback

* DisconnectedError
2016-11-10 21:43:48 -08:00
Paulus Schoutsen
6e6b1ef7ab fix panasonic viera doing I/O in event loop (#4341) 2016-11-10 21:42:41 -08:00
Pascal Vizeli
55ddaf1ee7 Synology SSL fix & Error handling (#4325)
* Synology SSL fix & Error handling

* change handling for cookies/ssl

* fix use not deprecated functions

* fix lint

* change verify

* fix connector close to coro

* fix force close

* not needed since websession close connector too

* fix params

* fix lint
2016-11-10 21:42:37 -08:00
Pascal Vizeli
6860d9b096 Update SoCo to 0.12 (#4337)
* Update SoCo to 0.12

* fix req
2016-11-10 21:41:28 -08:00
Sean Dague
3e1cc4282e Fix "argument of type 'NoneType' is not iterable" during discovery (#4279)
* Fix "argument of type 'NoneType' is not iterable" during discovery

When yamaha receivers are dynamically discovered, there config is
empty, which means that we need to set zone_ignore to [] otherwise the
iteration over receivers fails.

* Bump rxv library version to fix play_status bug

rxv version 0.3 will issue the play_status command even for sources
that don't support it, causing stack traces during updates when
receivers are on HDMI inputs.

This was fixed in rxv 0.3.1. Bump to fix bug #4226.

* Don't discovery receivers that we've already configured

The discovery component doesn't know anything about already configured
receivers. This means that specifying a receiver manually will make it
show up twice if you have the discovery component enabled.

This puts a platform specific work around here that ensures that if
the media_player is found, we ignore the discovery system.
2016-11-10 21:41:28 -08:00
Jan Losinski
200bdb30ff Change pilight systemcode validation to integer (#4286)
* Change pilight systemcode validation to integer

According to the pilight code the systemcode should be an integer and
not a string (it is an int in the pilight code). Passing this as a
string caused errors from pilight:
"ERROR: elro_800_switch: insufficient number of arguments"

This fixes #4282

* Change pilight unit-id to positive integer

According to the pilight code the unit of an entity is also evrywhere
handled as an integer. So converting and passing this as string causes
pilight not to work.

This fixes #4282

Signed-off-by: Jan Losinski <losinski@wh2.tu-dresden.de>
2016-11-10 21:41:28 -08:00
Paulus Schoutsen
eb17ba970c Increase update delay (#4321) 2016-11-10 21:41:28 -08:00
Paulus Schoutsen
ffe4c425af Fix Tellstick doing I/O inside event loop (#4268) 2016-11-10 21:41:28 -08:00
Jesse Newland
a18fdbfbb8 Fix alarm.com I/O inside properties (#4307)
* Fix alarm.com I/O inside properties

* First line should end with a period

* Not needed

* Fetch state on init
2016-11-10 21:41:28 -08:00
Lewis Juggins
58600f25b3 Fix OWM async I/O (#4298) 2016-11-10 21:41:28 -08:00
Pascal Vizeli
749fc583ea Fix rest switch default template (#4331) 2016-11-10 21:32:08 -08:00
Daniel Høyer Iversen
b07d887d77 Add support for rgb light in led flux, fixes issue #4303 (#4332) 2016-11-10 21:30:52 -08:00
Johann Kellerman
9bb94a4512 Improve async generic camera's error handling (#4316)
* Handle errors

* Feedback

* DisconnectedError
2016-11-10 21:28:22 -08:00
Paulus Schoutsen
e76d553513 fix panasonic viera doing I/O in event loop (#4341) 2016-11-10 21:17:44 -08:00
Pascal Vizeli
844799a1f7 Synology SSL fix & Error handling (#4325)
* Synology SSL fix & Error handling

* change handling for cookies/ssl

* fix use not deprecated functions

* fix lint

* change verify

* fix connector close to coro

* fix force close

* not needed since websession close connector too

* fix params

* fix lint
2016-11-10 21:04:47 -08:00
Pascal Vizeli
e005ebe989 Update SoCo to 0.12 (#4337)
* Update SoCo to 0.12

* fix req
2016-11-10 21:01:42 -08:00
Sean Dague
e9d19c1dcc Fix "argument of type 'NoneType' is not iterable" during discovery (#4279)
* Fix "argument of type 'NoneType' is not iterable" during discovery

When yamaha receivers are dynamically discovered, there config is
empty, which means that we need to set zone_ignore to [] otherwise the
iteration over receivers fails.

* Bump rxv library version to fix play_status bug

rxv version 0.3 will issue the play_status command even for sources
that don't support it, causing stack traces during updates when
receivers are on HDMI inputs.

This was fixed in rxv 0.3.1. Bump to fix bug #4226.

* Don't discovery receivers that we've already configured

The discovery component doesn't know anything about already configured
receivers. This means that specifying a receiver manually will make it
show up twice if you have the discovery component enabled.

This puts a platform specific work around here that ensures that if
the media_player is found, we ignore the discovery system.
2016-11-10 20:44:38 -08:00
Jan Losinski
7d2ab4fce6 Change pilight systemcode validation to integer (#4286)
* Change pilight systemcode validation to integer

According to the pilight code the systemcode should be an integer and
not a string (it is an int in the pilight code). Passing this as a
string caused errors from pilight:
"ERROR: elro_800_switch: insufficient number of arguments"

This fixes #4282

* Change pilight unit-id to positive integer

According to the pilight code the unit of an entity is also evrywhere
handled as an integer. So converting and passing this as string causes
pilight not to work.

This fixes #4282

Signed-off-by: Jan Losinski <losinski@wh2.tu-dresden.de>
2016-11-10 13:14:40 -08:00
Pascal Vizeli
ba2ea35089 Add logging to platform/component setup (#4300)
* Add timeout to platform/component

* Revert "Add timeout to platform/component"

This reverts commit 280a311e48.

* Add logging data

* Change log message with paulus comments
2016-11-10 18:46:31 +01:00
Erik Eriksson
ade62faa38 Don't fail if component name is None. Fixes (#4334)
https://github.com/home-assistant/home-assistant/issues/4326

Might fix https://github.com/home-assistant/home-assistant/issues/4326
2016-11-10 08:46:32 -08:00
Finbarr Brady
ee322dbbdc Cisco IOS device tracker support (#4193) 2016-11-09 22:36:57 +02:00
John Arild Berentsen
0d4141bf13 Add missing Index labels (#4328) 2016-11-09 19:11:24 +01:00
Christopher Viel
d404ac8978 Add support for off script to WOL switch (#4258) 2016-11-09 08:44:30 -08:00
Pascal Vizeli
71da21dcc8 Change pending task sheduler to time based cleanup (#4324)
* Change pending task sheduler to time based cleanup

* update unittest
2016-11-09 08:41:17 -08:00
Paulus Schoutsen
04dbc992ec Increase update delay (#4321) 2016-11-09 07:21:58 -08:00
Paulus Schoutsen
6d0e08cf7d Fix KNX async I/O (#4267) 2016-11-08 21:00:33 -08:00
Paulus Schoutsen
1e0025acae Fix Tellstick doing I/O inside event loop (#4268) 2016-11-08 20:25:19 -08:00
Pascal Vizeli
8fc853ba11 Add more unittest for async_add_job (#4320)
* Add more unittest for async_add_job

* fix test

* lint
2016-11-08 20:01:05 -08:00
sustah
8cbb8f6527 Update dlink.py (#4317)
corrected "total consumption" units from W to kWh
2016-11-08 19:58:27 -08:00
Jesse Newland
4f86c9ecda Fix alarm.com I/O inside properties (#4307)
* Fix alarm.com I/O inside properties

* First line should end with a period

* Not needed

* Fetch state on init
2016-11-08 19:57:46 -08:00
Lewis Juggins
9561fed650 Fix Dark Sky async I/O (#4299) 2016-11-08 19:46:44 -08:00
Lewis Juggins
67b599475e Fix OWM async I/O (#4298) 2016-11-08 18:57:56 -08:00
Pascal Vizeli
114ece1848 Fix possible sigterm / unittest / Fix all lazy test (#4297)
* replace weakref with a list

* add unittest

* fix lint

* fix handling

* fix unittest

* change code style

* fix lazy tests
2016-11-08 10:24:50 +01:00
Fabian Affolter
c05815cced Upgrade sqlalchemy to 1.1.3 (#4277) 2016-11-07 23:08:17 -08:00
Pascal Vizeli
2e0c185740 Async cleanup part 3 (#4302) 2016-11-07 22:31:40 -08:00
Johann Kellerman
231ef40f53 iOS links (#4295) 2016-11-08 00:07:24 +01:00
Fabian Affolter
b4159c7dc9 Upgrade python-digitalocean to 1.10.1 (#4276) 2016-11-06 23:49:25 -08:00
Fabian Affolter
8cc5fc1369 Upgrade psutil to 5.0.0 (#4275) 2016-11-06 23:49:11 -08:00
Paulus Schoutsen
fc3235fb6d Merge pull request #4271 from home-assistant/release-0-32-2
Release 0 32 2
2016-11-06 23:40:06 -08:00
David-Leon Pohl
d129df93dd Hotfix #4272 (#4273) 2016-11-06 23:34:45 -08:00
David-Leon Pohl
67336a111b Hotfix #4272 (#4273) 2016-11-06 23:34:32 -08:00
Paulus Schoutsen
0af1a96f14 Lint 2016-11-06 23:24:25 -08:00
andyat
272899ec96 Fix setting temperature in Celsius on radiotherm CT50 (#4270) 2016-11-06 23:21:08 -08:00
andyat
7d28d9d6b4 Fix setting temperature in Celsius on radiotherm CT50 (#4270) 2016-11-06 23:18:06 -08:00
Paulus Schoutsen
6a92e27e2f Version bump to 0.32.2 2016-11-06 23:12:37 -08:00
Paulus Schoutsen
faceb4c1dc Sequential updates for non-async entities 2016-11-06 23:12:20 -08:00
Paulus Schoutsen
6d5f00098a Move Honeywell I/O out of event loop (#4244) 2016-11-06 23:09:31 -08:00
Pascal Vizeli
618a86a37c Set executor to 15 and help to reduce flooting async core with updates (#4252)
* Set executor to 15 and help to reduce flooting async core with udpates

* fix typing

* if it a executor, wait

* address comments from paulus

* add space for style :)

* fix spell

* Update entity_component.py

* Update entity_component.py
2016-11-06 22:28:03 -08:00
Paulus Schoutsen
880ef8af48 Remove broken disable verify ssl synology (#4269) 2016-11-06 22:17:56 -08:00
William Scanlon
95124c7ddb Revert "Catch AttributeError on Wink PubNub update" (#4263) 2016-11-06 20:05:42 -08:00
William Scanlon
0aba227300 Catch AttributeError (#4253) 2016-11-06 16:04:57 -08:00
Martin Hjelmare
734bd75fd3 Fix mysensors overwriting gateway in GATEWAYS (#4013)
GATEWAYS was a dict, so would overwrite item if key was the same. This
would happen when using multiple MQTT gateways, since the device id is
the same (`mqtt`).

* Fix by changing GATEWAYS from dict into list.
* Use hass data to store mysensors gateways instead of having GATEWAYS
  be a global.
2016-11-06 10:49:43 -08:00
Frantz
0c5e077091 Updated netdisco to 0.7.6 (#4250) 2016-11-06 10:43:13 -08:00
Nicolas Graziano
1ed2f8ae91 Update braviarc to 0.3.6 (#4246)
Add HDMI sources.
Sources ordered.
2016-11-06 09:27:55 -08:00
Paulus Schoutsen
a343c20404 Async gather wait (#4247)
* Fix config validation for input_*, script

* Allow scheduling coroutines

* Validate entity ids when entity ids set by platform

* Async: gather -> wait

* Script/Group: use async_add_job instead of create_task
2016-11-06 09:26:40 -08:00
Antoine Bertin
d4e8b831a0 Add mqtt_template light component (#4233)
* Add mqtt_template component

* Docstring copy paste party on overriden methods

* pep8 E501 🌟

* Add missing docstrings on unittests
2016-11-06 09:09:01 -08:00
Paulus Schoutsen
98f41d6b84 Tweak block_till_done (#4245) 2016-11-06 08:43:32 -08:00
Paulus Schoutsen
7774a03a55 Move Honeywell I/O out of event loop (#4244) 2016-11-06 07:53:54 -08:00
Fabian Affolter
c35e5c9997 Upgrade astral to 1.3 (#4238) 2016-11-06 07:36:16 -08:00
Fabian Affolter
5d862e426e Upgrade fuzzywuzzy to 0.14.0 (#4240) 2016-11-06 07:36:03 -08:00
William Scanlon
bab8d574fe Wink Thermostat support and NoneType error fixes (#4175) 2016-11-06 07:27:15 -08:00
Fabian Affolter
c980d26aae Upgrade distro to 1.0.1 (#4239) 2016-11-06 14:00:41 +02:00
Paulus Schoutsen
08f75f7935 Merge pull request #4235 from home-assistant/release-0-32-1
0.32.1
2016-11-05 17:09:10 -07:00
Brent Hughes
1ad14b8227 Updated Emulated_Hue to send request info as variables to scripts (#4010)
* Updated Emulated_Hue to send request info as variables to scripts

* Updated tests to not use the old mqtt

* Updated test to actualy use and validate the script variables

* Fixed the removal of time in a recent merge

* fixed test to not use a timer
2016-11-05 17:08:54 -07:00
Pascal Vizeli
382ac5c3b5 Async cleanups with new handling and executor (#4234) 2016-11-06 01:01:03 +01:00
Paulus Schoutsen
af297aa0dc Version bump to 0.32.1 2016-11-05 17:00:06 -07:00
Paulus Schoutsen
20e1b3eae0 Fix radiotherm I/O inside properties (#4227) 2016-11-05 16:59:52 -07:00
Paulus Schoutsen
28861221ae Remove chunked encoding (#4230) 2016-11-05 16:59:52 -07:00
Pascal Vizeli
f367c49fb9 Sonos fix for slow update (#4232)
* Sonos fix for slow update

* fix auto update on discovery

* fix unittest
2016-11-05 16:59:52 -07:00
Pascal Vizeli
ad8645baf4 Sonos fix for slow update (#4232)
* Sonos fix for slow update

* fix auto update on discovery

* fix unittest
2016-11-05 16:58:29 -07:00
Paulus Schoutsen
62785c2431 More async tests (#4223)
* Annotate test callbacks to be async

* Convert device_sun_light_trigger to be async
2016-11-05 16:36:20 -07:00
Paulus Schoutsen
22c3d014aa Remove chunked encoding (#4230) 2016-11-05 15:29:22 -07:00
Paulus Schoutsen
3f3127a290 Fix radiotherm I/O inside properties (#4227) 2016-11-05 13:28:11 -07:00
Danijel Stojnic
88fc64c8a0 Add Map support for Locative component (#4174)
* Add Map support for Locative component

The Locative App on the mobile is sending an HTTP request to the
server where also the GPS location is sent.
But the GPS location was not passed to the event device_tracker.see.

Use the passed GPS location from Locative and pass it to the
device_tracker.see event.

With this the device is then also shown on the HA Map component.

* Use existing constants for latitude and longitude

Use the existing constants from homeassistant.consts:

ATTR_LATITUDE for 'latitude'
ATTR_LONGITUDE for 'longitude'

* Reuse the "yield from self.hass.loop.run_in_executor" again

* Use variable gps_location
2016-11-05 13:05:15 -07:00
Samuel Bétrisey
1463fc4fe0 Add Swisscom Internet-Box device tracker (#4123)
* Add Swisscom Internet-Box device tracker

* Add Swisscom device tracker to .coveragerc

* Add timeout to requests
Fix formatting and add missing comments to pass the lint test

* Remove authentication which was not required

I realised that there was no need to be authenticated to get the
connected devices. Thanks Swisscom :/

* Moving config to a PLATFORM_SCHEMA and using voluptuous
2016-11-05 13:04:44 -07:00
Pascal Vizeli
ece58ce78f Remove ThreadPool with async executor (#4154)
* Remove ThreadPool with async executor

* Fix zigbee

* update unittest

* fix remote api

* add pending task to remote

* fix lint

* remove unused import

* remove old stuff for lazy tests

* fix bug and add a exception handler to executor

* change executor handling

* change to wait from gather

* fix unittest
2016-11-05 09:27:55 -07:00
Paulus Schoutsen
b67f1fed52 Version bump to 0.33.0.dev0 2016-11-05 08:53:13 -07:00
Paulus Schoutsen
4770888d22 Merge pull request #4166 from home-assistant/dev
0.32
2016-11-05 08:52:57 -07:00
Paulus Schoutsen
1d0f3b930f Version bump to 0.32.0 2016-11-05 08:40:32 -07:00
Paulus Schoutsen
22e2262f8e Merge remote-tracking branch 'origin/master' into dev 2016-11-05 08:40:04 -07:00
William Scanlon
53d1a040d4 Stop Octoprint from logging errors during startup (#4220)
* Fix log errors

* Remove discovery code
2016-11-05 07:55:59 -07:00
Fabian Affolter
d7d71c97e2 Make the wind details more robust (weather.openweathermap) (#4215)
* Make the wind details more robust

* Return None if values is not available
2016-11-05 09:15:59 +01:00
Paulus Schoutsen
c15fd4323e Disable insteon hub (#4221) 2016-11-04 23:38:27 -07:00
Pascal Vizeli
91227d9a2e Refactory nest component/platforms (#4219)
* Refactory nest component/platforms
2016-11-04 20:22:47 -04:00
jbcodemonkey
a3db0ec231 add dimmer slide control to imported isy lights (#4152)
Supported attribute added and checks appear to pass. 🐬
2016-11-04 15:28:22 -06:00
Paulus Schoutsen
18e965c3cd Fix flaky group notify test (#4212) 2016-11-03 22:56:55 -07:00
Paulus Schoutsen
4cc417677e Add link to issue in warning slow entity update (#4211) 2016-11-03 22:45:01 -07:00
Paulus Schoutsen
525d735f21 Warn if fetching properties takes too long (#4208)
* Warn if fetching properties takes too long

* Update entity.py
2016-11-03 21:58:25 -07:00
Paulus Schoutsen
e88b98f5fa Clean up tests (#4209) 2016-11-03 21:58:18 -07:00
Lewis Juggins
6f68752d1e Speed up Sonos tests (#4196) 2016-11-03 21:23:37 -07:00
Fabian Affolter
61a0976752 Use port instead of url and fix PEP257 issues (#4192) 2016-11-03 18:43:42 -07:00
Pascal Vizeli
d7b3c9c38e Fix log owntrack log flooting (#4198) 2016-11-03 18:42:22 -07:00
jgriff2
a01939c6e9 Fix Synology Camera SSL certificate option (#4201) [BREAKING CHANGE]
* Fix Synology SSL config

* Revert "Fix Synology SSL config"

This reverts commit b8dc2a92abee6249b3dd42c99d0786820ebbeb72.

* Revert "Fix Synology SSL config"

This reverts commit 805e87f3af300a1b7627bb5df0792285fcf38901.

* Fix Synology SSL config
2016-11-03 18:41:32 -07:00
Fabian Affolter
c128919b5f Remove globally disabled pylint warnings (#4204) 2016-11-03 18:40:43 -07:00
Pascal Vizeli
e5d69feb93 Fix blocking/stack trace with empty list (#4191) 2016-11-03 18:33:18 -07:00
Paulus Schoutsen
ee5f228309 Make services yield (#4187)
* Make services yield

* Disable pylint abstract-method check

* add input_select

* add input_slider

* change to async vers.

* fix lint

* yield on add_entities as other components does
2016-11-03 18:32:14 -07:00
John Arild Berentsen
15dde7925a Prevent multiple instances of device initialzed (#4179) 2016-11-03 13:08:23 +01:00
Pascal Vizeli
fcf318cf53 Bugfix windows have a other default loop now (#4195)
* Bugfix windows have a other default loop now

* fix handling with 3.4.2 that not support ensure_future

* make the same as ensure_future does

* fix spell

* fix lazy test
2016-11-03 11:07:47 +01:00
Pascal Vizeli
c2a5f63b1f Bugfix async Yr.no (#4190) 2016-11-03 11:09:03 +02:00
Fabian Affolter
79fa2d4175 CUPS sensor (#4142)
* Add CUPS sensor

* Use CupsData

* Fix requirement
2016-11-03 09:31:50 +01:00
Erik Eriksson
214a18f08c Support for Dovado routers (#4176)
* Implemented support for the Dovado router

* Update .coveragerc
2016-11-02 21:20:21 -07:00
Ferry van Zeelst
ded2ea8b19 Synology DSM sensor (#4156)
* Added Synology DSM Sensor

* Fixed balloobbot's comments

* Fixed mistake (should have run lint and flake8 before committing

* Fixed update mechanisme according to balloobs feedback

* Requesting retest as test failure isn't related to changes made
2016-11-02 21:17:29 -07:00
Paulus Schoutsen
1d100dcac9 Bugfix/frontend group urls (#4185)
* Remove unnecessary sleeps

* Frontend: fix serving index when refreshing view page.
2016-11-02 21:15:23 -07:00
Bart274
a3ae96440b Update the icloud device_tracker (#4081)
* Update the icloud device_tracker

* addressed @kellerza 's comments

* GMTT config needs an entity_id

* renamed services

* fix cookiedir and clean up keep_alive function

* fix travis errors

* forgot a self.

* update devices after initializing the API

* changed wording

* addressed changes from @kellerza

* Syntax error solved

* Update icloud.py

* Only use account of username instead of whole username as default for account name

* use slugify instead of slug for schema

* remove Google Maps Travel Time

* Add comment from original tracker back
2016-11-02 21:07:23 -07:00
devdelay
0235626f40 yet another command_line sensor update (#4184) 2016-11-02 21:00:32 -07:00
Paulus Schoutsen
d7dd7df5e7 Update frontend 2016-11-02 20:39:42 -07:00
Nicolas Graziano
1e28851280 Media player BraviaTv : Try to connect only if tv is not in off state. (#4140)
When HA is restart with the TV in off state there was error log every 10s until the TV is set ON.
2016-11-02 19:51:53 -07:00
bestlibre
df68de8032 Influxdb sensor state set to unknown if query return no points (#4148)
* Influxdb sensor state set to unknown if query return no points

* Update influxdb.py
2016-11-02 19:50:18 -07:00
Johann Kellerman
f3595f790a Async version of Yr.no (#4158)
* initial

* feedback

* More feedback. Still need to fix match_url

* url_match

* split_lines
2016-11-02 19:34:12 -07:00
Johann Kellerman
0d14920758 Component setup error messages with markdown (#3919)
* Remove_dev_link_async

* callback
2016-11-02 19:31:09 -07:00
Paulus Schoutsen
2940fb72fb EntityComponent.add_entities now converts generators to a list (#4183) 2016-11-02 19:24:25 -07:00
Daniel Perna
8e0838adeb Added support for Philips TVs with jointSPACE API (#4157)
* Added support for Philips Tvs with JointSpace API

* Flake + Lint fixes

* Lint be like "lol fu"

* Changes as requested by reviewers, except lib-requirement

* Switched to library-usage

* lint... newline-bingo...
2016-11-02 19:19:53 -07:00
Paulus Schoutsen
4e820ea30a Move mocks to async_start (#4182) 2016-11-02 19:16:59 -07:00
Pascal Vizeli
26490109ac Change event loop on windows (#4075)
* Change event loop on windows

* fix

* split PR

* remove set event loop

* Add paulus suggestion

* fix missing import

* revert stuff from PR Splitting

* fix event loop on test
2016-11-02 21:53:52 +01:00
Georgi Kirichkov
e4a713207d Fixes in TP-Link Switch logging 0 values on init (#4026)
* Fixes in TP-Link Switch logging 0 values on init

On init of component the emeter would log to influxdb and possibly other inputs a 0 value, instead of not logging anything.
Initial polling should circumvent that behavior and avoid logging inconsistencies.

* Refactors update call in __init__
2016-11-02 12:23:43 -07:00
Greg Dowling
cc0d0a38d7 Get temparature units from vera controller. (#4130)
Alrighty 👯‍♀️
2016-11-02 14:20:44 +01:00
Erik Eriksson
afde5a6b26 extracted logic into an external package. monitor more attributes. support for more than one vehicle (#4170) 2016-11-01 22:01:00 -07:00
Lewis Juggins
a5fb284717 Add new_device_discovered event (#4132) 2016-11-01 21:52:27 -07:00
Johann Kellerman
e487a09190 Remove None value before writing known_devices (#4098)
* Remove None

* Replace null
2016-11-01 21:51:31 -07:00
Jan Losinski
52eb816c62 Introduce a send_delay for pilight component (#4051)
* Add a method to throttle calls to services

This adds CallRateDelayThrottle. This is a class that provides an
decorator to throttle calls to services. Instead of the Throttle in
homeassistant.util it does this by delaying all subsequent calls
instead of just dropping them. Dropping of calls would be bad if we
call services to actual change the state of a connected hardware (like
rf controlled power plugs).

Ihe delay is done by rescheduling the call using
track_point_in_utc_time from homeassistant.helpers.event so it should
not block the mainloop at all.

* Add unittests for CallRateDelayThrottle

Signed-off-by: Jan Losinski <losinski@wh2.tu-dresden.de>

* Introduce a send_delay for pilight component

If pilight is used with a "pilight USB Nano" between the daemon and the
hardware, we must use a delay between sending multiple signals.
Otherwise the hardware will just skip random codes. We hit this
condition for example, if we switch a group of pilight switches on or
off. Without the delay, random switch signals will not be transmitted by
the RF transmitter.

As this seems not necessary, if the transmitter is directly connected
via GPIO, we introduce a optional configuration to set the delay.

* Add unittests for pilight send_delay handling

This adds an unittest to test the delayed calls to the send_code
service.
2016-11-01 21:50:27 -07:00
Jason Carter
90d894a499 Garadget (#4031)
* Initial attempt at implementation

* Adding Garadget cover component

* Updating Device to be Required

* Updating .coveragerc to exclude from testing

* Updating code review items

* Updating per 2nd code review

* Updating configuration to be more like command-line
2016-11-01 21:49:27 -07:00
Jon Caruana
ba13951fff Add LiteJet (a lighting control system) component (#4125)
* Initial submission of LiteJet integration.

* Add LiteJet switch pressed automation trigger. (State changes are too slow to catch a press-release.)
Add LiteJet scene, replacing commented out code that treated these as lights.
Include LiteJet numbers in the device state so that it is easy to lookup entity -> number.

* Fix missing global.

* Allow light's brightness to be set explicitly.

* Support optional 'ignore' key to ignore prefixes of loads, switches, and scenes that weren't configured for use in the LiteJet system.

* Fix lint errors and warnings.

* Cleanup header comments.
Default to not creating LiteJet switches as these are generally not useful.

* Lint fixes.

* Fixes from pull request feedback.

* Use hass.data instead of globals for data storage.

* Fix lint warnings.
2016-11-01 20:44:25 -07:00
Sean Dague
2a7b7ebd6a Merge pull request #3985 from postlund/yamaha_additions
Improve support for Yamaha receiver
2016-11-01 21:50:03 -04:00
Bjarni Ivarsson
df7d9c3bb2 Fallback to read volume and mute state from speaker. (#4173) 2016-11-01 15:12:18 -07:00
Bjarni Ivarsson
c549ea115d Sonos responsiveness improvements + enhancements (#4063)
* Sonos responsiveness improvements (async_ coroutines, event based updating, album art caching) + Better radio station information

* Docstring fixes.

* Docstring fixes.

* Updated SoCo dependency + fixed file permissions.

* Only fetch speaker info if needed.

* PEP8 fixes

* Fixed SoCoMock.get_speaker_info to get test to pass.

* Regenerated requirements_all.txt + async fetching of album art with caching + added http_session to HomeAssistant object.

* Unit test fixed.

* Add blank line as per flake8

* Fixed media image proxy unit test.

* Removed async stuff.

* Removed last remnants of async stuff.
2016-11-01 10:42:38 -07:00
Fabian Affolter
dad54bb993 Update to make the sample file validate (#4168) 2016-11-01 15:11:42 +01:00
Fabian Affolter
0211cf29eb Change behavior to be more natural and fix test (#4150) 2016-11-01 10:43:48 +01:00
Nicholas Sideras
1d9ac5f8b3 Update __init__.py (#4155)
Changed manifest.json to respect Android screen rotate lock.
2016-10-31 13:04:54 -07:00
Paulus Schoutsen
7f699b4261 Lazy initialise the worker pool (#4110)
* Lazy initialise the worker pool

* Minimize pool initialization in core tests

* Fix tests on Python 3.4

* Remove passing in thread count to mock HASS

* Tests: Allow pool by default for threaded, disable for async

* Remove JobPriority for thread pool

* Fix wrong block_till_done

* EmulatedHue: Remove unused test code

* Zigbee: do not touch hass.pool

* Init loop in add_job

* Fix core test

* Fix random sensor test
2016-10-31 08:47:29 -07:00
Paulus Schoutsen
a1e910f1cf Disable rest switch tests 2016-10-31 08:22:49 -07:00
Fabian Affolter
b4899ec469 Allow multiple symbols (sensor.yahoo_finance) (#4126)
* Allow multiple symbols

* Update test
2016-10-31 13:31:09 +01:00
John
06de7053ce Add Emby Server media_player component (#3862)
* Add Emby Server media_player component

* Code cleanup, move to request sessions, generate UUID per session

* Make media image fetch more robust

* Allow for http or https

* Cleanup some Keyerror conditions found through more testing

* Move EmbyRemote to pip, update requirements

* Code cleanup, add SSL config option
2016-10-31 13:29:08 +01:00
Fabian Affolter
4484a7a94b Use voluptuous for Pilight switch (#3819)
* Migrate to voluptuous

* Add protocol

* Update
2016-10-31 13:18:47 +01:00
Jared Beckham
a89e635bf3 Added tests for REST switches (#4016)
* Added tests for REST switches

* Remove REST switch from test coverage exclusions
2016-10-31 13:14:23 +01:00
Daniel Høyer Iversen
3ab056ba69 Merge pull request #4149 from home-assistant/flux_led_library
flux led lib
2016-10-31 11:56:00 +01:00
Daniel
5ba815ab21 flux led lib 2016-10-31 09:23:34 +01:00
Fabian Affolter
274e9799b3 Add random number sensor (#4139) 2016-10-31 00:01:25 -07:00
Jared Beckham
5ce9aea65d Added tests for REST sensors (#4115) 2016-10-30 21:51:03 -07:00
Michael
705814cb08 Catch all errors when doing mqtt message unicode-decode. (#4143)
* catch all errors when doing mqtt message unicode-decode.

* added AttributeError and UnicodeDecodeError to exception when decoding an mqtt message payload
2016-10-30 23:17:41 +01:00
Alok Saboo
8e695d1eb0 Fixed typo (#4145) 2016-10-30 23:13:27 +01:00
Fabian Affolter
be272ac64a Disable too-many-* (#4107)
* Disable too-many-* and too-few-public-methods

* Remove globally disabled pylint warnings
2016-10-30 22:18:53 +01:00
Fabian Affolter
b910a9917d Migrate to async (sensor.statistics) (#4138)
* Migrate to async

* Add async_ prefix and remove stale print
2016-10-30 18:56:26 +01:00
Fabian Affolter
9649097b32 Migrate to async (sensor.min_max) (#4136)
* Migrate to async

* Add async_ prefix
2016-10-30 16:45:53 +01:00
Fabian Affolter
5e76a51db4 Migrate to async (#4135) 2016-10-30 15:23:47 +01:00
Fabian Affolter
27abac85b6 Migrate to async (sensor.time_date) (#4100)
* Migrate to async

* Update acc. #4114
2016-10-30 15:21:23 +01:00
Fabian Affolter
9f2aae1357 Maintenance 2nd (#4106)
* Add link to docs

* Fix link

* Update line breaks

* Update ordering

* Align vera platofrm to only use add_devices
(instead od add_devices_callback)

* Remove line break

* Use consts

* Update ordering

* Update ordering

* Use const, create default name, use string formatting

* Update ordering

* Use const

* Update import style

* Update ordering and line breaks

* update line breaks

* Set default port

* Set defaults and update ordering

* Update ordering

* Minor style updates

* Update ordering, defaults, line breaks, and readability

* Use constants

* Add line breaks

* use string formatting

* Update line breaks

* Update logger
2016-10-30 09:58:34 +01:00
Adam Mills
e6ece4bf6d Fix initialization of zwave color bulbs (#4085)
* Fix initialization of zwave color bulbs

Zwave values can be added to the node in any order. This change allows
proper initialization when the multilevel value is added before the
color value.

* Fix incorrect rename of color command class
2016-10-29 17:14:28 -07:00
Hydreliox
aea2d1b317 Add support for Yeelight Wifi bulbs (#4065)
* Add support for Yeelight Wifi bulbs

* Fix cache property in instance
2016-10-29 17:03:26 -07:00
Pierre Ståhl
33e46b484f Add service to change visibility of a group (#3998) 2016-10-29 16:54:26 -07:00
wokar
3f6a5564ad lg_netcast platform fails to load if no channels defined (#4083)
* fixes loading of lg_netcast platform if no channels are defined

* turned list comprehension into for loop
2016-10-29 16:52:53 -07:00
Erik Eriksson
3317b4916b OSError is alias for IOException and base class for many other exceptions - no need to catch redundant exceptions if OSError already present in except-clause (#4111) 2016-10-29 15:33:56 -07:00
Pascal Vizeli
9c0455e3dc Allow update entities on add_entities callback (#4114)
* Allow udpate entities on add_entities callback

* fix wrong position

* update force_update to update_before_add

* add unittest for update_befor_add

* fix unittest

* change mocking
2016-10-29 15:33:11 -07:00
Fabian Affolter
5d43d3eb1c Fix error message (#4122) 2016-10-29 15:30:23 -07:00
Paulus Schoutsen
4163e55dbd Introducing hass.data (#4121)
* Hello hass.data

* Migrate setup_component to hass.data
2016-10-29 14:51:17 -07:00
Paulus Schoutsen
3cc4fdaa34 Fix HTTP static file singular (#4118) 2016-10-29 14:45:31 -07:00
Pascal Vizeli
edeb31d74e Fix bug with aioHTTP and none authentification (#4116) 2016-10-29 22:47:46 +02:00
Fabian Affolter
54d19e3c53 Maintenance (sensor.currencylayer, sensor.fixer) (#4103)
* Add new const (base)

* Use constant

* Remove second error message, use const, add attribution, add link
to docs, remove unused vars, and a little simplification

* Add quote

* Use const

* Add attribution, simplify the code, and use consts
2016-10-29 13:27:02 -07:00
Fabian Affolter
892f455aee Maintenance (sensor.bitcoin, sensor.yahoo_finance) (#4104)
* Add attribution

* Update ordering

* Update ordering
2016-10-29 13:21:09 -07:00
Fabian Affolter
942d630762 Maintenance zoneminder (#4102)
* Add timeout to requests, fix typos, and defaults

* Clean-up
2016-10-29 13:10:42 -07:00
Paulus Schoutsen
9ea1101aba Fix bootstrap circular imports (#4108)
* Fix bootstrap circular imports

* fix test

* Lint
2016-10-29 12:54:47 -07:00
Pascal Vizeli
08a65a3b31 Async input_*/zone migration (#4095)
* Async input_*

* Async zone component

* rename service callback
2016-10-29 12:19:27 -07:00
Fabian Affolter
d4b3f56d53 Maintenance (#4101)
* UPdate ordering, fix typos, and align logger messages

* Update import style, fix PEP257 issue, and align logger messages

* Updaate import style and align logger messages

* Update import style and align logger messages

* Update ordering

* Update import style and ordering

* Update quotes

* Make logger messages more clear

* Fix indentation
2016-10-29 09:12:43 -07:00
Paulus Schoutsen
5a2b4a5376 Core Async improvements (#4087)
* Clean up HomeAssistant.start

* Add missing pieces to remote HA constructor

* Make HomeAssistant constructor async safe

* Code cleanup

* Init websession lazy
2016-10-29 08:57:59 -07:00
Sean Dague
9d836a115a Add zone_ignore option for yamaha. (#4091)
* Add zone_ignore option for yamaha.

We attempt to discover all zones for yamaha receivers. There are times
when users may want to suppress some zones from showing up. When a
Zone isn't actually connected to speakers, or on some newer receivers
where Zone_4 is an HDMI only zone, that doesn't support even basic
media_player UI.

This provide a mechanism for users to do that.

Fixes #4088

* Update yamaha.py
2016-10-28 19:18:31 -07:00
Fabian Affolter
bf92aedd38 Add hddtemp sensor (#4092) 2016-10-28 19:06:24 -07:00
devdelay
230c3815f2 Update command_line sensor to use STATE_UNKNOWN (#4093) 2016-10-28 19:03:40 -07:00
Pascal Vizeli
9afe066ec8 Fix name in openalpr cloud api (#4097) 2016-10-28 19:01:14 -07:00
Pascal Vizeli
66541a6a19 Update ha-ffmpeg to version 0.15 (#4096) 2016-10-29 00:12:53 +02:00
Pascal Vizeli
825ee3612d fix some comments spell (#4082)
* fix some comments

* fix in an executor

* address paulus comments
2016-10-28 21:26:52 +02:00
Abhishek Anand
65bd7d2326 Generalized REST switch to enable templating and configurable timeout. (#3329)
* successfully tested the "remote temperature mode" switch for the radio thermostat

* removed logging and interpreted None as Off.

* turn_off value is also templated now -- can depend on state

Also, undid accidental removal of error logging.

* ensured backward compatibility of config file

if value_template is not provided, the update function behaves as before

* ran autopep8 --in-place

* fixed another complaint of tox

* addressed the comments of balloob

* undid acccidental log.error to log.info

* timeout : 50 -> 10

* added a timeout parameter

* removed the stray '-', better names for the failure case

* string comparisons after .lower(), as suggested by balloob

* addressed balloob's latest requests

* making flake happy

* value_template --> is_on_template in config file

* moved CONF_IS_ON_TEMPLATE to local file

* null checks

* addressed flake error

* properly comparing template text when is_on is not a template.
2016-10-27 22:34:22 -07:00
John Arild Berentsen
d8c1013b09 Zwave climate, add operating state to attributes (#4069)
* Zwave climate, add operating state to attributes

* Reversed assisgnment
2016-10-27 22:25:17 -07:00
Fabian Affolter
02d1dc6247 Upgrade psutil to 4.4.2 (#4079) 2016-10-27 22:22:43 -07:00
Paulus Schoutsen
726d950522 Update aiohttp.py 2016-10-27 21:45:35 -07:00
Pascal Vizeli
3324995e70 Async clientsession / fix stuff on aiohttp and camera platform (#4084)
* add websession

* convert to websession

* convert camera to async

* fix lint

* fix spell

* add import

* create task to loop

* fix test

* update aiohttp

* fix tests part 2

* Update aiohttp.py
2016-10-27 21:40:10 -07:00
Fabian Affolter
85747fe2ef Upgrade python-telegram-bot to 5.2.0 (#4080) 2016-10-27 21:28:09 -07:00
Pascal Vizeli
09db875ace Fix async bug in automation (#4078) 2016-10-27 18:26:55 +02:00
bestlibre
7d407756c3 Converting unit_of_measurement variable to optional, to be consistent with other sensors (#4076) 2016-10-27 08:50:36 -07:00
Richard Cox
91d682d02c Adding ssl option to zoneminder (#4074) 2016-10-27 15:54:03 +02:00
Benoit BESSET
b75c103db4 fixed Up/Down (#4064) 2016-10-27 12:10:38 +02:00
Richard Cox
bba323d226 [media_player/onkyo] host should be optional (#4073) 2016-10-27 10:33:35 +02:00
Paulus Schoutsen
7564d539c1 Lint 2016-10-27 00:37:02 -07:00
Paulus Schoutsen
33439aaa22 Update frontend 2016-10-27 00:21:55 -07:00
Pascal Vizeli
d5368f6f78 Async bootstrap / component init (#3991)
* Async bootstrap

* Adress comments

* Fix tests

* More fixes

* Tests fixes
2016-10-27 00:16:23 -07:00
Simon Szustkowski
d9999f36e8 Added a ThingSpeak component (#4027)
* Added a ThingSpeak component

* Forgot a colon. Fixed it

* Some config variables are better required

* New requirements created by the script

* Updated the .coveragerc

* Fixed small linting errors

* Removed unneccessary validation

* Even more linting error fixes

* Changed the way the component listens to state changes

* Removed unneccessary declaration of 'state' variable, referring to new_state instead
2016-10-26 23:56:51 -07:00
Pierre Ståhl
235e1a0885 Minor improvements to RPi camera platform (#4059)
* Try to create output file instead of checking write permissions

* Kill raspistill process during shutdown
2016-10-26 23:51:13 -07:00
Paulus Schoutsen
541fec0534 Sort .coveragerc alphabetically. 2016-10-26 23:50:11 -07:00
bestlibre
b3ad7989ae Influxdb sensor (#4060)
* Influxdb sensor with voluptuous configuration validation

* Adding sensor to coveragerc since there is no test for now
2016-10-26 23:48:57 -07:00
Sean Dague
3d897e0e52 Add discovery for yamaha component (#4061)
This uses the discovery code from netdisco/ha to discover yamaha
receivers. The old discovery code remains if discovery is turned of in
HA, at least for now. Though it probably is worth turning that off in
the future.
2016-10-26 23:46:44 -07:00
Alok Saboo
c6d5987109 Create Currencylayer exchange rate sensor (#4062)
* Added Currencylayer exchange rate sensor

* Updated .coveragerc to include currencylayer

* Update currencylayer.py

* Added Conf_name
2016-10-26 23:46:13 -07:00
Matthew Treinish
5d3956ea98 Cleanup use of MQTT in emulated_hue tests (#4068)
* Use unix newlines on test_emulated_hue

This commit switches the test_emulated_hue module to use unix newlines
instead of the DOS style that were there before. (using dos2unix on
the file) This makes it consistent with the other files in the repo.

* Cleanup emulated_hue tests

Previously these tests relied on the mqtt light platform as test devices
to control with the emulated hue. However, this was pretty heavyweight
and required running an MQTT broker in the tests. Instead this commit
switches it to use the demo light platform which is strictly in memory.

Fixes #3549
2016-10-26 23:33:43 -07:00
Marcelo Moreira de Mello
4fb0b27310 Wunderground sensor with alerts exceeds API limits (#4070)
* Fixes issue #4067 - Wunderground sensor with alerts exceeds API limits

 To avoid hitting the max limit of 500 calls per day, this patch keeps weather conditions being updated each 5 minutes
  and weather advisories each 15 minutes.

 This formula will result the following:

   conditions -> 300 seconds -> 5 minutes -> 12 req/h -> 288 req/day
   alerts -> 900 seconds -> 15 minutes -> 4 req/h -> 96 req/day

* Using timedelta in minutes instead seconds
2016-10-26 23:31:49 -07:00
Paulus Schoutsen
4833e992fb Pin cython==0.24.1 (#4057) 2016-10-25 23:38:32 -07:00
Paulus Schoutsen
fe3aed0f0c Update .coveragerc 2016-10-25 23:32:58 -07:00
Paulus Schoutsen
57402bcb43 Update .coveragerc 2016-10-25 23:30:43 -07:00
Scott O'Neil
7f48c00793 Adding timer setting functionality to sonos component (#3941)
* Adding timer setting functionality to sonos component

* Adding clear sleep timer for Sonos
2016-10-25 23:22:17 -07:00
Paulus Schoutsen
f58647849a Fix Z-Wave: Pin cython in Dockerfile (#4055) 2016-10-25 23:17:34 -07:00
Marcelo Moreira de Mello
1f468fc94d If no weather advisories were issued, state should return 0 instead Unknown (#4029)
* If no weather advisories were issued, state should return 0 instead Unknown

* Updated to keep on the same if statement

* Revert "Updated to keep on the same if statement"

This reverts commit 0e6a94aa0f.
2016-10-25 22:49:51 -07:00
Bjarni Ivarsson
961c02f72a Sonos improvements (#3997)
* Sonos improvements: media_* properties delegate to coordinator if speaker is a slave, media_image_url and media_title now works for radio streams, source selection/list takes speaker model into account, commands on slaves delegate to coordinator.

* Fixed failing unit tests.
2016-10-26 00:37:47 +02:00
Robbie Trencheny
79da1ec0d9 Merge pull request #4037 from home-assistant/remove-deprecated-things
Remove deprecated things
2016-10-25 14:28:01 -07:00
Robbie Trencheny
fe174402d2 Remove more deprecated things 2016-10-25 14:16:08 -07:00
Matthew Treinish
1b2dfb8ed1 Handle FreeBSD version in updater component (#4048) 2016-10-25 22:38:22 +02:00
Pierre Ståhl
297a6f6f03 Improve support for Yamaha receiver
* Playback (play, pause, stop, next, previous)

* Media title, artist and album
2016-10-25 20:53:04 +02:00
Per Sandström
0dfcf40d37 [WIP] Config validation error line numbers (#3976)
Config validation error line numbers
2016-10-25 20:13:32 +02:00
Fabian Affolter
d308ea69ce Upgrade yahoo-finance to 1.3.2 (#4040) 2016-10-25 08:36:20 -07:00
Sean Dague
a8c5c995a0 Merge pull request #4042 from sdague/typo
fix typos in script module strings
2016-10-25 07:40:11 -04:00
Sean Dague
86b318e992 fix typos in script module strings
It looks like some copy / paste in docstrings, clean them up for
posterity.
2016-10-25 07:20:40 -04:00
Bart274
53ea926292 Fix for see service attributes (#4023) 2016-10-25 10:59:20 +02:00
Robbie Trencheny
2b1f4123db Update requirements_all.txt 2016-10-24 22:36:04 -07:00
Robbie Trencheny
b36e346ccb Fix helpers.state tests 2016-10-24 22:33:54 -07:00
Adam Mills
89e8fb4066 Configurator support for entity_picture (#4028) 2016-10-24 22:28:34 -07:00
David-Leon Pohl
e2d23d902a Unittests for ddwrt device tracker and bugfix (#3996)
* BUG Message data cannot be changed thus use voluptuous to ensure format

* Pilight daemon expects JSON serializable data

Thus dict is needed and not a mapping proxy.

* Add explanation why dict as message data is needed

* Use more obvious voluptuous validation scheme

* Pylint:  Trailing whitespace

* Pilight sensor component

* Python 3.4 compatibility

* D202

* Use pytest-caplog and no unittest.TestCase

* Fix setup/teardown of unittests

* Activate coverage testing

* Bugfix whitelist filter and use bugfixed pilight library

* Use newest pilight library that has a bugfix

* Add unittest for pilight hub component

* PEP257 for docstrings

* Bugfix setting device name from host name and small cleanup

- Init with connection error handling is more clear
- Comments clean-up

* PEP257

* New unittest with full coverage

* Upload missing testfixtures

* D209

* Handle double quotes in reply

* Formatting
2016-10-24 22:18:24 -07:00
Fabian Affolter
2604dd89a6 Add test (#3999) 2016-10-24 22:01:38 -07:00
Robbie Trencheny
044b9caa76 Remove garage_door, hvac, rollershutter and thermostat components/platforms 2016-10-24 22:00:43 -07:00
Daniel Perna
1707cdf9f3 Added support for Notifications for Android TV / FireTV (#3978)
* Added support for Notifications for Android TV / FireTV

* Silly me forgot to commit coverage

* Fixed pylint

* Fixed flake8

* Fixed another flake8 -.-

* Changed option 'ip' to 'host' like most other platforms do
2016-10-24 21:59:09 -07:00
Fabian Affolter
4c86721e70 Update tests, rename variable, and change conversion (#3546) 2016-10-24 21:53:03 -07:00
Matthew Treinish
0ff500ca25 Add mochad component (#3970)
This commit adds a new component for communicating with mochad[1] a
socket interface for the CM15A and CM19A USB X10 controllers. This
commit leverages the pymochad library to interface with a mochad socket
either on a local or remote machine. Mochad is added as as a generic
platform because it supports multiple different classes of device,
however in this patch only the switch device implemented as a starting
point. Future patches will include other devices types. (although
that's dependent on someone gaining access to those)

[1] https://sourceforge.net/projects/mochad/
2016-10-24 21:49:49 -07:00
Robbie Trencheny
23f54b07c7 Dont load notify.ios if no devices exist. Thanks @arsaboo for catching this. 2016-10-24 18:46:47 -07:00
Robbie Trencheny
f25ddef4d7 More iOS HTTP Async updates 2016-10-24 17:31:45 -07:00
Robbie Trencheny
7158919346 Missed a wsgi->http on iOS component 2016-10-24 15:03:51 -07:00
Fabian Affolter
627517cbbc Upgrade psutil to 4.4.0 (#4032) 2016-10-24 22:24:33 +02:00
Fabian Affolter
4ecfc7d066 Upgrade sqlalchemy to 1.1.2 (#4003) 2016-10-24 22:00:22 +02:00
Fabian Affolter
72751b95b5 Upgrade slacker to 0.9.29 (#4000) 2016-10-24 22:00:02 +02:00
Fabian Affolter
fc3b7907ed Upgrade python-telegram-bot to 5.1.1 (#4001) 2016-10-24 21:59:48 +02:00
Paulus Schoutsen
f26a7fc6bb Update http 2016-10-24 00:09:20 -07:00
Robbie Trencheny
0c563f7b14 Minor updater... updates (#4020)
* Enable updater in dev versions

* Code clarity

* Add log line about being on the current version already

* Remove dev check test
2016-10-24 00:01:56 -07:00
Paulus Schoutsen
519d9f2fd0 async HTTP component (#3914)
* Migrate WSGI to asyncio

* Rename wsgi -> http

* Python 3.4 compat

* Move linting to Python 3.4

* lint

* Lint

* Fix Python 3.4 mock_open + binary data

* Surpress logging aiohttp.access

* Spelling

* Sending files is a coroutine

* More callback annotations and naming fixes

* Fix ios
2016-10-23 23:48:01 -07:00
Paulus Schoutsen
3701ac292c Merge pull request #4017 from home-assistant/release-0-31-1
0.31.1
2016-10-23 21:57:38 -07:00
Lewis Juggins
1db18478d2 Exclude dirs/files prefixed with . (#3986) 2016-10-23 21:08:56 -07:00
Robbie Trencheny
3230869f74 Fix a spelling problem on user-facing error 2016-10-23 20:34:31 -07:00
Robbie Trencheny
9aa88819a5 Fix a spelling problem on user-facing error 2016-10-23 20:33:49 -07:00
Paulus Schoutsen
3e92318cb2 Version bump to 0.31.1 2016-10-23 19:20:30 -07:00
Johann Kellerman
f0a38dded6 Catch UnicodeDecodeError Error (#4007)
* Catch UnicodeDecodeError Error

Error for #3933

* Forgot (exc)

* catch...

* Tests by @lwis

* Docstring

* Create open
2016-10-23 19:20:13 -07:00
Robbie Trencheny
c32f47aea6 iOS component hotfixes (#4015)
* iOS component hot fixes around component/platform loading, logging, and more

* Load device_tracker and zeroconf in deps instead of bootstraping

* Change conditional check on status code
2016-10-23 19:18:13 -07:00
Robbie Trencheny
626763a7c3 iOS component hotfixes (#4015)
* iOS component hot fixes around component/platform loading, logging, and more

* Load device_tracker and zeroconf in deps instead of bootstraping

* Change conditional check on status code
2016-10-23 19:17:34 -07:00
Johann Kellerman
5df8477536 Catch UnicodeDecodeError Error (#4007)
* Catch UnicodeDecodeError Error 

Error for #3933

* Forgot (exc)

* catch...

* Tests by @lwis

* Docstring

* Create open
2016-10-23 18:55:06 -07:00
Fabian Affolter
1f89e6ddba Upgrade pytz to 2016.7 (#4002) 2016-10-23 20:51:41 +02:00
Lewis Juggins
13ab2be5f6 Exclude dirs/files prefixed with . (#3986) 2016-10-23 16:47:06 +02:00
Robbie Trencheny
2bc84af87e Version bump to 0.32.0.dev0 2016-10-22 15:23:01 -07:00
Robbie Trencheny
ef2ed7bfc9 Merge pull request #3937 from home-assistant/dev
0.31
2016-10-22 15:22:07 -07:00
Robbie Trencheny
6040a40af2 Update version 2016-10-22 15:09:05 -07:00
jbags81
fb352c20d9 Update wink.py (#3957)
* Update wink.py

added lambda and smoke detector call in component loading routine to fix broken functionality.

* Update wink.py

fixed extra space.

* Update wink.py

applied cleaner refactor per comments

* Update wink.py

fixed spacing

* Update wink.py

fixed lint error #1
2016-10-22 16:59:20 -04:00
John Arild Berentsen
678f30def1 Prevent Verisure cam to delete a file when it is None (#3988) 2016-10-22 21:01:12 +02:00
Paulus Schoutsen
0fce5ccc7f Update frontend 2016-10-22 11:24:06 -07:00
John Arild Berentsen
02afc98668 Prevent zwave from firing event at shutdown (#3987) 2016-10-22 14:08:24 +02:00
Eric Hagan
57777ef79a Adds support for Pioneer AVR interface port number (#3878)
* Adds support for Pioneer AVR interface port number

https://community.home-assistant.io/t/support-for-pioneer-avr/503
telnetlib supports a port number so adding port as
an optional config element with a default of 23 resolves this.

* Adds timeout to Pioneer AVR

timeout in telnetlib defaults to socket._GLOBAL_DEFAULT_TIMEOUT
which is not a value, but rather a bare Object used for comparison.

telnetlib says the following about the timeout optional argument:
"The optional timeout parameter specifies a timeout in seconds
 for blocking operations like the connection attempt (if not
 specified, the global default timeout setting will be used)."

From the documentation for sockets:
"Sockets are by default always created in blocking mode"

Catching connect and timeout errors, logging to debug
and continuing.

* Catches timeout exceptions, logs and continues.
2016-10-22 11:05:00 +02:00
Paulus Schoutsen
ca6fa1313e Fix updater, add new fields (#3982)
* Fix updater

* Add Docker and virtualenv checks

* Add log line informing user of update/analytics

* Remove str
2016-10-21 23:30:40 -07:00
Robbie Trencheny
ea91d24eb2 HA iOS support (#3752)
* Initial commit of the iOS component and platform

* Allow extra

* Add battery to identify, a new function to get devices, and load the upcoming sensor

* Add iOS sensor platform, currently for battery state & level

* Add discoverability for the iOS app

* Convert single quote to double quotes

* Load all required components and platforms when loading the iOS component for the best experience

* Unify quote style to double

* Change to hass_ios

* Update push URL, add support for logging based on status code, log rate limit updates

* Block iOS from coverage checks for now...
2016-10-21 23:20:15 -07:00
Brent Hughes
6e5a3c0a94 Fixed statsd stopping if state is not numeric or only attributes changed (#3981)
* Fixed statsd stopping if attribute changed by not the state

* Fixed tests which exposed a new bug.

* Fixed another issue. whoops
2016-10-21 23:18:13 -07:00
dasos
754d536974 Work better with password-protected Squeezebox / LMS servers (#3953)
* Work better with password-protected Squeezebox / LMS servers, including getting file art. Refactored to only have a single method calling the telent lib. (Should make it easier to convert to the more appropriate JSON interface)

* Update squeezebox.py

* Update squeezebox.py

* Update squeezebox.py

* Update squeezebox.py

* Update squeezebox.py
2016-10-21 22:37:35 -07:00
Georgi Kirichkov
4f6ed09a99 Adds energy monitoring capabilities to the TP-Link HS110 (#3917)
* Adds energy monitoring capabilities to the TP-Link HS110

Energy monitoring works only on the HS110 model

* Reverts to using GadgetReactor's module

* Updates requirements_all.txt

* Refactors tplink switch to use attribute caching

* Update tplink.py
2016-10-21 21:45:36 -07:00
Johann Kellerman
8d375e2d47 Improve known_device.yaml writing (#3955)
* Better known_device.yaml writing

* yaml dump
2016-10-21 21:41:27 -07:00
Hydreliox
1d2d338cd0 Add Bbox Router bandwidth as sensors (#3956)
* Add Bbox Routeur bandwidth as sensors

Add possibility to monitor max and currently used bandwidth of your xdsl connection for Bbox Routeur

* Minor Fixes

Unit constant get back into the main sensor file

* Unused round removed
2016-10-21 21:34:22 -07:00
Hugo Dupras
cb47507002 Add support for Neato Connected robot as a switch (#3935)
* Add support for Neato Connected robot as a switch

Signed-off-by: Hugo D. (jabesq) <jabesq@gmail.com>

* Add checklist items

Signed-off-by: Hugo D. (jabesq) <jabesq@gmail.com>

* Add missing docstring

Signed-off-by: Hugo D. (jabesq) <jabesq@gmail.com>

* [Neato] Add update function to retrieve robot state

* Add docstring for update function + catch exception when retrieving state

* Change type of HTTPError when updating state

* Fix pylint errors
2016-10-21 21:14:45 -07:00
Fabian Affolter
fae620f3b3 Migrate to voluptuous (#3748) 2016-10-21 21:14:35 -07:00
Paulus Schoutsen
b821a82417 Merge remote-tracking branch 'origin/master' into dev 2016-10-21 20:57:07 -07:00
Paulus Schoutsen
da7837af73 Update frontend 2016-10-21 20:52:58 -07:00
Johann Kellerman
6e903fd429 Updater component - rename opt_out to reporting (#3979)
* Updater component - rename opt_out to reporting

* Fix tests
2016-10-21 20:40:23 -07:00
Martin Hjelmare
9f7e167669 Fix test using libsodium and SECRET_KEY (#3975)
* Move test to class with custom config setups and with config
  validation.
2016-10-21 20:23:29 -07:00
John Arild Berentsen
54a64fb8d9 Add support for verisure file camera. (#3952) 2016-10-21 22:41:17 +02:00
Nick Vella
2d89c3ecf4 Telstra SMS API notification component (#3949)
* Telstra API component

* import PLATFORM_SCHEMA

* Exclude Telstra notify component in coveragerc

* fix authentication issues

* Include title in SMS if it's provided

* pass lint

* Fix many code styling issues

* Confirm credentials are correct on component setup
2016-10-20 23:47:21 -07:00
Teemu Mikkonen
9f6d1c4e7b Device tracker: SNMPv3 (#3961)
* Add initial SNMPv3 support for better security

* Fixed indentation errors

* Fixed flake8 E128 on row 65

* Disabled warning about too many instance-attributes

* Removed extra code, added Inclusive to make better config validation
2016-10-20 23:01:30 -07:00
AlucardZero
62b8e54235 Upgrade SoCo to 0.12 (#3951)
Changelog: https://github.com/SoCo/SoCo/releases/tag/v0.12

Backwards Compatability changes:

    Dropped support for Python 3.2
    Methods relating to the music library (get_artists, get_album_artists, get_albums and others) have been moved to the music_library module. Instead of device.get_album_artists(), please now use device.music_library.get_album_artists() etc. Old code will continue to work for the moment, but will raise deprecation warnings
    Made a hard deprecation of the Spotify plugin since the API it relied on has been deprecated and it therefore no longer worked
    Dropped pylint checks for Python 2.6
2016-10-20 22:51:00 -07:00
Dustin S
1ceac8407d Adding security contexts to the resources. (#3840) 2016-10-20 22:43:39 -07:00
Jason Carter
0c0b02eb3d Moving updates out of state property (#3966) 2016-10-20 22:35:25 -07:00
Johann Kellerman
c70722dbae Updater component with basic system reporting (#3781) 2016-10-20 21:30:44 +02:00
Martin Hjelmare
a05fb4cef8 Upgrade pymysensors to 0.8 (#3954) 2016-10-20 20:56:26 +02:00
Marcelo Moreira de Mello
fee01fcccc Added unit test to the Yahoo Finance sensor (#3943) 2016-10-20 20:14:50 +02:00
henryk
2b37b4251b Fritzbox - Only report a MAC address if it's really there (#3964)
Fixes 'Neither mac or device id passed in'
2016-10-20 20:04:11 +02:00
Fabian Affolter
3aa1b6a3f8 Fix PEP257 issues (#3962) 2016-10-20 19:10:12 +02:00
Pascal Vizeli
c32afcd961 Bugfix sonos (#3926)
* Bugfix Sonos

* lint

* Use player uid for looking of exists

* fix lint

* fix unittest

* Change player_id to unique_id
2016-10-20 08:36:48 -07:00
hcooper
d60c2d604f Add support for multiple inputs to nmap tracking module as a list (#3944) 2016-10-20 07:15:00 +02:00
David-Leon Pohl
081e61528d Bugfixes for pilight hub component and unit tests (#3948) 2016-10-19 22:02:11 +02:00
Richard Cox
5799d1aec9 Fixing verbage (#3940) 2016-10-18 18:25:47 -07:00
Adam Mills
7d32e5eeeb Logbook filtering of automations by entity_id (#3927)
* Logbook filtering of automations by entity_id

* Trigger action function parameters required
2016-10-18 18:11:35 -07:00
Johann Kellerman
57f32fa629 Fixup device_tracekt.mqtt voluptuous & unit tests (#3904) 2016-10-18 18:10:28 -07:00
Sean Dague
7da47852d4 Yamaha zones (#3920)
* Enhance yamaha component

This enhances the yamaha component to create 1 player per zone,
instead of only one play, which provides direct control of the various
zones for the player.

It also exposes play_media for NET_RADIO sources, which allows direct
setting of that.

This requires code changes in rxv 0.2.0, so the requirement dependency
is raised.

* Support current playback metadata for NET_RADIO

When on NET RADIO, support the currently playing information.
2016-10-18 18:04:15 -07:00
Justin Weberg
f1b658ea5d Fix Typo (#3942) 2016-10-18 17:59:14 -07:00
Pascal Vizeli
754e93ff6a Rename add_devices to async_add_devices like dev guide (#3938) 2016-10-19 00:35:22 +02:00
David-Leon Pohl
947c1efca2 New pilight sensor component (#3822)
* Pilight daemon expects JSON serializable data. Thus dict is needed and not a mapping proxy.
* Add explanation why dict as message data is needed
* Use pytest-caplog and no unittest.TestCase
2016-10-18 23:16:20 +02:00
hexa-
a1239077d9 Add support for matrix notifications (#3827) 2016-10-18 21:13:00 +02:00
Paulus Schoutsen
53b5dc8e84 Build frontend 2016-10-18 09:10:22 -07:00
Lewis Juggins
09bcd7321a Reset Bravia playing info to ensure state reflects correctly (#3903) 2016-10-17 23:13:35 -07:00
Pascal Vizeli
14ef0ca786 Bugfix Template sensors (#3931) 2016-10-18 07:27:32 +02:00
Rob Capellini
272539105f Replacing tempfile with mock_open in tests (#3753)
- test_bootstrap.py
- test_config.py
- components/test_init.py
- components/test_panel_custom.py
- components/test_api.py
- components/notify/test_file.py
- components/notify/test_demo.py
- components/camera/test_local_file.py
- helpers/test_config_validation.py
- util/test_package.py
- util/test_yaml.py

No changes needed in:
- components/cover/test_command_line.py
- components/switch/test_command_line.py
- components/rollershutter/test_command_line.py
- components/test_shell_command.py
- components/notify/test_command_line.py

Misc changes in:
- components/mqtt/test_server.py

Also, removed some unused mock parameters in tests/components/mqtt/test_server.py.
2016-10-17 20:16:36 -07:00
Fabian Affolter
7d67017de7 Upgrade python-digitalocean to 1.10.0 (#3921) 2016-10-17 20:13:43 -07:00
juggie
d921073e77 Ecobee - Celsius (#3906)
* #3899 - Ecobee tempoeratures

* #3899 Remove unused import

* #3899 Implement min/max_temp in ecobee.py as these temperatures have to be in F for ecobee api.

* #3899 Stale print

* #3899 Use min/max_temp from base class

* #3899 Removed unused import (again) so tests pass since changing to use super class

* #3899 Fix long lines

* #3899 Install tox locally... make it happy, commit

* #3899 Remove overridden min/max_temp and instead update __init__:min/max_temp to convert to self.temperature_unit (of the thermostat) as opposed to self.unit_of_measurement (of the system), which is wrong

* Remove unused import from ecobee
2016-10-17 20:06:03 -07:00
Jason Carter
9cf2acb495 Concord232 alarm panel (#3842)
* Adding Concord232 Alarm Panel

* Adding Concord232 Zones as Sensors

* Updating requirements_all.txt

* Adding DOCType and making helper function a closure for clarity

* Fixing D400 error in build

* Fixing pylint errors

* Adding # pylint: disable=too-many-locals

* Updating with proper polling methods

* Fixing Merge issues

* Fixing DocStyle Issue

* Moving Import out of setup

* Fixing DocString

* Removing overthought GLOBAL
2016-10-17 19:59:41 -07:00
Giel Janssens
3b424b034a Netatmo thermostat (#3888)
* Added Netatmo-thermostat

* Remove-CONF_DEVICES
2016-10-17 19:57:02 -07:00
Marcelo Moreira de Mello
76598bc4d2 #3829 - Fixed issued LowHighTuple doesn't define __round__ method for Nest Sensor (#3881)
* #3829 - Fixed type LowHighTuple doesn't define __round__ method issue when Nest is operating in range mode

* Testing if temperature is a tuple instead int or float
2016-10-17 19:55:53 -07:00
William Scanlon
c54476b62f Protocol is an int (#3928) 2016-10-17 19:53:50 -07:00
sam-io
ae8a8e22ad Support for Apple Push Notification Service (#3756)
* added push notification implementation

* some lint changes

* added docs

* added push notification implementation

* some lint changes

* added docs

* Fixed comment formatting issues

* Added requirments

* Update requirements_all.txt

* Update apns.py

* re-generated requirments_all.txt

* Added link to online docs

* added push notification implementation

* some lint changes

* added docs

* added push notification implementation

* some lint changes

* added docs

* Fixed comment formatting issues

* Added requirments

* Update requirements_all.txt

* Update apns.py

* re-generated requirments_all.txt

* Added link to online docs

* changed to use http/2 library for push notifications

* fixed lint issue

* fixed test that fails on CI

* another go at fixing test that fails on CI

* another go at fixing test that fails on CI

* another go at fixing test that fails on CI

* added missing docstring

* moved service description to main services.yaml file

* renamed apns service
2016-10-17 19:41:49 -07:00
Paulus Schoutsen
4c8d1d9d2f Clean up some async stuff (#3915)
* Clean up some async stuff

* Adjust comments

* Pass hass instance to eventbus
2016-10-17 19:38:41 -07:00
Sean Dague
daea93d9f9 Suppress requests/urllib3 connection pool log messages (#3854)
requests/urllib3 is notorious for using the INFO log level for very
DEBUG kinds of information. Given the configurability of python
logging it's actually pretty easy to just set requests to WARN by
default. This cleans out a bunch of largely unuseful log lines from
home assistant output.
2016-10-17 21:14:10 +02:00
Pascal Vizeli
1540bb1279 Async template (#3909)
* port binary_sensor/template

* port sensor/template

* port switch/template

* fix unittest

* fix

* use task instead yield on it

* fix unittest

* fix unittest v2

* fix invalid config

* fix lint

* fix unuset import
2016-10-17 07:00:55 +02:00
Jan Harkes
555e533f67 Added tests for the template is_defined filter 2016-10-17 03:20:07 +02:00
Jan Harkes
118f2f0bad Use a filter to fail rendering undefined variables
Instead of globally using StrictUndefined, introduce a filter that
will trigger a render failure on undefined variables.

Use as `{{ value_json.someval | is_defined }}`.
2016-10-17 03:20:07 +02:00
Jan Harkes
c8add59ea5 Fail when rendering undefined objects in Jinja2 templates
By not successfully rendering unknown objects to an empty string
the caller provided error_value actually gets used.

This allows, for instance, the MQTT sensor to retain its state when an
unexpected or unwanted message (#2733/#3834) is received.
2016-10-17 03:20:07 +02:00
Willems Davy
18f5258aaf Emoncms history component (#3531)
* Emoncms_history component, fix git mess

* - switch to track_point_in_time to send all data at foxed interval
- don't use json_dump
- switch to http post instead of http get
2016-10-16 17:05:01 -07:00
Justin Weberg
207c9e8575 Fix Comment (#3913) 2016-10-16 16:56:02 -07:00
Rob Capellini
4891ca1610 Removing calls to mock.assert_called_once_with (#3896)
If a mock's assert_called_once_with method is misspelled (e.g. asert_called_once_with) then the test will appear as passing.  Therefore, this commit removes all instances of assert_called_once_with calls and replaces them with two assertions:

        self.assertEqual(mock.call_count, 1)
        self.assertEqual(mock.call_args, mock.call(call_args))
2016-10-16 16:13:27 -07:00
Lewis Juggins
10c9132046 Resolve issue with delay not passing variables to render (#3901) 2016-10-16 16:08:12 -07:00
Fabian Affolter
71ee847aee Add web scrape sensor (#3841)
* Add web scrape sensor

* Add support for 'value_template', set 'verify_ssl' to true,
and remove 'before', 'after' & 'element'

* Fix pylint issue
2016-10-16 16:06:07 -07:00
Per Sandström
d9ae7ceb0c Tellstick switch force update (#3874) 2016-10-16 15:56:55 -07:00
Justin Weberg
2a972b2334 Move micromarkdown to HA (#3908)
* Move micromarkdown to HA

* Fix requests

* Update micromarkdown-js.html& .gz

* Update micromarkdown-js files
2016-10-16 15:47:34 -07:00
Pascal Vizeli
7484152be1 Async speedup add_device callback (#3910)
* Speed up entities processing from add_device callback

* fix lint

* fix bug
2016-10-17 00:35:57 +02:00
Paulus Schoutsen
6581dc2381 Document more core pieces 2016-10-16 13:45:17 -07:00
Paulus Schoutsen
31ec0ac6a7 Add util.async to the dev docs 2016-10-16 13:35:01 -07:00
John Arild Berentsen
8b2edc1514 ZWave: Add association service (#3894)
* Add association service

* Refactor service

* Requested changes

* Grammar in pydocstyle
2016-10-16 20:36:06 +02:00
Adam Mills
2612c6d6b8 Zwave alt delay workaround for HS-WD100+ (#3893) 2016-10-16 20:35:39 +02:00
Pascal Vizeli
0b8b9ecb94 Async EntitiesComponent (#3820)
* first version

* First draft component entities

* Change add_entities to callback from coroutine

* Fix bug add async_prepare_reload

* Group draft v1

* group async

* bugfix

* bugfix v2

* fix lint

* fix extract_entity_ids

* fix other things

* move get_component out of executor

* bugfix

* Address minor changes

* lint

* bugfix - should work now

* make group init async only

* change update handling to old stuff

* fix group handling, remove generator from init

* fix lint

* protect loop for spaming with updates

* fix lint

* update test_group

* fix

* update group handling

* fix __init__ async trouble

* move device_tracker to new layout

* lint

* fix group unittest

* Test with coroutine

* fix bug

* now it works 💯

* ups

* first part of suggestion

* add_entities to coroutine

* change group

* convert add async_add_entity to coroutine

* fix unit tests

* fix lint

* fix lint part 2

* fix wrong import delete

* change async_update_tracked_entity_ids to coroutine

* fix

* revert last change

* fix unittest entity id

* fix unittest

* fix unittest

* fix unittest entity_component

* fix group

* fix group_test

* try part 2 to fix test_group

* fix all entity_component

* rename _process_config

* Change Group to init with factory

* fix lint

* fix lint

* fix callback

* Tweak entity component and group

* More fixes

* Final fixes

* No longer needed blocks

* Address @bbangert comments

* Add test for group.stop

* More callbacks for automation
2016-10-16 09:35:46 -07:00
Fabian Affolter
a0fdb2778d Fix name allocation (#3890) 2016-10-16 18:07:34 +02:00
Fabian Affolter
5ef8ca9b03 Upgrade sendgrid to 3.6.0 (#3887) 2016-10-16 09:09:48 +02:00
Fabian Affolter
a10fa90357 Update link to docs repo (#3886) 2016-10-15 13:46:45 +02:00
Fabian Affolter
9743e17d62 Minimum/maximum/mean sensor (#3852)
* Add min/max sensor

* Update min_max.py
2016-10-14 21:43:46 -07:00
Marcelo Moreira de Mello
6fcb1b548e Added the ability to Weather Underground to track severe weather alerts (#3505)
*  Added the ability to Weather Underground to track severe weather alerts

*   * Added message on the advisory attr

  * Updated tests

* * Making use of guard clause

* Checking multiple_alerts prior loop

* Using a better way to create dict

* Fixed issue to set to None only the object that failed

* Added unittest

* Split update() method to different calls with their one throttle control to minimize API calls

* Updated unittest and make sure the alert sensor will not return 'unknown' status'

* Removed update() method from state property

* Branch rebased and include Weather Underground attribution

* Update wunderground.py
2016-10-14 21:35:27 -07:00
Adam Mills
1bf5554017 Zwave rgb fix (#3879)
* _zw098 must be set before update_properties

* Fix problematic zwave color light value matching

See https://community.home-assistant.io/t/color-issues-with-aeotec-zwave-zw098/2830
2016-10-14 21:17:48 -07:00
Georgi Kirichkov
49b1643ff0 Relaxes the configuration options for influxdb (#3869)
* Relaxes the configuration options for influxdb

By default influxdb allows unauthenticated access
Home Assistant required at least username and password to be present to properly submit data to influxdb

* Removes unused import of 'copy'

The copy module was used only in the removed test case responsible for testing the missing keys

* Updates InfluxDB config schema to require user and password

Current InfluxDB (v 1.0) can work without any authentication, but when authentication is enabled both username and password should be set.

* Removes extra white space in test_influxdb.py
2016-10-14 21:10:04 -07:00
Michael
ce19e6367f Catch MQTT encoding errors (#3749)
* added error handling to mqtt message receive if payload is not utf-8 unicode
added mqtt test for above code as well

* change permission back to 644

* attempting to test new code

* changed exception to AttributeError
fixed test for above

* fixed lint errors I made in tests....mqtt/test_init.py

* more lint fixes for my added test

* remove dual decode of MQTT payload

* convert if to try, except, else statement for mqtt payload decode

* rework mqtt unicode testing code to properly check for log file entriy on unicode decode exception

* fixed lint error

* Update test_init.py
2016-10-14 21:08:44 -07:00
Fabian Affolter
180e146e14 Upgrade uber_rides to 0.2.7 (#3876) 2016-10-14 21:00:27 -07:00
Fabian Affolter
bead274b20 Upgrade slacker to 0.9.28 (#3877) 2016-10-14 20:58:49 -07:00
Richard Cox
1cbf8c8049 Zoneminder component (#3795)
* Initial Zoneminder commit

* Fixing bug when ZM sets its function to 'None'

* Adding zoneminder to coverage

* Quick Doc fix

* Update zoneminder.py

Doc Fix

* making the url base optional
2016-10-14 20:56:40 -07:00
Lukas
ad259ead50 Add ignore option to zwave customize configuration (#3865) 2016-10-14 08:36:55 -07:00
Daniel Høyer Iversen
bb457f47cc Merge pull request #3868 from home-assistant/flux_led_lib
update flux led library
2016-10-14 11:41:18 +02:00
Daniel
df3e904fe7 update flux led library 2016-10-14 11:17:03 +02:00
Hugo Dupras
7697cdef0a Pushbullet push an url note if an url is provided inside data (#3758) 2016-10-14 00:11:48 -07:00
Igor Shults
6951b6f60b Allow any positive integer for Z-Wave polling intensity (#3859) 2016-10-14 00:09:52 -07:00
John Arild Berentsen
6ca0d4cd14 Use pass instead of return None (#3856) 2016-10-14 00:09:24 -07:00
Sean Dague
a5b756e1e5 Bump proliphix library to 0.4.0 (#3855)
There was a bug in setback setting which is now fixed in 0.4.0. This
ensures that any users have working setback code.
2016-10-14 00:06:53 -07:00
Sean Dague
7848791a04 add arwn sensor platform (#3846)
This adds a sensor component that builds sensors based on the arwn
project (https://github.com/sdague/arwn). This uses a 433mhz receiver
to collect weather data and publish it over mqtt in a well defined
schema, which home-assistant can display as sensors.
2016-10-14 00:06:04 -07:00
Paulus Schoutsen
f916fc04f9 Update frontend 2016-10-14 00:02:21 -07:00
John Arild Berentsen
8f4608c654 Use only node id to identify node in set_config_parameter (#3801) 2016-10-13 23:45:00 -07:00
Per Sandström
399a0b470a select next and previous of input select (#3839) 2016-10-13 21:53:47 -07:00
Jan Harkes
4d716cec2b Bump pychromecast dependency to 0.7.6 (#3864) 2016-10-13 21:24:54 -07:00
Lukas
1373db8b60 Include index and instance in object_id of zwave devices (#3759)
* Include index and instance in object_id of zwave devices

* Add the instance id if there is more than one instance for the value
2016-10-13 21:13:05 -07:00
Hydreliox
7771cc2ccf Add Bbox Modem Routeur for device tracker (#3848) 2016-10-13 19:43:51 -07:00
Per Sandström
c5ad7996fb Merge pull request #3857 from persandstrom/vsure0.11.1
vsure 0.11.1
2016-10-13 22:18:42 +02:00
Per Sandström
3d94f77998 vsure 0.11.1 2016-10-13 21:53:50 +02:00
Marcelo Moreira de Mello
6330d9cde6 Fixed Fitbit resting heart rate attribute (#3835)
* Fixed Fitbit restingHeartRate field to grab the correct field from dictionary

In [31]: r['activities-heart'][-1].get('value')
Out[31]:
{'customHeartRateZones': [],
 'heartRateZones': [{'caloriesOut': 126.18348,
   'max': 94,
   'min': 30,
   'minutes': 67,
   'name': 'Out of Range'},
  {'caloriesOut': 27.21339,
   'max': 131,
   'min': 94,
   'minutes': 5,
   'name': 'Fat Burn'},
  {'caloriesOut': 0, 'max': 159, 'min': 131, 'minutes': 0, 'name': 'Cardio'},
  {'caloriesOut': 0, 'max': 220, 'min': 159, 'minutes': 0, 'name': 'Peak'}],
 'restingHeartRate': 69}

In [32]: r['activities-heart'][-1].get('value').get('restingHeartRate')
Out[32]: 69

* Renamed sensor to Resting Heart Rate to match it

* Fixed lint style
2016-10-13 09:22:05 -07:00
Hugo Dupras
9a0bb62654 Hotfix for Netatmo discovery (#3837)
This should definetly fix #2601

Signed-off-by: Hugo D. (jabesq) <jabesq@gmail.com>
2016-10-13 09:21:22 -07:00
Fabian Affolter
d873a7baf0 Use async_render_* and fix config validation (#3847) 2016-10-13 09:20:49 -07:00
Robbie Trencheny
c663d85129 Add Alexa Flash Briefing Skill API support (#3745)
* Add Alexa Flash Briefing Skill API support

* Set default value for text to empty string as per API docs

* Clean up existing Alexa tests

* Update configuration parsing and validation

* Add tests for the Flash Briefing API

* Update test_alexa.py
2016-10-13 09:14:22 -07:00
John
8c13d3ed4c Update zwave lights to increase update delay timer as needed (#3741)
Fix permissions
2016-10-13 09:09:41 -07:00
Johann Kellerman
cb322f72db Add persistent notifications to bootstrap (#3738)
* Add persistent notifications to bootstrap

* Rebase, Fix test
2016-10-13 09:09:07 -07:00
Scott Reston
39a446c43c Proper title, added album and artist for Squeezebox (#3735)
* Proper title, added album and artist

Title had previously concatenated artist - title.

* Made changes suggested by @balloobbot
2016-10-13 09:07:10 -07:00
wokar
aa8622f8e8 Added include and exclude functionality to history component (#3674)
* added include and exclude functionality to history component

* fixed summary lines in test method doc.

* cleanup of query filter creation

* o improved config validation
o move move IGNORE_DOMAINS to Filter.apply()
o removed config from Last5StatesView
o Filters instance is now created on setup
o config values are processed in setup and set to the Filters instance
o function _set_filters_in_query() moved to Filters class and renamed to apply()

* added unittests for more include/exclude filter combinations

* make pylint happy
2016-10-13 08:54:45 -07:00
Vittorio Monaco
e031b8078f Fixes an issue where Chromecast audio groups were not properly discovered (#3630)
* Fixes an issue where Chromecast audio groups were not properly discovered

* Forgot to commit the main fix

* Removes unused variable

* Doesn't use a protected API anymore

* PR remarks

* Fixes tests, adds comment

* Restores line as it was in the original commit, rephrases comment

* Should fix lint issues

* Trailing whitespace

* Some more lint
2016-10-13 08:51:43 -07:00
jgriff2
e1647fb6ac Add synology ss cameras (#3626)
* Add files via upload

* Update .coveragerc

* test

* Update synology camera

* Use voluptuous for synology

* Use voluptuous for synology

* Use voluptuous for synology

* Use voluptuous for synology

* Conform synology to flake8

* Added Whitelist to synology

* Sync to dev branch

* Added helper function to synology
2016-10-13 08:49:58 -07:00
Lewis Juggins
10feac11d9 Support recursive config inclusions (#3783) 2016-10-12 12:05:41 +02:00
Paulus Schoutsen
d4e2332ce0 Merge pull request #3814 from home-assistant/release-0-30-1
0.30.2
2016-10-11 22:28:00 -07:00
Jean Regisser
1d7169403b Add again certifi to Docker image (#3813)
Latest versions of certifi (>= 2016.8.31) don't seem to break anything
anymore.
See home-assistant/home-assistant#2554
2016-10-11 22:25:17 -07:00
Keith Lamprecht
e4685de459 Restore Optional Target Config Attribute (notify.pushover) (#3769)
* Restore Optional Target Config Attribute

* Fix Tabs

* Change indents to spaces

* Make a target fix

* Change to simpler not syntax
2016-10-11 21:59:45 -07:00
Keith Lamprecht
d83de36c32 Restore Optional Target Config Attribute (notify.pushover) (#3769)
* Restore Optional Target Config Attribute

* Fix Tabs

* Change indents to spaces

* Make a target fix

* Change to simpler not syntax
2016-10-11 21:59:34 -07:00
Fabian Affolter
73547c8c4b Fix slack targets (#3826) 2016-10-11 21:58:54 -07:00
Fabian Affolter
40094cecae Fix slack targets (#3826) 2016-10-11 21:16:11 -07:00
Robbie Trencheny
0b327cd4d9 Notify: Only attach target if in call data (#3831)
* Only pass through the target if it has a value

* Target will no longer be none
2016-10-11 20:34:14 -07:00
Robbie Trencheny
d302dbec2d Notify: Only attach target if in call data (#3831)
* Only pass through the target if it has a value

* Target will no longer be none
2016-10-11 20:33:41 -07:00
Fabian Affolter
e135691bd6 Migrate to voluptuous (#3817) 2016-10-11 08:33:22 -07:00
Fabian Affolter
d4dc2707a1 Use voluptuous for eQ-3 thermostat (#3729)
* Migrate to voluptuous

* Fix requirement and typo
2016-10-11 11:27:31 +02:00
Paulus Schoutsen
a8cdf36d5c Update recorder callback (#3812) 2016-10-11 00:58:43 -07:00
Fabian Affolter
a99f36f519 Migrate to voluptuous (#3737) 2016-10-11 00:56:57 -07:00
Fabian Affolter
0568ef025b Use voluptuous for Heatmiser (#3732) 2016-10-11 00:53:24 -07:00
Fabian Affolter
8ded8f572a Add/adjust attribution of sensor platform (#3719)
* Add/adjust attribution

* Fix typo
2016-10-11 00:28:19 -07:00
Fabian Affolter
7cf2c48175 Use voluptuous for FitBit (#3686)
* Migrate to voluptuous

* Fix default
2016-10-11 00:27:15 -07:00
Fabian Affolter
7cf9ff83bc Migrate to voluptuous (#3293) [BREAKING CHANGE] 2016-10-11 00:26:11 -07:00
Paulus Schoutsen
dfe9af7110 Version bump to 0.30.2 2016-10-11 00:21:01 -07:00
Erik Eriksson
016e8f833d slugify (#3777) 2016-10-11 00:20:49 -07:00
Teemu Mikkonen
574df0f420 Fix for html5 notification tag problem. Fixes #3774 (#3790) 2016-10-11 00:20:49 -07:00
Pascal Vizeli
f18f181962 Hotfix device name with autodiscovery (#3791) 2016-10-11 00:20:49 -07:00
Ellis Percival
4754455295 Make 'pin' optional for zigbee device config. (#3799) 2016-10-11 00:20:49 -07:00
Robbie Trencheny
8c1317f278 Wrap found target in list (#3809)
* Wrap found target in list

* Fix test_messages_to_targets_route
2016-10-11 00:20:49 -07:00
Russell Cloran
7c2cb6cffd Separate climate platform and presentation units (#3755)
* Separate platform and presentation units in climate

* Fix unit tests

Maybe

* Fix unit tests some more

Maybe

* Rename _platform_unit_of_measurement to temperature_unit

* Fix tests for renamed attribute
2016-10-11 00:00:29 -07:00
Ferry van Zeelst
8c9d1d9af1 Added additional checks which hides functions which are not supported by Nest (#3751)
* Added additional checks which hides functions which are not support (like fans / humidity / cooling)

* Fixed pylint and flake8 errors (not test file available)

* Fixed pydocstyle error

* Refactored Code and Comments as described in pull-request

* Added additional comment and requesting retest

* Upgraded to python-nest 2.11 which contains previously hidden functions
2016-10-10 23:57:14 -07:00
Lukas
941fccd3fc Update python-lirc to 1.2.3 (#3784)
* Upgrade to latest python-lirc 1.2.3

* update requirements_all.txt
2016-10-10 23:44:41 -07:00
Clemens Wolff
711526e574 Cache condition in helpers.Script (#3797)
* Cache condition in helpers.Script

The caching is a simple in-memory, per-instance dictionary.
We use __str__ to format cache keys.

This naive implementation has some disadvantages (e.g., we won't be able
to cache two conditions that contain references to
distinct-but-equivalent object instances and we don't have any control
over the size of the condition cache), but for most simple use-cases the
approach should be good enough.

Resolves #3629

* Fix docstring style
2016-10-10 23:36:38 -07:00
Fabian Affolter
a2503e4d13 Upgrade sqlalchemy to 1.1.1 (#3796) 2016-10-10 23:29:43 -07:00
Fabian Affolter
656ee52435 Upgrade cherrypy to 8.1.2 (#3805) 2016-10-10 23:27:53 -07:00
Fabian Affolter
002660fd9e Upgrade dnspython3 to 1.15.0 (#3804) 2016-10-10 23:24:10 -07:00
Fabian Affolter
63580f9e03 Upgrade pyowm to 2.5.0 (#3806) 2016-10-10 23:23:32 -07:00
Teemu Mikkonen
87d9cdd78f Fix for html5 notification tag problem. Fixes #3774 (#3790) 2016-10-10 23:17:27 -07:00
phardy
c8ca66b671 Stop GTFS component from overwriting friendly_name (#3798)
* Prevent update from clobbering configured name.

* linted

* Fixing awkward line breaking.
2016-10-10 22:36:20 -07:00
Robbie Trencheny
9b98d470c2 Wrap found target in list (#3809)
* Wrap found target in list

* Fix test_messages_to_targets_route
2016-10-10 22:31:15 -07:00
sander76
b19ec21e88 Changing import as powerview api did change. (#3780) 2016-10-10 22:30:27 -07:00
Fabian Affolter
3b331eac56 Update docstrings (sensor.pi_hole, sensor.haveibeenpwned) (#3793)
* Fix docstrings

* Update docstrings
2016-10-10 19:38:32 +02:00
Fabian Affolter
552265bc31 No longer use old name (#3792) 2016-10-10 19:38:20 +02:00
Ellis Percival
df58f718ab Make 'pin' optional for zigbee device config. (#3799) 2016-10-10 16:53:18 +02:00
Pascal Vizeli
76a1a54369 Hotfix device name with autodiscovery (#3791) 2016-10-10 13:46:23 +02:00
Per Sandström
b6e008be71 Merge pull request #3782 from persandstrom/vsure0.11.0
vsure0.11.0
2016-10-09 22:01:46 +02:00
Per Sandström
9d5c20b629 vsure0.11.0 2016-10-09 21:47:35 +02:00
Erik Eriksson
63d9ea6643 slugify (#3777) 2016-10-09 09:15:58 -07:00
Hugo Dupras
1d0df63615 Netatmo binary sensor (#3455)
* Basic support for Netatmo welcome binary sensors

Signed-off-by: Hugo D. (jabesq) <jabesq@gmail.com>

* Bug fixes and optimization for Netatmo devices

Signed-off-by: Hugo D. (jabesq) <jabesq@gmail.com>

* pylint fixes

* Bug Fixing and optimization for Netatmo devices

Signed-off-by: Hugo D. (jabesq) <jabesq@gmail.com>

* Add unique_id for cameras to avoid duplicate
And global config to disable discovery for netatmo devices

Signed-off-by: Hugo D. (jabesq) <jabesq@gmail.com>
2016-10-09 08:45:12 -07:00
hexa-
154eacef6c Http: Change approved_ips from string to cidr validation (#3532) [BREAKING CHANGE]
* Change approved_ips from string to cidr validation

Relabel to trusted_networks, better reflecting its expected inputs,
everything that ipaddress.ip_networks recognizes as an ip network
is possible:
- 127.0.0.1      (single ipv4 addresses)
- 192.168.0.0/24 (ipv4 networks)
- ::1            (single ipv6 addresses)
- 2001:DB8::/48  (ipv6 networks)

* Add support for the X-Forwarded-For header
2016-10-09 08:13:30 -07:00
Fabian Affolter
dc95b28487 Use voluptuous for Russound RNET (#3689)
* Migrate to voluptuous

* Remove wrong default
2016-10-09 16:40:54 +02:00
Paulus Schoutsen
c9a88322d6 Merge pull request #3765 from home-assistant/hotfix-0-30-1
0.30.1
2016-10-08 14:50:52 -07:00
Paulus Schoutsen
46b58db2ff Version bump to 0.30.1 2016-10-08 14:42:47 -07:00
mtl010957
78cbfa3f96 Fixed issue #3760, handle X10 unit numbers greater than 9. (#3763) 2016-10-08 14:42:24 -07:00
Roi Dayan
dba5c74c8f Fix command line cover template (#3754)
The command line cover value template is optional so we
need to check it's not none before assigning hass to it.

Fixes #3649

Signed-off-by: Roi Dayan <roi.dayan@gmail.com>
2016-10-08 14:42:24 -07:00
Johann Kellerman
a94a5ac9b5 Coerce device IDs from known_devices to be slugs (#3764)
* Slugify & consider_home test fix [due to load valid PR]

* undo schema change

* Fix slugify error
2016-10-08 14:42:24 -07:00
Johann Kellerman
4d9bac6f9c Coerce device IDs from known_devices to be slugs (#3764)
* Slugify & consider_home test fix [due to load valid PR]

* undo schema change

* Fix slugify error
2016-10-08 14:40:50 -07:00
Roi Dayan
6419d273ea Fix command line cover template (#3754)
The command line cover value template is optional so we
need to check it's not none before assigning hass to it.

Fixes #3649

Signed-off-by: Roi Dayan <roi.dayan@gmail.com>
2016-10-08 13:03:32 -07:00
mtl010957
7882b19dc5 Fixed issue #3760, handle X10 unit numbers greater than 9. (#3763) 2016-10-08 12:57:40 -07:00
Willems Davy
8f8bba4ad7 Haveibeenpwned sensor platform (#3618)
* Initial version of "haveibeenpwned" sensor component

* 2 flake8 fixes

* remove debugging error message

* Increase scan_interval as well as throttle to make sure that during initial startup of hass the request happens with 5 seconds delays and after startup with 15 minutes delays. Scan_interval is increased also to not call update as often

* update .coveragerc

* remove (ssl) verify=False

* - use dict to keep the request values with email as key
- use track_point_in_time system to make sure data updates initially at 5 seconds between each call until all sensor's email have a result in the dict.

* fix a pylint error that happend on the py35 tests
2016-10-08 11:38:58 -07:00
Johann Kellerman
7b40a641ec Continue on invalid platforms and new setup_component unit tests (#3736) 2016-10-08 11:27:35 -07:00
wokar
1b26b5ad14 add include configuration to logbook (#3739) 2016-10-08 11:26:14 -07:00
Hugo Dupras
bbbb4441ea Add discovery support for Netatmo weather Station (#3714)
* Add discovery support for Netatmo Weather station

Only The weather information are currently supported (No battery or wifi status supported)

Signed-off-by: Hugo D. (jabesq) <jabesq@gmail.com>

* Add unique_id for netatmo sensors to avoid duplicate

Signed-off-by: Hugo D. (jabesq) <jabesq@gmail.com>

* Update requirements_all.txt and PEP8 fixes

Signed-off-by: Hugo D. (jabesq) <jabesq@gmail.com>
2016-10-08 11:26:01 -07:00
Paulus Schoutsen
1e2e877302 Version bump to 0.31.0.dev0 2016-10-08 09:58:28 -07:00
Paulus Schoutsen
4239a2b844 Merge pull request #3715 from home-assistant/dev
0.30
2016-10-08 09:58:08 -07:00
Paulus Schoutsen
408b68bfac Version bump to 0.30.0 2016-10-08 09:57:51 -07:00
Paulus Schoutsen
fe317b806f Close event loop to avoid error on exiting HASS (#3762) 2016-10-08 18:56:36 +02:00
Paulus Schoutsen
09cbf68637 Update frontend 2016-10-08 09:23:45 -07:00
Johann Kellerman
fb94aaa5a1 Load yaml using validator and include consider_home (#3743)
* Load yaml using validator, consider_home

* timedelta, track_if_away

* improve voluptuous

* Add default back

* Change time_period validation order
2016-10-07 18:08:33 -07:00
Fabian Affolter
b09b13f552 Catch exception (fixes #3699) (#3727) 2016-10-07 17:30:59 -07:00
Erik Eriksson
2d4df42a65 improved error handling (#3725) 2016-10-07 17:25:51 -07:00
Erik Eriksson
fccc7e69d0 Improved exception handling. Don't stop updating from server because of exception. (#3724) 2016-10-07 17:24:02 -07:00
Pascal Vizeli
f1e5d32ef5 Async exception handling (#3731)
* remove unused exception

* add logging

* disable pylint broad-except

* add exception handler

* fix lint

* update log output

* change log message in async with exc_info

* Add exc_info to asyncio exception handler
2016-10-07 17:20:39 -07:00
Erik Eriksson
1c24018fbb Improved exception handling (#3746) 2016-10-07 17:16:35 -07:00
Robbie Trencheny
f37038921f Fix E501 line too long error 2016-10-07 11:48:38 -07:00
Robbie Trencheny
f030ff67ad Set anel_pwrctrl switch to specific commit instead of master 2016-10-07 11:38:39 -07:00
Robbie Trencheny
3cfec2b5e2 Set TP-Link switch to specific commit instead of master 2016-10-07 11:36:43 -07:00
Robbie Trencheny
58b3dd7cc0 Set specific commit for Hunter Douglas API package due to upstream rename 2016-10-07 11:34:41 -07:00
Fabian Affolter
5e16dc6307 Fix typo (#3744) 2016-10-07 00:00:12 -07:00
Fabian Affolter
8b059e9aad Migrate to voluptuous (#3687) 2016-10-06 16:11:08 +02:00
Fabian Affolter
12f1be9b1c Fix PEP257 issues and ordering (#3720) 2016-10-05 17:32:29 -07:00
Robbie Trencheny
519f400175 Merge branch 'master' into dev 2016-10-05 15:35:01 -07:00
Fabian Affolter
a94571fd10 Change name of Forecast.io platform to Dark Sky (#3698)
* Rename Forecast.io platform to Dark Sky

* Upgrade to python-forecastio to 1.3.5

* Update to reflect name change (Forecast.io -> Dark Sky)

* Rename forecast to darksky
2016-10-05 21:42:58 +02:00
Fabian Affolter
cb3a78b330 Adjust vol to accept filenames (fixes #3701) (#3707) 2016-10-05 18:02:45 +02:00
John
1bc6366051 Increase allowable polling intensity values (#3711) 2016-10-05 16:58:06 +02:00
Fabian Affolter
5d339fb141 Fix sentence (#3709) 2016-10-05 16:28:38 +02:00
Fabian Affolter
0c68f381b0 Migrate to voluptuous (#3679) 2016-10-05 14:40:08 +02:00
Daniel Høyer Iversen
3e40b24293 Merge pull request #3708 from home-assistant/flux_led
Update flux led library
2016-10-05 11:12:56 +02:00
Daniel Høyer Iversen
4b828d225e Merge pull request #3656 from home-assistant/pushetta
customize if pushetta should send test message on start up
2016-10-05 11:03:35 +02:00
Daniel
201294e481 Update flux led library 2016-10-05 10:49:33 +02:00
Daniel
350d23f7eb customize if pushetta should send test message on start up 2016-10-05 10:45:41 +02:00
Daniel Høyer Iversen
b8beae9c6c Merge pull request #3651 from home-assistant/automation
Customize initial state of automation
2016-10-05 09:48:55 +02:00
Daniel
46f3337b07 Customize initial state of automation 2016-10-05 09:20:51 +02:00
John Arild Berentsen
b2354f45be Add possibility to set temperature to a given operation_mode (#3646)
* Add possibility to set temperature to a given operation_mode

* Correctly break

* Review changes
2016-10-04 23:48:25 -07:00
Paulus Schoutsen
e4e13b59cf Update frontend 2016-10-04 23:15:10 -07:00
Paulus Schoutsen
8c694eb279 Speed up MQTT server test (#3703) 2016-10-04 22:49:43 -07:00
Paulus Schoutsen
9d085a023c Merge pull request #3706 from home-assistant/hotfix-0-29-7b
Fix broken unit tests
2016-10-04 22:47:46 -07:00
Martin Hjelmare
c06313a897 Set force_update to true for mysensors sensors (#3648) 2016-10-04 22:45:38 -07:00
Per Sandström
ed490b1c11 Add västtrafik sensor (#3640) 2016-10-04 22:37:45 -07:00
Marcelo Moreira de Mello
70fc94003d Fixed issue #3624 and bumped python-nest to 2.10.0 version (#3665)
* Fixed issue #3624 and bumped python-nest to 2.10.0 version

*    Fixed return state when accessing attribute operation_mode

* Fixed typo
2016-10-04 22:29:21 -07:00
Paulus Schoutsen
114fae76e1 Fix broken unit tests 2016-10-04 22:23:58 -07:00
Paulus Schoutsen
4f0064b00e Fix broken tests (#3704)
* Fix broken tests

* Lint
2016-10-04 22:19:12 -07:00
Fabian Affolter
dc53c21548 Check that no configuration is provided (#3675) 2016-10-04 22:10:31 -07:00
Pascal Vizeli
b9b41d3855 Update ha-alpr / change default interval (#3691) 2016-10-04 22:04:50 -07:00
John Arild Berentsen
17a8dd3f70 Add set_config_parameter service (#3696) 2016-10-04 22:04:19 -07:00
gwendalg
03d6a7c42a Add Ted5000 Sensor (#3559)
* Add Ted5000 Sensor

Signed-off-by: Gwendal Grignou <gwendal@gmail.com>

* sensors: ted5000: use requests instead of urllib.

Signed-off-by: Gwendal Grignou <gwendal@gmail.com>

* Update ted5000.py

Add timeout to requests call.
2016-10-04 21:57:40 -07:00
Daniel Høyer Iversen
d2d393feb5 Add automations and scripts to group.all_automations and group.all_scripts (#3664)
* Add automations to group.all_automations

* Add scripts to group.all_scripts
2016-10-04 21:20:48 -07:00
Paulus Schoutsen
e49651cdeb Merge pull request #3702 from home-assistant/hotfix-0-29-7
0.29.7
2016-10-04 21:03:47 -07:00
Paulus Schoutsen
a60e845203 Version bump to 0.29.7 2016-10-04 21:01:28 -07:00
Pascal Vizeli
f23eb9336f Service & signal (stop/restart) fix (#3690)
* Bugfix signhandling/services

* change from coroutine to callback

* add error handling

* fix bug with endless running

* fix unit test

* Revert "fix unit test"

This reverts commit 31135c7709.

* Disable sigterm/sighup test
2016-10-04 21:01:08 -07:00
Pascal Vizeli
0bf8bb62ad Service & signal (stop/restart) fix (#3690)
* Bugfix signhandling/services

* change from coroutine to callback

* add error handling

* fix bug with endless running

* fix unit test

* Revert "fix unit test"

This reverts commit 31135c7709.

* Disable sigterm/sighup test
2016-10-04 21:00:36 -07:00
Paulus Schoutsen
5085cdb0f7 Add async_safe annotation (#3688)
* Add async_safe annotation

* More async_run_job

* coroutine -> async_save

* Lint

* Rename async_safe -> callback

* Add tests to core for different job types

* Add one more test with different type of callbacks

* Fix typing signature for callback methods

* Fix callback service executed method

* Fix method signatures for callback
2016-10-04 20:44:32 -07:00
Robbie Trencheny
8358f938b5 Now no one wants to be blacklisted, so lets remove the configuration entirely 2016-10-04 13:39:48 -07:00
Robbie Trencheny
be7401f4a2 Now no one wants to be blacklisted, so lets remove the configuration entirely 2016-10-04 13:38:56 -07:00
Robbie Trencheny
760117167d Update .mention-bot to add more users to blacklist and remove skipAlreadyMentionedPR 2016-10-04 13:25:57 -07:00
Robbie Trencheny
2fd83b439c Update .mention-bot to add more users to blacklist and remove skipAlreadyMentionedPR 2016-10-04 13:25:16 -07:00
Robbie Trencheny
e523c3d196 Add @mention-bot configuration 2016-10-04 13:22:35 -07:00
Per Sandström
d9e73d1d71 Merge pull request #3697 from persandstrom/verisure_0.10.3
vsure 0.10.3
2016-10-04 22:20:12 +02:00
Per Sandström
5d3e93b4ef vsure 0.10.3 2016-10-04 22:01:36 +02:00
sam-io
85782f9c29 fix for date formatting issue (#3693) 2016-10-04 08:41:39 -07:00
William Scanlon
2cf49f3de6 Added support for Wink Smoke and CO detectors (#3645) 2016-10-04 01:07:50 -07:00
Fabian Affolter
a072047d9d Auth and headers support for REST sensor (#3592)
* Add auth and header support

* Update header part
2016-10-04 01:07:17 -07:00
Fabian Affolter
74b0e4cb45 Statistics sensor (#3513)
* Initial stats sensor

* Add total and tests

* Use deque, rename var, set default, and only update sensor
2016-10-04 01:04:00 -07:00
Rob Capellini
694983379f test: mocking IO in HTML5 notify tests (#3685)
Replacing temporary file creation in tests with mock's mock_open for faster IO.
2016-10-04 01:01:41 -07:00
Erik Eriksson
5900d8a2c1 only query vehicle attributes once (#3668)
use registration number as dev id
2016-10-04 00:58:25 -07:00
Erik Eriksson
287a7e2720 Support for encrypted payload (#3587) 2016-10-04 00:57:37 -07:00
William Scanlon
8592ba3cb9 Report availability of arest (#3614) 2016-10-04 00:51:45 -07:00
deisi
c93b63963b Fix 3621 (#3642)
Happens when the scanner searches for a mac address, that has been forgotten
by the fritzbox.
2016-10-04 00:47:58 -07:00
Fabian Affolter
194402f7e7 Upgrade Sphinx to 1.4.8 and set missing variables (#3650) 2016-10-04 00:47:28 -07:00
Paulus Schoutsen
d58548dd1c Address asyncio comments (#3663)
* Template platforms: create_task instead of yield from

* Automation: less yielding, more create_tasking

* Helpers.script: less yielding, more create_tasking

* Deflake logbook test

* Deflake automation reload config test

* MQTT: Use async_add_job and threaded_listener_factory

* Deflake other logbook test

* lint

* Add test for automation trigger service

* MQTT client can be called from within async
2016-10-03 22:39:27 -07:00
Robbie Trencheny
f2a12b7ac2 Add @mention-bot configuration 2016-10-03 17:36:00 -07:00
Pascal Vizeli
625319846c Big Homematic update (#3677)
* Update homeassistant with new pyhomematic layout

* fix linter
2016-10-03 23:21:53 +02:00
Daniel Høyer Iversen
c3ea04f2dd revert update of input_boolean 2016-10-03 22:05:06 +02:00
Daniel Høyer Iversen
4a5a1e1e96 Ensure unique entity id for input_boolean 2016-10-03 22:03:16 +02:00
Pascal Vizeli
41aff96375 Bugfix temp convert on none temp attribute / unittest for that (#3654) 2016-10-03 10:46:31 +02:00
Justin Weberg
0219df17f5 Expose Configuration path to frontend (#3660)
* Expose config path to frontend

* Fix typo

* Add deleted code.
2016-10-03 00:04:43 -07:00
Robbie Trencheny
b586e80977 Squashed commit of the following:
commit 220331260e9748ac8e17b3ce776330c1dfb7725b
Merge: 73d93e5 c891820
Author: Robbie Trencheny <me@robbiet.us>
Date:   Sun Oct 2 17:57:24 2016 -0700

    Merge branch 'color_temp_for_mqtt_light' of https://github.com/alterscape/home-assistant into alterscape-color_temp_for_mqtt_light

commit c89182008a
Author: Ryan Spicer <ryanspicer@gmail.com>
Date:   Sun Sep 18 23:06:34 2016 -0700

    fix missing docstring.

commit e61dda4dd3
Author: Ryan Spicer <ryanspicer@gmail.com>
Date:   Sun Sep 18 22:43:04 2016 -0700

    fix pep8 errors and typos in tests.

commit 559d1752d2
Author: Ryan Spicer <ryanspicer@gmail.com>
Date:   Sun Sep 18 21:41:07 2016 -0700

    add tests for mqtt color temp support

commit 702defb932
Author: Ryan Spicer <ryanspicer@gmail.com>
Date:   Sun Sep 18 20:55:07 2016 -0700

    Add color temp support to mqtt lights.
2016-10-02 18:04:00 -07:00
hexa-
73d93e526e Add anel_pwrctrl platform to control switches on ANEL PwrCtrl devices (#3644)
* Add pwrctrl platform to control switches on ANEL PwrCtrl devices

* make requested changes
2016-10-02 16:51:15 -07:00
Paulus Schoutsen
148ea82513 Update frontend 2016-10-02 15:38:18 -07:00
Paulus Schoutsen
abb8bcb6d9 Protect waiting for event loop from within event loop (#3658)
* Protect waiting for event loop from within event loop

* Faster fetching of loop attribute for ident check
2016-10-02 15:07:23 -07:00
John Arild Berentsen
e455daa61d Make sure temperature slider is shown if reported temp is 0 (#3653) 2016-10-02 17:47:04 +02:00
Martin Hjelmare
b6b0bad0c7 Add new mysensors types (#3637)
* Add S_INFO, S_GAS, S_GPS, S_WATER_QUALITY.
* Extend S_CUSTOM, S_POWER.
* Add more units.
2016-10-01 23:23:31 -07:00
Paulus Schoutsen
d5ab292ff3 Sensor.emoncms: Never disable SSL verification. 2016-10-01 23:13:07 -07:00
Erik Eriksson
9f8acbec95 Add support for tracking position and status for a Volvo car (#3617) 2016-10-01 23:00:01 -07:00
Jeff Wilson
d55ed7a3a2 Flux switch improvements (#3615)
* Make flux always adjust brightness of light (even when not in XY mode)

* Remove kelvin mode from flux switch

The light/turn_on service only works with mired values, kelvin values
are out of range per the schema.

* Use already defined min/max values for light/turn_on schema

* Clamp temp value to light/turn_on allowed values
2016-10-01 22:57:15 -07:00
Greg Dowling
fcbfcf0aa7 Bump pywemo version - changes port order for faster startup. (#3612) 2016-10-01 22:53:24 -07:00
Simon Szustkowski
183936375f Add a Timeout for InfluxDB connections (#3563)
* Add a Timeout for InfluxDB connections

* Removed trailing whitespace
2016-10-01 22:29:06 -07:00
Paulus Schoutsen
1f1ac02457 Merge branch 'pr/3552' into dev 2016-10-01 22:20:58 -07:00
Robbie Trencheny
646eaccd4d Update notify to expect a list of string targets instead of a single … (#3548)
* Update notify to expect a list of string targets instead of a single string

* Actually do the thing I set out to do

* Fix notify.group test to expect an array of targets

* REST platform will only use the first target in the list

* Update notify platforms to expect a list of targets

* Update notify services.yaml
2016-10-01 22:19:17 -07:00
Pascal Vizeli
c189c05676 Add temp convert to climate base object (#3611)
* Add temp convert to climate base object

* fix nest

* fix lint
2016-10-01 22:15:19 -07:00
Lewis Juggins
9683e3e3ad Correctly define requirements for emulated hue (#3535) 2016-10-01 21:56:45 -07:00
Fabian Affolter
a61e08680a Add persistent notification for failed login attempts (#3528) 2016-10-01 21:20:16 -07:00
Klaas Hoekema
9da2d6edd0 Make forecast.io update interval configurable (#3520)
Adds a config parameter (`update_interval`) to the `forecast` sensor to
set the minimum update interval. The default remains 120 seconds.
2016-10-01 21:18:10 -07:00
William Scanlon
1f38e9fa57 Support for wink oath2 and relay sensors (#3496) 2016-10-01 20:45:39 -07:00
Paulus Schoutsen
996d7cf1cd Merge pull request #3627 from home-assistant/async-entity-update
Add async updates to entities
2016-10-01 16:20:48 -07:00
Paulus Schoutsen
c36d30f4fe Typo 2016-10-01 15:43:33 -07:00
Paulus Schoutsen
8f3e12c9b8 Make Automation.reload_service_handler async 2016-10-01 15:42:17 -07:00
Paulus Schoutsen
56fdc2a625 Automation: call prepare_setup_platform in executor 2016-10-01 14:11:16 -07:00
Paulus Schoutsen
e18825ba20 Automation: only call executor once when processing config 2016-10-01 14:11:16 -07:00
Paulus Schoutsen
7ab7edd81c Make automation async 2016-10-01 14:11:16 -07:00
Paulus Schoutsen
16ff68ca84 Add mqtt.async_subscribe 2016-10-01 14:11:16 -07:00
Paulus Schoutsen
b8504f8fc8 Make helpers.script async 2016-10-01 14:11:16 -07:00
Paulus Schoutsen
185bd6c28a Make helpers.condition.* async 2016-10-01 14:11:16 -07:00
Paulus Schoutsen
33a51623f8 Make Service.call_from_config async 2016-10-01 14:11:16 -07:00
Paulus Schoutsen
4198c42736 Have template platforms never leave the event loop 2016-10-01 14:11:16 -07:00
Paulus Schoutsen
3e24a35c1e Skip RFXtrx tests unless RFXTRX=RUN (#3625)
* Skip RFXtrx tests unless RFXTRX=RUN

* Remove my previous hacks to slightly speed up rfxtrx

* Exclude RFXTRX tests from coverage

* Remove unused import in rfxtrx tstt

* Add close connection back to RFXtrx tests

* Typo
2016-10-01 13:57:10 -07:00
Paulus Schoutsen
651f3ab55c Merge pull request #3641 from home-assistant/hotfix-0-29-6
0.29.6
2016-10-01 12:12:56 -07:00
Paulus Schoutsen
756f23f0b4 Version bump to 0.29.6 2016-10-01 12:10:00 -07:00
Paulus Schoutsen
ef0e018cbb Service config calls will no longer mutate original config (#3628) 2016-10-01 12:09:25 -07:00
Ben Bangert
9cf2ad0b55 Monkey-patch a weakref set in Task to be a no-op. (#3639)
* Monkey-patch a weakref set in Task to be a no-op.

* Fix linting issues
2016-10-01 12:08:56 -07:00
Ben Bangert
892bbdc2dd Monkey-patch a weakref set in Task to be a no-op. (#3639)
* Monkey-patch a weakref set in Task to be a no-op.

* Fix linting issues
2016-10-01 12:08:25 -07:00
Paulus Schoutsen
bb03960ba5 Voluptuous arest (#3558)
* Migrate to voluptuous

* Adjust sensor.arest for new template system

* Use items() to align the var section with the pins
2016-10-01 18:45:43 +02:00
Fabian Affolter
15ed8c6332 Add units (fixes #3619) (#3633) 2016-10-01 17:35:32 +02:00
Paulus Schoutsen
412b5350ce Service config calls will no longer mutate original config (#3628) 2016-09-30 23:26:15 -07:00
Otto Winter
d5f8aa52c4 Add support for MySensors cover (#3512)
* Added support for MySensors cover device

* Fixed set_req not defined

* Fixed V_PERCENTAGE is str

* Removed set_cover_position

The MySensors documentation doesn’t specify when sending a V_PERCENTAGE
is allowed.

* Fixed homeassistant/components/mysensors.py line too long

* Fixed lint ATTR_POSITION imported but unused

* Use V_PERCENTAGE for MySensors cover

* Revert "Removed set_cover_position"

This reverts commit d78cb3a04d.

* Fix set_req, ATTR_POSITION not defined

* Added support for non-exactly positionable covers

* Fixed V_PERCENTAGE cast to bool

* Ported MySensors cover back to v1.4

`V_PERCENTAGE` and `V_DIMMER` are aliases just like `V_STATUS` and
`V_LIGHT`, so the code inside `MySensorsCover` doesn’t need to be
updated.

* Fixed v1.5 V_TYPES not in in v1.4 gateway SetReq
2016-10-01 01:36:04 +02:00
Paulus Schoutsen
b650b2b0db Spread async love (#3575)
* Convert Entity.update_ha_state to be async

* Make Service.call async

* Update entity.py

* Add Entity.async_update

* Make automation zone trigger async

* Fix linting

* Reduce flakiness in hass.block_till_done

* Make automation.numeric_state async

* Make mqtt.subscribe async

* Make automation.mqtt async

* Make automation.time async

* Make automation.sun async

* Add async_track_point_in_utc_time

* Make helpers.track_sunrise/set async

* Add async_track_state_change

* Make automation.state async

* Clean up helpers/entity.py tests

* Lint

* Lint

* Core.is_state and Core.is_state_attr are async friendly

* Lint

* Lint
2016-09-30 12:57:24 -07:00
Fabian Affolter
7e50ccd32a Component for Digital Ocean (#3322)
* Add Digital Ocean implementation

* Remove kernel
2016-09-30 18:30:44 +02:00
John Arild Berentsen
521080d1b0 Zwave: Update commandclasses and deviceclasses according to sigma SDK (#3495)
* Update Command classes and device types to Sigma SDK

* Fix some pylint

* Seperate constants to file

* Flake8

* coverage and flake8 pylint

* Add services.yaml

* Service descriptions was missing

* Spelling :)

* grammar

* Remove zwave service descriptions from main
2016-09-30 08:43:18 -07:00
Paulus Schoutsen
d76cf092c3 Merge pull request #3610 from home-assistant/hotfix-0-29-5
0.29.5
2016-09-30 00:24:59 -07:00
Paulus Schoutsen
dfb92fa836 Version bump to 0.29.5 2016-09-30 00:15:14 -07:00
Paulus Schoutsen
5cb8ce71ef Lint 2016-09-30 00:14:59 -07:00
Jeff Wilson
099e983ca0 Nest operation modes (#3609)
* Add ability to change Nest mode to all available options

* Make Nest state reflect current operation not current operation mode

* Update Nest sensor to use operation mode

* Fix linting

* Revert "Make Nest state reflect current operation not current operation mode"

This reverts commit 573ba028d8.

Conflicts:
	homeassistant/components/climate/nest.py
2016-09-30 00:14:59 -07:00
Marcelo Moreira de Mello
39514be1f9 Fixed issue #3574 - Temperature slider fixed on frontend on heat/cool mode (#3606)
* Fixed issue #3574 - Temperature slider fixed on frontend on heat/cool mode

* Fixed target_temperature to return None when self.is_away_mode_on is True
2016-09-30 00:14:59 -07:00
Paulus Schoutsen
234f4449b0 Lint 2016-09-30 00:14:08 -07:00
Jeff Wilson
a89d036e26 Nest operation modes (#3609)
* Add ability to change Nest mode to all available options

* Make Nest state reflect current operation not current operation mode

* Update Nest sensor to use operation mode

* Fix linting

* Revert "Make Nest state reflect current operation not current operation mode"

This reverts commit 573ba028d8.

Conflicts:
	homeassistant/components/climate/nest.py
2016-09-29 23:44:14 -07:00
Marcelo Moreira de Mello
9ea030f42e Fixed issue #3574 - Temperature slider fixed on frontend on heat/cool mode (#3606)
* Fixed issue #3574 - Temperature slider fixed on frontend on heat/cool mode

* Fixed target_temperature to return None when self.is_away_mode_on is True
2016-09-29 22:17:13 -07:00
Paulus Schoutsen
7ac8425099 Fix tests 2016-09-29 21:42:36 -07:00
Fabian Affolter
c000e74d0a Migrate to voluptuous (#3374) 2016-09-29 19:07:35 -07:00
Fabian Affolter
6632747543 Migrate to voluptuous (#3341) 2016-09-29 19:06:28 -07:00
Fabian Affolter
a7266ae6cf Check that no configuration is provided (#3553) 2016-09-29 19:02:22 -07:00
Paulus Schoutsen
4031f70665 Merge pull request #3603 from home-assistant/hotfix-0-29-4
Hotfix 0 29 4
2016-09-29 18:59:09 -07:00
Paulus Schoutsen
2b59409e52 Version 0.29.4 2016-09-29 18:57:33 -07:00
Dan Cinnamon
b41c795d34 Passing original config reference to load_platform. (#3602) 2016-09-29 18:56:09 -07:00
Pascal Vizeli
db56ed400d Bugfix voluptuous acer_projector (#3598) 2016-09-29 18:56:09 -07:00
Paulus Schoutsen
c603ffbe26 Fix voluptuous alexa config (#3596) 2016-09-29 18:56:09 -07:00
Dan Cinnamon
68028afb98 Passing original config reference to load_platform. (#3602) 2016-09-29 18:55:43 -07:00
Paulus Schoutsen
733120c577 Fix voluptuous alexa config (#3596) 2016-09-29 18:45:55 -07:00
Pascal Vizeli
01435f7f42 Bugfix voluptuous acer_projector (#3598) 2016-09-29 18:36:20 -07:00
Paulus Schoutsen
77c91c8a5e Merge pull request #3590 from home-assistant/hotfix-0-29-3
Hotfix 0 29 3
2016-09-29 09:09:51 -07:00
Paulus Schoutsen
a321c2f0d8 Version bump to 0.29.3 2016-09-29 09:07:19 -07:00
Pascal Vizeli
807daf8f5d Bugfix voluptuous for hue (#3589) 2016-09-29 09:07:00 -07:00
Pascal Vizeli
08bacd8e31 Bugfix voluptuous for hue (#3589) 2016-09-29 09:06:41 -07:00
Paulus Schoutsen
f79d762e66 Merge pull request #3585 from home-assistant/hotfix-29-2
Hotfix 29 2
2016-09-29 08:18:51 -07:00
Paulus Schoutsen
30aa67b789 Version bump to 0.29.2 2016-09-29 07:50:34 -07:00
Hugo Dupras
883e45c476 Netatmo: Hotfix for hass 0.29 (#3576)
Signed-off-by: Hugo D. (jabesq) <jabesq@gmail.com>
2016-09-29 07:46:04 -07:00
Hugo Dupras
dd551cf056 Netatmo: Hotfix for hass 0.29 (#3576)
Signed-off-by: Hugo D. (jabesq) <jabesq@gmail.com>
2016-09-29 07:45:54 -07:00
Fabian Affolter
47a3adb6b3 Remove duplicate port entry (fixes #3583) (#3584) 2016-09-29 07:45:39 -07:00
Fabian Affolter
7d86fb8c72 Remove duplicate port entry (fixes #3583) (#3584) 2016-09-29 07:45:25 -07:00
Greg Dowling
e87467cb20 Merge pull request #3577 from home-assistant/fix_loopenergy_exceptions
Loopenergy library - bump to catch more exceptions in poll thread.
2016-09-29 10:49:14 +01:00
pavoni
abd1213cc4 Bump library to catch more exceptions in poll thread. 2016-09-29 09:55:05 +01:00
Paulus Schoutsen
f3d838c448 Version bump to 0.29.1 2016-09-28 22:08:02 -07:00
Marcelo Moreira de Mello
574e3231d0 Fixed typo (#3569)
Sep 29 00:59:22 pi hass[21333]: if self.device.measurment_scale == 'F':
Sep 29 00:59:22 pi hass[21333]: AttributeError: 'Device' object has no attribute 'measurment_scale'
2016-09-28 22:07:40 -07:00
Marcelo Moreira de Mello
48ffdea31f Fixed typo (#3569)
Sep 29 00:59:22 pi hass[21333]: if self.device.measurment_scale == 'F':
Sep 29 00:59:22 pi hass[21333]: AttributeError: 'Device' object has no attribute 'measurment_scale'
2016-09-28 22:07:23 -07:00
Paulus Schoutsen
8e14da7454 Version bump to 0.29 2016-09-28 21:21:13 -07:00
Paulus Schoutsen
6e80581b30 Version bump to 0.30.0.dev0 2016-09-28 21:21:03 -07:00
Paulus Schoutsen
9780ea5c52 Version bump to 0.29 2016-09-28 21:20:47 -07:00
Paulus Schoutsen
c4d817146f Merge pull request #3486 from home-assistant/dev
0.29 - 🎈 anniversary edition
2016-09-28 20:59:50 -07:00
Fabian Affolter
f3caca6a06 Upgrade python-telegram-bot to 5.1.0 (#3525) 2016-09-28 00:08:24 -07:00
Fabian Affolter
d6c586bf42 Upgrade fuzzywuzzy to 0.12.0 (#3524) 2016-09-28 00:07:52 -07:00
Fabian Affolter
3b5142eb85 Upgrade dnspython3 to 1.14.0 (#3522) 2016-09-28 00:07:39 -07:00
Paulus Schoutsen
4b8bc90d16 Limit worker pool to 10 threads (#3560)
* Limit worker pool to 10 threads

* Comment evdev in requirements

* Allow skipping RFXtrx tests locally

* Fix worker pool size tests

* lol whut
2016-09-28 00:05:38 -07:00
Fabian Affolter
a084232cf5 Add link to error message (#3530) 2016-09-27 23:59:34 -07:00
Paulus Schoutsen
00e298206e Optimize template 2 (#3521)
* Enforce compiling templates

* Refactor templates

* Add template validator to Logbook service

* Some more fixes

* Lint

* Allow easy skipping of rfxtrx tests

* Fix template bug in AND & OR conditions

* add entities extractor

Conflicts:
	tests/helpers/test_template.py

* fix unittest

* Convert template to be async

* Fix Farcy

* Lint fix

* Limit template updates to related entities

* Make template automation async
2016-09-27 21:29:55 -07:00
happyleaves
559f63bfc3 bump limitlessled version 2016-09-27 16:30:26 -04:00
John Arild Berentsen
6694b0470e Update Climate slider code (#3394)
* Update ecobee to use only range setpoints

* Update nest to only use range setpoints

* Update demo to use only range for ecobee test device

* Update test

* Fetch unit from ecobee

* generic_thermostat did not have state

* generic_thermostat test update
2016-09-27 19:34:16 +02:00
Daniel Høyer Iversen
da6c09640c Merge pull request #3542 from home-assistant/rfxtrx_lib
update rfxtrx lib
2016-09-27 12:35:02 +02:00
Daniel
2505792ef3 update rfxtrx lib 2016-09-27 10:42:03 +02:00
Per Sandström
4c45e92116 modbus update, add error log instead of AttributeError exception (#3517) 2016-09-26 20:46:34 -07:00
Fabian Affolter
041c92699a Change line separator to lf instead of crlf (#3533)
* Change line separator to lf instead of crlf

* Update permissions

* Use LN instead of CRLF

* Remove BOM and use LN instead of CRLF
2016-09-26 20:26:32 -07:00
Dan Cinnamon
d761b000a5 Added a dispatch call to the envisalink sensor to also get partition status updates. 2016-09-26 20:13:41 -07:00
Pascal Vizeli
cae10cfe26 Use setup_component in tests v2 (#3537)
* setup_component - sun

* setup_component - updater

* setup_component - weblink
2016-09-26 23:20:36 +02:00
Martin Hjelmare
ea4f49f0a0 Fix mqtt cover retain and state (#3519)
* Platform schema had duplicate retain keys, which made it always set
	to default.
* Optimistic state changed was inverted, due to using integer position
	instead	of boolean.
* Add more tests for mqtt cover.
2016-09-26 00:53:38 +02:00
Pascal Vizeli
bbfd86dec3 Use setup_component in tests v1 (#3507)
* update unittests like #3414

* setup_component - splunk

* setup_component - statsd

* fix statsd & splunk unittest config values

* component_setup - device_sun_light_trigger

* setup_component - introduction

* component_setup - persistent_notification

* setup_component - logentries, mqtt eventstream

* fix unittest logentries
2016-09-25 23:15:21 +02:00
Paulus Schoutsen
0c0feda834 Pre-compile templates (#3515)
* Pre-compile templates

* Compile templates in numeric_state condition
2016-09-25 13:33:01 -07:00
Robbie Trencheny
b3d67a7ed9 Change notify target property to be a dictionary (#3501)
* Change notify target property to be a dictionary

* Make demo target properties unique and fix test to match behavior
2016-09-25 09:41:11 -07:00
Martin Hjelmare
986873834a Fix mysensors white value (#3508)
* Fix turning on mysensors light with white value attribute in kwargs.
* Fix import order in check_config.py.
2016-09-24 23:45:01 +02:00
Paulus Schoutsen
36921748ed Merge branch 'master' into dev
Conflicts:
	homeassistant/components/climate/ecobee.py
	homeassistant/components/cover/wink.py
	homeassistant/const.py
2016-09-24 01:03:56 -07:00
Paulus Schoutsen
b628fb088b Merge pull request #3503 from home-assistant/fix-platform-component-no-config
Allow platform components without config
2016-09-24 00:15:58 -07:00
Pascal Vizeli
4a5cc5ad3d Add new component for licence plates processing (OpenAlpr) (#3461)
* Add new component for licence plates processing (OpenAlpr)

* address balloobbot comments

* add to coveragerc

* move config from device to base

* fix lint

* move local api test to voluptous

* split render engine

* change cloud_api pip string & lint

* update requirements_all.txt

* fix lint

* update cloud_api url

* convert base64 byte string to string

* Update cloudapi / add configence / add state

* fix lint

* change state to high confidence plate

* fix cloudapi

* fix local api detection

* add wraper for local api

* fix lint

* fix wrong import

* fix HAAlpr name

* update ha-alpr without async

* support only eventbased requests with interval 0

* fix minor things

* fix lint

* fix lint2
2016-09-24 00:07:42 -07:00
Paulus Schoutsen
a1488b46f6 Fix zone being setup twice 2016-09-24 00:04:03 -07:00
Paulus Schoutsen
ac4e54c6ff Filter out falsey platform configs 2016-09-24 00:03:44 -07:00
Dan Smith
bac8ffdd52 Bump somecomfort to 0.3.2 (#3502)
This has fixes related to #3468
2016-09-23 22:15:05 -07:00
Robbie Trencheny
d3a012a536 Fix ENTITY_ID_ALL_COVERS format 2016-09-23 17:14:29 -07:00
Robbie Trencheny
e00a469828 Fix all_covers group friendly_name
It now matches other components (`all covers` instead of `all_covers`).
2016-09-23 17:13:12 -07:00
Johann Kellerman
1b9d867d60 Add domain to boolean (#3500) 2016-09-23 14:10:12 -07:00
Martin Hjelmare
8d0009b894 Fix mysensors required version for HVAC (#3499) 2016-09-23 22:07:06 +02:00
Fabian Affolter
ad2dea939b Fix lint issues (#3492) 2016-09-23 12:20:22 +02:00
Fabian Affolter
2ecbcac2b1 Fix PEP257 issues (#3491)
* Align test name with platform

* Fix PEP257 issues
2016-09-23 10:28:28 +02:00
Fabian Affolter
3d31d26b6c Fix typos (#3490) 2016-09-23 10:28:16 +02:00
Fabian Affolter
0065dc0cd7 Update links (#3488) 2016-09-23 10:28:05 +02:00
Daniel Høyer Iversen
e4c5f356e2 Merge pull request #3489 from home-assistant/rfxtrx_update
Update rfxtrx lib to 0.12
2016-09-23 09:25:15 +02:00
Johann Kellerman
9631179126 Use voluptuous for input_slider, input_boolean, input_select (#3256)
* Use voluptuous for input slider

* floats

* _setup_component

* Imperative mood

* CONFIG_SCHEMA

* None returns empty ensure_list

* allow_extra

* bool

* restore ensure_list behaviour
2016-09-23 00:12:11 -07:00
Johann Kellerman
de51cfbc07 Sorted yaml output for check_config (#3354)
* Consistent display of check_config dicts

* OrderedDict

* remove sorted
2016-09-23 00:10:19 -07:00
Open Home Automation
de4c63b437 Added more configuration parameters (#3479)
Upgraded miflora library to 0.1.9 (which is more stable)
2016-09-23 00:09:15 -07:00
Sytone
d5912f41fb Added play media to squeezebox (#3306)
* Added play media to squeezebox

The squeezebox component can now add a URI to an existing playlist or just over write it to force a stream to play.

* Cleaned up flake8 issues with formatting. 

Spacing... The end of the world! Fixed. Once day the tools will fix this on the fly, one day...

[x] ./homeassistant/components/media_player/squeezebox.py:307:1: W293 blank line contains whitespace
[x] ./homeassistant/components/media_player/squeezebox.py:366:1: W391 blank line at end of file
[x] ./homeassistant/components/media_player/squeezebox.py:366:1: W293 blank line contains whitespace

Updated SUPPORT_SQUEEZEBOX to add SUPPORT_PLAY_MEDIA

[x] ./homeassistant/components/media_player/squeezebox.py:13:1: F401 'homeassistant.components.media_player.SUPPORT_PLAY_MEDIA' imported but unused

* Updates from review

Updated the comments to indicate they are developer / API comments and not for end users.
Marked the private functions with a leading underscore (_)

* Fixed Lint issues. 

202ERROR: InvocationError: '/home/travis/build/home-assistant/home-assistant/.tox/lint/bin/flake8'

203lint runtests: commands[1] | pylint homeassistant

204************* Module homeassistant.components.media_player.squeezebox

205C:322, 0: Trailing whitespace (trailing-whitespace)
2016-09-23 00:05:33 -07:00
Daniel
03b2c48d45 Update rfxtrx to 0.12 2016-09-23 09:04:57 +02:00
irvingwa
65b1a731ca Added check for channel in kodi media player to play channel from PVR. (#3475)
* Added check for channel in kodi media player to play channel from PVR.

* test
2016-09-22 23:50:07 -07:00
kaustubhphatak
7625aae373 Add support for mysensors HVAC device (#3405)
* Added Support for mysensnors Climate/HVAC device

* Added Support for mysensnors-hvac device:fix pylint error

* Added Support for mysensnors-hvac device:fix pylint error2

* Fixed Issues in code as per review comments

* Fixed Linter Errors

* Fixed Linter Errors:2

* Fixed Linter Errors:2

* Fixed Linter Errors

* Fixed Linter Errors

* Fixed Linter Errors

* Added Support for MySensors HVAC| Fixed Review Comments| Removed Additional Comments

* Added Support for MySensors HVAC| Fixed Review Comments Itr2

* Changes to correctly support devices with both high and low bound temperatures

* Changed to optimize the code
2016-09-22 23:47:40 -07:00
Paulus Schoutsen
8251039ca4 Fix nmap config (#3482) 2016-09-22 08:44:18 -07:00
Pascal Vizeli
3418d03e69 convert first to string befor matching (#3476) 2016-09-22 00:03:32 -07:00
tinglis1
f1caf3f2b5 Bom weather current component (#3370)
* add bom_weather_current component

* wrong fork

* wrong fork

* Code tidy up

- fixed order of imports
- changes some of the units to be standardised

* Rename bom_weather_current.py to bom.py

* pylint changes

* lint formatting changes

* formatting

* fix logger string variable formatting

* Update .coveragerc
2016-09-21 19:26:28 +02:00
Paulus Schoutsen
3dea4be2cc Fix missing commits from 0.28
Add missing commits to master
2016-09-21 08:52:30 -07:00
Paulus Schoutsen
8f9fea37b2 Merge branch 'master' into potential-master-fix 2016-09-21 08:50:53 -07:00
Teagan Glenn
380993f2ca Automatic polling (#3360)
* Test updating automatic

* Scan interval

* Schedule scan every time delta

* Pass around has

* Recursive issue

* Method invocation

* Oops

* Set up poll

* Default argument value

* Unused import

* Semicolon

* Fix tests

* Linting

* Unneeded throttle as it's handled by time event

* Use track time change event listener

* Disable lint rule

* Attribute removed - removing test

* Debug instead of info

* Unused import
2016-09-21 08:34:22 -07:00
Paulus Schoutsen
5fd93e8d80 Version bump to 0.28.2 2016-09-21 08:34:22 -07:00
Nick Vella
bc9d2586c6 Add open/closed state for open_cover and close_cover in SERVICE_TO_STATE (#3180)
* Add open/closed state mapping for open_cover and close_cover

* Add 'open', 'closed' for open/close_cover_tilt

* Revert "Add 'open', 'closed' for open/close_cover_tilt"

This reverts commit e45582d439.
2016-09-21 08:34:22 -07:00
John Arild Berentsen
ad7683470a Bugfix ecobee: inverted high and low temps and enforce int to temps (#3325)
* inverted high and low temps

* Looks like somethings are mixed up

* Added debugentires

* Added debugentires 2

* Enforce int on temperatures
2016-09-21 08:34:22 -07:00
John Arild Berentsen
329474d3e3 Missing garage door detection (#3349) 2016-09-21 08:34:22 -07:00
Pascal Vizeli
b7430d939d Bugfix voluptuous on recorder (#3350) 2016-09-21 08:34:22 -07:00
David-Leon Pohl
e5af126fae Bugfix pilight component (#3355)
* BUG Message data cannot be changed thus use voluptuous to ensure format

* Pilight daemon expects JSON serializable data

Thus dict is needed and not a mapping proxy.

* Add explanation why dict as message data is needed

* Use more obvious voluptuous validation scheme

* Pylint:  Trailing whitespace
2016-09-21 08:34:22 -07:00
Paulus Schoutsen
9aff839925 Version bump to 0.28.1 2016-09-21 08:34:22 -07:00
Paulus Schoutsen
287f9c9bda Bugfix group order (#3323)
* Add ordered dict config validator

* Have group component use ordered dict config validator

* Improve config_validation testing

* update doc string config_validation.ordered_dict

* validate full dict entries

* Further simplify ordered_dict validator.

* Lint fix
2016-09-21 08:34:22 -07:00
Teagan Glenn
a6673f6741 Automatic Device Tracker Bug Fix (#3330)
* Iterate over items

* Pass display name as host name
2016-09-21 08:34:22 -07:00
John Arild Berentsen
784cf0c4bd Revert only add 1 device (#3324) 2016-09-21 08:34:22 -07:00
Marcelo Moreira de Mello
5966c46a67 Fixed voluptuous to accept string instead positive_int for CODE on Simplisafe (#3310) 2016-09-21 08:34:22 -07:00
Teagan Glenn
b9992a9914 UOM is a list - not a string. (#3469) 2016-09-21 08:03:26 -07:00
Dan Cinnamon
edf812c0ea Envisalink Fixes + Enhancements (#3460)
* Added the ability to trigger the alarm.

* Bump version of pyenvisalink to 1.3

* Fixed an issue where the panic_type was not passed to the sub-components properly.

* Bump pyenvisalink version, and make default panic mode = police.

* Pass in event loop to pyenvisalink.

* Made the components play nicely with asyncio.

* Bump pyenvisalink to 1.6

* Bump up pyenvisalink, and better handle synchronous setup.
2016-09-20 23:51:10 -07:00
Hugo Dupras
a310599a03 Add specific icon for forecast.io sensors (#3465) 2016-09-20 22:40:10 -07:00
Simon Szustkowski
4c625d09aa Add the ability to manually specify a Yamaha AVR via it's IP address (#3451)
* Added the possibility to manually specify a Yamaha Receiver

* Added the possibility to manually specify a Yamaha AVR

* Using string formatting

* Hostname checks for None now

* Do not use add_devices for each if-branch separately

* Fixed linting
2016-09-20 22:26:43 -07:00
Fabian Affolter
0335f88e61 Migrate to voluptuous (#3342) [Breaking Change] 2016-09-20 22:21:06 -07:00
Lewis Juggins
769bc37150 Add additional fields to influx (#3462) 2016-09-20 22:20:05 -07:00
Marc Pabst
138205a019 Adding support for a white value (#3338)
* Update __init__.py

addedattribute "WHITE_VALUE" to improve support for RGBW devices

* Update services.yaml

* Update __init__.py

* Update __init__.py

* Update __init__.py

* Update __init__.py

* Update __init__.py

* Update __init__.py

shortened line

* Update __init__.py

* Update __init__.py

* Add mysensors RGBW and light tests

* Activate support for mysensors RGBW devices with support for
	white_value attribute.
* Add white_value support in light demo platform.
* Add tests for white_value and more for light component.
* Add tests for light demo platform.
* Fix import order in check_config.
2016-09-20 21:26:40 -07:00
wokar
e891f1a260 Filter entities from logbook (#3426)
* o added ability to exclude entities or domains from logbook
o exclude hidden entities

* fixed remaned configuration key

* - filter the events before they get passed to humanify, to separate concerns
- instead of looking at customize, look for the hidden attribute on the state change events
- access to configuration defaults to an empty list - no need to check

* - filter only events of type EVENT_STATE_CHANGED
- improve config handling

* added unit tests to cover all filter cases and logbook message creation
2016-09-20 20:07:26 -07:00
Milas Bowman
eb1871dc5b Allow pairing with Harmony Hub (#3467)
The real Hue hub responds to both `/api` and `/api/`. For greater
compatibility, the view now responds to both using `extra_urls`.
2016-09-20 20:05:14 -07:00
Fabian Affolter
f75b0a99d9 Use voluptuous for Hue (#3340)
* Migrate to voluptuous

* Change name used in test
2016-09-20 12:35:10 +02:00
Christian Brædstrup
81ebdadcec D-link switch library bump and error handling for W110 devices (#3386) (#3425) 2016-09-20 00:10:15 -07:00
sam-io
de5bd26050 Email (#3421)
* Added email component

* added email sensor component

* added doc string to test class

* fixed lint error

* fixed lint error

* rename of email component

* added another block as test fails on CI

* added retry to multi email test

* added delay to retry

* added to .coveragerc

* removed sleep from tests and fixed up stale comments
2016-09-20 00:09:14 -07:00
Lewis Juggins
54248863b3 Use uvloop for asyncio policy (#3417) 2016-09-20 00:06:33 -07:00
William Scanlon
43c395232a Sensor updates (#3410) 2016-09-20 00:05:54 -07:00
Paulus Schoutsen
68835c4b4b Update frontend 2016-09-19 23:56:40 -07:00
Paulus Schoutsen
be68fe0d85 Move worker pool monitoring to be time based instead of add_job based. (#3439)
* Move worker pool monitoring to be time based instead of add_job based.

* Stub out worker pool monitor during tests

* Add test for monitor worker pool.

* Improve naming

* Test stop_monitor coroutine

* Add async_create_timer test

* Finish rename create_timer
2016-09-19 23:39:49 -07:00
Micha LaQua
d31f6bc3f0 Allow hiding automation entities from UIs (#3442)
* Allow hiding automation entities from UIs

* Flake8 fixes: Allow hiding automation entities from UIs

* Automation: Rework hide entity feature

 * Refactor keyword 'hidden' to 'hide_entity' to avoid ambiguity
 * Migrate hide_entity subsetting to Voluptuous
2016-09-19 23:39:07 -07:00
Marcelo Moreira de Mello
ae1b69430e Added support to Yahoo Finance to track the stock market within Home Assistant (#3446)
* Added support to Yahoo Finance to track the stock market within Home Assistant

* Fixed pylint issues

* Fixed formatting issues

* Fixed pep257 issues

*   - Fixed URL link
  - Added attributes for Yahoo Finance

* Removed price sales ATTR

* Fixed lint and flake8 issues. Added attribution to Yahoo! per https://developer.yahoo.com/attribution/
2016-09-19 23:38:10 -07:00
Fabian Affolter
a998846961 Add unit to comment (#3452) 2016-09-19 23:17:52 -07:00
Paulus Schoutsen
9ac39df33f Fix logger config validation (#3459) 2016-09-19 21:12:56 -07:00
Paulus Schoutsen
fa2ce366de Update frontend 2016-09-19 21:12:31 -07:00
Teagan Glenn
35603268ca Isy fixes (#3457)
* Fix binary sensor

* Add 'stopped' to states

* Add '%' to states for light

* ISY light brightness support

* Method case

* Z-Wave unit 51 is a light
2016-09-19 20:16:51 -07:00
Paulus Schoutsen
d6ad4bc22b Remove validate_config (#3448) 2016-09-18 21:40:49 -07:00
Paulus Schoutsen
87fe83dcb9 Fix slow tests (#3444)
* Fix RFXtrx tests

* Report slow tests on CI

* Minor rfxtrx clean up

* rfxtrx test tweak
2016-09-18 21:40:37 -07:00
Ben Bangert
256062fd99 Fix test shutdown to ensure loop/threads are clean. (#3447)
* Fix test shutdown to ensure loop/threads are clean.

We now ensure the loop is closed, it has completed, and the
executer has completed. This ensure all threads are freed
up with any test calling hass.stop().

* Fix lint issue with run_loop
2016-09-18 20:35:58 -07:00
Paulus Schoutsen
8a99ce78c2 Better Hue error reporting (#3443) 2016-09-18 19:59:38 -07:00
Paulus Schoutsen
9a87e5e336 Feature/voluptuous influxdb (#3441)
* Migrate to voluptuous

* Fix voluptuous influxdb
2016-09-18 15:32:18 -07:00
Paulus Schoutsen
da8994e4b5 Migrate camera.uvc to voluptuous (#3440) 2016-09-18 14:22:32 -07:00
Josh Nichols
b34101b277 Update Ecobee state after making changes to climate (#3436)
* Update Ecobee state after making changes to climate

Without this, climate and sensor state will take up to 3 minutes
(the MIN_TIME_BETWEEN_UPDATES on its update throttle) to update in
the interface, which makes it more difficult to do automation around the
state.

* Use a boolean instance variable that update can check, rather than always calling update
2016-09-18 13:20:06 -07:00
Daniel Høyer Iversen
11c07440fe Accept login from approved ips without password (#3427) 2016-09-18 10:20:19 -07:00
John
2c43d6718b Update pyenvisalink to latest version (#3435) 2016-09-18 10:19:32 -07:00
Pascal Vizeli
de4cc5034e Add toggle service to input_boolean (#3432) 2016-09-18 10:18:44 -07:00
Paulus Schoutsen
c89a77dc74 Update frontend 2016-09-18 00:04:43 -07:00
Phil Hawthorne
91e36f380b Add PyBluez to Dockerfile (#3423)
* Add PyBluez to Dockerfile

Adds PyBluez to Dockerfile so people using Docker can run Bluetooth
devices

* Remove pip install of pybluez

Pybluez will be installed automatically when the Bluetooth device
tracker is enabled
2016-09-17 23:57:12 -07:00
Johann Kellerman
169f054c6c Use voluptuous for nmap, tplink, thomson device trackers (#3124)
* Use Voluptuous for nmap, tplink, thomson device_trackers

* Fix logic
2016-09-17 23:44:15 -07:00
joyrider3774
9184773f8f Emoncms feeds sensor component (#3258)
* Add Initial version for emoncms feeds sensor

* flake8 test fixes

* pylint test fixes

* - fix bug with include_feed_id_names not assigning the name to the  element in the same postion as found in include_feed_id
- a few structure changes to have less nesting (pylint fix)
- minor other changes

* update .coveragerc

* voluptuous fixes:
- exclude_feed_id and include_feed_id Exclusive group so that only one (or none) can be specified at once
- id must be positive int
- exclude_feed_id and include_feed_id must be positive int

* Fix comment so it refers to the documentation

* use string formatting

* Remove outer try

* clean up sensors.append calls
(break them out for loop)

* multiple changes like:
- rename config value "include_feed_id" to "include_only_feed_id"
- rename config value "include_feed_id_names" to "sensor_names"
- renamed config value sensor_names is now a dictionary an can also be used when renamed config value "include_only_feed_id" is not specified
- Set default value for scan_interval using the config validation
- blank lines between default, 3rd party and own imports
- removed homeassistant.util import, it was not needed anymore

* fix extended voluptuous schema
scan_interval should not be extended to PLATFORM_SCHEMA as it was already in the schema by config_validation helper so i should not add / change it. It was also causing problems reading the value from the config.

* Use Home Assistant polling

* remove statement that can never happen

* Guard clause

* Reduce instance variables
2016-09-17 23:34:24 -07:00
Paulus Schoutsen
e19a092934 Update Docker to use Python 3.5 (#3430) 2016-09-17 23:32:11 -07:00
deisi
1c706834e0 Recieve signals from a keyboard and use keyboard as a remote control (#3305) 2016-09-17 23:31:27 -07:00
Fabian Affolter
04d31e4ef4 Use voluptuous for RPi GPIO (#3371)
* Migrate to voluptuous

* Remove the check for lists
2016-09-17 23:28:37 -07:00
Fabian Affolter
2b7d1fe20d Use voluptuous for logger (#3375)
* Migrate to voluptuous

* No list for configuration check
2016-09-17 23:23:45 -07:00
Daniel Høyer Iversen
a90049568e Fix issue #3401 weblink (#3402) 2016-09-17 23:21:24 -07:00
Pascal Vizeli
534f56a3e2 Bugfix if ffmpeg is not present on config / Update ha-ffmpeg 0.13 (#3418) 2016-09-17 22:57:18 -07:00
Lewis Juggins
81928b1a6b Update pychromecast (#3416) 2016-09-17 22:51:40 -07:00
Paulus Schoutsen
325220e009 Make track_point_in_utc_time more async (#3428)
* Make track_point_in_utc_time more async

* Make track_point_in_time async friendly
2016-09-17 19:51:18 -07:00
Paulus Schoutsen
aca375c312 Asyncio event helpers (#3415)
* Automation - Event: Use coroutine

* Convert event helpers to coroutine

* Fix linting

* Add hass.async_add_job

* Automation - Event to use async_add_job
2016-09-17 18:28:01 -07:00
Paulus Schoutsen
4076ccf639 Use setup_component in tests (#3414)
* Alarm Control Panel Manual - use setup_component

* Update automation - zone tests

* Update climate - demo tests

* Update climate - generic thermostat tests

* Update cover - command line tests

* Update cover - demo tests

* Update device tracker tests

* Update device tracker - owntracks tests

* Update fan - demo tests

* Update garage door - demo tests

* Update light tests

* Update lock - demo tests

* Update media player - demo tests

* Update notify - command line tests

* Update notify - demo tests

* Update notify - file tests

* Update notify - group tests

* Update sensor - mfi tests

* Update sensor - moldindicator tests

* Update sensor - mqtt room tests

* Update switch - command line

* Update switch - flux

* Update switch tests

* Update scene tests

* Fix wrong default port for mfi switch
2016-09-17 10:29:58 -07:00
Jeff Wilson
d7452f9d5d Add ability to set fan made to Nest climate component (#3399)
* Add ability to set fan made to Nest climate component

* Use constants for fan values

* Use STATE_ON from cost

* Fix lint error
2016-09-15 21:01:32 -07:00
Paulus Schoutsen
c23ad3e285 Fix zones (#3413) 2016-09-15 19:40:18 -07:00
Greg Dowling
0a6f496425 Add support for Vera covers. (#3411) 2016-09-15 20:47:03 +02:00
Pascal Vizeli
07a92e8ac3 Split ffmpeg to compoment (#3396)
Add an optional extended description…
2016-09-15 14:35:40 +02:00
Dan
d1b08824e8 Implemented onkyo reconnect (#3061)
* Implemented onkyo reconnect

Connection object is cleared after a failed command. It will be
automatically recreated upon the next command running. This should allow
for failed connections to be restored.

* Remove reduntant error catching

* Run all update commands with command wrapper.

* Handle errors better

* Removed unused global

I have no idea how that got there.
2016-09-14 18:21:01 -07:00
gross1989
c693db49b3 Nuimo controller component based on SDK (#3039) 2016-09-14 18:20:49 -07:00
Dan
b58976bc36 Add operation_list to radiotherm (#3393)
* Add operation_list to radiotherm

* Use constants
2016-09-14 18:14:39 -07:00
Eric Jansen
70a79efb77 Bugfix: incorrectly inverted value when setting cover position (#3376) 2016-09-14 17:41:45 -07:00
chrom3
982a0bc195 Kodi notification platform (#3403) 2016-09-14 21:54:45 +02:00
Daniel Høyer Iversen
9ad592e606 Merge pull request #3395 from home-assistant/style_fix
fix style in tellstick sensor
2016-09-14 12:12:45 +02:00
Daniel
6f840de1d2 fix style in tellstick sensor 2016-09-14 11:58:26 +02:00
Fabian Affolter
d029861c93 Use voluptuous for Tellstick (#3367)
* Migrate to voluptuous

* Update tellstick.py
2016-09-13 23:29:15 -07:00
Fabian Affolter
c6fa07d059 Migrate to voluptuous (#3372) 2016-09-13 23:20:58 -07:00
Fabian Affolter
782838af56 Use voluptuous for Zone (#3377)
* Migrate to voluptuous

* Zone: Remove unneeded latitude/longitude check
2016-09-13 23:13:10 -07:00
Jeff Wilson
7724cb9eb4 Fix octoprint sensor (#3385)
* Fix non-temperature sensors for octoprint

* Fix double space in octoprint temperature names

* Fix tox linting errors
2016-09-13 23:10:49 -07:00
Pascal Vizeli
b78e98702a Update yahooweather 0.8 / change request time (#3352) [Breaking change] 2016-09-13 23:04:26 -07:00
Fabian Affolter
727b756054 Use voluptuous for KNX (#3345)
* Migrate to voluptuous

* Make host optional and set default
2016-09-13 23:03:30 -07:00
Fabian Affolter
4791b5679e Use voluptuous for iTunes (#3344)
* Migrate to voluptuous

* Add support for SSL/TLS
2016-09-13 23:01:51 -07:00
Fabian Affolter
79bff0fc57 Migrate to voluptuous (#3337) 2016-09-13 22:52:51 -07:00
Fabian Affolter
1e8cf8c1b7 Upgrade PyMata to 2.13 (#3335) 2016-09-13 22:52:11 -07:00
Fabian Affolter
26a118e75d Upgrade cherrypy to 8.1.0 (#3334) 2016-09-13 22:51:55 -07:00
Fabian Affolter
e7f9fdca67 Upgrade sqlalchemy to 1.0.15 (#3333) 2016-09-13 22:51:13 -07:00
Open Home Automation
0c7c85dbfe Miflora (#3053)
* First version of the MiFlora sensor (not yet finished)

* First workign version

* Added some documentation
Get name from sensor, if not defined

* Ignore IOError

* Added force_update option

* Updated comments

* Renamed fertility to conductivity (what it really is)

* MiFlora library update

* Updated helper files

* Formatting

* Fixed pylint errors

* Removed default from monitored conditions

* Removed KeyError handling as a KeyError should never be raised

* Added a return when no data is received

* emoved unnecessary return statement

* Changed default name

* Changes quotes and string operation ( @Teagan42 )

* - number of samples for median calculation is now configurable
- set state to None if no data could be polled from sensor

* Bugfix in library
more logging

* Fixed miflora version number
2016-09-13 22:37:57 -07:00
Nolan Gilley
2c01a67446 short sleep (#3115) 2016-09-13 21:46:11 -07:00
Fabian Affolter
68def21615 Use voluptuous for Yamaha receiver (#3210)
* Migrate to voluptuous

* Add missing configuration variables
2016-09-13 21:39:03 -07:00
Rob Johnson
7528da455c Vera Thermostat Support (#3247)
* vera thermostat & climate support

* disable abstract

* code review changes

* fix

* fix build

* remove old method
2016-09-13 21:36:49 -07:00
Heiko Rothe
8da85d7a91 Added away timeout setting for idle devices (#3321) 2016-09-13 20:34:59 -07:00
Fabian Affolter
ac5647a30e Use voluptuous for statsd (#2928)
* Migrate to voluptuous

* Update tests
2016-09-13 18:22:30 -07:00
David Baumann
cb3ab1e873 Implement Sensor for KNX Platform (#2911)
* Added Sensor Support for KNX Devices

Added Sensor for KNX Group Addresses
- Temperature
- Wind Speed
- Illuminance(LUX)

Mostly to fetch from a KNX Wetterstation

* Some pylint,flake8 fixes

* Pydoc Fixes

* Fix Coverage Ordering

* Refactor KNX Sensor

Refactor to Idea from @usul27 and added Minimum Maximum

* Removed Measurement Untis from const.py

Removed needed Measurement Units from const.py and add it to
sensor\knx.py

* Change .coveragerc

* Add as Requested from @Teagan42 the new Type Names

Additional add CONF_MINIMUM and CONF_MAXIMUM

* Added Changes as Requested from @Teagan42

* Fixed the Merge Conflict, Hopefully i done it rigth :-)

* Fixed Styling
2016-09-13 18:21:43 -07:00
Johann Kellerman
afc527ea55 Fix tests (#3387) 2016-09-13 18:17:51 -07:00
wokar
165362da0c fixed link constructor to show icon again (#3388) 2016-09-13 18:15:19 -07:00
Pascal Vizeli
1697a8c774 SleepIQ component with sensor and binary sensor platforms (#3390)
Original from #2949
2016-09-14 00:11:50 +02:00
Eric Clymer
de2eed3c9f Fix saving push_notification.conf as suggested by @robbiet480 (#3382) 2016-09-13 14:22:55 -07:00
Per Sandström
ca646c08c2 Modbus component refactoring - sensors and switches (#3297) 2016-09-13 22:47:44 +02:00
Pascal Vizeli
e4f4e91096 Bugfix auto/manual mode change (#3384) 2016-09-13 21:43:37 +02:00
Pascal Vizeli
812dc99073 fix xbox live entity id (#3368) 2016-09-13 21:27:43 +02:00
John Arild Berentsen
898cf1b352 zxt_120 set temperature did not update on setpoint (#3380) 2016-09-13 20:26:44 +02:00
Fabian Affolter
bba75bf6c3 Add Simplepush notifications (#3336) 2016-09-13 19:26:47 +02:00
John Arild Berentsen
efbc378226 Fix temp conversion for nest setpoint (#3373)
* Fix temp conversion for nest setpoint

* DEbug
2016-09-13 19:16:17 +02:00
Fabian Affolter
8ba952ee0e Use voluptuous for SCSGate (#3265)
* Migrate to voluptuous

* Extend platforms
2016-09-13 07:23:53 +02:00
Paulus Schoutsen
db3bfad0b5 Merge pull request #3359 from home-assistant/hotfix-0-28-2
0.28.2
2016-09-12 21:28:57 -07:00
Teagan Glenn
2b1416c514 Automatic polling (#3360)
* Test updating automatic

* Scan interval

* Schedule scan every time delta

* Pass around has

* Recursive issue

* Method invocation

* Oops

* Set up poll

* Default argument value

* Unused import

* Semicolon

* Fix tests

* Linting

* Unneeded throttle as it's handled by time event

* Use track time change event listener

* Disable lint rule

* Attribute removed - removing test

* Debug instead of info

* Unused import
2016-09-12 19:59:53 -07:00
Teagan Glenn
8189ec2c8d Automatic polling (#3360)
* Test updating automatic

* Scan interval

* Schedule scan every time delta

* Pass around has

* Recursive issue

* Method invocation

* Oops

* Set up poll

* Default argument value

* Unused import

* Semicolon

* Fix tests

* Linting

* Unneeded throttle as it's handled by time event

* Use track time change event listener

* Disable lint rule

* Attribute removed - removing test

* Debug instead of info

* Unused import
2016-09-12 19:59:34 -07:00
beepmill
7f6fb95afd Ignore desktop.ini (Windows Explorer) (#3363) 2016-09-12 19:45:39 -07:00
Paulus Schoutsen
609d7ebea5 Migrate core from threads to async awesomeness (#3248)
* Add event loop to the core

* Add block_till_done to HA core object

* Fix some tests

* Linting core

* Fix statemachine tests

* Core test fixes

* fix block_till_done to wait for loop and queue to empty

* fix test_core for passing, and correct start/stop/block_till_done

* Fix remote tests

* Fix tests: block_till_done

* Fix linting

* Fix more tests

* Fix final linting

* Fix remote test

* remove unnecessary import

* reduce sleep to avoid slowing down the tests excessively

* fix remaining tests to wait for non-threadsafe operations

* Add async_ doc strings for event loop / coroutine info

* Fix command line test to block for the right timeout

* Fix py3.4.2 loop var access

* Fix SERVICE_CALL_LIMIT being in effect for other tests

* Fix lint errors

* Fix lint error with proper placement

* Fix slave start to not start a timer

* Add asyncio compatible listeners.

* Increase min Python version to 3.4.2

* Move async backports to util

* Add backported async tests

* Fix linting

* Simplify Python version check

* Fix lint

* Remove unneeded try/except and queue listener appproriately.

* Fix tuple vs. list unorderable error on version compare.

* Fix version tests
2016-09-12 19:16:14 -07:00
Paulus Schoutsen
b9154158e8 Version bump to 0.28.2 2016-09-12 18:33:36 -07:00
Nick Vella
b43bf62347 Add open/closed state for open_cover and close_cover in SERVICE_TO_STATE (#3180)
* Add open/closed state mapping for open_cover and close_cover

* Add 'open', 'closed' for open/close_cover_tilt

* Revert "Add 'open', 'closed' for open/close_cover_tilt"

This reverts commit e45582d439.
2016-09-12 18:33:11 -07:00
John Arild Berentsen
c6b6ab1b79 Bugfix ecobee: inverted high and low temps and enforce int to temps (#3325)
* inverted high and low temps

* Looks like somethings are mixed up

* Added debugentires

* Added debugentires 2

* Enforce int on temperatures
2016-09-12 18:33:11 -07:00
John Arild Berentsen
07148fc580 Missing garage door detection (#3349) 2016-09-12 18:33:11 -07:00
Pascal Vizeli
bc600b8f32 Bugfix voluptuous on recorder (#3350) 2016-09-12 18:33:11 -07:00
David-Leon Pohl
dd4611064f Bugfix pilight component (#3355)
* BUG Message data cannot be changed thus use voluptuous to ensure format

* Pilight daemon expects JSON serializable data

Thus dict is needed and not a mapping proxy.

* Add explanation why dict as message data is needed

* Use more obvious voluptuous validation scheme

* Pylint:  Trailing whitespace
2016-09-12 18:33:11 -07:00
Nick Vella
24f1bff7f1 Add open/closed state for open_cover and close_cover in SERVICE_TO_STATE (#3180)
* Add open/closed state mapping for open_cover and close_cover

* Add 'open', 'closed' for open/close_cover_tilt

* Revert "Add 'open', 'closed' for open/close_cover_tilt"

This reverts commit e45582d439.
2016-09-12 18:31:44 -07:00
David-Leon Pohl
6959407dfd Bugfix pilight component (#3355)
* BUG Message data cannot be changed thus use voluptuous to ensure format

* Pilight daemon expects JSON serializable data

Thus dict is needed and not a mapping proxy.

* Add explanation why dict as message data is needed

* Use more obvious voluptuous validation scheme

* Pylint:  Trailing whitespace
2016-09-12 18:28:11 -07:00
John Arild Berentsen
14b6f9d927 Missing garage door detection (#3349) 2016-09-12 18:23:18 -07:00
Pascal Vizeli
d7e3fa22eb Bugfix voluptuous on recorder (#3350) 2016-09-12 18:21:35 -07:00
Pascal Vizeli
a9ef8d8568 Update ha-ffmpeg version 0.12 and add tests (#3301)
* update ha-ffmpeg version 0.12 and add tests

* change error logging
2016-09-12 22:52:49 +02:00
John Arild Berentsen
a69c575dab Bugfix ecobee: inverted high and low temps and enforce int to temps (#3325)
* inverted high and low temps

* Looks like somethings are mixed up

* Added debugentires

* Added debugentires 2

* Enforce int on temperatures
2016-09-12 17:40:46 +02:00
Heiko Rothe
240cb9b8f0 Minor naming fix (#3318) 2016-09-12 16:58:49 +02:00
Fabian Affolter
ac063f8e61 Fix typo (#3343) 2016-09-12 16:19:46 +02:00
Fabian Affolter
c028e1fc6f Update ordering, constants, and callback name (light.*) (#3339)
* Extend schema

* Update ordering

* Add line breaks

* Align callback name with other platforms

* ALign callbackname with other platforms

* Update callback name to match other platforms

* Update callback name

* Update callback name
2016-09-12 15:52:22 +02:00
Richard Cox
44681ebd55 Slack notification optional username / icon (#3314)
* Slack notification optional username / icon

* Small bugfix to handle defaults better

* Dedup'ing code
2016-09-12 09:49:26 +02:00
clach04
c90cc77c41 bluetooth_le_tracker clarify header with LE (#3328) 2016-09-12 07:56:12 +02:00
Paulus Schoutsen
71aa1a2f3c Merge pull request #3332 from home-assistant/hotfix-0-28-1
Hotfix 0 28 1
2016-09-11 22:42:16 -07:00
Paulus Schoutsen
0cfa5e5f67 Version bump to 0.28.1 2016-09-11 22:28:53 -07:00
Paulus Schoutsen
f0ec51711c Bugfix group order (#3323)
* Add ordered dict config validator

* Have group component use ordered dict config validator

* Improve config_validation testing

* update doc string config_validation.ordered_dict

* validate full dict entries

* Further simplify ordered_dict validator.

* Lint fix
2016-09-11 22:27:47 -07:00
Teagan Glenn
d6ca930427 Automatic Device Tracker Bug Fix (#3330)
* Iterate over items

* Pass display name as host name
2016-09-11 22:27:47 -07:00
John Arild Berentsen
7bce8bc33f Revert only add 1 device (#3324) 2016-09-11 22:27:47 -07:00
Marcelo Moreira de Mello
36785296ce Fixed voluptuous to accept string instead positive_int for CODE on Simplisafe (#3310) 2016-09-11 22:27:47 -07:00
Paulus Schoutsen
838b09bb8f Bugfix group order (#3323)
* Add ordered dict config validator

* Have group component use ordered dict config validator

* Improve config_validation testing

* update doc string config_validation.ordered_dict

* validate full dict entries

* Further simplify ordered_dict validator.

* Lint fix
2016-09-11 22:25:01 -07:00
Paulus Schoutsen
fa4b253871 Comment out pyuserinput in requirements_all (#3307)
* Comment out pyuserinput in requirements_all

* Ignore import error for keyboard component
2016-09-11 21:59:48 -07:00
Teagan Glenn
360a650370 Automatic Device Tracker Bug Fix (#3330)
* Iterate over items

* Pass display name as host name
2016-09-11 21:53:05 -07:00
John Arild Berentsen
26abe83be5 Revert only add 1 device (#3324) 2016-09-11 21:46:14 -07:00
Johann Kellerman
dba78b02da Add voluptuous to locative (#3254) 2016-09-12 01:12:28 +02:00
Fabian Affolter
515c4773f3 Use voluptuous for netatmo (#3287)
* Migrate to voluptuous

* Switch back to archive (reverting #3285)
2016-09-11 21:27:58 +02:00
Teagan Glenn
05a3b610ff Add ISY programs and support for all device types (#3082)
*  ISY Lock, Binary Sensor, Cover devices, Sensors and Fan support
* Support for ISY Programs
2016-09-11 20:18:53 +02:00
William Scanlon
8c7a1b4b05 Merge pull request #3218 from w1ll1am23/full_color_support_wink_osram
Add full color support for Osram Lightify bulbs with Wink
2016-09-11 10:55:19 -04:00
William Scanlon
58c0990508 Convert rgb to hsb for Wink Osram light 2016-09-11 10:45:04 -04:00
Fabian Affolter
11396a221e Extend schema (#3278) 2016-09-11 11:45:38 +02:00
Fabian Affolter
ab826eef0d Migrate to voluptuous (#3276) 2016-09-11 11:38:43 +02:00
Fabian Affolter
d20b4c17a2 Migrate to voluptuous (#3277) 2016-09-11 11:30:27 +02:00
Fabian Affolter
1b77b2c3a3 Migrate to voluptuous (#3280) 2016-09-11 11:19:10 +02:00
Fabian Affolter
f5df5615be Migrate to voluptuous (#3282) 2016-09-11 10:04:07 +02:00
Fabian Affolter
cc99d266b7 Use constants and update ordering (#3275) 2016-09-11 10:01:46 +02:00
Fabian Affolter
aed1348411 Use constants and update ordering (#3274) 2016-09-11 09:25:19 +02:00
Fabian Affolter
f6bc63092c Migrate to voluptuous (#3281) 2016-09-11 09:24:25 +02:00
Fabian Affolter
d48ed41122 Use constants (#3284) 2016-09-11 09:24:07 +02:00
Fabian Affolter
cce3e284d7 Use voluptuous for Neurio (#3289)
* Migrate to voluptuous

* Migrate to voluptuous
2016-09-11 09:23:33 +02:00
Fabian Affolter
ac9151af54 Migrate to voluptuous (#3292) 2016-09-11 09:22:49 +02:00
Fabian Affolter
f341974b8b Migrate to voluptuous (#3290) 2016-09-11 09:22:08 +02:00
Fabian Affolter
78313c793c Migrate to voluptuous (#3298) 2016-09-11 09:21:16 +02:00
Fabian Affolter
3f4d30c8da Add timeout (#3304) 2016-09-11 09:21:01 +02:00
Marcelo Moreira de Mello
9bbe7be684 Fixed voluptuous to accept string instead positive_int for CODE on Simplisafe (#3310) 2016-09-11 09:07:13 +02:00
Robbie Trencheny
4748e7f7e9 Version bump 2016-09-10 18:23:21 -07:00
Fabian Affolter
1b46ed5045 0.28 (#3288)
* Backend support for importing waypoints from owntracks as HA zones

* Added test for Owntracks waypoints import

* Backend support for importing waypoints from owntracks as HA zones

* Added test for Owntracks waypoints import

* Removed redundant assignment to CONF_WAYPOINT_IMPORT_USER

* Fixed zone test break and code style issues

* Fixed style issues

* Fixed variable scope issues for entities

* Fixed E302

* Do not install pip packages in tests

* EventBus: return function to unlisten

* Convert automation to entities with services

* Refactored zone creation based on code review feedback, enhanced configuration

* Added unit test to enhance waypoint_whitelist coverage

* Fix JSON encoder issue in recorder

* Fix tests docstring

* * Improved zone naming in waypoint import
* Added more test coverage for owntracks and zone

* Back to 0.28.0.dev0

* Code review feedback from @pavoni

* Added bitfield of features for flux_led since we are supporting effects

* Host should be optional for apcupsd component (#3072)

* Use voluptuous for file (#3049)

* Zwave climate Bugfix: if some setpoints have different units, we should fetch the o… (#3078)

* Bugfix: if some setpoints have different units, we should fetch the one that are active.

* Move order of population for first time detection

* Default to config if None unit_of_measurement

* unit fix (#3083)

* humidity slider (#3088)

* If device was off target temp was null. Default to Heating setpoint (#3091)

* Fix linting

* Upgrade pyuserinput to 0.1.11 (#3068)

* Upgrade pyowm to 2.4.0 (#3067)

* improve isfile validation check (#3101)

* Refactor notification titles to allow for them to be None, this also includes a change in Telegram to only include the title if it's present, and to use a Markdown parse mode for messages (#3100)

* Fix broken test

* rfxtrx sensor clean up

* Bitcoin sensor use warning instead of error (#3103)

* Use voluptuous for HDMI CEC & CONF_DEVICES constants (#3107)

* Update voluptuous for nest (#3109)

* Update configuration check
* Extend platform

* Fix for BLE device tracker (#3019)

* Bug fix tracked devices
* Added scan_duration configuration parameter

* fix homematic climate implementation (#3114)

* Allow 'None' MAC to be loaded from known_devices (#3102)

* Use voluptuous for xmpp (#3127)

* Use voluptuous for twitter (#3126)

* Use voluptuous for Fritzbox and DDWRT (#3122)

* Use Voluptuous for BT Home Hub (#3121)

* Use voluptuous for syslog (#3120)

* Use voluptuous for Aruba (#3119)

* Use constants, update configuration check, and ordering (Pilight) (#3118)

* Use contants, update configuration check, and ordering

* Fix pylint issue

* Migrate to voluptuous (#3113)

* Fix typo (#3108)

* Migrate to voluptuous (#3106)

* Update voluptuous (#3104)

* Climate and cover bugfix (#3097)

* Avoid None comparison for zwave cover.

* Just rely on unit from config for unit_of_measurement

* Explicit return None

* Mqtt (#11)

* Explicit return None

* Missing service and wrong service name defined

* Mqtt state was inverted, and never triggering

* Migrate to voluptuous (#3096)

* Migrate to voluptuous (#3084)

* Fixed Homematic cover (#3116)

* Migrate to voluptuous (#3069)

🐬

* Migrate to voluptuous (#3066)

🐬

* snapcast update (#3012)

* snapcast update

* snapcast update

* validate config

* use conf constants

* orvibo updates (#3006)

🐬

* Update frontend

* move units to temperature for climate zwave. wrong state was sent to mqtt cove

* Use voluptuous for instapush (#3132)

* Use voluptuous for Octoprint (#3111)

* Migrate to voluptuous

* Fix pylint issues

* Add missing docstrings (fix PEP257 issues) (#3098)

* Add missing docstrings (fix PEP257 issues)

* Finish sentence

* Updated braviatv's braviarc version to 0.3.4 (#2997)

* Updated braviarc version to 0.3.4

* Updated braviarc version to requirements_all.txt

* Use voluptuous for Acer projector switch (#3077)

🐬

* Use voluptuous for twilio (#3134)

* Use voluptuous for webostv (#3135)

* Use voluptuous for Command line platforms (#2968)

* Migrate to voluptuous

* Fix pylint issues

* Remove FIXME

* Split setup test

* Test with bootstrap

* Remove lon and lat

* Fix pylint issues

* Add coinmarketcap sensor (#3064)

* Migrate to voluptuous (#3142)

🐬

* Back out insteon hub and fan changes (#3062)

* Move details to docs (#3146)

* Update frontend

* Use constants (#3148)

* Update ordering (#3149)

* Migrate to voluptuous (#3092)

* Display the error instead of the traceback (notify.slack) (#3079)

* Display the error instead of the traceback

* Remove name for check

* Automatic ODB device tracker & device tracker attributes (#3035)

* Migrate to voluptuous (#3173)

* Add voluptuous for tomato and SNMP (#3172)

* Improve voluptuous and login errors for Asus device tracker (#3170)

* Add exclude option to nmap device tracker (#2983)

* Add exclude option to nmap device tracker

Adds an optional exclude paramater to nmap device tracker.
Devices specified in the exclude list will never be scanned
by nmap. This can help to reduce log spam.

ex:
```
device_tracker:
  - platform: nmap_tracker
    hosts: 10.0.0.1/24
    home_interval: 1
    interval_seconds: 12
    consider_home: 120
    track_new_devices: yes
    exclude:
      - 10.0.0.2
      - 10.0.0.1
```

* Handle optional exclude

* Style fixed

* Added Xbox Live component (#3013)

* Added Xbox Live component

* Added Xbox Live sensor to coveralls

* Added init success checks

* Added entity id

* Adding link_names to post.message call (#3167)

If you do not turn link_names on, Slack will not highlight @channel and @username messages.

* Allow https (fixes #3150) (#3155)

* Use constants (#3156)

* Bugfix: ctach Runtime errors (#3153)

"RuntimeError: Disable scan failed" has been seen in a live installation

* Migrate to voluptuous (#3166)

🐬

* Migrate to voluptuous (#3164)

🐬

* Migrate to voluptuous (#3163)

🐬

* Migrate to voluptuous (#3162)

🐬 and 🍪 for fixing quotes!

* Exclude www_static from pydocstyle linting (#3175)

🐬

* Migrate to voluptuous (#3174)

* Migrate to voluptuous (#3171)

* Use voluptuous for mFi switch (#3168)

* Migrate to voluptuous

* Take change configuration into account

* Migrate to voluptuous (#3144)

🐬

* Add the occupancy sensor_class (#3176)

Such a complicated PR

* Update frontend

* Use voluptuous for Unifi, Ubus (#3125)

* Using alert with Hue maintains prior state (#3147)

* When using flash with hue, dont change the on/off state of the light so that it will naturally return to its previous state once flash is complete

* ATTR_FLASH not ATTR_EFFECT

* MQTT fan platform (#3095)

* Add fan.mqtt, allow brightness to be passed and mapped to a fan speed for compatibility with emulated_hue

* Pylint/Flake8 fixes

* Remove brightness

* Add more features, like custom oscillation/speed payloads and setting the speed list

* Flake8 fixes

* flake8/pylint fixes

* Use constants

* block fan.mqtt from coverage

* Fix oscillating comment

* Add Sphinx API doc generation (#3029)

* add's sphinx project to docs/ dir
* include core/helpers autodocs for API reference

* Allow reloading automation without restarting HA (#3002)

* Migrate to voluptuous (#3182)

🐬

* Migrate to voluptuous (#3179)

🐬

* Added scale and offset to the Temper component (#2853)

🐬

* Use voluptuous for BT and Owntracks device trackers (#3187)

🐬

* Correct binary_sensor.ecobee docs URL

* Use voluptuous for Hikvisioncam switch (#3184)

* Migrate to voluptuous

* Use vol.Optional

* Use voluptuous for Edimax (#3178)

🐬

* Use voluptuous for Bravia TV (#3165)

🐬

* Added support to 'effect: random' to Osram Lightify lights (#3192)

* Added support to 'effect: random' to Osram Lightify lights

* removed extra line not required

* Use voluptuous for message_bird, sendgrid (#3136)

* Try out the RTD theme

* Doc updates

* Update voluptuous for existing notify platforms (#3133)

* Update voluptuous for exists notify platforms

* fix constants

* Simple trend sensor. (#3073)

* First cut of trend sensor.

* Tidy.

* Migrate to voluptuous (#3193)

* Migrate to voluptuous (#3194)

🐬

* Migrate to voluptuous (#3197)

* Migrate to voluptuous (#3198)

🐬

* Use extend of PLATFORM_SCHEMA (#3199)

* Migrate to voluptuous (#3202)

🐬

* Updated to use the occupancy sensor_class (#3204)

🐬

* Migrate to voluptuous (#3206)

* Migrate to voluptuous (#3207)

* Migrate to voluptuous (#3208)

🐬

* Migrate to voluptuous (#3209)

🐬

* Migrate to voluptuous (#3214)

* Use voluptuous for SqueezeBox (#3212)

* Migrate to voluptuous

* Remove name

* Migrate to voluptuous and upgrade uber_rides to 0.2.5 (#3181)

* Migrate to voluptuous (#3200)

🐬

* Use Voluptuous for Luci and Netgear device trackers (#3123)

* Use Voluptuous for Luci and NEtgear device trackers

* str_schema shortcut

* Undo str_schema

* change update handling with variable for breack CCU2 (#3215)

* Update ordering (#3216)

* Docs update

* Flake8/pylint

* Add new docs requirements

* Update email validation (#3228)

🐬

* Fix email validation (fixes #3138) (#3227)

* Upgrade slacker to 0.9.25 (#3224)

* Upgrade psutil to 4.3.1 (#3223)

* Upgrade gps3 to 0.33.3 (#3222)

* Upgrade Werkzeug to 0.11.11 (#3220)

* Upgrade sendgrid to 3.4.0 (#3226)

* Bluetooth: keep looking for new devices (#3201)

* keep looking for new devices

* Update bluetooth_tracker.py

* change default value for tracking new devices

* remove commented code

* dlink switch added device state attributes and support for legacy firmware (#3211)

* Use voluptuous for free mobile (#3236)

* Use voluptuous for nma (#3241)

* Improve 1-Wire device family detection and error checking. Use volupt… (#3233)

* Improve 1-Wire device family detection and error checking. Use voluptuous

* Fix detection of gpio connected devices

* Replace rollershutter and garage door with cover, add fan (#3242)

* Use voluptuous for Alarm.com (#3229)

* Use voluptuous for gntp (#3237)

* Use voluptuous for pushbullet, pushetta and pushover (#3240)

* Migrate to voluptuous (#3230)

🐬

* Fix mFi sensors in uninitialized state (#3246)

If mFi sensors are identified but not fully assigned they can
have no tag value, and mficlient throws a ValueError to signal this.
This patch handles that case by considering such devices to always
be STATE_OFF.

* Use voluptuous for PulseAudio Loopback (#3160)

* Migrate to voluptuous

* Fix conf var

* Use voluptuous for Verisure (#3169)

* Migrate to voluptuous

* Update type and add missing config variable

* thread safe modbus (#3188)

*  Upgraded fitbit to version 0.2.3 which fixed oauthlib.oauth2.rfc6749.errors.TokenExpiredError: (token_expired) (#3244)

* update ffmpeg version to 0.10 add get image to camera (#3235)

* Migrate to voluptuous (#3234)

* fix bugfix with unique_id (#3217)

* Zwave climate fix and wink cover. (#3205)

* Fixes setpoint get was done outside loop

* zxt_120

* Wink not migrated to cover

* Clarifying debug

* too long line

* Only add 1 device entity

* Owntracks voluptuous fix (#3191)

* Zwave set temperature fix (#3221)

* If device was off set target temp would not work.

* Changed to use a workaround just for Horstmann HRT4-ZW Zwave Thermostat

* Wrong Horseman id

* style changes

* Change PR to suggestion on gitter (#3243)

* Reload groups (#3203)

* Allow reloading groups without restart

* Test to make sure automation listeners are removed.

* Remove unused imports for group tests

* Simplify group config validation

* Add prepare_reload function to entity component

* Migrate group to use entity_component.prepare_reload

* Migrate automation to use entity_component.prepare_reload

* Clean up group.get_entity_ids

* Use cv.boolean for group config validation

* fix remove listener (#3196)

* Add linux battery sensor (#3238)

* protect service data for changes in calls (#3249)

* protect service data for changes in calls

* change handling

* move MappingProxyType to service call

* Fix issue #3250 (#3253)

* Minor Ecobee changes (#3131)

* Update configuration check, ordering, and constants

* Make API key optional

* issue #3250

* Add voluptuous to ecobee (#3257)

* Use constants and update ordering (#3261)

* Add support for complex template structures to data_template (#3255)

* Improve yaml fault tolerance and handle check_config border cases (#3159)

* Use voluptuous for nx584 alarm (#3231)

* Migrate to voluptuous

* Fix pylint issue

* fastdotcom from pypi (#3269)

* Use constants and update ordering (#3268)

🐬

* Use constants and update ordering (#3267)

🐬

* Add additional template for custom date formats (#3262)

I can live with a few visual line breaks 🐬

* Use constants and update ordering (#3266)

* Updated  braviatv's braviarc version to 0.3.5 (#3271)

* Use voluptuous for Device Sun Light Trigger (#3105)

* Migrate to voluptuous

* Use default

* Point to master till archive is back (#3285)

* Pi-Hole statistics sensor (#3158)

* Add Pi-Hole sensor

* Update docstrings and remove print()

* Use None for payload

* Added stuff for support range setting (#3189)

* cleanup Homematic code (#3291)

* cleanup old code

* cleanup round 2

* remove unwanted platforms

* Update frontend

* Hotfix for #3100 (#3302)

* Fix TP-Link Archer C7 long passwords (#3225)

* Fix tplink C7 long passwords

Fixes an issue where passwords longer than 15 chars could not log in to Archer C7 routers.

* Truncate in correct place

* Add comment about TP-Link C7 pass truncation

* Fix lint error

* Truncate comment at 79 chars not 80

* modbus write registers service (#3252)

* Fix bloomsky platform discovery (#3303)

* Remove dev tag
2016-09-10 18:22:58 -07:00
Robbie Trencheny
e8f8ea080b Remove dev tag 2016-09-10 18:13:27 -07:00
Paulus Schoutsen
b8251b084a Fix bloomsky platform discovery (#3303) 2016-09-10 09:12:24 -07:00
Per Sandström
54a17f5d98 modbus write registers service (#3252) 2016-09-10 08:17:28 -07:00
Mal Curtis
8438001942 Fix TP-Link Archer C7 long passwords (#3225)
* Fix tplink C7 long passwords

Fixes an issue where passwords longer than 15 chars could not log in to Archer C7 routers.

* Truncate in correct place

* Add comment about TP-Link C7 pass truncation

* Fix lint error

* Truncate comment at 79 chars not 80
2016-09-10 08:08:51 -07:00
Lewis Juggins
de150ecbc9 Hotfix for #3100 (#3302) 2016-09-10 07:36:55 -07:00
Robbie Trencheny
d466bae244 Update frontend 2016-09-09 14:23:03 -07:00
Pascal Vizeli
e87da765c5 cleanup Homematic code (#3291)
* cleanup old code

* cleanup round 2

* remove unwanted platforms
2016-09-09 19:33:12 +02:00
John Arild Berentsen
ba28208106 Added stuff for support range setting (#3189) 2016-09-09 11:06:53 -06:00
Fabian Affolter
545329174d Pi-Hole statistics sensor (#3158)
* Add Pi-Hole sensor

* Update docstrings and remove print()

* Use None for payload
2016-09-09 17:10:46 +02:00
Fabian Affolter
5881f6000e Point to master till archive is back (#3285) 2016-09-09 16:53:18 +02:00
Daniel Høyer Iversen
3411c4c7c3 Merge pull request #3260 from home-assistant/issue_#3250
issue #3250
2016-09-09 09:33:26 +02:00
Fabian Affolter
5bf66cae1f Use voluptuous for Device Sun Light Trigger (#3105)
* Migrate to voluptuous

* Use default
2016-09-09 09:06:24 +02:00
Brian Karani Ndwiga
53c8115f82 Updated braviatv's braviarc version to 0.3.5 (#3271) 2016-09-09 08:38:32 +02:00
Fabian Affolter
911231afc1 Use constants and update ordering (#3266) 2016-09-09 08:37:30 +02:00
Lewis Juggins
44f5a66b66 Add additional template for custom date formats (#3262)
I can live with a few visual line breaks 🐬
2016-09-08 18:49:02 -06:00
Fabian Affolter
ee6c83f569 Use constants and update ordering (#3267)
🐬
2016-09-08 18:34:55 -06:00
Fabian Affolter
fb0232429e Use constants and update ordering (#3268)
🐬
2016-09-08 18:32:32 -06:00
Nolan Gilley
1cace5782c fastdotcom from pypi (#3269) 2016-09-08 18:26:50 -06:00
Fabian Affolter
02848b3949 Use voluptuous for nx584 alarm (#3231)
* Migrate to voluptuous

* Fix pylint issue
2016-09-08 23:06:57 +02:00
Johann Kellerman
e8ad76c816 Improve yaml fault tolerance and handle check_config border cases (#3159) 2016-09-08 22:20:38 +02:00
Pascal Vizeli
267cda447e Add support for complex template structures to data_template (#3255) 2016-09-08 18:19:47 +02:00
Fabian Affolter
94e3986d54 Use constants and update ordering (#3261) 2016-09-08 16:26:54 +02:00
Pascal Vizeli
24aa3b3c97 Add voluptuous to ecobee (#3257) 2016-09-08 16:11:00 +02:00
Daniel
b3d2db45de issue #3250 2016-09-08 08:43:05 +02:00
Fabian Affolter
1af5d4c8b8 Minor Ecobee changes (#3131)
* Update configuration check, ordering, and constants

* Make API key optional
2016-09-07 20:21:42 +02:00
Daniel Høyer Iversen
4d41c5cd0f Fix issue #3250 (#3253) 2016-09-07 19:17:16 +02:00
Pascal Vizeli
e632a47772 protect service data for changes in calls (#3249)
* protect service data for changes in calls

* change handling

* move MappingProxyType to service call
2016-09-07 08:19:19 -07:00
Fabian Affolter
32c234ffcc Add linux battery sensor (#3238) 2016-09-07 16:32:35 +02:00
Paulus Schoutsen
5995f2438e fix remove listener (#3196) 2016-09-07 06:59:59 -07:00
Paulus Schoutsen
35b388edce Reload groups (#3203)
* Allow reloading groups without restart

* Test to make sure automation listeners are removed.

* Remove unused imports for group tests

* Simplify group config validation

* Add prepare_reload function to entity component

* Migrate group to use entity_component.prepare_reload

* Migrate automation to use entity_component.prepare_reload

* Clean up group.get_entity_ids

* Use cv.boolean for group config validation
2016-09-07 06:59:16 -07:00
Pascal Vizeli
91028cbc13 Change PR to suggestion on gitter (#3243) 2016-09-07 06:57:59 -07:00
Dave Banks
3668afe306 Zwave set temperature fix (#3221)
* If device was off set target temp would not work.

* Changed to use a workaround just for Horstmann HRT4-ZW Zwave Thermostat

* Wrong Horseman id

* style changes
2016-09-07 11:22:51 +02:00
Johann Kellerman
47864fc7d7 Owntracks voluptuous fix (#3191) 2016-09-06 18:35:10 -07:00
John Arild Berentsen
e88e6d1030 Zwave climate fix and wink cover. (#3205)
* Fixes setpoint get was done outside loop

* zxt_120

* Wink not migrated to cover

* Clarifying debug

* too long line

* Only add 1 device entity
2016-09-06 18:34:28 -07:00
Pascal Vizeli
d7b757fb97 fix bugfix with unique_id (#3217) 2016-09-06 18:31:56 -07:00
Fabian Affolter
6a837f3aad Migrate to voluptuous (#3234) 2016-09-06 18:28:55 -07:00
Pascal Vizeli
165871d48a update ffmpeg version to 0.10 add get image to camera (#3235) 2016-09-06 18:24:11 -07:00
Marcelo Moreira de Mello
fb719f530a Upgraded fitbit to version 0.2.3 which fixed oauthlib.oauth2.rfc6749.errors.TokenExpiredError: (token_expired) (#3244) 2016-09-06 18:23:08 -07:00
Per Sandström
d53d8f5ea9 thread safe modbus (#3188) 2016-09-06 18:21:38 -07:00
Fabian Affolter
7aafa309c9 Use voluptuous for Verisure (#3169)
* Migrate to voluptuous

* Update type and add missing config variable
2016-09-06 18:18:34 -07:00
Fabian Affolter
abff2f2b36 Use voluptuous for PulseAudio Loopback (#3160)
* Migrate to voluptuous

* Fix conf var
2016-09-06 18:16:03 -07:00
Dan Smith
f55095df83 Fix mFi sensors in uninitialized state (#3246)
If mFi sensors are identified but not fully assigned they can
have no tag value, and mficlient throws a ValueError to signal this.
This patch handles that case by considering such devices to always
be STATE_OFF.
2016-09-06 18:04:20 -07:00
Fabian Affolter
9d4ccb1f49 Migrate to voluptuous (#3230)
🐬
2016-09-06 18:03:43 -06:00
Pascal Vizeli
9eacde0005 Use voluptuous for pushbullet, pushetta and pushover (#3240) 2016-09-06 18:00:33 -06:00
Pascal Vizeli
22870d424a Use voluptuous for gntp (#3237) 2016-09-06 16:16:21 -06:00
Fabian Affolter
e00f9339d1 Use voluptuous for Alarm.com (#3229) 2016-09-06 23:48:32 +02:00
Fabian Affolter
d8db881e9a Replace rollershutter and garage door with cover, add fan (#3242) 2016-09-06 23:41:26 +02:00
Ardetus
fa8ed4de41 Improve 1-Wire device family detection and error checking. Use volupt… (#3233)
* Improve 1-Wire device family detection and error checking. Use voluptuous

* Fix detection of gpio connected devices
2016-09-06 14:50:02 -06:00
Pascal Vizeli
79fa9963da Use voluptuous for nma (#3241) 2016-09-06 22:24:04 +02:00
Pascal Vizeli
d06a3c9145 Use voluptuous for free mobile (#3236) 2016-09-06 21:33:11 +02:00
Christian Brædstrup
c1139a9fda dlink switch added device state attributes and support for legacy firmware (#3211) 2016-09-06 11:52:22 -06:00
Bart274
9ade87013e Bluetooth: keep looking for new devices (#3201)
* keep looking for new devices

* Update bluetooth_tracker.py

* change default value for tracking new devices

* remove commented code
2016-09-06 11:51:36 -06:00
Fabian Affolter
478c82c34c Upgrade sendgrid to 3.4.0 (#3226) 2016-09-06 18:12:24 +02:00
Fabian Affolter
85baebb23b Upgrade Werkzeug to 0.11.11 (#3220) 2016-09-06 08:55:23 -06:00
Fabian Affolter
88d62bd935 Upgrade gps3 to 0.33.3 (#3222) 2016-09-06 08:53:21 -06:00
Fabian Affolter
9530c7366b Upgrade psutil to 4.3.1 (#3223) 2016-09-06 08:51:51 -06:00
Fabian Affolter
26eba4cb1a Upgrade slacker to 0.9.25 (#3224) 2016-09-06 08:51:23 -06:00
Fabian Affolter
c06fe51122 Fix email validation (fixes #3138) (#3227) 2016-09-06 08:48:24 -06:00
Fabian Affolter
f595c8715c Update email validation (#3228)
🐬
2016-09-06 08:45:33 -06:00
Robbie Trencheny
6e6b2ae3f4 Add new docs requirements 2016-09-05 18:12:44 -07:00
Robbie Trencheny
d903661577 Flake8/pylint 2016-09-05 18:10:04 -07:00
Robbie Trencheny
a5faa851e8 Docs update 2016-09-05 18:06:19 -07:00
Fabian Affolter
5ec6eaf7d0 Update ordering (#3216) 2016-09-05 22:53:23 +02:00
Pascal Vizeli
73036f4725 change update handling with variable for breack CCU2 (#3215) 2016-09-05 22:39:29 +02:00
Johann Kellerman
17a2cac7e1 Use Voluptuous for Luci and Netgear device trackers (#3123)
* Use Voluptuous for Luci and NEtgear device trackers

* str_schema shortcut

* Undo str_schema
2016-09-05 11:37:36 -06:00
Fabian Affolter
e0a6d7941c Migrate to voluptuous (#3200)
🐬
2016-09-05 11:34:35 -06:00
Fabian Affolter
4638696f8c Migrate to voluptuous and upgrade uber_rides to 0.2.5 (#3181) 2016-09-05 11:33:35 -06:00
Fabian Affolter
428db4a644 Use voluptuous for SqueezeBox (#3212)
* Migrate to voluptuous

* Remove name
2016-09-05 19:27:06 +02:00
Fabian Affolter
ea1e4ea215 Migrate to voluptuous (#3214) 2016-09-05 19:22:26 +02:00
Fabian Affolter
6b787ee01e Migrate to voluptuous (#3209)
🐬
2016-09-05 10:05:27 -06:00
Fabian Affolter
6be20883f0 Migrate to voluptuous (#3208)
🐬
2016-09-05 10:04:46 -06:00
Fabian Affolter
95ea0c02b9 Migrate to voluptuous (#3207) 2016-09-05 10:03:25 -06:00
Fabian Affolter
5059d8dde9 Migrate to voluptuous (#3206) 2016-09-05 10:01:50 -06:00
arsaboo
3bbd909b20 Updated to use the occupancy sensor_class (#3204)
🐬
2016-09-05 09:55:29 -06:00
Fabian Affolter
909b5ffa5b Migrate to voluptuous (#3202)
🐬
2016-09-05 09:51:18 -06:00
Fabian Affolter
e324885ff6 Use extend of PLATFORM_SCHEMA (#3199) 2016-09-05 09:47:53 -06:00
Fabian Affolter
8afed2cafa Migrate to voluptuous (#3198)
🐬
2016-09-05 09:46:57 -06:00
Fabian Affolter
6bbe3483d9 Migrate to voluptuous (#3197) 2016-09-05 09:45:06 -06:00
Fabian Affolter
9c600012a1 Migrate to voluptuous (#3194)
🐬
2016-09-05 09:40:57 -06:00
Fabian Affolter
aed59aea7d Migrate to voluptuous (#3193) 2016-09-05 09:39:21 -06:00
Greg Dowling
09d52820dd Simple trend sensor. (#3073)
* First cut of trend sensor.

* Tidy.
2016-09-05 16:32:14 +02:00
Pascal Vizeli
48c1631178 Update voluptuous for existing notify platforms (#3133)
* Update voluptuous for exists notify platforms

* fix constants
2016-09-05 13:27:10 +02:00
Robbie Trencheny
1170b2897a Doc updates 2016-09-05 03:31:48 -07:00
Robbie Trencheny
5144547b70 Try out the RTD theme 2016-09-05 02:25:03 -07:00
Pascal Vizeli
e460d8f637 Use voluptuous for message_bird, sendgrid (#3136) 2016-09-05 07:07:31 +02:00
Marcelo Moreira de Mello
7bab4055a5 Added support to 'effect: random' to Osram Lightify lights (#3192)
* Added support to 'effect: random' to Osram Lightify lights

* removed extra line not required
2016-09-04 21:15:44 -07:00
Fabian Affolter
892f6a706a Use voluptuous for Bravia TV (#3165)
🐬
2016-09-04 19:22:01 -06:00
Fabian Affolter
59cd92cb4d Use voluptuous for Edimax (#3178)
🐬
2016-09-04 19:17:40 -06:00
Fabian Affolter
98bdcd3405 Use voluptuous for Hikvisioncam switch (#3184)
* Migrate to voluptuous

* Use vol.Optional
2016-09-04 19:16:16 -06:00
Robbie Trencheny
a569ee787d Correct binary_sensor.ecobee docs URL 2016-09-04 14:37:10 -07:00
Johann Kellerman
ad52816595 Use voluptuous for BT and Owntracks device trackers (#3187)
🐬
2016-09-04 11:10:20 -06:00
Heiko Rothe
29870b301e Added scale and offset to the Temper component (#2853)
🐬
2016-09-04 10:37:10 -06:00
Fabian Affolter
b4c8d10dbc Migrate to voluptuous (#3179)
🐬
2016-09-04 10:32:12 -06:00
Fabian Affolter
cd67368bb7 Migrate to voluptuous (#3182)
🐬
2016-09-04 10:27:19 -06:00
Paulus Schoutsen
e9813b219e Allow reloading automation without restarting HA (#3002) 2016-09-04 17:15:52 +02:00
Ben Bangert
641d531be3 Add Sphinx API doc generation (#3029)
* add's sphinx project to docs/ dir
* include core/helpers autodocs for API reference
2016-09-04 14:36:44 +02:00
Robbie Trencheny
74980d9563 MQTT fan platform (#3095)
* Add fan.mqtt, allow brightness to be passed and mapped to a fan speed for compatibility with emulated_hue

* Pylint/Flake8 fixes

* Remove brightness

* Add more features, like custom oscillation/speed payloads and setting the speed list

* Flake8 fixes

* flake8/pylint fixes

* Use constants

* block fan.mqtt from coverage

* Fix oscillating comment
2016-09-04 03:15:55 -07:00
Robbie Trencheny
0f37d8d8eb Using alert with Hue maintains prior state (#3147)
* When using flash with hue, dont change the on/off state of the light so that it will naturally return to its previous state once flash is complete

* ATTR_FLASH not ATTR_EFFECT
2016-09-04 03:04:12 -07:00
Johann Kellerman
22362727e4 Use voluptuous for Unifi, Ubus (#3125) 2016-09-04 10:06:16 +02:00
Robbie Trencheny
48e6befc13 Update frontend 2016-09-03 22:04:23 -07:00
Robbie Trencheny
4de9717256 Add the occupancy sensor_class (#3176)
Such a complicated PR
2016-09-03 22:52:31 -06:00
Fabian Affolter
b02b008fe5 Migrate to voluptuous (#3144)
🐬
2016-09-03 20:36:21 -06:00
Fabian Affolter
3c615e2319 Use voluptuous for mFi switch (#3168)
* Migrate to voluptuous

* Take change configuration into account
2016-09-03 20:32:35 -06:00
Fabian Affolter
8467d07a3d Migrate to voluptuous (#3171) 2016-09-03 20:24:29 -06:00
Fabian Affolter
6f45906eda Migrate to voluptuous (#3174) 2016-09-03 20:21:59 -06:00
Martin Hjelmare
34ba4d3e09 Exclude www_static from pydocstyle linting (#3175)
🐬
2016-09-03 20:21:19 -06:00
Fabian Affolter
3b1c0a7502 Migrate to voluptuous (#3162)
🐬 and 🍪 for fixing quotes!
2016-09-03 20:20:45 -06:00
Fabian Affolter
6a2f0fc456 Migrate to voluptuous (#3163)
🐬
2016-09-03 20:18:11 -06:00
Fabian Affolter
2aab77a486 Migrate to voluptuous (#3164)
🐬
2016-09-03 20:14:28 -06:00
Fabian Affolter
02960ec482 Migrate to voluptuous (#3166)
🐬
2016-09-03 20:09:02 -06:00
Open Home Automation
db7f6a328f Bugfix: ctach Runtime errors (#3153)
"RuntimeError: Disable scan failed" has been seen in a live installation
2016-09-03 16:47:11 -07:00
Fabian Affolter
290ec9b4ac Use constants (#3156) 2016-09-03 16:45:49 -07:00
Fabian Affolter
0198ba4eac Allow https (fixes #3150) (#3155) 2016-09-03 16:45:31 -07:00
Steven Barnes
09b53a0d55 Adding link_names to post.message call (#3167)
If you do not turn link_names on, Slack will not highlight @channel and @username messages.
2016-09-03 16:44:30 -07:00
Heiko Rothe
269e97c6de Added Xbox Live component (#3013)
* Added Xbox Live component

* Added Xbox Live sensor to coveralls

* Added init success checks

* Added entity id
2016-09-03 16:43:33 -07:00
Dan
68ef55a982 Add exclude option to nmap device tracker (#2983)
* Add exclude option to nmap device tracker

Adds an optional exclude paramater to nmap device tracker.
Devices specified in the exclude list will never be scanned
by nmap. This can help to reduce log spam.

ex:
```
device_tracker:
  - platform: nmap_tracker
    hosts: 10.0.0.1/24
    home_interval: 1
    interval_seconds: 12
    consider_home: 120
    track_new_devices: yes
    exclude:
      - 10.0.0.2
      - 10.0.0.1
```

* Handle optional exclude

* Style fixed
2016-09-03 16:41:38 -07:00
Johann Kellerman
91a3522100 Improve voluptuous and login errors for Asus device tracker (#3170) 2016-09-03 17:32:43 -06:00
Johann Kellerman
fe7f797ad9 Add voluptuous for tomato and SNMP (#3172) 2016-09-03 17:30:48 -06:00
Fabian Affolter
70888532f8 Migrate to voluptuous (#3173) 2016-09-03 17:30:21 -06:00
Robbie Trencheny
32e1e046ae Merge branch 'master' into dev 2016-09-03 16:25:59 -07:00
Robbie Trencheny
64cc4a47ec 0.27.2 (#3151)
* Host should be optional for apcupsd component (#3072)

* Zwave climate Bugfix: if some setpoints have different units, we should fetch the o… (#3078)

* Bugfix: if some setpoints have different units, we should fetch the one that are active.

* Move order of population for first time detection

* Default to config if None unit_of_measurement

* unit fix (#3083)

* humidity slider (#3088)

* If device was off target temp was null. Default to Heating setpoint (#3091)

* Fix for BLE device tracker (#3019)

* Bug fix tracked devices
* Added scan_duration configuration parameter

* fix homematic climate implementation (#3114)

* Allow 'None' MAC to be loaded from known_devices (#3102)

* Climate and cover bugfix (#3097)

* Avoid None comparison for zwave cover.

* Just rely on unit from config for unit_of_measurement

* Explicit return None

* Mqtt (#11)

* Explicit return None

* Missing service and wrong service name defined

* Mqtt state was inverted, and never triggering

* Fixed Homematic cover (#3116)

* Add missing docstrings (fix PEP257 issues) (#3098)

* Add missing docstrings (fix PEP257 issues)

* Finish sentence

* Merge pull request #3130 from turbokongen/zwave_fixes

Bugfix. climate and covermqt

* Back out insteon hub and fan changes (#3062)

* Bump version

* Special frontend build for 0.27.2
2016-09-03 15:59:20 -07:00
Teagan Glenn
601395bc12 Automatic ODB device tracker & device tracker attributes (#3035) 2016-09-03 18:38:17 +02:00
Fabian Affolter
a08ac85971 Display the error instead of the traceback (notify.slack) (#3079)
* Display the error instead of the traceback

* Remove name for check
2016-09-03 17:01:05 +02:00
Fabian Affolter
5dc63c17c8 Migrate to voluptuous (#3092) 2016-09-03 10:56:41 +02:00
Fabian Affolter
795121d5a8 Update ordering (#3149) 2016-09-03 09:35:33 +02:00
Fabian Affolter
6ae4e5cb6c Use constants (#3148) 2016-09-03 00:09:14 +02:00
Robbie Trencheny
b5ae005acc Update frontend 2016-09-02 14:50:10 -07:00
Fabian Affolter
fb9627deda Move details to docs (#3146) 2016-09-02 23:25:35 +02:00
Teagan Glenn
6fdd7f5350 Back out insteon hub and fan changes (#3062) 2016-09-02 12:18:32 -07:00
Robbie Trencheny
a7a662d224 Merge pull request #3130 from turbokongen/zwave_fixes
Bugfix. climate and covermqt
2016-09-02 12:15:27 -07:00
Fabian Affolter
3bbcf4d8b1 Migrate to voluptuous (#3142)
🐬
2016-09-02 11:16:42 -06:00
Fabian Affolter
a0a509ceea Add coinmarketcap sensor (#3064) 2016-09-02 16:59:05 +02:00
Fabian Affolter
40c71b5d96 Use voluptuous for Command line platforms (#2968)
* Migrate to voluptuous

* Fix pylint issues

* Remove FIXME

* Split setup test

* Test with bootstrap

* Remove lon and lat

* Fix pylint issues
2016-09-02 08:09:09 -06:00
Pascal Vizeli
81628b01c2 Use voluptuous for webostv (#3135) 2016-09-02 07:59:38 -06:00
Pascal Vizeli
28e939afcf Use voluptuous for twilio (#3134) 2016-09-02 07:59:08 -06:00
Fabian Affolter
e5ef548f10 Use voluptuous for Acer projector switch (#3077)
🐬
2016-09-02 07:42:38 -06:00
Tomi Tuhkanen
dedc4a129c Updated braviatv's braviarc version to 0.3.4 (#2997)
* Updated braviarc version to 0.3.4

* Updated braviarc version to requirements_all.txt
2016-09-02 15:07:40 +02:00
Fabian Affolter
95cc672161 Add missing docstrings (fix PEP257 issues) (#3098)
* Add missing docstrings (fix PEP257 issues)

* Finish sentence
2016-09-02 14:25:13 +02:00
Fabian Affolter
6a84b82663 Use voluptuous for Octoprint (#3111)
* Migrate to voluptuous

* Fix pylint issues
2016-09-02 12:26:23 +02:00
Pascal Vizeli
000832a82c Use voluptuous for instapush (#3132) 2016-09-02 11:14:18 +02:00
turbokongen
0907eea442 move units to temperature for climate zwave. wrong state was sent to mqtt cove 2016-09-02 10:49:53 +02:00
Robbie Trencheny
b8b1fadc6d Update frontend 2016-09-01 21:59:32 -07:00
happyleavesaoc
24d3cbdfe9 orvibo updates (#3006)
🐬
2016-09-01 22:37:09 -06:00
happyleavesaoc
451f0cb3f1 snapcast update (#3012)
* snapcast update

* snapcast update

* validate config

* use conf constants
2016-09-01 22:36:14 -06:00
Fabian Affolter
b4df9b30d8 Migrate to voluptuous (#3066)
🐬
2016-09-01 22:34:42 -06:00
Fabian Affolter
27ee4c555a Migrate to voluptuous (#3069)
🐬
2016-09-01 22:34:07 -06:00
Daniel Perna
0c310c166a Fixed Homematic cover (#3116) 2016-09-01 22:32:12 -06:00
Fabian Affolter
06df31bb5b Migrate to voluptuous (#3084) 2016-09-01 22:31:49 -06:00
Fabian Affolter
177d8ef4ef Migrate to voluptuous (#3096) 2016-09-01 22:31:32 -06:00
John Arild Berentsen
a50205aedb Climate and cover bugfix (#3097)
* Avoid None comparison for zwave cover.

* Just rely on unit from config for unit_of_measurement

* Explicit return None

* Mqtt (#11)

* Explicit return None

* Missing service and wrong service name defined

* Mqtt state was inverted, and never triggering
2016-09-01 22:31:25 -06:00
Fabian Affolter
9226cef61e Update voluptuous (#3104) 2016-09-01 22:30:49 -06:00
Fabian Affolter
29f2dd2ce9 Migrate to voluptuous (#3106) 2016-09-01 22:30:25 -06:00
Fabian Affolter
ed7a227035 Fix typo (#3108) 2016-09-01 22:30:20 -06:00
Fabian Affolter
d8ad4e1584 Migrate to voluptuous (#3113) 2016-09-01 22:29:35 -06:00
Fabian Affolter
db7abc1cfe Use constants, update configuration check, and ordering (Pilight) (#3118)
* Use contants, update configuration check, and ordering

* Fix pylint issue
2016-09-01 22:28:52 -06:00
Johann Kellerman
a571271c39 Use voluptuous for Aruba (#3119) 2016-09-01 22:28:46 -06:00
Pascal Vizeli
9e38255c26 Use voluptuous for syslog (#3120) 2016-09-01 22:28:33 -06:00
Johann Kellerman
586e47d08d Use Voluptuous for BT Home Hub (#3121) 2016-09-01 22:28:28 -06:00
Johann Kellerman
78f0e681ed Use voluptuous for Fritzbox and DDWRT (#3122) 2016-09-01 22:28:03 -06:00
Pascal Vizeli
afdd734b44 Use voluptuous for twitter (#3126) 2016-09-01 22:27:38 -06:00
Pascal Vizeli
6b6d34ba51 Use voluptuous for xmpp (#3127) 2016-09-01 22:27:28 -06:00
Johann Kellerman
dadcf92290 Allow 'None' MAC to be loaded from known_devices (#3102) 2016-09-02 00:02:35 +02:00
Pascal Vizeli
dcfc1ef361 fix homematic climate implementation (#3114) 2016-09-01 22:20:55 +02:00
Open Home Automation
83f1272662 Fix for BLE device tracker (#3019)
* Bug fix tracked devices
* Added scan_duration configuration parameter
2016-09-01 22:18:58 +02:00
Fabian Affolter
d2dfe04ec9 Update voluptuous for nest (#3109)
* Update configuration check
* Extend platform
2016-09-01 22:08:03 +02:00
Fabian Affolter
24d412938e Use voluptuous for HDMI CEC & CONF_DEVICES constants (#3107) 2016-09-01 22:04:00 +02:00
Fabian Affolter
748d7f4ecb Bitcoin sensor use warning instead of error (#3103) 2016-09-01 21:57:47 +02:00
Daniel Høyer Iversen
1094de7ad9 Merge pull request #3110 from home-assistant/rfxtrx_sensor_cleanup
rfxtrx sensor clean up
2016-09-01 19:42:40 +02:00
Daniel
831d96995d rfxtrx sensor clean up 2016-09-01 19:23:26 +02:00
Paulus Schoutsen
60f540315a Fix broken test 2016-09-01 14:40:13 +01:00
Lewis Juggins
0bcfb65a30 Refactor notification titles to allow for them to be None, this also includes a change in Telegram to only include the title if it's present, and to use a Markdown parse mode for messages (#3100) 2016-09-01 14:35:46 +01:00
Pascal Vizeli
5036bb0bc6 improve isfile validation check (#3101) 2016-09-01 14:35:00 +01:00
Paulus Schoutsen
87e332c777 Merge pull request #2980 from home-assistant/automation-entities
Create entities for automation
2016-09-01 09:50:39 +01:00
Fabian Affolter
88e600827e Upgrade pyowm to 2.4.0 (#3067) 2016-09-01 09:38:50 +01:00
Fabian Affolter
e045a6f0c3 Upgrade pyuserinput to 0.1.11 (#3068) 2016-09-01 09:37:58 +01:00
Paulus Schoutsen
c792dd4126 Fix linting 2016-09-01 09:12:42 +01:00
John Arild Berentsen
571cbdf40c If device was off target temp was null. Default to Heating setpoint (#3091) 2016-09-01 09:31:52 +02:00
John Arild Berentsen
4b12ea04d6 humidity slider (#3088) 2016-09-01 07:13:33 +02:00
John Arild Berentsen
5f664acb4f unit fix (#3083) 2016-08-31 22:30:44 +02:00
John Arild Berentsen
e5b6592870 Zwave climate Bugfix: if some setpoints have different units, we should fetch the o… (#3078)
* Bugfix: if some setpoints have different units, we should fetch the one that are active.

* Move order of population for first time detection

* Default to config if None unit_of_measurement
2016-08-31 21:50:03 +02:00
Pascal Vizeli
705b3571f4 Use voluptuous for file (#3049) 2016-08-31 18:12:34 +02:00
Daniel Høyer Iversen
dfee443312 Host should be optional for apcupsd component (#3072) 2016-08-31 18:09:22 +02:00
Greg Dowling
0943cc78cd Merge pull request #2973 from nma83/owntracks-waypoint-import
Owntracks waypoint import
2016-08-31 15:25:49 +01:00
Daniel Høyer Iversen
8816b62d9c Merge pull request #3063 from tchellomello/flux_led_supportability
Added bitfield of features for flux_led since we are supporting effects
2016-08-31 10:25:29 +02:00
Marcelo Moreira de Mello
eadd07dc7d Added bitfield of features for flux_led since we are supporting effects 2016-08-31 03:52:19 -04:00
NMA
12e2c38436 Code review feedback from @pavoni 2016-08-31 08:16:01 +05:30
Robbie Trencheny
4864a67dcd Back to 0.28.0.dev0 2016-08-30 14:23:00 -07:00
Robbie Trencheny
dfc38b76a4 Merge pull request #3060 from home-assistant/dev
0.27.1
2016-08-30 14:22:01 -07:00
Robbie Trencheny
e9354bb1e8 Make pep8 happy 2016-08-30 13:58:53 -07:00
Robbie Trencheny
d907902af8 0.27.1 NOT 0.28.1, thanks for the catch @arsaboo 2016-08-30 13:44:35 -07:00
Robbie Trencheny
9a4447ca13 0.28.1 2016-08-30 13:37:47 -07:00
Fabian Affolter
eec96ea137 Migrate to voluptuous (#2954) 2016-08-30 21:34:33 +02:00
John Arild Berentsen
7ceb22a08b Ecobee (#3055)
* Added in list for opreation

* Added attribute to reflect the old operation

* fix humidity
2016-08-30 21:04:53 +02:00
Pascal Vizeli
cf9b49ac03 update ha-ffmpeg version to 0.9 (#3059) 2016-08-30 20:58:37 +02:00
Johann Kellerman
55d305359e Device tracker component & platform validation. No more home_range. (#2908)
* Device tracker component & platform validation. No more home_range.

* Mock, bluetooth

* Renamed _CONFIG_SCHEMA. Raise warning for #1606

* test duplicates

* Fix assert

* Coverage

* Typing

* T fixes
2016-08-30 10:22:52 -06:00
Daniel Høyer Iversen
16e0187fcc Merge pull request #3051 from tchellomello/added_random_effect_flux_led
Added option to use effect:random for Flux Led light bulbs
2016-08-30 09:52:50 +02:00
Marcelo Moreira de Mello
650ec1a337 Added option to use effect:random for Flux Led light bulbs 2016-08-29 19:55:01 -04:00
Pascal Vizeli
4e044361c3 Use voluptuous for smtp (#3048)
Make note of the breaking change in release notes
2016-08-29 16:56:40 -06:00
Fabian Affolter
c1794d111e Upgrade sendgrid to 3.2.10 (#3044) 2016-08-29 14:16:18 -06:00
Fabian Affolter
008e3000bb Upgrade TwitterAPI to 2.4.2 (#3043) 2016-08-29 14:16:10 -06:00
Greg Dowling
1b718c62a3 Fix bug in wemo discovery caused by voluptuous addition. (#3027) 2016-08-29 07:45:48 -06:00
Daniel Høyer Iversen
6275cffab4 Merge pull request #3036 from home-assistant/bug_fix_asuwrt
Bug fix for asuswrt device_tracker. Issue #3015
2016-08-29 08:36:42 +02:00
Daniel
62bbda1f82 Bug fix for asuswrt device_tracker. Issue #3015 2016-08-29 08:23:20 +02:00
arsaboo
39402aff2e Remove units for humidity in Wundeground sensor (#3018)
* Remove units for humidity

Wunderground returns the information with the units.

* Trim the % from the return value of humidity
2016-08-28 21:05:28 -06:00
Martin Hjelmare
1699885907 Fix media_player descriptions and select_source (#3030)
🐬
2016-08-28 20:00:43 -06:00
Teagan Glenn
b6ad0bfbea Allow user to configure server id to perform speed test against (#3008)
* Allow user to configure server id to perform speed test against

* Don't overwrite list

* Type-o

* Convert to string

* Append lists

* str(None) => 'None' did not realize that.
2016-08-28 19:09:34 -06:00
Daniel Høyer Iversen
821b3d7fac Bug fix for asuswrt device_tracker. Issue #3015 (#3016)
🐬
2016-08-28 17:34:01 -06:00
John Arild Berentsen
2d8bc754c8 Ecobee (#3025)
* fix ecobee mode

* Fixup
2016-08-28 22:51:56 +02:00
John Arild Berentsen
2a5ca1c873 Map Modes to setpoint indexes (#3023)
* Map Modes to setpoint indexes

* Fixes devices with no thermostat mode

* another try to fix devices without mode

* another try to fix devices without mode 2

* another try to fix devices without mode 3

* fix setting setpoint for devices with no mode

* fix setting setpoint for devices with no mode
2016-08-28 22:41:48 +02:00
Pascal Vizeli
3313995c4c fix voluptuous and cover autodiscovery (#3022) 2016-08-28 20:00:44 +02:00
John Arild Berentsen
17a57d3b47 Fixes wrong statevalue and problem with zwave setpoint (#3017)
* Fixes wrong statevalue and problem with zwave setpoint

* Fix demo test to match bugfix (#10)
2016-08-28 17:58:50 +02:00
NMA
70fe7f747a * Improved zone naming in waypoint import
* Added more test coverage for owntracks and zone
2016-08-28 13:18:30 +05:30
Robbie Trencheny
7940648725 0.28.0.dev0 2016-08-27 21:07:55 -07:00
Robbie Trencheny
7b2f0e709b Merge pull request #2952 from home-assistant/dev
0.27
2016-08-27 20:27:52 -07:00
Robbie Trencheny
78675ed3f8 Version bump to 0.27.0 2016-08-27 20:07:20 -07:00
Robbie Trencheny
43555b646c update frontend 2016-08-27 20:05:44 -07:00
Teagan Glenn
fdb6de4d23 Fan demo (#2976)
* Update attr to property and default state method

* State prop is defined in parent class

* Demo platform fan

* PyDoc

* Copy-pasta artifact

* PyDoc

* Linting

* Raise error if turn_off and turn_on not implemented

* Update demo platform

* Initial unit test commit

* Readability

* Unneeded typing

* Should inherit from fan entity

* Turn off polling

* Initial oscillating flag

* Pass HASS into demo

* Typing

* Invoke set_speed instead of setting directly

* Service update

* Update demo tests

* Forgot to block after service call.

* linting

* Test to make sure not implemented is thrown

* Is On Method test

* Update const to match string

* Update services yaml

* Toggle method

* Toggle service

* Typing

* TYPE O

* Attribute check

* Type-o

* Type-o

* Put typing back

* ToggleEntity

* Linting

* Linting

* Oops

* Stale prints

* Demo support
2016-08-27 14:53:12 -06:00
Fabian Affolter
a4b90c9879 Use voluptuous for Raspberry Pi and local file camera (#2988)
* Migrate to voluptuous

* Update const.py

* Migrate to voluptuous

* Remove duplicate _LOGGER entry
2016-08-27 14:44:22 -06:00
Fabian Affolter
2accc15d41 Migrate to voluptuous (#2991)
🐬
2016-08-27 14:43:33 -06:00
Fabian Affolter
e6b9d5f5b3 Migrate to voluptuous (#2989)
🍪 🐬
2016-08-27 14:42:34 -06:00
Martin Hjelmare
6acaf25b0d Use voluptuous for mysensors (#2992)
* Add voluptuous config validation for mysensors
* Remove and clean up parts that are not needed for pymysensors 0.7.
2016-08-27 14:41:21 -06:00
Johann Kellerman
6f1c97b9d3 Voluptuous for AsusWRT (#2998)
* Voluptuous for AsusWRT
2016-08-27 22:30:06 +02:00
John Arild Berentsen
f863efdaca Use COMMAND_CLASS_THERMOSTAT_SETPOINT to get unit_of_measurement instad of COMMAND_CLASS_SENSOR_MULTILEVEL. Not all devices have multilevel sensor. (#3003) 2016-08-27 13:39:22 +02:00
Robbie Trencheny
04f0fec352 Merge pull request #2970 from persandstrom/modbus_write
modbus write register service
2016-08-27 03:07:34 -07:00
Per Sandström
2c26514c95 modbus sensor value scaling (#2972) 2016-08-27 02:49:49 -07:00
Matthew Bowen
c05d27d214 Completely local control of entities via Alexa (#2942)
* Initial code for alexa_local_control.

* Added support for creating a dummy username.

* Move SSDP responses to local variables.

* Added config validation via Voluptuous.

* Modify and remove unnecessary returned emulated bridge values.

* Remove script and scene domains from default exposed domains.

* Replaced Flask with HomeAssistantWSGI.

* Fix lint errors.

* Correcting grammar and spelling in docs and comments.

* Rename alexa_local_control to emulated_hue.

* Rename emulated_hue attributes.

* Fix a bug where something marked not exposed is exposed by default.

* Make sure the UPNP responder thread cleanly stops when HASS stops.

Also fix some config loading and lint errors.

* Fixed unexposed entities still having individual state exposed.

* Started writing tests for emulated_hue.

* Fix being able to set state of non-exposed entity.

* Another test for emulated_hue.

* More tests for emulated_hue.

Also slightly simplified emulated_hue's PUT handler.

* Fix bad test, sorry :/

* Third time's the charm.

* Fix lint and value validation tests.

* Rename emulated_hue bridge name.

* Remove license and documentation from header.

* Combine two if statements.

* Style changes.

* Fixed various issues and added some constants
2016-08-27 01:23:40 -07:00
Paulus Schoutsen
7f27cc5468 Fix tests docstring 2016-08-27 07:45:46 +01:00
Paulus Schoutsen
586208b3ed Fix JSON encoder issue in recorder 2016-08-27 07:43:42 +01:00
icovada
a4b8c3cab0 Update telegram.py add send_document (#2937)
🐬
2016-08-26 18:52:44 -06:00
Johann Kellerman
4aad83d60b Voluptuous for pushover (#3000) 2016-08-26 17:43:59 -07:00
Johann Kellerman
37048919bf Check config requirement fix (#2999)
* Check config requirement fix
2016-08-27 01:33:57 +02:00
Fabian Affolter
5cc672ea59 Migrate to voluptuous (#2990)
🐬
2016-08-26 14:50:32 -06:00
Per Sandström
ead0559661 Merge pull request #2995 from persandstrom/vsure_10.2
bump vsure version
2016-08-26 21:53:31 +02:00
Per Sandström
4ee37cb8c8 bump vsure version 2016-08-26 21:38:49 +02:00
NMA
2430acf3ad Added unit test to enhance waypoint_whitelist coverage 2016-08-26 22:00:48 +05:30
NMA
5a25c74276 Refactored zone creation based on code review feedback, enhanced configuration 2016-08-26 19:52:08 +05:30
Pascal Vizeli
9ab2ac766e add motion sensor / rewrite ffmpeg binary sensor (#2969)
🐬 

* use const flags
2016-08-26 06:48:17 -06:00
Pascal Vizeli
d2bb61ad9e Change variable to poll for ccu/homegear (#2987) 2016-08-26 12:17:50 +02:00
Pascal Vizeli
95b98f6752 Full homematic system variable support (#2986) 2016-08-26 10:25:56 +02:00
Paulus Schoutsen
3fa1963345 Convert automation to entities with services 2016-08-25 23:36:48 -07:00
Paulus Schoutsen
d9ecc4af64 EventBus: return function to unlisten 2016-08-25 23:25:35 -07:00
Paulus Schoutsen
62ba0fa7a2 Do not install pip packages in tests 2016-08-25 23:23:14 -07:00
Martin Hjelmare
877dc9c7b5 Merge pull request #2960 from MartinHjelmare/mysensors-mqtt
Add MQTT gateway for MySensors
2016-08-26 08:10:57 +02:00
Roi Dayan
d611010a6e Fix reading dht config values (#2956)
🐬
2016-08-25 20:09:48 -06:00
Pascal Vizeli
2eadae2039 add homematic hub device with variable support / update pyhomematic with new device / add cover support (#2981) 2016-08-25 21:55:03 +02:00
Daniel Høyer Iversen
354f4b4740 Upgrade rfxtrx lib (#2974) 2016-08-25 10:52:48 -07:00
MartinHjelmare
d1e94b958f Extract mqtt string into constant and add log 2016-08-25 19:07:22 +02:00
NMA
ed872f6054 Fixed E302 2016-08-25 22:29:16 +05:30
Landrash
34f57ebdc9 Fix reference to wrong components in tests for cameras (#1) (#2975)
🐬 👍
2016-08-25 10:55:37 -06:00
NMA
47a9313fdb Fixed variable scope issues for entities 2016-08-25 22:15:31 +05:30
NMA
ca73295dd1 Fixed style issues 2016-08-25 21:35:04 +05:30
NMA
2ca3541eac Fixed zone test break and code style issues 2016-08-25 21:33:07 +05:30
Teagan Glenn
826ec9b9d7 Add a Fan component and support for an Insteon Hub Fan (#2964)
* Fan component and service definitions
* Insteon Hub fan support
2016-08-25 14:47:07 +02:00
NMA
95b7a8c4b9 Removed redundant assignment to CONF_WAYPOINT_IMPORT_USER 2016-08-25 17:07:53 +05:30
NMA
185ae50e24 Rebased to upstream 2016-08-25 17:02:45 +05:30
NMA
e6b7511e7d Added test for Owntracks waypoints import 2016-08-25 16:52:22 +05:30
NMA
1ada7d6211 Backend support for importing waypoints from owntracks as HA zones 2016-08-25 16:52:22 +05:30
NMA
2bea5a484f Added test for Owntracks waypoints import 2016-08-25 16:47:34 +05:30
Per SandstrÃom
be1981ca5d modbus write register service 2016-08-25 08:20:08 +00:00
Johann Kellerman
17631cd728 Check config script: various fixes (#2967)
🐬
2016-08-24 23:18:32 -06:00
Fabian Affolter
b199c61c88 Migrate to voluptuous (#2955)
🐬
2016-08-24 22:36:41 -06:00
Fabian Affolter
9219d65c3e Migrate to voluptuous (#2958) 2016-08-24 22:35:09 -06:00
John Arild Berentsen
d9322b81f3 Bugfixing DemoCover NotImplemented Was not raised for is_closed (#2965)
* NotImplemented was not raised when is_closed was missing

* Bugfixing Demo
2016-08-24 20:36:43 +02:00
Open Home Automation
cc358a5dde Corrected sensor name from HM-Z19 to MH-Z19 (#2963)
Approved
2016-08-24 10:54:34 -06:00
John Arild Berentsen
5d2d9af8e3 Add deprecated warning to thermostat and hvac (#2962)
* Add deprecated warning for thermostat and hvac
2016-08-24 16:30:14 +02:00
Daniel Høyer Iversen
daa066c036 Merge pull request #2959 from home-assistant/rfxtrx
minor bug in rfxtrx sensor
2016-08-24 14:25:07 +02:00
John Arild Berentsen
e5abf6074c Cover (#2957)
* current_position was set, it should be optional

* Update mqtt test to match
2016-08-24 11:53:02 +02:00
Daniel
99796e559e minor bug in rfxtrx sensor 2016-08-24 11:33:57 +02:00
MartinHjelmare
e7b206da0c Add MQTT gateway for MySensors
* Use mqtt component to enable a MySensors MQTT gateway.
* Setup the MQTT gateway if mysensors config has mqtt as a value for
	the key	device in the list of gateways.
* Simplify two lines in the mqtt component.
2016-08-24 10:48:55 +02:00
Greg Dowling
4795122463 Add voluptuous to binary template sensor (#2938)
* Add voluptuous to binary template sensor / update failing test.

* Update tests.

* Quick fixes to remove duplicate variables
2016-08-24 01:16:26 -07:00
Nolan Gilley
61ef2683c5 Add volume and seek control to gpmdp (#2953) 2016-08-23 23:32:00 -07:00
Carter
52acb2e6f0 adding pull mode and relay time for you garage door (#2896)
* adding pull mode and relay time

* fixing failing tests

* removed unused vars, removed trailing whitespace

* removed white space

* split line in 2

* removed whitespace and fixed indent

* undid line break

* Update rpi_gpio.py

new line so its not too long

* back to no new line

* Moved long method to a new line

* Moved comment

* moved comment to above method

* adding required blank line

* fixed variables and made them optional

misunderstood the logic at first.

* removed line for lint and removed vars that were not required

* added second blank line for class

* added new configs to platform_schema - still have same error on load

* changing string to int

* added code to covers rpi as well
2016-08-23 23:28:49 -07:00
Robby Grossman
78b2c87b54 Implement support for NEST structures. (#2736)
* Implement support for NEST structures.

* Conform to balloobbot style preferences.

* Log to debug level rather than info level.

* Use config validation to coerce list format if supplied as string.

* Use list comprehension for more succinct code.

* Conform to project linting standards.
2016-08-23 22:47:53 -07:00
Robbie Trencheny
5d4dc713f2 Append the travel mode to the sensor name for Google Travel Time 2016-08-23 21:01:31 -07:00
Paulus Schoutsen
21fb18e5aa pep257 fixes 2016-08-23 20:25:52 -07:00
Paulus Schoutsen
c4b53039c1 Merge remote-tracking branch 'origin/master' into dev 2016-08-23 19:39:03 -07:00
Paulus Schoutsen
63e3d20260 update frontend 2016-08-23 19:36:45 -07:00
Nolan Gilley
0c91ba4a50 improve gpmdp (#2951) 2016-08-23 19:09:43 -07:00
Pascal Vizeli
c5fd665151 add ffmpeg noise detection sensor (#2950) 2016-08-23 19:08:20 -07:00
Fabian Affolter
98364248d4 Use voluptuous for graphite (#2929)
* Migrate to voluptuous

* Update tests

* Fix tests and check if Graphite instance is reachable
2016-08-23 19:01:46 -07:00
Fabian Affolter
6f27d58188 Use voluptuous for Splunk (#2931)
* Migrate to voluptuous

* Update tests
2016-08-23 18:58:59 -07:00
John Arild Berentsen
cf832499cd Combine garage_door and rollershutter to cover (#2891)
* First draft for cover component

* Efficiency from @martinhjelmare

* migrate demo

* migrate demo test

* migrate command_line rollershutter

* migrate command_line test

* migrate rpi_gpio garage_door

* make some abstract methods optional

* migrate homematic

* migrate scsgate

* migrate rfxtrx and test

* migrate zwave

* migrate wink

* migrate mqtt rollershutter and test

* requirements

* coverage

* Update mqtt with garage door

* Naming and cleanup

* update test_demo.py

* update demo and core

* Add deprecated warning to rollershutter and garage_door

* Naming again

* Update

* String constants

* Make sure set_position works properly in demo too

* Make sure position is not set if not available.

* Naming, and is_closed

* Update zwave.py

* requirements

* Update test_rfxtrx.py

* fix mqtt

* requirements

* fix wink version

* Fixed demo test

* naming
2016-08-23 18:23:18 -07:00
Fabian Affolter
a43ea81d8e Migrate to voluptuous (#2927) 2016-08-23 17:27:54 -07:00
Paulus Schoutsen
2b4f0cb5a1 Fix broken template sensor tests 2016-08-23 00:14:45 -07:00
Paulus Schoutsen
88573667fa Update frontend 2016-08-23 00:06:58 -07:00
Greg Dowling
dfd76fc0e6 Minor tidy of voluptuous. (#2945) 2016-08-22 23:57:07 -07:00
Greg Dowling
5abb46a809 Tidy voluptuous. (#2946) 2016-08-22 23:56:39 -07:00
Robbie Trencheny
82de1cd6fe change const.py to use single quotes 2016-08-22 23:15:22 -07:00
Paulus Schoutsen
c9d5d1a417 Remove debug print 2016-08-22 21:44:58 -07:00
Johann Kellerman
14b034f452 Check config script (#2657)
* Add check_config, yaml linting script

* WIP: Start reusing some bootstrap methods for validation

* Start outputs

* Secrets, files and failed config

* requirements_all

* Fixes

* formatting

* Fix unit test after formatting
2016-08-22 21:42:05 -07:00
William Scanlon
f00cdc50df Updated python-wink version to fix color/temp detection (#2935) 2016-08-22 21:31:17 -07:00
Johann Kellerman
0def842231 Quick lint script for changed files (#2941) 2016-08-22 20:52:31 -07:00
Greg Dowling
dfca2476bd Add voluptuous to efergy. (#2943) 2016-08-22 20:51:17 -07:00
Greg Dowling
9fcfc213c7 Bump pywemo. (#2944) 2016-08-22 20:50:05 -07:00
Greg Dowling
eac67fd971 Add voluptuous to template switch (#2940)
* Add voluptuous to template switch / revise tests.
2016-08-23 00:05:45 +02:00
Fabian Affolter
e5969f0733 Clean-up (#2933) 2016-08-22 14:20:04 +02:00
Fabian Affolter
fb639e08d7 Fix schemas and update ordering (#2932) 2016-08-22 14:19:19 +02:00
Fabian Affolter
b6da4a53d5 Use voluptuous for dweet and arduino (#2926)
* Migrate to voluptuous

* Migrate to voluptuous

* One import is enough
2016-08-22 11:28:58 +02:00
Greg Dowling
32318c6f19 Add voluptuous validation to template sensor. (#2886) 2016-08-22 01:11:16 -07:00
Fabian Affolter
5d816b5eb5 Use voluptuous for OhmConnect (#2906)
* Migrate to voluptuous

* Remove string
2016-08-22 08:20:31 +02:00
Paulus Schoutsen
0d7d125344 Update frontend 2016-08-21 16:58:42 -07:00
Paulus Schoutsen
7598de90cb Allow unregistering a push subscription (#2921)
* Allow unregistering a push subscription

* Update frontend

* ps - HTML5 tests DRY 🍾
2016-08-21 16:01:24 -07:00
Teagan Glenn
d2f7b3c7db Merge pull request #2922 from dpford/tplink-5g
Add tplink Archer C7 device tracking support for 5Ghz networks
2016-08-21 16:49:19 -06:00
Jesse Newland
520d4d5dc0 Add zwave.rename_node service (#2923)
* Add zwave.rename_node service

* Validate service data

* Better schema
2016-08-21 14:36:44 -07:00
Dan Ford
2b4980ae5d Add tplink Archer C7 device tracking support for 5Ghz networks 2016-08-21 13:09:44 -07:00
Josh Nichols
d70d1e1303 Add support for notifying with Slack attachments. (#2914)
* Add support for notifying with Slack messages.

When creating notifications, this allows you to pass in `attachments`
with the `data`. It's an array of attachments as defined in
https://api.slack.com/docs/message-attachments

When passing in attachments, message is still required, but it's okay to
be a blank string.

* Split over multiple lines

* Make sure attachments gets assigned, even if there isn't attachment data
2016-08-21 11:54:28 -07:00
Paulus Schoutsen
f802d6bfa3 Update test packages (#2918) 2016-08-21 11:44:40 -07:00
Nolan Gilley
635e5c8eba Add voluptuous to ecobee, speedtest.net, fast.com, actiontec, forecast.io (#2872)
* add voluptuous

* fixes for comments

* str to cv.string
2016-08-21 10:29:13 -07:00
Martin Hjelmare
fa3d83118a Merge pull request #2917 from hensing/update_mysensors
Update pymysensors version to 0.7.1
2016-08-21 13:16:49 +02:00
Henning Dickten
a12dadab5e Update pymysensors version to 0.7.1 2016-08-21 12:47:40 +02:00
Paulus Schoutsen
23e86fc8ea Update frontend 2016-08-20 23:44:31 -07:00
Paulus Schoutsen
aa6a0523ef Add template support to generic camera + local file tests (#2881)
* Add template support to generic camera

* Add tests for local file
2016-08-20 23:04:55 -07:00
Teagan Glenn
9cfad34866 Merge pull request #2916 from Teagan42/YamlSecret-LoadBeforeBreak
Approved by @balloob via gitter
2016-08-20 22:20:11 -06:00
Teagan M. Glenn
af22aeeba8 Apparently, doesn't load the root config secret 2016-08-20 22:07:21 -06:00
Heiko Rothe
6aa0789e38 MQTT room presence detection (#2913)
* Added room presence tracker

* Fixed room/device discovery bugs

* Added tests for room tracker

* Fixed some formatting mistakes

* Fixed a tiny bug with the track new option

* Converted device tracker into sensor

* Removed leftover service entry

* Changed name to mqtt_room

* Changed payload validation to voluptuous

* Fixed validation

* Removed sleep from tests
2016-08-20 20:49:38 -07:00
Open Home Automation
46dcfb3d70 Serial CO2 sensor support (#2885)
* Added support for serial HM-Z19 CO2 sensor

* Minor pylint bug fixes

* Added new files to .coveragerc

* Removed newline

* Changes in requirements after change of pmsensor library

* Change the implementation of default name

* Check if serial interface is working before adding the sensor

* Maximum sensor value is 5000ppm
2016-08-20 16:35:10 -07:00
Fabian Affolter
5f508b6afa Use voluptuous for REST platforms (#2887)
* Initial step to migrate to voluptuous

* Migrate to voluptuous

* Add schema for sensor_classes
2016-08-20 16:28:45 -07:00
Roi Dayan
b62c3ac56c Update dht sensor dependency Adafruit_DHT to v1.3.0 (#2900)
The repository already merged the pull request adding python3 support.
root is no longer required to use the gpio.

Signed-off-by: Roi Dayan <roi.dayan@gmail.com>
2016-08-20 15:41:58 -07:00
Fabian Affolter
18fd17fdf3 Migrate to voluptuous (#2901) 2016-08-20 15:41:14 -07:00
Fabian Affolter
e8c6e4d561 Clean-up, ordering, constants, and extend of schema (#2903)
* Clean-up, ordering, constants, and extend of schema

* Put REQUIREMENTS back and re-add line breaks

* Clean-up, ordering, constants, and extend of schema

* Extend platform
2016-08-20 15:40:16 -07:00
Fabian Affolter
8fc27cbe43 Migrate to voluptuous (#2905) 2016-08-20 15:28:26 -07:00
Fabian Affolter
502c65ca32 Migrate to voluptuous (#2907) 2016-08-20 15:25:11 -07:00
Paulus Schoutsen
3fae4fefbf Bust cache for new media player covers (#2882) 2016-08-20 15:14:57 -07:00
Daniel Perna
2558501235 Added LlamaLab Automate notify platform (#2863)
* Addod LlamaLab Automate notify platform

* Added platform to .coveragerc

* Added device-option and switched to voluptuous

* Fixed voluptuous usage
2016-08-20 15:11:37 -07:00
Martin Hjelmare
b7eee6fbb3 Merge pull request #2910 from hensing/update_mysensors
Update pymysensors version to 0.7
2016-08-20 23:32:17 +02:00
Henning Dickten
7d0c50a106 Update pymysensors version to 0.7 2016-08-20 22:45:55 +02:00
Teagan Glenn
8d1a9d86ea Yaml secret fallback to parent folders (#2878)
* Move secret cache out of loader so it can be referenced by other folders
* Unit test to verify secrets from another folder work & see if it overrides parent secret
* Clear secret cache after load
2016-08-20 21:39:56 +02:00
Per Sandström
ca75e66c1a Merge pull request #2902 from persandstrom/vsure_10.1
vsure 10.1
2016-08-20 17:23:07 +02:00
Per Sandström
b5cc145a92 bump vsure version 2016-08-20 17:08:42 +02:00
Greg Dowling
a46230b830 Merge pull request #2892 from home-assistant/vera_voluptuous
Add voluptuous to Vera.
2016-08-20 16:05:51 +01:00
pavoni
c0cd2d749f Tidy. 2016-08-20 15:43:07 +01:00
Greg Dowling
2df85242f9 Merge pull request #2890 from home-assistant/loop_energy_voluptuous
Add voluptuous to Loopenergy
2016-08-20 15:34:53 +01:00
Josh Nichols
8eb66ac2b8 Ensure Slack messages appear as correct user (#2893)
Current documentation suggests to use personal API tokens. This isn't
ideal because for a few reasons:

* messages will come as your own user, so it's hard to tell it's coming
  from hass
* it's harder to manage if multiple people are using Slack and home
* assistant, since you'd have to coordinate rolling of it

It is possible to use Slack bot users already. Just make a new one from https://your-team.slack.com/apps/build/custom-integration, and use the token for that. You can even add an icon from the web frontend for home assistant.

However, the message will appear as a bot without a name or icon. This pull requests fixes this by passing the as_user parameter, which uses the bot user's name and icon.

One caveat is you need to invite the bot user into the room you want to
post to. This probably was an issue before though.

🎩 to @jnewland who pointed me to this in his branch
2016-08-20 14:36:28 +02:00
Greg Dowling
482f32bb87 Add voluptuous to wemo. (#2895) 2016-08-20 14:03:57 +02:00
John Arild Berentsen
6e672b7bee More generic use of up and down commands plus a workaround for SOMFY controller. (#2852)
* Support older devices

* Update with workaround

* Inverted up and down

* Make dual arguments
2016-08-20 13:59:23 +02:00
Pascal Vizeli
a50463d2f1 Improve homematic climate support (#2894) 2016-08-20 00:20:41 +02:00
pavoni
712f1498ae Add voluptuous to Vera. 2016-08-19 22:43:40 +01:00
pavoni
d1a31b3e0c Change CONFIG to CONF for consistency. 2016-08-19 21:47:07 +01:00
pavoni
337b2e3f77 Add voluptuous
.# Please enter the commit message for your changes. Lines starting
2016-08-19 20:07:09 +01:00
Fabian Affolter
4f1712c933 Use voluptuous for system monitoring sensors (#2813)
* Use voluptuous for system monitoring sensors

* Extent platform, ordering, and consts

* Add resource/resources
2016-08-19 14:57:14 +02:00
Open Home Automation
def9bbf827 Upgrade pmsensor to 0.3 (#2883) 2016-08-19 14:56:10 +02:00
Fabian Affolter
ca1de9cac1 Add url to validation (#2874)
* Add url to validation

* Fix pylint issue

* Clean-up
2016-08-19 13:41:01 +02:00
Fabian Affolter
c74e167a7b Use voluptuous for dweet, transmission, and twitch sensor (#2802)
* Use voluptuous for dweet, transmission, and twitch sensor

* Extent platform, ordering, and consts

* Clean-up
2016-08-19 00:18:45 -07:00
John Arild Berentsen
ada4de3ffb Migrate Thermostat and HVAC component to climate component (#2825)
* First draft for climate

* Updates for thermostats
2016-08-19 00:17:28 -07:00
Fabian Affolter
0abc50e844 Use voluptuous for transport sensors (#2867) 2016-08-19 00:12:56 -07:00
Nolan Gilley
2a563e1604 binary occupancy sensor (#2869) 2016-08-19 00:11:56 -07:00
Paulus Schoutsen
a031d64a44 Merge pull request #2880 from home-assistant/hotfix-026-3
Hotfix 026 3
2016-08-18 22:48:02 -07:00
Paulus Schoutsen
a548eb6c7f Version bump to 0.26.3 2016-08-18 22:46:34 -07:00
Paulus Schoutsen
2b10a1ac20 Fix media player art (#2879) 2016-08-18 22:46:17 -07:00
Paulus Schoutsen
bafc9413a3 Fix media player art (#2879) 2016-08-18 22:45:42 -07:00
Nolan Gilley
9bfac590f6 fix 2862 (#2868) 2016-08-18 16:21:01 -07:00
Teagan Glenn
85d632c272 Merge pull request #2870 from Teagan42/AddFixToWunderground
Fix PyDoc and other issues with Wunderground - approved by robbie
2016-08-18 17:20:15 -06:00
Teagan Glenn
297fca9351 Type-o 2016-08-18 16:39:16 -06:00
Teagan Glenn
cb3a37691f Type-o 2016-08-18 16:28:19 -06:00
Pascal Vizeli
df4a9ea1da add move_postion support for HA rollershutter / CONFIG_SCHEMA (#2873) 2016-08-18 23:14:14 +02:00
Teagan M. Glenn
5bdcf60a21 Extend platform schema 2016-08-18 10:47:52 -06:00
Teagan M. Glenn
90449a90f1 Use string templating 2016-08-18 10:46:24 -06:00
Teagan M. Glenn
25840f97c2 Consistent use of WUnderground 2016-08-18 10:46:04 -06:00
Teagan M. Glenn
c2b75140bf Fix config validation import to make things more readable 2016-08-18 10:40:28 -06:00
Teagan M. Glenn
ec5e20f0d9 Use string constant 2016-08-18 10:38:34 -06:00
Teagan M. Glenn
db2d9ec854 Unused property 2016-08-18 10:37:39 -06:00
Teagan M. Glenn
ddec28da4b Use schema validators already avaialble 2016-08-18 10:37:26 -06:00
Teagan M. Glenn
6f57d36134 Add doc link to header of file 2016-08-18 10:37:00 -06:00
Teagan M. Glenn
0490fe832a Unneeded validation removed 2016-08-18 10:32:19 -06:00
Teagan M. Glenn
2b8e2a3d36 Remove print lines 2016-08-18 10:27:53 -06:00
Teagan M. Glenn
41f84d9e20 Pydoc for unit test methods 2016-08-18 10:27:38 -06:00
Teagan Glenn
c1653d2fca Merge pull request #2861 from arsaboo/patch-2
Wunderground weather sensor
2016-08-18 09:40:00 -06:00
arsaboo
230dde4b57 Removed blank line (linting error) 2016-08-18 10:12:56 -04:00
arsaboo
90fdc89838 Updated to address @balloob's comments 2016-08-18 09:59:41 -04:00
Nolan Gilley
09d531b3b9 fix gpmdp (#2864)
* fix gpmdp

* fix balloobs comments

* move create_connection
2016-08-18 00:08:58 -07:00
Emil Horpen Hetty
053a55bc5f Added name support for Forecast.io (#2638)
* Added support for name

Added name support and changed default name to "Forecast.io" since "Weather" had conflict with Yahoo weather and Open weather map

* Update forecast.py
2016-08-17 23:54:08 -07:00
Open Home Automation
ccd8f51253 Ble tracker (#2810)
* Added Bluetooth Low Energy device tracker

* Added new file(s)

* Fixed pylint errors

* Remove traling zeros from device names

* recreated deleted file

* Added requirements

* Renamed to bluetooth_le tracker
Removed gattlib from tests
Minor code cleanup

* - fixed .coveragerc bug
- changed discovery algorithm, new devices will only be added if seen 5 times to make sure
  HA doesn't blow the database with devices just passing by
2016-08-17 23:41:05 -07:00
Roi Dayan
98f236c754 Add webos customize option to add custom sources (#2561)
Currently there are only hw inputs in the sources list.
Other interesting inputs can be live tv (dvbt) and vod apps.

* add customize option for webos
* add short names for livetv, youtube, mako apps
* add current app as a source
* use large icon (largeIcon is the same as icon if doesn't exists)
* filter out hw inputs that are not connected

Signed-off-by: Roi Dayan <roi.dayan@gmail.com>
2016-08-17 23:39:37 -07:00
Robbie Trencheny
a5f144cb7c HTML5 notify actions (#2855)
* Add action and callback support to html5 (#2855).

Remove registrations from the callback view since we always get the latest anyway.

We dont put an audience in the claims so we will never hit this error.

Bring tests back up to where they were before callbacks.

Only import jwt where necessary

Fix bracket spacing errors

Fix JWT decode check for loop

Remove stale comment.

Add tests for the callback system.

Shorten line

Disable pylint broad-except and change e to jwt_decode_error.

Verify expiration

Remove duplicate jwt.exceptions.DecodeError

Catch no keys matched and return False

* Switch to using registrations for callbackview instead of json_path

* Only check for URL and such if the data object actually exists

* raise instead of return

* cleanup decode_jwt

* Clean up JWT errors

* Correctly set status_code to 401

* Improve JWT by adding target to claims and attempting to check the given target for a decode match first, as well as pass the target through in the event payload.

* Add tag support and fix formatting issues

* Pass through any keys that dont apply to the payload into the notification.data dictionary

* Remove stale print

* Pass back the data dictionary if it exists

* Actually put the default url even if a notify payload dictionary doesnt exist

* pylint, flake8

* Add subscription validation

* Add validation for the callback event payload and use constants where possible

* Use HTTP_UNAUTHORIZED instead of 401

* Change callback dictionary to dict instead of cv.match_all

* Fix up tests and make subscription required

* Whoops, that test was supposed to fail

* Use the result of CALLBACK_EVENT_PAYLOAD_SCHEMA as event_payload

* Add a test for html5 callback decode_jwt where the device has been renamed since notification has been sent.

* Remove the loop through logic, assume that target is always in JWT

* Always return something instead of possibly None.

* Update frontend
2016-08-17 22:34:12 -07:00
Teagan M. Glenn
a5fd04f215 Unit tests around wunderground 2016-08-17 22:33:39 -06:00
Teagan M. Glenn
4e586c18ff Check for error and pull obvservation 2016-08-17 22:32:42 -06:00
Teagan M. Glenn
87f81bf3b4 Use url builder helper 2016-08-17 22:32:19 -06:00
Teagan M. Glenn
d2ba8ee0a7 Reraise exception 2016-08-17 22:31:58 -06:00
Teagan M. Glenn
466dd35f3d Don't set state on update - state already handles this 2016-08-17 22:31:47 -06:00
Teagan M. Glenn
e54ba5ff72 No need no need to set variable 2016-08-17 22:31:28 -06:00
Teagan M. Glenn
dd14f90afb Error handling on state 2016-08-17 22:30:23 -06:00
Teagan M. Glenn
ecb4eb843b Don't call update on init of sensor 2016-08-17 22:30:03 -06:00
Teagan M. Glenn
afef255a25 Condition is already a string 2016-08-17 22:29:49 -06:00
Teagan M. Glenn
417711d665 Refactoring 2016-08-17 22:29:37 -06:00
Teagan M. Glenn
31237a891c Catch exception from update on initial platform setup 2016-08-17 22:29:25 -06:00
Teagan M. Glenn
62b00e1294 Update invocation of WUndergroundData 2016-08-17 22:29:00 -06:00
Teagan M. Glenn
563154c3c2 Validate configuration 2016-08-17 22:28:18 -06:00
Teagan M. Glenn
1a8e17ce41 Pass hass to constructor 2016-08-17 22:28:05 -06:00
Teagan M. Glenn
42caa31067 Unused variable 2016-08-17 22:22:29 -06:00
Teagan M. Glenn
e4abecd359 Build url helper method 2016-08-17 22:22:11 -06:00
Teagan M. Glenn
53b97feb3c Rename constant - make valid for lat/long too 2016-08-17 22:20:22 -06:00
Teagan M. Glenn
a09baf1d5a Not using payload 2016-08-17 22:19:57 -06:00
Teagan M. Glenn
b7809675eb Config schema 2016-08-17 22:19:13 -06:00
Teagan M. Glenn
333e3ba822 Add imports 2016-08-17 22:18:37 -06:00
David Straub
49998272db Added daily temp/precip forecast values to forecast.io (#2846) 2016-08-17 19:48:51 -07:00
Paulus Schoutsen
8088322c43 Consider core running while starting (#2858) 2016-08-17 18:58:00 -07:00
Johann Kellerman
244f60d6cd Fix script help (#2860)
Allow `--help` to filter down to the script
2016-08-17 18:57:52 -07:00
arsaboo
a0bcd33b71 Update wunderground.py 2016-08-17 17:48:37 -04:00
arsaboo
be57cd55c5 Update wunderground.py 2016-08-17 17:25:42 -04:00
arsaboo
4dff42e8bb Update wunderground.py 2016-08-17 17:04:11 -04:00
arsaboo
75cd1f8063 Update wunderground.py 2016-08-17 16:50:32 -04:00
arsaboo
fae9267701 Update wunderground.py 2016-08-17 16:41:22 -04:00
arsaboo
1a34bc5301 Removed lynting issues 2016-08-17 16:31:36 -04:00
arsaboo
aabeda2b60 Update wunderground.py 2016-08-17 16:15:07 -04:00
arsaboo
469d095827 Create initial Wunderground weather sensor 2016-08-17 15:06:12 -04:00
Matthias Grawinkel
8a3c511a04 Adding Digest Auth for webcam image retrieval (#2821)
* Adding Digest Auth for webcam image retrieval

* Update generic.py

* Update mjpeg.py

* Update generic.py

* Update mjpeg.py

* Update generic.py

* Update mjpeg.py
2016-08-17 19:08:47 +02:00
Paulus Schoutsen
2237189c86 Add default badge to push notification (#2859) 2016-08-16 23:05:00 -07:00
Paulus Schoutsen
7720a17c18 Add badge 2016-08-16 23:02:19 -07:00
Pascal Vizeli
4a847dbd91 new yahooweather version and fix update function (#2848) 2016-08-16 22:40:20 -07:00
Robbie Trencheny
848781fbb7 Add a group notify platform (#2842)
* Add a group notify platform which allows sending a single notification to multiple platforms.

* Correctly sort group.py

* Clean up the payload logic

* Make name and entity id required in the schema

* Deep update the dictionary to fix a bug where data wasnt merging.

* Add notify.group tests.

* Improve docstrings.

* Change entities to services and entity_id to service

* Make service a slug without a default value

* Update tests for entities->services, entity_id->service

* vol.Any(cv.slug) -> cv.slug
2016-08-16 22:14:04 -07:00
Robbie Trencheny
c1ce6855c5 Expose notify platform targets as individual services (#2837)
* First pass on providing individual services for all possible targets that a notification platform supports.

* Add a quite hacky first version of notification groups

* Add a docstring for get_targets

* Register group service under notifygroup/ and safely check for notifygroups in config

* Remove notifygroups, because it belongs in its own PR

* Make @balloob requested changes

* get_targets()->targets

* Add tests for notify targets exposed as individual services

* If we dont have a platform name set in configuration, lets use the name of the platform instead of notify

* Fix test docstring.

* Dont use a dictionary for just one value

* No need to double slugify

* targets is now just a list of strings instead of a dict
2016-08-16 22:05:41 -07:00
Robbie Trencheny
37561765ff Add Gravatar support to device_tracker (#2836)
* Support passing an email address linked to Gravatar as the picture in known_devices.

* Add a dedicated field for Gravatar

* Bring tests back up to where they were before Gravatar.

* Add tests for Gravatar.
2016-08-16 21:08:57 -07:00
Pascal Vizeli
4fcfffc172 add tcp/udp port to config validation (#2854) 2016-08-16 20:55:29 -07:00
Kevin Gottsman
781fe9c54e Fix logging message for disarm (#2857) 2016-08-16 20:53:59 -07:00
Nolan Gilley
324ddfdaeb fix flux_update service (#2792)
* fix flux_update service

* fix tests

* give update service unique name

* remove unnecessary param

* Revert "fix tests"

This reverts commit 2fd7760455.

* fix flux_update
2016-08-16 20:53:00 -07:00
Maggi Trymbill
f668a88485 Fixed typo (#2856)
Pretty sure this is a typo ... it made finding the plist and logs a bit of a headache for me at least :)
2016-08-16 18:24:37 -07:00
Robbie Trencheny
72fc526ee8 Html5 notifications improvements (#2840)
* Retry sending the push for 1 day instead of failing instantly if the target is unavailable

* Add timestamp to push payload

* Correctly use the title and body fields for their intended purposes

* Add callback support

* Revert changes to frontend files.

* Add default URL which will open Home Assistant. Also put all the data into the data object of the payload so it is accessible in the browser. Without doing this, things like URL wouldnt be accessible.

* Flake8 and pylint fixes

* event->type

* Dont send the default url if actions exist

* flake8/pylint fixes again

* Update html5 tests

* Remove callbacks from this branch, will re-stage on a different branch

* Remove remnant of callbacks

* Add url to data dictionary if it exists instead of copying the entire data dictionary in

* flake8 fix
2016-08-16 14:26:01 -07:00
Fabian Affolter
822b7f8770 Use voluptuous for exchange sensors (#2801)
* Use voluptuous for exchange sensors

* Remove additional checks
2016-08-16 22:22:55 +02:00
Fabian Affolter
dab5a78f88 Use voluptuous for time/date sensors (#2799)
* Use voluptuous for time/date sensors

* Extend platform

* Remove additional checks
2016-08-16 21:43:56 +02:00
Fabian Affolter
1c140de0dc Use voluptuous for NZB sensors (#2847) 2016-08-16 21:42:43 +02:00
Greg Dowling
91e24de3d5 Merge pull request #2833 from home-assistant/fix_owntracks_beacon_accuracy_bug3
Handle accuracy zero correctly in enter/leave events.
2016-08-16 10:34:27 +01:00
pavoni
41dad9a8f7 Tidy warnings. 2016-08-16 09:48:13 +01:00
Nuno Sousa
7762365b3f Add position to zwave rollershutter (#2772) 2016-08-16 00:37:58 -07:00
Open Home Automation
693098ff00 Bugfix in pknx library (#2835)
* Bugfix in pknx library

* Version pinned to 0.3.3
2016-08-15 23:42:45 -07:00
David Straub
83a043a0ea Add FritzBox call monitor sensor (#2791)
* Add FritzBox call monitor sensor

* Correct docstrings and suppress too few public methods warning

* Remove blank lines after docstrings

* Add blank lines after class docstrings

* Remove trailing white space

* Make daemon; add reconnect on disconnect
2016-08-15 23:22:54 -07:00
Juggels
a7f218f712 HP ILO component (#2844)
* HP ILO component

* HP ILO component

* Add Onboard Administrator sensor

* Add Onboard Administrator sensor

* Add period to first line

Fix D400 error on line 1
2016-08-15 23:19:11 -07:00
Assaf Inbal
72ad1d8d7c Added support for exposing light features (#2828) 2016-08-15 23:07:07 -07:00
Nolan Gilley
d281a7260d check for runtime error during db query (#2834) 2016-08-15 22:48:42 -07:00
John Arild Berentsen
27e27ee156 Exit when command_classes are missing thermostat Zwave (#2824) 2016-08-15 22:13:49 -07:00
Martin Hjelmare
9afb1d8c0d Fix unit log message (#2823)
* Fix log message for deprecated temp key

* Use string formatting and pass constant variables as arguments in log
	message to show correct name of config keys.

* Fix import order
2016-08-15 22:12:43 -07:00
Paulus Schoutsen
7594cf3c94 Merge pull request #2734 from tobiebooth/manual-alarm-improvements
Return to previous alarm state after trigger (#2580)
2016-08-15 22:10:32 -07:00
pavoni
a7703f27d8 Add missed docstring. 2016-08-15 13:14:07 +01:00
pavoni
c0b1ff0eaf Handle accuracy zero correctly in enter/leave events. 2016-08-15 13:08:30 +01:00
Paulus Schoutsen
f61f0623f8 Merge pull request #2827 from home-assistant/hotfix-0-26-2
Hotfix 0 26 2
2016-08-14 21:25:11 -07:00
Paulus Schoutsen
c4b714a10d Version bump to 0.26.2 2016-08-14 21:22:28 -07:00
Greg Dowling
8a8551132f Bump to pywemo 0.4.5 - fixes bug with requests 2.11.0 (#2818) 2016-08-14 21:22:06 -07:00
Greg Dowling
6fd0fe05f9 Bump to pywemo 0.4.5 - fixes bug with requests 2.11.0 (#2818) 2016-08-14 11:42:43 -07:00
Paulus Schoutsen
a6bbd749e4 Merge pull request #2817 from home-assistant/hotfix-0-26-1
Hotfix 0 26 1
2016-08-14 01:26:19 -07:00
Paulus Schoutsen
32051c042c Version bump to 0.26.1 2016-08-14 01:21:57 -07:00
John Arild Berentsen
c16a29b930 Fix unknown unit of measurement for hvac and thermostat component (#2816)
* Fix unknown unit of measurement for hvac and thermostat component

* Simplify
2016-08-14 01:21:36 -07:00
Heiko Rothe
12ce3deffc Check for existence of system mode on Honeywell thermostats (#2815)
* Check for existence of system mode on Honeywell thermostats

* Return None instead of undefined

* Use getattr instead of if/else
2016-08-14 01:21:28 -07:00
Open Home Automation
7c041f0797 Bugfix: removed conf_platform (#2811)
* Bugfix: removed conf_platform

* Remove unused import

* Fix for wrong update
2016-08-14 01:21:18 -07:00
Heiko Rothe
8210d65850 Check for existence of system mode on Honeywell thermostats (#2815)
* Check for existence of system mode on Honeywell thermostats

* Return None instead of undefined

* Use getattr instead of if/else
2016-08-14 01:20:28 -07:00
John Arild Berentsen
bb14239d91 Fix unknown unit of measurement for hvac and thermostat component (#2816)
* Fix unknown unit of measurement for hvac and thermostat component

* Simplify
2016-08-14 01:19:54 -07:00
Paulus Schoutsen
dc68f61261 Html5 push notifications notify platform (#2807)
* Initial work to add Chrome Push Notification support

* Remove push.js from home-assistant since it is now in Polymer

* Chrome->HTML5, general cleanup/fixes

* Make html5 generic, move manifest.json into frontend so that we can dynamically add the gcm_sender_id

* Pylint, flake8, pydocstyle frontend init

* HTML5 push fixes

* Update polymer

* Remove crypto req

* Add notify default platform.

* Fix HTML5 push

* Registration fixes

* Linting fix

* pep257 fix

* Add tests

* pep257 fix

* Update frontend
2016-08-14 01:10:07 -07:00
Open Home Automation
c6f67a5203 Implemented range checking for temperature and humidity. Out-of-range… (#2805)
* Implemented range checking for temperature and humidity. Out-of-range values will be ignored

* Removed unused import

* Use celsius_to_fahrenheit conversion method
2016-08-14 01:02:26 -07:00
Open Home Automation
8329472c72 Bugfix: removed conf_platform (#2811)
* Bugfix: removed conf_platform

* Remove unused import

* Fix for wrong update
2016-08-13 14:16:06 -07:00
Paulus Schoutsen
8ba85effd4 Version bump to 0.27.0.dev0 2016-08-13 12:02:13 -07:00
Paulus Schoutsen
0270ae05e9 Merge pull request #2760 from home-assistant/dev
0.26
2016-08-13 12:01:56 -07:00
Paulus Schoutsen
9c0b9b9ad6 Version bump to 0.26.0 2016-08-13 12:01:34 -07:00
Robbie Trencheny
7882ce1afd Add CORS fixes to support OPTIONS preflight requests. (#2773)
* Add CORS fixes to support OPTIONS preflight requests.

* Add CORS tests

* Fix formatting
2016-08-13 11:49:44 -07:00
Tobie Booth
abaffc2d8c add disarm_after_trigger to manual alarm panel 2016-08-13 12:53:32 -05:00
Tobie Booth
1e3f7ad9a4 Return to previous alarm state after trigger (#2580) 2016-08-13 12:53:32 -05:00
Paulus Schoutsen
176a078b3c Update .coveragerc 2016-08-13 10:39:13 -07:00
Fabian Affolter
5baed6acfb Add support for GPSD (#2254)
* Add support for GPSD

* Add gpsd.py

* Check if socket is open

* Fix pylint issue

* Rename file to be a sensor

* Update for being a sensor

* Rework for being a sensor
2016-08-13 10:37:12 -07:00
Paulus Schoutsen
f845893f8f Update frontend 2016-08-13 10:21:54 -07:00
Tomi Tuhkanen
9c636ab6fd Fix for braviatv get mac regex none case (#2808)
* Fix for braviatv get mac regex none case

* E128 fix
2016-08-13 09:45:49 -07:00
Brent Hughes
0df229773f Removed error log on roku connection error (#2809) 2016-08-13 09:45:09 -07:00
Paulus Schoutsen
0b404cc0be Update frontend 2016-08-13 09:41:23 -07:00
Paulus Schoutsen
18829daa65 Merge remote-tracking branch 'origin/master' into dev
Conflicts:
	homeassistant/components/recorder/__init__.py
	homeassistant/const.py
	requirements_all.txt
	setup.py
2016-08-12 18:57:15 -07:00
Pascal Vizeli
f0a138dd51 update yahooweather version (#2796) 2016-08-12 18:47:45 -07:00
Daniel Høyer Iversen
b28114fb5a Merge pull request #2804 from home-assistant/rfxtrx_log
improve logging from rfxtrx component
2016-08-12 20:56:19 +02:00
Daniel
6d83ebc5e4 improve logging from rfxtrx component 2016-08-12 20:46:54 +02:00
Daniel Høyer Iversen
29bd9b4587 Merge pull request #2803 from home-assistant/rfxtrx_log
improve logging from rfxtrx component
2016-08-12 19:35:44 +02:00
Daniel
5ed22f3ef0 improve logging from rfxtrx component 2016-08-12 19:21:12 +02:00
Daniel Høyer Iversen
a14995ed27 Merge pull request #2798 from home-assistant/flux_led_minor_bug
Fix minor bug in flux led
2016-08-12 15:41:22 +02:00
Daniel
0a78b69ee2 Fix minor bug in flux led 2016-08-12 15:21:51 +02:00
NMA
75e6ed87d6 Backend support for importing waypoints from owntracks as HA zones 2016-08-12 14:48:28 +05:30
Daniel Høyer Iversen
b7ebf3b1eb Merge pull request #2789 from home-assistant/rfxtrx_lib
update rfxtrx lib
2016-08-11 14:34:50 +02:00
Daniel
2493155f2b update rfxtrx lib 2016-08-11 14:18:23 +02:00
Fabian Affolter
e06ff95107 Remove pylint disable (#2785) 2016-08-11 12:00:37 +02:00
Daniel Høyer Iversen
eea7824a7e Merge pull request #2786 from home-assistant/rfxtrx_lib
update rfxtrx lib
2016-08-11 11:41:49 +02:00
Daniel
a3c2db70e2 update rfxtrx lib 2016-08-11 11:25:50 +02:00
Fabian Affolter
a784f48022 Minor changes (#2784)
* Update link to docs

* Use fast.com

* Update docstring

* Add link to docs

* Add link to docs

* Update docstrings

* Update docstrings

* Fix typo
2016-08-11 11:14:24 +02:00
Paulus Schoutsen
e926426af9 Recorder: Increase size of the entity column in states table (#2778)
Fixes https://github.com/home-assistant/home-assistant/issues/2697
2016-08-10 17:40:52 -07:00
Johann Kellerman
bf21d6b4e1 Update unit tests for remote.py (#2782)
* Update remote unit tests

* Sleep again
2016-08-10 17:40:35 -07:00
Nolan Gilley
dcf4fc5e9b fast.com speedtest sensor (#2783)
* fast.com speedtest sensor

* update for fastdotcom
2016-08-10 17:39:52 -07:00
Johann Kellerman
f3376ba276 Script requirement logging, db_migrator REQUIREMENTS (#2781) 2016-08-10 13:32:07 -07:00
Adam Mills
1a327d682d Fix farcy failure for logbook test (#2780) 2016-08-10 08:07:50 -07:00
Corban Mailloux
9c851790dc Add support for new mqtt_json light platform. (#2777)
* Add support for new mqtt_json light platform.

* Fix W503 errors.

* Bring in feedback from @balloob.

* Add test coverage for invalid color and brightness data.

* Add coverage for transition in turn_off.
2016-08-09 23:55:10 -07:00
Johann Kellerman
aadf6a7750 Handle requirements for scripts (#2765) 2016-08-09 23:54:34 -07:00
John Arild Berentsen
a03691455b Various fixes for missing components and rollershutter. (#2698)
* Various fixes for missing components, rollershutter.

* Setting up different method for catching value of correct type.
2016-08-10 08:31:44 +02:00
Paulus Schoutsen
1726c4b45a Merge pull request #2776 from home-assistant/add-notify-test
Add notify demo data test
2016-08-09 21:47:11 -07:00
Paulus Schoutsen
9fa1328111 Move config validation exception logging to bootstrap + humanize 2016-08-09 21:38:44 -07:00
Paulus Schoutsen
f904d06c9a Add test for new template validation logic 2016-08-09 21:09:56 -07:00
Paulus Schoutsen
253628da11 Add notify test being called from a YAML/script combi 2016-08-09 21:03:06 -07:00
Paulus Schoutsen
e773526714 Template config validator should not allow dictionaries 2016-08-09 20:58:27 -07:00
Paulus Schoutsen
6dc49ff123 Humanize service call config validation errors 2016-08-09 20:58:08 -07:00
Paulus Schoutsen
6bb6a6ebe9 Add notify demo data test 2016-08-09 20:26:17 -07:00
Paulus Schoutsen
492ade7b1a Update frontend 2016-08-09 20:12:20 -07:00
D.-L.Pohl
dc9f990ad2 Pilight component (#2742)
* New component to interface with a pilight-daemon for RF send/receive

* Fix bug that changed the received data, add connected flag, clean up

* New pilight switch component

* New optional whitelist filter to filter uninteressting devices

* Add pilight

* PEP8: too long lines, white spaces

* To keep up the good coverage ...

* PEP 257

* pylint enhancements

* pylint enhancements

* PEP 257

* Better HA config validation and cleanup following code review for #2742

* Fix requirenments to require fixed pilight version

* Change config validation to use voluptuous

* Pilight switch exclude not needed due to wildcard pilight exclude

* Enhance configuration parsing using voluptuous
2016-08-09 19:45:40 -07:00
Paulus Schoutsen
d80c05b6b6 Enforce lower case for services and warn if local unknown service called (#2764) 2016-08-09 19:41:45 -07:00
Per Sandström
180a7ec295 add changed_by attribute to lock (#2766) 2016-08-09 19:37:46 -07:00
Pascal Vizeli
431f0fd236 update pyhomematic to version 0.1.11 (#2770) 2016-08-09 22:55:25 +02:00
schneefux
3d2830278a Hyperion: backwards compatibility (#2769) 2016-08-09 08:46:47 -07:00
Adam Mills
3ac9aaf025 Filter continuous values from logbook (#2761)
* Filter continuous values from logbook

* Test filter continuous values from logbook
2016-08-09 08:01:02 -07:00
Paulus Schoutsen
0b7b0e54ba Move unit system to util (#2763) 2016-08-08 20:42:25 -07:00
Paulus Schoutsen
640a8b5a7f Limit dependencies of HA core (#2762) 2016-08-08 20:21:40 -07:00
Teagan Glenn
915b9cb3eb Fix pydoc strings 2016-08-08 20:19:56 -06:00
Phil Hansen
88734f05c6 garage door rpi_gpio.py fix (#2759) 2016-08-08 19:03:23 -07:00
Robbie Trencheny
8e6dd62853 Add an OhmConnect sensor (#2758)
* Add an OhmConnect sensor

* use .get
2016-08-08 17:54:59 -07:00
Paulus Schoutsen
9948587401 Merge branch 'pr/2726' into dev 2016-08-08 17:42:34 -07:00
Nick Touran
3c2b4f5128 Added optional embedded image attachments to notify.smtp. (#2738)
* Added optional embedded image attachments to notify.smtp.

Also restructured a bit to minimize code duplication and add some tests.

* Fixed formatting errors.

* SMTP cleanups thanks to code review.
2016-08-08 17:36:49 -07:00
Johann Kellerman
efe754636a Script to manage secrets stored in the keyring (#2743)
* Keyring script to get, set and delete secrets

* Add info & keyring version
2016-08-08 17:36:11 -07:00
Paulus Schoutsen
8081fe794e Add panel custom to load any webcomponent (#2747) 2016-08-08 17:35:46 -07:00
Paulus Schoutsen
9a575eb6d6 Link prefetch panels (#2748)
* Add link=prefetch to index.html

* Improve http request logging
2016-08-08 17:35:27 -07:00
Pascal Vizeli
98c77dc08f Add ffmpeg camera platform support (#2755) 2016-08-08 17:34:46 -07:00
Robbie Trencheny
991e292d7e Foursquare Component (#2723)
* Add a Foursquare component which accepts push notifications from Foursquare and provides a user checkin service

* @balloob requested fixes

* Sort .coveragerc list of components by name

* Revert "Sort .coveragerc list of components by name"

This reverts commit 997ae22576.

* Only sort Foursquare since I get conflicts otherwise

* Add Foursquare checkin service to services.yaml
2016-08-08 17:34:29 -07:00
Teagan Glenn
7e37634b54 Honeywell hvac mode (#2757)
* Add set hvac mode to honeywell us thermostat

* Add hvac service to the HoneywellRound entity

* Fix pydoc

* Add typing

* Typing to unit test
2016-08-08 17:32:53 -07:00
Pascal Vizeli
5445aafee7 update yahooweather to 0.5 (#2756) 2016-08-08 12:43:15 -07:00
John Arild Berentsen
7077103c4f General logmessage cleanup (#2753) 2016-08-08 20:05:45 +02:00
Daniel Høyer Iversen
fc101fbbcb Merge pull request #2754 from home-assistant/flux_led_lib
update flux led library
2016-08-08 20:03:07 +02:00
Daniel
21ffe2ed9b update flux led library 2016-08-08 19:43:04 +02:00
Paulus Schoutsen
19fae75669 Fix broken remote test 2016-08-08 09:11:15 -07:00
Per Sandström
8568773e7d add changed_by attribute to alarm control panel (#2737) 2016-08-08 09:00:20 -07:00
Dean Camera
5ff9e59b79 Update to latest Plex API, add music support. (#2739)
* Update to latest Plex API, add music support.

* Fix PyLint errors.

* Update Plex sensor module to latest PlexAPI.

* Oops - update Python sensor import.

* According to PlexAPI docs, this is the new API for Plex Pass members.

* More pylint STFUs.

* Move pylint suppression.

* Use plexapi NA type directly.

* Pylint objects to short variable names.
2016-08-08 08:55:58 -07:00
Daniel Høyer Iversen
689939ab9d Add support color and brightness for flux light (#2750) 2016-08-08 08:47:02 -07:00
Sean Dague
8daaee702b bump proliphix library to 0.3.1 (#2751)
The 0.3.1 version of the library includes fixes for time syncing the
thermostat under the covers when needed. All changes are done on the
library side, we just need to bump the required level in home
assistant.
2016-08-08 08:03:12 -07:00
John Arild Berentsen
e6ad2e8d91 Handling and improvements for zwave network (#2728) 2016-08-08 16:52:28 +02:00
Paulus Schoutsen
dd0b9f2f36 Update frontend 2016-08-08 00:41:32 -07:00
Marcelo Moreira de Mello
0383da7af1 This patch makes use of the unit_system global configuration parameter to determine the mesurement system between 'metric' or 'imperial' for Fibit component. It also supports the fitbit accept-language when en_GB measurement is desired. (#2745) 2016-08-07 21:58:16 -07:00
Paulus Schoutsen
b9b1d95514 Tweak panel parameters (#2746) 2016-08-07 21:56:17 -07:00
Daniel Høyer Iversen
23472cb44d Handle numeric device id for rfxtrx devices (#2740) 2016-08-07 17:15:39 -07:00
Fabian Heredia Montiel
0377338a81 Improvement typing (#2735)
* Fix: Circular dependencies of internal files

* Change: dt.date for Date and dt.datetime for DateTime

* Use NewType if available

* FIX: Wrong version test

* Remove: Date and DateTime types due to error

* Change to HomeAssistantType

* General Improvement of Typing

* Improve typing config_validation

* Improve typing script

* General Typing Improvements

* Improve NewType check

* Improve typing db_migrator

* Improve util/__init__ typing

* Improve helpers/location typing

* Regroup imports and remove pylint: disable=ungrouped-imports

* General typing improvements
2016-08-07 16:26:35 -07:00
Open Home Automation
a3ca3e878b Added support for serial particulate matters sensors - serial_pm (#2571) 2016-08-07 22:14:01 +02:00
Paulus Schoutsen
d1107a9cf3 Merge pull request #2731 from home-assistant/teagan-unit-system
Teagan unit system
2016-08-04 22:53:44 -07:00
Paulus Schoutsen
231656916c Address last comments 2016-08-04 22:44:37 -07:00
Teagan M. Glenn
26526ca57a Add unit system support
Add unit symbol constants

Initial unit system object

Import more constants

Pydoc for unit system file

Import constants for configuration validation

Unit system validation method

Typing for constants

Inches are valid lengths too

Typings

Change base class to dict - needed for remote api call serialization

Validation

Use dictionary keys

Defined unit systems

Update location util to use metric instead of us fahrenheit

Update constant imports

Import defined unit systems

Update configuration to use unit system

Update schema to use unit system

Update constants

Add imports to core for unit system and distance

Type for config

Default unit system

Convert distance from HASS instance

Update temperature conversion to use unit system

Update temperature conversion

Set unit system based on configuration

Set info unit system

Return unit system dictionary with config dictionary

Auto discover unit system

Update location test for use metric

Update forecast unit system

Update mold indicator unit system

Update thermostat unit system

Update thermostat demo test

Unit tests around unit system

Update test common hass configuration

Update configuration unit tests

There should always be a unit system!

Update core unit tests

Constants typing

Linting issues

Remove unused import

Update fitbit sensor to use application unit system

Update google travel time to use application unit system

Update configuration example

Update dht sensor

Update DHT temperature conversion to use the utility function

Update swagger config

Update my sensors metric flag

Update hvac component temperature conversion

HVAC conversion for temperature

Pull unit from sensor type map

Pull unit from sensor type map

Update the temper sensor unit

Update yWeather sensor unit

Update hvac demo unit test

Set unit test config unit system to metric

Use hass unit system length for default in proximity

Use the name of the system instead of temperature

Use constants from const

Unused import

Forecasted temperature

Fix calculation in case furthest distance is greater than 1000000 units

Remove unneeded constants

Set default length to km or miles

Use constants

Linting doesn't like importing just for typing

Fix reference

Test is expecting meters - set config to meters

Use constant

Use constant

PyDoc for unit test

Should be not in

Rename to units

Change unit system to be an object - not a dictionary

Return tuple in conversion

Move convert to temperature util

Temperature conversion is now in unit system

Update imports

Rename to units

Units is now an object

Use temperature util conversion

Unit system is now an object

Validate and convert unit system config

Return the scalar value in template distance

Test is expecting meters

Update unit tests around unit system

Distance util returns tuple

Fix location info test

Set units

Update unit tests

Convert distance

DOH

Pull out the scalar from the vector

Linting

I really hate python linting

Linting again

BLARG

Unit test documentation

Unit test around is metric flag

Break ternary statement into if/else blocks

Don't use dictionary - use members

is metric flag

Rename constants

Use is metric flag

Move constants to CONST file

Move to const file

Raise error if unit is not expected

Typing

No need to return unit since only performing conversion if it can work

Use constants

Line wrapping

Raise error if invalid value

Remove subscripts from conversion as they are no longer returned as tuples

No longer tuples

No longer tuples

Check for numeric type

Fix string format to use correct variable

Typing

Assert errors raised

Remove subscript

Only convert temperature if we know the unit

If no unit of measurement set - default to HASS config

Convert only if we know the unit

Remove subscription

Fix not in clause

Linting fixes

Wants a boolean

Clearer if-block

Check if the key is in the config first

Missed a couple expecting tuples

Backwards compatibility

No like-y ternary!

Error handling around state setting

Pretty unit system configuration validation

More tuple crap

Use is metric flag

Error handling around min/max temp

Explode if no unit

Pull unit from config

Celsius has a decimal

Unused import

Check if it's a temperature before we try to convert it to a temperature

Linting says too many statements - combine lat/long in a fairly reasonable manner

Backwards compatibility unit test

Better doc
2016-08-04 22:02:19 -07:00
Robby Grossman
dfad8aa6dc Remove 'remove node (secure)' service; is not a specialized implementation in Python-OZW and standard removal works fine. (#2730) 2016-08-04 21:04:08 -07:00
Matthew Treinish
496972a587 Add option to heat_control component to set min cycle duration
This commit adds a new config option to the heat_control thermostat
component, min_cycle_duration. Some heaters and/or ACs don't like
being constantly cycled on and off. Prior to this patch the
heat_control component can end up cycling the switch quite
frequently. (depending on how quickly the temperature changes) The
new option added is used for setting a minimum duration that must
have elapsed in either the on or off state before the thermostat will
send the service call to cycle the switch. This should enable users to
hand tune how frequently heat_control can switch the device on or off
to best suit the device being used.
2016-08-04 12:37:08 -04:00
mmello
ef3e7b28a9 Added whitelist option to InfluxDB to select the only entities that will be logged on InfluxDB (#2727) 2016-08-04 08:35:01 -07:00
Paulus Schoutsen
792154a6a7 Update frontend 2016-08-03 08:22:47 -07:00
Johann Kellerman
09262a36c4 Hide NewType ImportErrors (#2717)
* Hide NewType ImportErrors

* No more NewType
2016-08-03 08:21:30 -07:00
Matthew Treinish
94acda2a31 Add AC mode to heat_control component (#2719)
This commit adds a new option to the heat_control component, ac_mode.
When set to true, this treats the toggle device as a cooler instead
of a heater. The concept being if you have a window or in-wall ac
unit that doesn't have a built-in thermostat having the home assistant
implemented thermostat would be as useful as for space heaters.
2016-08-02 21:56:08 -07:00
William Scanlon
b8492832a6 Convert null to 0 for temp % sensors (#2710) 2016-08-02 21:53:26 -07:00
Assaf Inbal
bb22ad3064 Proxy requests to the media player's media image (#2693)
This is needed when the media server and UI client are not on the same network.
2016-08-02 18:31:15 -07:00
John Arild Berentsen
e36c6b24ee Add secure inclusion of nodes for zwave network (#2715)
* Add secure inclusion of nodes for zwave network

* Add secure inclusion of nodes for zwave network
2016-08-02 20:17:10 +02:00
John Arild Berentsen
ad0224e9aa Add start and stop for zwave network (#2709) 2016-08-02 19:08:04 +02:00
John Arild Berentsen
40d7361828 Implement of BARRIER_OPERATOR for garage door (#2712) 2016-08-02 18:05:38 +02:00
Paulus Schoutsen
ab377f169d Upgrade to voluptuous 0.9.2 (#2692) 2016-08-02 00:14:13 -07:00
Tomi Tuhkanen
434a7d6975 Added VS Code config folder to gitignore (#2707) 2016-08-01 23:59:09 -07:00
Paulus Schoutsen
992be38b94 Upgrade netdisco (#2706) 2016-08-01 23:50:01 -07:00
Paulus Schoutsen
29dbeeb41e Remove SQLAlchemy as core dependency (#2702) 2016-08-01 18:37:00 -07:00
Tobie Booth
8b57fd008f Reverts changes to ZWave lock status update (#2595) (#2696) 2016-08-01 08:08:24 -07:00
Assaf Inbal
51d5268f9f Added a screenshot to LG Netcast TVs (#2694) 2016-07-31 21:58:55 -07:00
Paulus Schoutsen
6f23869a89 Fix Mac OS install script (#2691) 2016-07-31 20:58:39 -07:00
Sean Dague
483b0045fc support cooling season in proliphix thermostat (#2689)
Instead of always assuming we want to change the heat, instead use the
setback attribute which sets heat / cool setback based on current HVAC
mode. This means that the proliphix thermostat will do sensible things
during cooling season.
2016-07-31 19:13:36 -07:00
Paulus Schoutsen
1856e0110b Update frontend 2016-07-31 19:07:06 -07:00
Paulus Schoutsen
e7ead73fad Rollback voluptuous to 0.8.9 (#2687) 2016-07-31 17:20:08 -07:00
HBDK
a73c2e57a8 Added mired and kelvin mode to flux (#2665)
* Added mired and kelvin mode to flux

* changed as requested

* Renamed varible

* attempt to add test for new method in flux.py

* removed line to fix lint error
2016-07-31 16:55:48 -07:00
Paulus Schoutsen
c39c10a088 update frontend 2016-07-31 16:39:07 -07:00
Fabian Affolter
72fc77b84d Upgrade fuzzywuzzy to 0.11.1 (#2685) 2016-07-31 15:00:52 -07:00
Paulus Schoutsen
f4d6ce08e4 Update frontend 2016-07-31 14:47:01 -07:00
Johann Kellerman
e9bd5d54ad Recorder typing & ensure DB ready on query (#2680)
* Recorder typing & wait on DB ready
2016-07-31 22:56:57 +02:00
Fabian Affolter
2871ab6bb0 Upgrade sendgrid to 3.1.10 (#2684) 2016-07-31 13:49:01 -07:00
Jesse Newland
cfa69fef1e Add Docker test runner (#2673)
* Add docker test runner

* Move test Dockerfile into virtualization folder

* Don't build zwave in test environment
2016-07-31 13:48:41 -07:00
Fabian Affolter
5faba21b8c Upgrade python-nmap to 0.6.1 (#2681) 2016-07-31 13:47:46 -07:00
Fabian Affolter
ca1cf44194 Upgrade cherrypy to 7.1.0 (#2682) 2016-07-31 13:47:34 -07:00
Stephen Hoekstra
125059c5ac Add 5 second timeout to Kodi connections (#2683) 2016-07-31 13:47:24 -07:00
Robbie Trencheny
63ba5044b3 Kill celcius with fire, replacing it with celsius, finally finishing what #1860 started (#2679) 2016-07-31 12:18:40 -07:00
Robbie Trencheny
a93195610a Add alarm control panel services.yaml
...because I was almost done being bored
2016-07-31 11:49:30 -07:00
Robbie Trencheny
d48f6676ab Update lock services.yaml
Was so bored I forgot some things :(
2016-07-31 11:45:57 -07:00
Robbie Trencheny
794205ad8d Add garage door services.yaml
...because I was somehow still bored
2016-07-31 11:34:18 -07:00
Robbie Trencheny
0e367ceec6 Add lock services.yaml
...because I was still bored
2016-07-31 11:31:50 -07:00
Robbie Trencheny
44b9771d8a Add rollershutter services.yaml
...because I was bored
2016-07-31 11:27:57 -07:00
Teagan Glenn
122581da7f Proximity unit of measure (#2659)
* Allow multiple proximities

* Distance conversion

* Add unit of measurement and conversion to proximity

* Shorten attribute name

* Fix get unit of measurement

* Fix the km <-> m conversion

* Add type check and errors

* first path unit test around distance utility

* Fix numeric type check

* Fix conversion type-os

* Actually set the exception thrown flag

* Test for exact conversion

* More descriptive variable names

* Update method invocation to match change in method name

* Missed a couple variables

* Line continuation

* Fix linting too many return issue

* Break out proximity setup for list of proximity and for single proximity device

* Pass hass to setup function

* Check if setup succeeded for each proximity component

* Change variable name

* Break out branches in convert to avoid too many branches linting error

* Remove disable lint line

* Variables for default properties

* Combine logic

* Test loading multiple proximities for 100% code coverage on proximity component

* Unit test to reach 100%
Fail to configure proximities missing devices

* Fail first before processing

* Combine return statements

* lstrip = bad Teagan

* Utilize string formating instead of concatenation

* Fix variable reference

* Typeo

* Clean up conversion to reduce complexity

* Update unit tests to match code changes on distance util

* Test non numeric value

* Private methods, value type has already been checked.
2016-07-31 10:20:56 -07:00
Johann Kellerman
de7e27c92c Close session after execute. (#2677) 2016-07-31 10:10:30 -07:00
Paulus Schoutsen
89ec39f629 Update frontend 2016-07-31 00:43:28 -07:00
Jesse Newland
e0cbb92c05 Bring back delayed zwave value update behavior (#2674) 2016-07-31 09:09:00 +02:00
Paulus Schoutsen
b35c44ce04 Merge pull request #2671 from home-assistant/deflake-discovery-tests
Try to deflake discovery tests
2016-07-30 22:05:22 -07:00
Paulus Schoutsen
bbff13afee Try to deflake discovery tests 2016-07-30 19:58:14 -07:00
Paulus Schoutsen
af7f3bd455 Version bump to 0.26.0.dev0 2016-07-30 12:42:42 -07:00
894 changed files with 73025 additions and 21102 deletions

View File

@@ -4,6 +4,7 @@ source = homeassistant
omit = omit =
homeassistant/__main__.py homeassistant/__main__.py
homeassistant/scripts/*.py homeassistant/scripts/*.py
homeassistant/helpers/typing.py
# omit pieces of code that rely on external devices being present # omit pieces of code that rely on external devices being present
homeassistant/components/apcupsd.py homeassistant/components/apcupsd.py
@@ -15,6 +16,9 @@ omit =
homeassistant/components/bloomsky.py homeassistant/components/bloomsky.py
homeassistant/components/*/bloomsky.py homeassistant/components/*/bloomsky.py
homeassistant/components/digital_ocean.py
homeassistant/components/*/digital_ocean.py
homeassistant/components/dweet.py homeassistant/components/dweet.py
homeassistant/components/*/dweet.py homeassistant/components/*/dweet.py
@@ -24,9 +28,15 @@ omit =
homeassistant/components/envisalink.py homeassistant/components/envisalink.py
homeassistant/components/*/envisalink.py homeassistant/components/*/envisalink.py
homeassistant/components/google.py
homeassistant/components/*/google.py
homeassistant/components/insteon_hub.py homeassistant/components/insteon_hub.py
homeassistant/components/*/insteon_hub.py homeassistant/components/*/insteon_hub.py
homeassistant/components/ios.py
homeassistant/components/*/ios.py
homeassistant/components/isy994.py homeassistant/components/isy994.py
homeassistant/components/*/isy994.py homeassistant/components/*/isy994.py
@@ -45,6 +55,9 @@ omit =
homeassistant/components/qwikswitch.py homeassistant/components/qwikswitch.py
homeassistant/components/*/qwikswitch.py homeassistant/components/*/qwikswitch.py
homeassistant/components/rfxtrx.py
homeassistant/components/*/rfxtrx.py
homeassistant/components/rpi_gpio.py homeassistant/components/rpi_gpio.py
homeassistant/components/*/rpi_gpio.py homeassistant/components/*/rpi_gpio.py
@@ -76,7 +89,7 @@ omit =
homeassistant/components/zigbee.py homeassistant/components/zigbee.py
homeassistant/components/*/zigbee.py homeassistant/components/*/zigbee.py
homeassistant/components/zwave.py homeassistant/components/zwave/*
homeassistant/components/*/zwave.py homeassistant/components/*/zwave.py
homeassistant/components/enocean.py homeassistant/components/enocean.py
@@ -85,50 +98,81 @@ omit =
homeassistant/components/netatmo.py homeassistant/components/netatmo.py
homeassistant/components/*/netatmo.py homeassistant/components/*/netatmo.py
homeassistant/components/neato.py
homeassistant/components/*/neato.py
homeassistant/components/homematic.py homeassistant/components/homematic.py
homeassistant/components/*/homematic.py homeassistant/components/*/homematic.py
homeassistant/components/knx.py homeassistant/components/knx.py
homeassistant/components/switch/knx.py homeassistant/components/*/knx.py
homeassistant/components/binary_sensor/knx.py
homeassistant/components/thermostat/knx.py homeassistant/components/ffmpeg.py
homeassistant/components/*/ffmpeg.py
homeassistant/components/zoneminder.py
homeassistant/components/*/zoneminder.py
homeassistant/components/mochad.py
homeassistant/components/*/mochad.py
homeassistant/components/alarm_control_panel/alarmdotcom.py homeassistant/components/alarm_control_panel/alarmdotcom.py
homeassistant/components/alarm_control_panel/concord232.py
homeassistant/components/alarm_control_panel/nx584.py homeassistant/components/alarm_control_panel/nx584.py
homeassistant/components/alarm_control_panel/simplisafe.py homeassistant/components/alarm_control_panel/simplisafe.py
homeassistant/components/binary_sensor/arest.py homeassistant/components/binary_sensor/arest.py
homeassistant/components/binary_sensor/concord232.py
homeassistant/components/binary_sensor/rest.py homeassistant/components/binary_sensor/rest.py
homeassistant/components/browser.py homeassistant/components/browser.py
homeassistant/components/camera/amcrest.py
homeassistant/components/camera/bloomsky.py homeassistant/components/camera/bloomsky.py
homeassistant/components/camera/foscam.py homeassistant/components/camera/foscam.py
homeassistant/components/camera/generic.py
homeassistant/components/camera/mjpeg.py homeassistant/components/camera/mjpeg.py
homeassistant/components/camera/rpi_camera.py homeassistant/components/camera/rpi_camera.py
homeassistant/components/camera/synology.py
homeassistant/components/climate/eq3btsmart.py
homeassistant/components/climate/heatmiser.py
homeassistant/components/climate/homematic.py
homeassistant/components/climate/knx.py
homeassistant/components/climate/proliphix.py
homeassistant/components/climate/radiotherm.py
homeassistant/components/cover/garadget.py
homeassistant/components/cover/homematic.py
homeassistant/components/cover/rpi_gpio.py
homeassistant/components/cover/scsgate.py
homeassistant/components/cover/wink.py
homeassistant/components/device_tracker/actiontec.py homeassistant/components/device_tracker/actiontec.py
homeassistant/components/device_tracker/aruba.py homeassistant/components/device_tracker/aruba.py
homeassistant/components/device_tracker/asuswrt.py homeassistant/components/device_tracker/asuswrt.py
homeassistant/components/device_tracker/bbox.py
homeassistant/components/device_tracker/bluetooth_le_tracker.py
homeassistant/components/device_tracker/bluetooth_tracker.py homeassistant/components/device_tracker/bluetooth_tracker.py
homeassistant/components/device_tracker/bt_home_hub_5.py homeassistant/components/device_tracker/bt_home_hub_5.py
homeassistant/components/device_tracker/ddwrt.py homeassistant/components/device_tracker/cisco_ios.py
homeassistant/components/device_tracker/fritz.py homeassistant/components/device_tracker/fritz.py
homeassistant/components/device_tracker/gpslogger.py
homeassistant/components/device_tracker/icloud.py homeassistant/components/device_tracker/icloud.py
homeassistant/components/device_tracker/luci.py homeassistant/components/device_tracker/luci.py
homeassistant/components/device_tracker/netgear.py homeassistant/components/device_tracker/netgear.py
homeassistant/components/device_tracker/nmap_tracker.py homeassistant/components/device_tracker/nmap_tracker.py
homeassistant/components/device_tracker/snmp.py homeassistant/components/device_tracker/snmp.py
homeassistant/components/device_tracker/swisscom.py
homeassistant/components/device_tracker/thomson.py homeassistant/components/device_tracker/thomson.py
homeassistant/components/device_tracker/tomato.py homeassistant/components/device_tracker/tomato.py
homeassistant/components/device_tracker/tplink.py homeassistant/components/device_tracker/tplink.py
homeassistant/components/device_tracker/ubus.py homeassistant/components/device_tracker/ubus.py
homeassistant/components/device_tracker/volvooncall.py
homeassistant/components/discovery.py homeassistant/components/discovery.py
homeassistant/components/downloader.py homeassistant/components/downloader.py
homeassistant/components/emoncms_history.py
homeassistant/components/fan/mqtt.py
homeassistant/components/feedreader.py homeassistant/components/feedreader.py
homeassistant/components/garage_door/wink.py homeassistant/components/foursquare.py
homeassistant/components/garage_door/rpi_gpio.py
homeassistant/components/hdmi_cec.py homeassistant/components/hdmi_cec.py
homeassistant/components/ifttt.py homeassistant/components/ifttt.py
homeassistant/components/joaoapps_join.py homeassistant/components/joaoapps_join.py
homeassistant/components/keyboard.py homeassistant/components/keyboard.py
homeassistant/components/keyboard_remote.py
homeassistant/components/light/blinksticklight.py homeassistant/components/light/blinksticklight.py
homeassistant/components/light/flux_led.py homeassistant/components/light/flux_led.py
homeassistant/components/light/hue.py homeassistant/components/light/hue.py
@@ -137,12 +181,16 @@ omit =
homeassistant/components/light/limitlessled.py homeassistant/components/light/limitlessled.py
homeassistant/components/light/osramlightify.py homeassistant/components/light/osramlightify.py
homeassistant/components/light/x10.py homeassistant/components/light/x10.py
homeassistant/components/light/yeelight.py
homeassistant/components/lirc.py homeassistant/components/lirc.py
homeassistant/components/media_player/braviatv.py homeassistant/components/media_player/braviatv.py
homeassistant/components/media_player/cast.py homeassistant/components/media_player/cast.py
homeassistant/components/media_player/cmus.py homeassistant/components/media_player/cmus.py
homeassistant/components/media_player/denon.py homeassistant/components/media_player/denon.py
homeassistant/components/media_player/denonavr.py
homeassistant/components/media_player/directv.py homeassistant/components/media_player/directv.py
homeassistant/components/media_player/dunehd.py
homeassistant/components/media_player/emby.py
homeassistant/components/media_player/firetv.py homeassistant/components/media_player/firetv.py
homeassistant/components/media_player/gpmdp.py homeassistant/components/media_player/gpmdp.py
homeassistant/components/media_player/itunes.py homeassistant/components/media_player/itunes.py
@@ -153,6 +201,7 @@ omit =
homeassistant/components/media_player/onkyo.py homeassistant/components/media_player/onkyo.py
homeassistant/components/media_player/panasonic_viera.py homeassistant/components/media_player/panasonic_viera.py
homeassistant/components/media_player/pandora.py homeassistant/components/media_player/pandora.py
homeassistant/components/media_player/philips_js.py
homeassistant/components/media_player/pioneer.py homeassistant/components/media_player/pioneer.py
homeassistant/components/media_player/plex.py homeassistant/components/media_player/plex.py
homeassistant/components/media_player/roku.py homeassistant/components/media_player/roku.py
@@ -167,83 +216,124 @@ omit =
homeassistant/components/notify/aws_sqs.py homeassistant/components/notify/aws_sqs.py
homeassistant/components/notify/free_mobile.py homeassistant/components/notify/free_mobile.py
homeassistant/components/notify/gntp.py homeassistant/components/notify/gntp.py
homeassistant/components/notify/group.py
homeassistant/components/notify/instapush.py homeassistant/components/notify/instapush.py
homeassistant/components/notify/joaoapps_join.py homeassistant/components/notify/joaoapps_join.py
homeassistant/components/notify/kodi.py
homeassistant/components/notify/llamalab_automate.py
homeassistant/components/notify/matrix.py
homeassistant/components/notify/message_bird.py homeassistant/components/notify/message_bird.py
homeassistant/components/notify/nfandroidtv.py
homeassistant/components/notify/nma.py homeassistant/components/notify/nma.py
homeassistant/components/notify/pushbullet.py homeassistant/components/notify/pushbullet.py
homeassistant/components/notify/pushetta.py homeassistant/components/notify/pushetta.py
homeassistant/components/notify/pushover.py homeassistant/components/notify/pushover.py
homeassistant/components/notify/rest.py homeassistant/components/notify/rest.py
homeassistant/components/notify/sendgrid.py homeassistant/components/notify/sendgrid.py
homeassistant/components/notify/simplepush.py
homeassistant/components/notify/slack.py homeassistant/components/notify/slack.py
homeassistant/components/notify/smtp.py homeassistant/components/notify/smtp.py
homeassistant/components/notify/syslog.py homeassistant/components/notify/syslog.py
homeassistant/components/notify/telegram.py homeassistant/components/notify/telegram.py
homeassistant/components/notify/telstra.py
homeassistant/components/notify/twilio_sms.py homeassistant/components/notify/twilio_sms.py
homeassistant/components/notify/twitter.py homeassistant/components/notify/twitter.py
homeassistant/components/notify/xmpp.py homeassistant/components/notify/xmpp.py
homeassistant/components/nuimo_controller.py
homeassistant/components/openalpr.py
homeassistant/components/remote/harmony.py
homeassistant/components/scene/hunterdouglas_powerview.py homeassistant/components/scene/hunterdouglas_powerview.py
homeassistant/components/sensor/arest.py homeassistant/components/sensor/arest.py
homeassistant/components/sensor/arwn.py
homeassistant/components/sensor/bbox.py
homeassistant/components/sensor/bitcoin.py homeassistant/components/sensor/bitcoin.py
homeassistant/components/sensor/bom.py
homeassistant/components/sensor/coinmarketcap.py
homeassistant/components/sensor/cpuspeed.py homeassistant/components/sensor/cpuspeed.py
homeassistant/components/sensor/cups.py
homeassistant/components/sensor/currencylayer.py
homeassistant/components/sensor/darksky.py
homeassistant/components/sensor/deutsche_bahn.py homeassistant/components/sensor/deutsche_bahn.py
homeassistant/components/sensor/dht.py homeassistant/components/sensor/dht.py
homeassistant/components/sensor/dovado.py
homeassistant/components/sensor/dte_energy_bridge.py homeassistant/components/sensor/dte_energy_bridge.py
homeassistant/components/sensor/efergy.py homeassistant/components/sensor/efergy.py
homeassistant/components/sensor/eliqonline.py homeassistant/components/sensor/eliqonline.py
homeassistant/components/sensor/emoncms.py
homeassistant/components/sensor/fastdotcom.py
homeassistant/components/sensor/fitbit.py homeassistant/components/sensor/fitbit.py
homeassistant/components/sensor/fixer.py homeassistant/components/sensor/fixer.py
homeassistant/components/sensor/forecast.py homeassistant/components/sensor/fritzbox_callmonitor.py
homeassistant/components/sensor/glances.py homeassistant/components/sensor/glances.py
homeassistant/components/sensor/google_travel_time.py homeassistant/components/sensor/google_travel_time.py
homeassistant/components/sensor/gpsd.py
homeassistant/components/sensor/gtfs.py homeassistant/components/sensor/gtfs.py
homeassistant/components/sensor/haveibeenpwned.py
homeassistant/components/sensor/hddtemp.py
homeassistant/components/sensor/hp_ilo.py
homeassistant/components/sensor/imap.py homeassistant/components/sensor/imap.py
homeassistant/components/sensor/imap_email_content.py
homeassistant/components/sensor/influxdb.py
homeassistant/components/sensor/lastfm.py homeassistant/components/sensor/lastfm.py
homeassistant/components/sensor/linux_battery.py
homeassistant/components/sensor/loopenergy.py homeassistant/components/sensor/loopenergy.py
homeassistant/components/sensor/mhz19.py
homeassistant/components/sensor/miflora.py
homeassistant/components/sensor/mqtt_room.py
homeassistant/components/sensor/neurio_energy.py homeassistant/components/sensor/neurio_energy.py
homeassistant/components/sensor/nut.py
homeassistant/components/sensor/nzbget.py homeassistant/components/sensor/nzbget.py
homeassistant/components/sensor/ohmconnect.py
homeassistant/components/sensor/onewire.py homeassistant/components/sensor/onewire.py
homeassistant/components/sensor/openweathermap.py
homeassistant/components/sensor/openexchangerates.py homeassistant/components/sensor/openexchangerates.py
homeassistant/components/sensor/openweathermap.py
homeassistant/components/sensor/pi_hole.py
homeassistant/components/sensor/plex.py homeassistant/components/sensor/plex.py
homeassistant/components/sensor/rest.py homeassistant/components/sensor/pvoutput.py
homeassistant/components/sensor/sabnzbd.py homeassistant/components/sensor/sabnzbd.py
homeassistant/components/sensor/scrape.py
homeassistant/components/sensor/serial_pm.py
homeassistant/components/sensor/snmp.py homeassistant/components/sensor/snmp.py
homeassistant/components/sensor/sonarr.py
homeassistant/components/sensor/speedtest.py homeassistant/components/sensor/speedtest.py
homeassistant/components/sensor/steam_online.py homeassistant/components/sensor/steam_online.py
homeassistant/components/sensor/supervisord.py homeassistant/components/sensor/supervisord.py
homeassistant/components/sensor/swiss_hydrological_data.py homeassistant/components/sensor/swiss_hydrological_data.py
homeassistant/components/sensor/swiss_public_transport.py homeassistant/components/sensor/swiss_public_transport.py
homeassistant/components/sensor/synologydsm.py
homeassistant/components/sensor/systemmonitor.py homeassistant/components/sensor/systemmonitor.py
homeassistant/components/sensor/ted5000.py
homeassistant/components/sensor/temper.py homeassistant/components/sensor/temper.py
homeassistant/components/sensor/time_date.py homeassistant/components/sensor/time_date.py
homeassistant/components/sensor/torque.py homeassistant/components/sensor/torque.py
homeassistant/components/sensor/transmission.py homeassistant/components/sensor/transmission.py
homeassistant/components/sensor/twitch.py homeassistant/components/sensor/twitch.py
homeassistant/components/sensor/uber.py homeassistant/components/sensor/uber.py
homeassistant/components/sensor/worldclock.py homeassistant/components/sensor/vasttrafik.py
homeassistant/components/sensor/waqi.py
homeassistant/components/sensor/xbox_live.py
homeassistant/components/sensor/yweather.py homeassistant/components/sensor/yweather.py
homeassistant/components/sensor/waqi.py
homeassistant/components/switch/acer_projector.py homeassistant/components/switch/acer_projector.py
homeassistant/components/switch/anel_pwrctrl.py
homeassistant/components/switch/arest.py homeassistant/components/switch/arest.py
homeassistant/components/switch/dlink.py homeassistant/components/switch/dlink.py
homeassistant/components/switch/edimax.py homeassistant/components/switch/edimax.py
homeassistant/components/switch/hikvisioncam.py homeassistant/components/switch/hikvisioncam.py
homeassistant/components/switch/hook.py
homeassistant/components/switch/mystrom.py homeassistant/components/switch/mystrom.py
homeassistant/components/switch/netio.py homeassistant/components/switch/netio.py
homeassistant/components/switch/orvibo.py homeassistant/components/switch/orvibo.py
homeassistant/components/switch/pilight.py
homeassistant/components/switch/pulseaudio_loopback.py homeassistant/components/switch/pulseaudio_loopback.py
homeassistant/components/switch/rest.py homeassistant/components/switch/rest.py
homeassistant/components/switch/rpi_rf.py homeassistant/components/switch/rpi_rf.py
homeassistant/components/switch/tplink.py homeassistant/components/switch/tplink.py
homeassistant/components/switch/transmission.py homeassistant/components/switch/transmission.py
homeassistant/components/switch/wake_on_lan.py homeassistant/components/switch/wake_on_lan.py
homeassistant/components/thermostat/eq3btsmart.py homeassistant/components/thingspeak.py
homeassistant/components/thermostat/heatmiser.py
homeassistant/components/thermostat/homematic.py
homeassistant/components/thermostat/proliphix.py
homeassistant/components/thermostat/radiotherm.py
homeassistant/components/upnp.py homeassistant/components/upnp.py
homeassistant/components/weather/openweathermap.py
homeassistant/components/zeroconf.py homeassistant/components/zeroconf.py

2
.dockerignore Normal file
View File

@@ -0,0 +1,2 @@
.tox
.git

View File

@@ -1,9 +1,9 @@
**Description:** **Description:**
**Related issue (if applicable):** fixes # **Related issue (if applicable):** fixes #<home-assistant issue number goes here>
**Pull request in [home-assistant.io](https://github.com/home-assistant/home-assistant.io) with documentation (if applicable):** home-assistant/home-assistant.io# **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):** **Example entry for `configuration.yaml` (if applicable):**
```yaml ```yaml
@@ -13,9 +13,9 @@
**Checklist:** **Checklist:**
If user exposed functionality or configuration variables are added/changed: If user exposed functionality or configuration variables are added/changed:
- [ ] Documentation added/updated in [home-assistant.io](https://github.com/home-assistant/home-assistant.io) - [ ] Documentation added/updated in [home-assistant.github.io](https://github.com/home-assistant/home-assistant.github.io)
If code communicates with devices, web services, or a: If the code communicates with devices, web services, or third-party tools:
- [ ] Local tests with `tox` run successfully. **Your PR cannot be merged unless tests pass** - [ ] Local tests with `tox` run successfully. **Your PR cannot be merged unless tests pass**
- [ ] New dependencies have been added to the `REQUIREMENTS` variable ([example][ex-requir]). - [ ] 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 dependencies are only imported inside functions that use them ([example][ex-import]).

17
.gitignore vendored
View File

@@ -7,7 +7,9 @@ config/custom_components/*
!config/custom_components/example.py !config/custom_components/example.py
!config/custom_components/hello_world.py !config/custom_components/hello_world.py
!config/custom_components/mqtt_example.py !config/custom_components/mqtt_example.py
!config/custom_components/react_panel !config/panels
config/panels/*
!config/panels/react.html
tests/testing_config/deps tests/testing_config/deps
tests/testing_config/home-assistant.log tests/testing_config/home-assistant.log
@@ -52,13 +54,15 @@ develop-eggs
lib lib
lib64 lib64
# Installer logs # Logs
*.log
pip-log.txt pip-log.txt
# Unit test / coverage reports # Unit test / coverage reports
.coverage .coverage
.tox .tox
nosetests.xml nosetests.xml
htmlcov/
# Translations # Translations
*.mo *.mo
@@ -91,3 +95,12 @@ ctags.tmp
virtualization/vagrant/setup_done virtualization/vagrant/setup_done
virtualization/vagrant/.vagrant virtualization/vagrant/.vagrant
virtualization/vagrant/config virtualization/vagrant/config
# Visual Studio Code
.vscode
# Built docs
docs/build
# Windows Explorer
desktop.ini

2
.hound.yml Normal file
View File

@@ -0,0 +1,2 @@
python:
enabled: true

View File

@@ -2,11 +2,11 @@ sudo: false
matrix: matrix:
fast_finish: true fast_finish: true
include: include:
- python: "3.4" - python: "3.4.2"
env: TOXENV=py34 env: TOXENV=py34
- python: "3.4" - python: "3.4.2"
env: TOXENV=requirements env: TOXENV=requirements
- python: "3.5" - python: "3.4.2"
env: TOXENV=lint env: TOXENV=lint
- python: "3.5" - python: "3.5"
env: TOXENV=typing env: TOXENV=typing

View File

@@ -1,4 +1,4 @@
FROM python:3.4 FROM python:3.5
MAINTAINER Paulus Schoutsen <Paulus@PaulusSchoutsen.nl> MAINTAINER Paulus Schoutsen <Paulus@PaulusSchoutsen.nl>
VOLUME /config VOLUME /config
@@ -10,7 +10,7 @@ RUN pip3 install --no-cache-dir colorlog cython
# For the nmap tracker, bluetooth tracker, Z-Wave # For the nmap tracker, bluetooth tracker, Z-Wave
RUN apt-get update && \ RUN apt-get update && \
apt-get install -y --no-install-recommends nmap net-tools cython3 libudev-dev sudo libglib2.0-dev && \ apt-get install -y --no-install-recommends nmap net-tools cython3 libudev-dev sudo libglib2.0-dev bluetooth libbluetooth-dev && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
COPY script/build_python_openzwave script/build_python_openzwave COPY script/build_python_openzwave script/build_python_openzwave
@@ -19,9 +19,8 @@ RUN script/build_python_openzwave && \
ln -sf /usr/src/app/build/python-openzwave/openzwave/config /usr/local/share/python-openzwave/config ln -sf /usr/src/app/build/python-openzwave/openzwave/config /usr/local/share/python-openzwave/config
COPY requirements_all.txt requirements_all.txt COPY requirements_all.txt requirements_all.txt
# certifi breaks Debian based installs RUN pip3 install --no-cache-dir -r requirements_all.txt && \
RUN pip3 install --no-cache-dir -r requirements_all.txt && pip3 uninstall -y certifi && \ pip3 install mysqlclient psycopg2 uvloop
pip3 install mysqlclient psycopg2
# Copy source # Copy source
COPY . . COPY . .

View File

@@ -1,7 +1,7 @@
homeassistant: homeassistant:
# Omitted values in this section will be auto detected using freegeoip.io # Omitted values in this section will be auto detected using freegeoip.io
# Location required to calculate the time the sun rises and sets. # Location required to calculate the time the sun rises and sets.
# Coordinates are also used for location for weather related components. # Coordinates are also used for location for weather related components.
# Google Maps can be used to determine more precise GPS coordinates. # Google Maps can be used to determine more precise GPS coordinates.
latitude: 32.87336 latitude: 32.87336
@@ -10,8 +10,8 @@ homeassistant:
# Impacts weather/sunrise data # Impacts weather/sunrise data
elevation: 665 elevation: 665
# C for Celsius, F for Fahrenheit # 'metric' for Metric System, 'imperial' for imperial system
temperature_unit: C unit_system: metric
# Pick yours from here: # Pick yours from here:
# http://en.wikipedia.org/wiki/List_of_tz_database_time_zones # http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
@@ -43,12 +43,10 @@ device_tracker:
username: admin username: admin
password: PASSWORD password: PASSWORD
chromecast:
switch: switch:
platform: wemo platform: wemo
thermostat: climate:
platform: nest platform: nest
# Required: username and password that are used to login to the Nest thermostat. # Required: username and password that are used to login to the Nest thermostat.
username: myemail@mydomain.com username: myemail@mydomain.com
@@ -79,7 +77,6 @@ group:
entities: entities:
- group.awesome_people - group.awesome_people
- group.climate - group.climate
kitchen: kitchen:
name: Kitchen name: Kitchen
entities: entities:
@@ -92,52 +89,23 @@ group:
- input_boolean.notify_home - input_boolean.notify_home
- camera.demo_camera - camera.demo_camera
example:
simple_alarm:
# Which light/light group has to flash when a known device comes home
known_light: light.Bowl
# Which light/light group has to flash red when light turns on while no one home
unknown_light: group.living_room
browser: browser:
keyboard: keyboard:
# https://home-assistant.io/getting-started/automation/ # https://home-assistant.io/getting-started/automation/
automation: automation:
- alias: 'Rule 1 Light on in the evening' - alias: Turn on light when sun sets
trigger: trigger:
- platform: sun platform: sun
event: sunset event: sunset
offset: "-01:00:00" offset: "-01:00:00"
- platform: state condition:
condition: state
entity_id: group.all_devices entity_id: group.all_devices
state: home state: 'home'
condition: action:
- platform: state service: light.turn_on
entity_id: group.all_devices
state: home
- platform: time
after: "16:00:00"
before: "23:00:00"
action:
service: homeassistant.turn_on
entity_id: group.living_room
- alias: 'Rule 2 - Away Mode'
trigger:
- platform: state
entity_id: group.all_devices
state: 'not_home'
condition: use_trigger_values
action:
service: light.turn_off
entity_id: group.all_lights
# Sensors need to be added into the configuration.yaml as sensor:, sensor 2:, sensor 3:, etc.
# Each sensor label should be unique or your sensors might not load correctly.
# Another way to do is to collect all entries under one "sensor:" # Another way to do is to collect all entries under one "sensor:"
# sensor: # sensor:
# - platform: mqtt # - platform: mqtt
@@ -154,34 +122,30 @@ sensor:
arg: '/' arg: '/'
- type: 'disk_use_percent' - type: 'disk_use_percent'
arg: '/home' arg: '/home'
- type: 'disk_use'
arg: '/home'
sensor 2: sensor 2:
platform: forecast platform: cpuspeed
api_key: <register on Forecast.io for your PRIVATE API>
monitored_conditions:
- summary
- precip_type
- precip_intensity
- temperature
script: script:
# Turns on the bedroom lights and then the living room lights 1 minute later
wakeup: wakeup:
alias: Wake Up alias: Wake Up
sequence: sequence:
# alias is optional - event: LOGBOOK_ENTRY
event_data:
name: Paulus
message: is waking up
entity_id: device_tracker.paulus
domain: light
- alias: Bedroom lights on - alias: Bedroom lights on
execute_service: light.turn_on service: light.turn_on
service_data: data:
entity_id: group.bedroom entity_id: group.bedroom
brightness: 100
- delay: - delay:
# supports seconds, milliseconds, minutes, hours, etc.
minutes: 1 minutes: 1
- alias: Living room lights on - alias: Living room lights on
execute_service: light.turn_on service: light.turn_on
service_data: data:
entity_id: group.living_room entity_id: group.living_room
scene: scene:

View File

@@ -1,30 +0,0 @@
"""
Custom panel example showing TodoMVC using React.
Will add a panel to control lights and switches using React. Allows configuring
the title via configuration.yaml:
react_panel:
title: 'home'
"""
import os
from homeassistant.components.frontend import register_panel
DOMAIN = 'react_panel'
DEPENDENCIES = ['frontend']
PANEL_PATH = os.path.join(os.path.dirname(__file__), 'panel.html')
def setup(hass, config):
"""Initialize custom panel."""
title = config.get(DOMAIN, {}).get('title')
config = None if title is None else {'title': title}
register_panel(hass, 'react', PANEL_PATH,
title='TodoMVC', icon='mdi:checkbox-marked-outline',
config=config)
return True

View File

@@ -1,3 +1,20 @@
<!--
Custom Home Assistant panel example.
Currently only works in Firefox and Chrome because it uses ES6.
Make sure this file is in <config>/panels/react.html
Add to your configuration.yaml:
panel_custom:
- name: react
sidebar_title: TodoMVC
sidebar_icon: mdi:checkbox-marked-outline
config:
title: Wow hello!
-->
<script src="https://fb.me/react-15.2.1.min.js"></script> <script src="https://fb.me/react-15.2.1.min.js"></script>
<script src="https://fb.me/react-dom-15.2.1.min.js"></script> <script src="https://fb.me/react-dom-15.2.1.min.js"></script>

230
docs/Makefile Normal file
View File

@@ -0,0 +1,230 @@
# Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = build
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
.PHONY: help
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " livehtml to make standalone HTML files via sphinx-autobuild"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " applehelp to make an Apple Help Book"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " epub3 to make an epub3"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " texinfo to make Texinfo files"
@echo " info to make Texinfo files and run them through makeinfo"
@echo " gettext to make PO message catalogs"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " xml to make Docutils-native XML files"
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
@echo " coverage to run coverage check of the documentation (if enabled)"
@echo " dummy to check syntax errors of document sources"
.PHONY: clean
clean:
rm -rf $(BUILDDIR)/*
.PHONY: html
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
.PHONY: livehtml
livehtml:
sphinx-autobuild -z ../homeassistant/ --port 0 -B -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
.PHONY: dirhtml
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
.PHONY: singlehtml
singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
.PHONY: pickle
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
.PHONY: json
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."
.PHONY: htmlhelp
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
.PHONY: qthelp
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Home-Assistant.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Home-Assistant.qhc"
.PHONY: applehelp
applehelp:
$(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
@echo
@echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
@echo "N.B. You won't be able to view it unless you put it in" \
"~/Library/Documentation/Help or install it in your application" \
"bundle."
.PHONY: devhelp
devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/Home-Assistant"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Home-Assistant"
@echo "# devhelp"
.PHONY: epub
epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
.PHONY: epub3
epub3:
$(SPHINXBUILD) -b epub3 $(ALLSPHINXOPTS) $(BUILDDIR)/epub3
@echo
@echo "Build finished. The epub3 file is in $(BUILDDIR)/epub3."
.PHONY: latex
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."
.PHONY: latexpdf
latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
.PHONY: latexpdfja
latexpdfja:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through platex and dvipdfmx..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
.PHONY: text
text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."
.PHONY: man
man:
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
.PHONY: texinfo
texinfo:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
@echo "Run \`make' in that directory to run these through makeinfo" \
"(use \`make info' here to do that automatically)."
.PHONY: info
info:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo "Running Texinfo files through makeinfo..."
make -C $(BUILDDIR)/texinfo info
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
.PHONY: gettext
gettext:
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
@echo
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
.PHONY: changes
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."
.PHONY: linkcheck
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
.PHONY: doctest
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."
.PHONY: coverage
coverage:
$(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
@echo "Testing of coverage in the sources finished, look at the " \
"results in $(BUILDDIR)/coverage/python.txt."
.PHONY: xml
xml:
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
@echo
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
.PHONY: pseudoxml
pseudoxml:
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
@echo
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
.PHONY: dummy
dummy:
$(SPHINXBUILD) -b dummy $(ALLSPHINXOPTS) $(BUILDDIR)/dummy
@echo
@echo "Build finished. Dummy builder generates no files."

281
docs/make.bat Normal file
View File

@@ -0,0 +1,281 @@
@ECHO OFF
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set BUILDDIR=build
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% source
set I18NSPHINXOPTS=%SPHINXOPTS% source
if NOT "%PAPER%" == "" (
set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
)
if "%1" == "" goto help
if "%1" == "help" (
:help
echo.Please use `make ^<target^>` where ^<target^> is one of
echo. html to make standalone HTML files
echo. dirhtml to make HTML files named index.html in directories
echo. singlehtml to make a single large HTML file
echo. pickle to make pickle files
echo. json to make JSON files
echo. htmlhelp to make HTML files and a HTML help project
echo. qthelp to make HTML files and a qthelp project
echo. devhelp to make HTML files and a Devhelp project
echo. epub to make an epub
echo. epub3 to make an epub3
echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
echo. text to make text files
echo. man to make manual pages
echo. texinfo to make Texinfo files
echo. gettext to make PO message catalogs
echo. changes to make an overview over all changed/added/deprecated items
echo. xml to make Docutils-native XML files
echo. pseudoxml to make pseudoxml-XML files for display purposes
echo. linkcheck to check all external links for integrity
echo. doctest to run all doctests embedded in the documentation if enabled
echo. coverage to run coverage check of the documentation if enabled
echo. dummy to check syntax errors of document sources
goto end
)
if "%1" == "clean" (
for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
del /q /s %BUILDDIR%\*
goto end
)
REM Check if sphinx-build is available and fallback to Python version if any
%SPHINXBUILD% 1>NUL 2>NUL
if errorlevel 9009 goto sphinx_python
goto sphinx_ok
:sphinx_python
set SPHINXBUILD=python -m sphinx.__init__
%SPHINXBUILD% 2> nul
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)
:sphinx_ok
if "%1" == "html" (
%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/html.
goto end
)
if "%1" == "dirhtml" (
%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
goto end
)
if "%1" == "singlehtml" (
%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
goto end
)
if "%1" == "pickle" (
%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can process the pickle files.
goto end
)
if "%1" == "json" (
%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can process the JSON files.
goto end
)
if "%1" == "htmlhelp" (
%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can run HTML Help Workshop with the ^
.hhp project file in %BUILDDIR%/htmlhelp.
goto end
)
if "%1" == "qthelp" (
%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can run "qcollectiongenerator" with the ^
.qhcp project file in %BUILDDIR%/qthelp, like this:
echo.^> qcollectiongenerator %BUILDDIR%\qthelp\Home-Assistant.qhcp
echo.To view the help file:
echo.^> assistant -collectionFile %BUILDDIR%\qthelp\Home-Assistant.ghc
goto end
)
if "%1" == "devhelp" (
%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished.
goto end
)
if "%1" == "epub" (
%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The epub file is in %BUILDDIR%/epub.
goto end
)
if "%1" == "epub3" (
%SPHINXBUILD% -b epub3 %ALLSPHINXOPTS% %BUILDDIR%/epub3
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The epub3 file is in %BUILDDIR%/epub3.
goto end
)
if "%1" == "latex" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
if errorlevel 1 exit /b 1
echo.
echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
goto end
)
if "%1" == "latexpdf" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
cd %BUILDDIR%/latex
make all-pdf
cd %~dp0
echo.
echo.Build finished; the PDF files are in %BUILDDIR%/latex.
goto end
)
if "%1" == "latexpdfja" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
cd %BUILDDIR%/latex
make all-pdf-ja
cd %~dp0
echo.
echo.Build finished; the PDF files are in %BUILDDIR%/latex.
goto end
)
if "%1" == "text" (
%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The text files are in %BUILDDIR%/text.
goto end
)
if "%1" == "man" (
%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The manual pages are in %BUILDDIR%/man.
goto end
)
if "%1" == "texinfo" (
%SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
goto end
)
if "%1" == "gettext" (
%SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
goto end
)
if "%1" == "changes" (
%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
if errorlevel 1 exit /b 1
echo.
echo.The overview file is in %BUILDDIR%/changes.
goto end
)
if "%1" == "linkcheck" (
%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
if errorlevel 1 exit /b 1
echo.
echo.Link check complete; look for any errors in the above output ^
or in %BUILDDIR%/linkcheck/output.txt.
goto end
)
if "%1" == "doctest" (
%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
if errorlevel 1 exit /b 1
echo.
echo.Testing of doctests in the sources finished, look at the ^
results in %BUILDDIR%/doctest/output.txt.
goto end
)
if "%1" == "coverage" (
%SPHINXBUILD% -b coverage %ALLSPHINXOPTS% %BUILDDIR%/coverage
if errorlevel 1 exit /b 1
echo.
echo.Testing of coverage in the sources finished, look at the ^
results in %BUILDDIR%/coverage/python.txt.
goto end
)
if "%1" == "xml" (
%SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The XML files are in %BUILDDIR%/xml.
goto end
)
if "%1" == "pseudoxml" (
%SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml.
goto end
)
if "%1" == "dummy" (
%SPHINXBUILD% -b dummy %ALLSPHINXOPTS% %BUILDDIR%/dummy
if errorlevel 1 exit /b 1
echo.
echo.Build finished. Dummy builder generates no files.
goto end
)
:end

View File

@@ -0,0 +1,45 @@
"""
Sphinx extension to add ReadTheDocs-style "Edit on GitHub" links to the
sidebar.
Loosely based on https://github.com/astropy/astropy/pull/347
"""
import os
import warnings
__licence__ = 'BSD (3 clause)'
def get_github_url(app, view, path):
github_fmt = 'https://github.com/{}/{}/{}/{}{}'
return (
github_fmt.format(app.config.edit_on_github_project, view,
app.config.edit_on_github_branch,
app.config.edit_on_github_src_path, path))
def html_page_context(app, pagename, templatename, context, doctree):
if templatename != 'page.html':
return
if not app.config.edit_on_github_project:
warnings.warn("edit_on_github_project not specified")
return
if not doctree:
warnings.warn("doctree is None")
return
path = os.path.relpath(doctree.get('source'), app.builder.srcdir)
show_url = get_github_url(app, 'blob', path)
edit_url = get_github_url(app, 'edit', path)
context['show_on_github_url'] = show_url
context['edit_on_github_url'] = edit_url
def setup(app):
app.add_config_value('edit_on_github_project', '', True)
app.add_config_value('edit_on_github_branch', 'master', True)
app.add_config_value('edit_on_github_src_path', '', True) # 'eg' "docs/"
app.connect('html-page-context', html_page_context)

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -0,0 +1,8 @@
<ul>
<li><a href="https://community.home-assistant.io">📌 Community Forums</a></li>
<li><a href="https://github.com/home-assistant/home-assistant">🚀 GitHub</a></li>
<li><a href="https://home-assistant.io/">🏡 Homepage</a></li>
<li><a href="https://gitter.im/home-assistant/home-assistant">💬 Gitter</a></li>
<li><a href="https://pypi.python.org/pypi/homeassistant">💾 Download Releases</a></li>
</ul>
<hr>

View File

@@ -0,0 +1,13 @@
{%- if show_source and has_source and sourcename %}
<h3>{{ _('This Page') }}</h3>
<ul class="this-page-menu">
{%- if show_on_github_url %}
<li><a href="{{ show_on_github_url }}"
rel="nofollow">{{ _('Show on GitHub') }}</a></li>
{%- endif %}
{%- if edit_on_github_url %}
<li><a href="{{ edit_on_github_url }}"
rel="nofollow">{{ _('Edit on GitHub') }}</a></li>
{%- endif %}
</ul>
{%- endif %}

View File

@@ -0,0 +1,7 @@
.. _bootstrap_module:
:mod:`homeassistant.bootstrap`
-------------------------
.. automodule:: homeassistant.bootstrap
:members:

38
docs/source/api/core.rst Normal file
View File

@@ -0,0 +1,38 @@
.. _core_module:
:mod:`homeassistant.core`
-------------------------
.. automodule:: homeassistant.core
.. autoclass:: Config
:members:
.. autoclass:: Event
:members:
.. autoclass:: EventBus
:members:
.. autoclass:: HomeAssistant
:members:
.. autoclass:: State
:members:
.. autoclass:: StateMachine
:members:
.. autoclass:: ServiceCall
:members:
.. autoclass:: ServiceRegistry
:members:
Module contents
---------------
.. automodule:: homeassistant.core
:members:
:undoc-members:
:show-inheritance:

View File

@@ -0,0 +1,10 @@
.. _components_device_tracker_module:
:mod:`homeassistant.components.device_tracker`
----------------------------------------------
.. automodule:: homeassistant.components.device_tracker
:members:
.. autoclass:: Device
:members:

View File

@@ -0,0 +1,12 @@
.. _helpers_entity_module:
:mod:`homeassistant.helpers.entity`
-----------------------------------
.. automodule:: homeassistant.helpers.entity
.. autoclass:: Entity
:members:
.. autoclass:: ToggleEntity
:members:

20
docs/source/api/event.rst Normal file
View File

@@ -0,0 +1,20 @@
.. _helpers_event_module:
:mod:`homeassistant.helpers.event`
----------------------------------
.. automodule:: homeassistant.helpers.event
.. autofunction:: track_state_change
.. autofunction:: track_point_in_time
.. autofunction:: track_point_in_utc_time
.. autofunction:: track_sunrise
.. autofunction:: track_sunset
.. autofunction:: track_utc_time_change
.. autofunction:: track_time_change

118
docs/source/api/helpers.rst Normal file
View File

@@ -0,0 +1,118 @@
homeassistant.helpers package
=============================
Submodules
----------
homeassistant.helpers.condition module
--------------------------------------
.. automodule:: homeassistant.helpers.condition
:members:
:undoc-members:
:show-inheritance:
homeassistant.helpers.config_validation module
----------------------------------------------
.. automodule:: homeassistant.helpers.config_validation
:members:
:undoc-members:
:show-inheritance:
homeassistant.helpers.discovery module
--------------------------------------
.. automodule:: homeassistant.helpers.discovery
:members:
:undoc-members:
:show-inheritance:
homeassistant.helpers.entity module
-----------------------------------
.. automodule:: homeassistant.helpers.entity
:members:
:undoc-members:
:show-inheritance:
homeassistant.helpers.entity_component module
---------------------------------------------
.. automodule:: homeassistant.helpers.entity_component
:members:
:undoc-members:
:show-inheritance:
homeassistant.helpers.event module
----------------------------------
.. automodule:: homeassistant.helpers.event
:members:
:undoc-members:
:show-inheritance:
homeassistant.helpers.event_decorators module
---------------------------------------------
.. automodule:: homeassistant.helpers.event_decorators
:members:
:undoc-members:
:show-inheritance:
homeassistant.helpers.location module
-------------------------------------
.. automodule:: homeassistant.helpers.location
:members:
:undoc-members:
:show-inheritance:
homeassistant.helpers.script module
-----------------------------------
.. automodule:: homeassistant.helpers.script
:members:
:undoc-members:
:show-inheritance:
homeassistant.helpers.service module
------------------------------------
.. automodule:: homeassistant.helpers.service
:members:
:undoc-members:
:show-inheritance:
homeassistant.helpers.state module
----------------------------------
.. automodule:: homeassistant.helpers.state
:members:
:undoc-members:
:show-inheritance:
homeassistant.helpers.template module
-------------------------------------
.. automodule:: homeassistant.helpers.template
:members:
:undoc-members:
:show-inheritance:
homeassistant.helpers.typing module
-----------------------------------
.. automodule:: homeassistant.helpers.typing
:members:
:undoc-members:
:show-inheritance:
Module contents
---------------
.. automodule:: homeassistant.helpers
:members:
:undoc-members:
:show-inheritance:

View File

@@ -0,0 +1,78 @@
homeassistant package
=====================
Subpackages
-----------
.. toctree::
helpers
util
Submodules
----------
bootstrap module
------------------------------
.. automodule:: homeassistant.bootstrap
:members:
:undoc-members:
:show-inheritance:
config module
---------------------------
.. automodule:: homeassistant.config
:members:
:undoc-members:
:show-inheritance:
const module
--------------------------
.. automodule:: homeassistant.const
:members:
:undoc-members:
:show-inheritance:
core module
-------------------------
.. automodule:: homeassistant.core
:members:
:undoc-members:
:show-inheritance:
exceptions module
-------------------------------
.. automodule:: homeassistant.exceptions
:members:
:undoc-members:
:show-inheritance:
loader module
---------------------------
.. automodule:: homeassistant.loader
:members:
:undoc-members:
:show-inheritance:
remote module
---------------------------
.. automodule:: homeassistant.remote
:members:
:undoc-members:
:show-inheritance:
Module contents
---------------
.. automodule:: homeassistant
:members:
:undoc-members:
:show-inheritance:

86
docs/source/api/util.rst Normal file
View File

@@ -0,0 +1,86 @@
homeassistant.util package
==========================
Submodules
----------
homeassistant.util.async module
-------------------------------
.. automodule:: homeassistant.util.async
:members:
:undoc-members:
:show-inheritance:
homeassistant.util.color module
-------------------------------
.. automodule:: homeassistant.util.color
:members:
:undoc-members:
:show-inheritance:
homeassistant.util.distance module
----------------------------------
.. automodule:: homeassistant.util.distance
:members:
:undoc-members:
:show-inheritance:
homeassistant.util.dt module
----------------------------
.. automodule:: homeassistant.util.dt
:members:
:undoc-members:
:show-inheritance:
homeassistant.util.location module
----------------------------------
.. automodule:: homeassistant.util.location
:members:
:undoc-members:
:show-inheritance:
homeassistant.util.package module
---------------------------------
.. automodule:: homeassistant.util.package
:members:
:undoc-members:
:show-inheritance:
homeassistant.util.temperature module
-------------------------------------
.. automodule:: homeassistant.util.temperature
:members:
:undoc-members:
:show-inheritance:
homeassistant.util.unit_system module
-------------------------------------
.. automodule:: homeassistant.util.unit_system
:members:
:undoc-members:
:show-inheritance:
homeassistant.util.yaml module
------------------------------
.. automodule:: homeassistant.util.yaml
:members:
:undoc-members:
:show-inheritance:
Module contents
---------------
.. automodule:: homeassistant.util
:members:
:undoc-members:
:show-inheritance:

419
docs/source/conf.py Normal file
View File

@@ -0,0 +1,419 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Home-Assistant documentation build configuration file, created by
# sphinx-quickstart on Sun Aug 28 13:13:10 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import sys
import os
from os.path import relpath
import inspect
from homeassistant.const import (__version__, __short_version__, PROJECT_NAME,
PROJECT_LONG_DESCRIPTION,
PROJECT_COPYRIGHT, PROJECT_AUTHOR,
PROJECT_GITHUB_USERNAME,
PROJECT_GITHUB_REPOSITORY,
GITHUB_PATH, GITHUB_URL)
sys.path.insert(0, os.path.abspath('_ext'))
sys.path.insert(0, os.path.abspath('../homeassistant'))
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.linkcode',
'sphinx_autodoc_annotation',
'edit_on_github'
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
# The encoding of source files.
#
# source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = PROJECT_NAME
copyright = PROJECT_COPYRIGHT
author = PROJECT_AUTHOR
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = __short_version__
# The full version, including alpha/beta/rc tags.
release = __version__
code_branch = 'dev' if 'dev' in __version__ else 'master'
# Edit on Github config
edit_on_github_project = GITHUB_PATH
edit_on_github_branch = code_branch
edit_on_github_src_path = 'docs/source/'
def linkcode_resolve(domain, info):
"""
Determine the URL corresponding to Python object
"""
if domain != 'py':
return None
modname = info['module']
fullname = info['fullname']
submod = sys.modules.get(modname)
if submod is None:
return None
obj = submod
for part in fullname.split('.'):
try:
obj = getattr(obj, part)
except:
return None
try:
fn = inspect.getsourcefile(obj)
except:
fn = None
if not fn:
return None
try:
source, lineno = inspect.findsource(obj)
except:
lineno = None
if lineno:
linespec = "#L%d" % (lineno + 1)
else:
linespec = ""
fn = relpath(fn, start='../')
return '{}/blob/{}/{}{}'.format(GITHUB_URL, code_branch, fn, linespec)
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#
# today = ''
#
# Else, today_fmt is used as the format for a strftime call.
#
# today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = []
# The reST default role (used for this markup: `text`) to use for all
# documents.
#
# default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#
# add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#
# add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#
# show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
# modindex_common_prefix = []
# If true, keep warnings as "system message" paragraphs in the built documents.
# keep_warnings = False
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
html_theme_options = {
'logo': 'logo.png',
'logo_name': PROJECT_NAME,
'description': PROJECT_LONG_DESCRIPTION,
'github_user': PROJECT_GITHUB_USERNAME,
'github_repo': PROJECT_GITHUB_REPOSITORY,
'github_type': 'star',
'github_banner': True,
'travis_button': True,
'touch_icon': 'logo-apple.png',
# 'fixed_sidebar': True, # Re-enable when we have more content
}
# Add any paths that contain custom themes here, relative to this directory.
# html_theme_path = []
# The name for this set of Sphinx documents.
# "<project> v<release> documentation" by default.
#
# html_title = 'Home-Assistant v0.27.0'
# A shorter title for the navigation bar. Default is the same as html_title.
#
# html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#
# html_logo = '_static/logo.png'
# The name of an image file (relative to this directory) to use as a favicon of
# the docs.
# This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#
html_favicon = '_static/favicon.ico'
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
# directly to the root of the documentation.
#
# html_extra_path = []
# If not None, a 'Last updated on:' timestamp is inserted at every page
# bottom, using the given strftime format.
# The empty string is equivalent to '%b %d, %Y'.
#
html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#
html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#
html_sidebars = {
'**': [
'about.html',
'links.html',
'searchbox.html',
'sourcelink.html',
'navigation.html',
'relations.html'
]
}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#
# html_additional_pages = {}
# If false, no module index is generated.
#
# html_domain_indices = True
# If false, no index is generated.
#
# html_use_index = True
# If true, the index is split into individual pages for each letter.
#
# html_split_index = False
# If true, links to the reST sources are added to the pages.
#
# html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#
# html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#
# html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#
# html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
# html_file_suffix = None
# Language to be used for generating the HTML full-text search index.
# Sphinx supports the following languages:
# 'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja'
# 'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr', 'zh'
#
# html_search_language = 'en'
# A dictionary with options for the search language support, empty by default.
# 'ja' uses this config value.
# 'zh' user can custom change `jieba` dictionary path.
#
# html_search_options = {'type': 'default'}
# The name of a javascript file (relative to the configuration directory) that
# implements a search results scorer. If empty, the default will be used.
#
# html_search_scorer = 'scorer.js'
# Output file base name for HTML help builder.
htmlhelp_basename = 'Home-Assistantdoc'
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'home-assistant.tex', 'Home Assistant Documentation',
'Home Assistant Team', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#
# latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#
# latex_use_parts = False
# If true, show page references after internal links.
#
# latex_show_pagerefs = False
# If true, show URL addresses after external links.
#
# latex_show_urls = False
# Documents to append as an appendix to all manuals.
#
# latex_appendices = []
# It false, will not define \strong, \code, itleref, \crossref ... but only
# \sphinxstrong, ..., \sphinxtitleref, ... To help avoid clash with user added
# packages.
#
# latex_keep_old_macro_names = True
# If false, no module index is generated.
#
# latex_domain_indices = True
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'home-assistant', 'Home Assistant Documentation',
[author], 1)
]
# If true, show URL addresses after external links.
#
# man_show_urls = False
# -- Options for Texinfo output -------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'Home-Assistant', 'Home Assistant Documentation',
author, 'Home Assistant', 'Open-source home automation platform.',
'Miscellaneous'),
]
# Documents to append as an appendix to all manuals.
#
# texinfo_appendices = []
# If false, no module index is generated.
#
# texinfo_domain_indices = True
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#
# texinfo_show_urls = 'footnote'
# If true, do not generate a @detailmenu in the "Top" node's menu.
#
# texinfo_no_detailmenu = False

22
docs/source/index.rst Normal file
View File

@@ -0,0 +1,22 @@
================================
Home Assistant API Documentation
================================
Public API documentation for `Home Assistant developers`_.
Contents:
.. toctree::
:maxdepth: 2
:glob:
api/*
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
.. _Home Assistant developers: https://home-assistant.io/developers/

View File

@@ -2,7 +2,7 @@ swagger: '2.0'
info: info:
title: Home Assistant title: Home Assistant
description: Home Assistant REST API description: Home Assistant REST API
version: "1.0.0" version: "1.0.1"
# the domain of the service # the domain of the service
host: localhost:8123 host: localhost:8123
@@ -12,17 +12,17 @@ schemes:
- https - https
securityDefinitions: securityDefinitions:
api_key: #api_key:
type: apiKey
description: API password
name: api_password
in: query
# api_key:
# type: apiKey # type: apiKey
# description: API password # description: API password
# name: x-ha-access # name: api_password
# in: header # in: query
api_key:
type: apiKey
description: API password
name: x-ha-access
in: header
# will be prefixed to all paths # will be prefixed to all paths
basePath: /api basePath: /api
@@ -38,6 +38,8 @@ paths:
description: Returns message if API is up and running. description: Returns message if API is up and running.
tags: tags:
- Core - Core
security:
- api_key: []
responses: responses:
200: 200:
description: API is up and running description: API is up and running
@@ -53,6 +55,8 @@ paths:
description: Returns the current configuration as JSON. description: Returns the current configuration as JSON.
tags: tags:
- Core - Core
security:
- api_key: []
responses: responses:
200: 200:
description: Current configuration description: Current configuration
@@ -81,6 +85,8 @@ paths:
summary: Returns all data needed to bootstrap Home Assistant. summary: Returns all data needed to bootstrap Home Assistant.
tags: tags:
- Core - Core
security:
- api_key: []
responses: responses:
200: 200:
description: Bootstrap information description: Bootstrap information
@@ -96,6 +102,8 @@ paths:
description: Returns an array of event objects. Each event object contain event name and listener count. description: Returns an array of event objects. Each event object contain event name and listener count.
tags: tags:
- Events - Events
security:
- api_key: []
responses: responses:
200: 200:
description: Events description: Events
@@ -113,6 +121,8 @@ paths:
description: Returns an array of service objects. Each object contains the domain and which services it contains. description: Returns an array of service objects. Each object contains the domain and which services it contains.
tags: tags:
- Services - Services
security:
- api_key: []
responses: responses:
200: 200:
description: Services description: Services
@@ -130,6 +140,8 @@ paths:
description: Returns an array of state changes in the past. Each object contains further detail for the entities. description: Returns an array of state changes in the past. Each object contains further detail for the entities.
tags: tags:
- State - State
security:
- api_key: []
responses: responses:
200: 200:
description: State changes description: State changes
@@ -148,6 +160,8 @@ paths:
Returns an array of state objects. Each state has the following attributes: entity_id, state, last_changed and attributes. Returns an array of state objects. Each state has the following attributes: entity_id, state, last_changed and attributes.
tags: tags:
- State - State
security:
- api_key: []
responses: responses:
200: 200:
description: States description: States
@@ -166,6 +180,8 @@ paths:
Returns a state object for specified entity_id. Returns a state object for specified entity_id.
tags: tags:
- State - State
security:
- api_key: []
parameters: parameters:
- name: entity_id - name: entity_id
in: path in: path
@@ -223,6 +239,8 @@ paths:
Retrieve all errors logged during the current session of Home Assistant as a plaintext response. Retrieve all errors logged during the current session of Home Assistant as a plaintext response.
tags: tags:
- Core - Core
security:
- api_key: []
produces: produces:
- text/plain - text/plain
responses: responses:
@@ -239,6 +257,8 @@ paths:
Returns the data (image) from the specified camera entity_id. Returns the data (image) from the specified camera entity_id.
tags: tags:
- Camera - Camera
security:
- api_key: []
produces: produces:
- image/jpeg - image/jpeg
parameters: parameters:
@@ -262,6 +282,8 @@ paths:
Fires an event with event_type Fires an event with event_type
tags: tags:
- Events - Events
security:
- api_key: []
consumes: consumes:
- application/json - application/json
parameters: parameters:
@@ -286,6 +308,8 @@ paths:
Calls a service within a specific domain. Will return when the service has been executed or 10 seconds has past, whichever comes first. Calls a service within a specific domain. Will return when the service has been executed or 10 seconds has past, whichever comes first.
tags: tags:
- Services - Services
security:
- api_key: []
consumes: consumes:
- application/json - application/json
parameters: parameters:
@@ -317,6 +341,8 @@ paths:
Render a Home Assistant template. Render a Home Assistant template.
tags: tags:
- Template - Template
security:
- api_key: []
consumes: consumes:
- application/json - application/json
produces: produces:
@@ -338,6 +364,8 @@ paths:
Setup event forwarding to another Home Assistant instance. Setup event forwarding to another Home Assistant instance.
tags: tags:
- Core - Core
security:
- api_key: []
consumes: consumes:
- application/json - application/json
parameters: parameters:
@@ -376,6 +404,8 @@ paths:
tags: tags:
- Core - Core
- Events - Events
security:
- api_key: []
produces: produces:
- text/event-stream - text/event-stream
parameters: parameters:
@@ -419,8 +449,17 @@ definitions:
description: Longitude of Home Assistant server description: Longitude of Home Assistant server
location_name: location_name:
type: string type: string
temperature_unit: unit_system:
type: string type: object
properties:
length:
type: string
mass:
type: string
temperature:
type: string
volume:
type: string
time_zone: time_zone:
type: string type: string
version: version:

View File

@@ -14,18 +14,64 @@ from homeassistant.const import (
__version__, __version__,
EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_START,
REQUIRED_PYTHON_VER, REQUIRED_PYTHON_VER,
REQUIRED_PYTHON_VER_WIN,
RESTART_EXIT_CODE, RESTART_EXIT_CODE,
) )
from homeassistant.util.async import run_callback_threadsafe
def monkey_patch_asyncio():
"""Replace weakref.WeakSet to address Python 3 bug.
Under heavy threading operations that schedule calls into
the asyncio event loop, Task objects are created. Due to
a bug in Python, GC may have an issue when switching between
the threads and objects with __del__ (which various components
in HASS have).
This monkey-patch removes the weakref.Weakset, and replaces it
with an object that ignores the only call utilizing it (the
Task.__init__ which calls _all_tasks.add(self)). It also removes
the __del__ which could trigger the future objects __del__ at
unpredictable times.
The side-effect of this manipulation of the Task is that
Task.all_tasks() is no longer accurate, and there will be no
warning emitted if a Task is GC'd while in use.
On Python 3.6, after the bug is fixed, this monkey-patch can be
disabled.
See https://bugs.python.org/issue26617 for details of the Python
bug.
"""
# pylint: disable=no-self-use, protected-access, bare-except
import asyncio.tasks
class IgnoreCalls:
"""Ignore add calls."""
def add(self, other):
"""No-op add."""
return
asyncio.tasks.Task._all_tasks = IgnoreCalls()
try:
del asyncio.tasks.Task.__del__
except:
pass
def validate_python() -> None: def validate_python() -> None:
"""Validate we're running the right Python version.""" """Validate we're running the right Python version."""
major, minor = sys.version_info[:2] if sys.platform == "win32" and \
req_major, req_minor = REQUIRED_PYTHON_VER sys.version_info[:3] < REQUIRED_PYTHON_VER_WIN:
print("Home Assistant requires at least Python {}.{}.{}".format(
if major < req_major or (major == req_major and minor < req_minor): *REQUIRED_PYTHON_VER_WIN))
print("Home Assistant requires at least Python {}.{}".format( sys.exit(1)
req_major, req_minor)) elif sys.version_info[:3] < REQUIRED_PYTHON_VER:
print("Home Assistant requires at least Python {}.{}.{}".format(
*REQUIRED_PYTHON_VER))
sys.exit(1) sys.exit(1)
@@ -256,12 +302,14 @@ def setup_and_run_hass(config_dir: str,
import webbrowser import webbrowser
webbrowser.open(hass.config.api.base_url) webbrowser.open(hass.config.api.base_url)
hass.bus.listen_once(EVENT_HOMEASSISTANT_START, open_browser) run_callback_threadsafe(
hass.loop,
hass.bus.async_listen_once,
EVENT_HOMEASSISTANT_START, open_browser
)
hass.start() hass.start()
exit_code = int(hass.block_till_stopped()) return hass.exit_code
return exit_code
def try_to_restart() -> None: def try_to_restart() -> None:
@@ -274,7 +322,7 @@ def try_to_restart() -> None:
# thread left (which is us). Nothing we really do with it, but it might be # thread left (which is us). Nothing we really do with it, but it might be
# useful when debugging shutdown/restart issues. # useful when debugging shutdown/restart issues.
try: try:
nthreads = sum(thread.isAlive() and not thread.isDaemon() nthreads = sum(thread.is_alive() and not thread.daemon
for thread in threading.enumerate()) for thread in threading.enumerate())
if nthreads > 1: if nthreads > 1:
sys.stderr.write( sys.stderr.write(
@@ -308,6 +356,8 @@ def try_to_restart() -> None:
def main() -> int: def main() -> int:
"""Start Home Assistant.""" """Start Home Assistant."""
monkey_patch_asyncio()
validate_python() validate_python()
args = get_arguments() args = get_arguments()

View File

@@ -1,57 +1,76 @@
"""Provides methods to bootstrap a home assistant instance.""" """Provides methods to bootstrap a home assistant instance."""
import asyncio
import logging import logging
import logging.handlers import logging.handlers
import os import os
import sys import sys
from collections import defaultdict from collections import OrderedDict
from threading import RLock
from types import ModuleType from types import ModuleType
from typing import Any, Optional, Dict from typing import Any, Optional, Dict
import voluptuous as vol import voluptuous as vol
from voluptuous.humanize import humanize_error
import homeassistant.components as core_components import homeassistant.components as core_components
from homeassistant.components import group, persistent_notification from homeassistant.components import persistent_notification
import homeassistant.config as conf_util import homeassistant.config as conf_util
import homeassistant.core as core import homeassistant.core as core
import homeassistant.helpers.config_validation as cv
import homeassistant.loader as loader import homeassistant.loader as loader
import homeassistant.util.package as pkg_util import homeassistant.util.package as pkg_util
from homeassistant.util.async import (
run_coroutine_threadsafe, run_callback_threadsafe)
from homeassistant.util.yaml import clear_secret_cache
from homeassistant.const import EVENT_COMPONENT_LOADED, PLATFORM_FORMAT from homeassistant.const import EVENT_COMPONENT_LOADED, PLATFORM_FORMAT
from homeassistant.exceptions import HomeAssistantError from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers import ( from homeassistant.helpers import (
event_decorators, service, config_per_platform, extract_domain_configs) event_decorators, service, config_per_platform, extract_domain_configs)
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
_SETUP_LOCK = RLock()
_CURRENT_SETUP = []
ATTR_COMPONENT = 'component' ATTR_COMPONENT = 'component'
ERROR_LOG_FILENAME = 'home-assistant.log' ERROR_LOG_FILENAME = 'home-assistant.log'
_PERSISTENT_ERRORS = {}
HA_COMPONENT_URL = '[{}](https://home-assistant.io/components/{}/)'
def setup_component(hass: core.HomeAssistant, domain: str, def setup_component(hass: core.HomeAssistant, domain: str,
config: Optional[Dict]=None) -> bool: config: Optional[Dict]=None) -> bool:
"""Setup a component and all its dependencies.""" """Setup a component and all its dependencies."""
return run_coroutine_threadsafe(
async_setup_component(hass, domain, config), loop=hass.loop).result()
@asyncio.coroutine
def async_setup_component(hass: core.HomeAssistant, domain: str,
config: Optional[Dict]=None) -> bool:
"""Setup a component and all its dependencies.
This method is a coroutine.
"""
if domain in hass.config.components: if domain in hass.config.components:
_LOGGER.debug('Component %s already set up.', domain)
return True return True
_ensure_loader_prepared(hass) if not loader.PREPARED:
yield from hass.loop.run_in_executor(None, loader.prepare, hass)
if config is None: if config is None:
config = defaultdict(dict) config = {}
components = loader.load_order_component(domain) components = loader.load_order_component(domain)
# OrderedSet is empty if component or dependencies could not be resolved # OrderedSet is empty if component or dependencies could not be resolved
if not components: if not components:
_async_persistent_notification(hass, domain, True)
return False return False
for component in components: for component in components:
if not _setup_component(hass, component, config): res = yield from _async_setup_component(hass, component, config)
if not res:
_LOGGER.error('Component %s failed to setup', component)
_async_persistent_notification(hass, component, True)
return False return False
return True return True
@@ -59,7 +78,10 @@ def setup_component(hass: core.HomeAssistant, domain: str,
def _handle_requirements(hass: core.HomeAssistant, component, def _handle_requirements(hass: core.HomeAssistant, component,
name: str) -> bool: name: str) -> bool:
"""Install the requirements for a component.""" """Install the requirements for a component.
This method needs to run in an executor.
"""
if hass.config.skip_pip or not hasattr(component, 'REQUIREMENTS'): if hass.config.skip_pip or not hasattr(component, 'REQUIREMENTS'):
return True return True
@@ -67,124 +89,196 @@ def _handle_requirements(hass: core.HomeAssistant, component,
if not pkg_util.install_package(req, target=hass.config.path('deps')): if not pkg_util.install_package(req, target=hass.config.path('deps')):
_LOGGER.error('Not initializing %s because could not install ' _LOGGER.error('Not initializing %s because could not install '
'dependency %s', name, req) 'dependency %s', name, req)
_async_persistent_notification(hass, name)
return False return False
return True return True
def _setup_component(hass: core.HomeAssistant, domain: str, config) -> bool: @asyncio.coroutine
"""Setup a component for Home Assistant.""" def _async_setup_component(hass: core.HomeAssistant,
# pylint: disable=too-many-return-statements,too-many-branches domain: str, config) -> bool:
# pylint: disable=too-many-statements """Setup a component for Home Assistant.
This method is a coroutine.
"""
# pylint: disable=too-many-return-statements
if domain in hass.config.components: if domain in hass.config.components:
return True return True
with _SETUP_LOCK: setup_lock = hass.data.get('setup_lock')
# It might have been loaded while waiting for lock if setup_lock is None:
if domain in hass.config.components: setup_lock = hass.data['setup_lock'] = asyncio.Lock(loop=hass.loop)
return True
if domain in _CURRENT_SETUP: setup_progress = hass.data.get('setup_progress')
_LOGGER.error('Attempt made to setup %s during setup of %s', if setup_progress is None:
domain, domain) setup_progress = hass.data['setup_progress'] = []
if domain in setup_progress:
_LOGGER.error('Attempt made to setup %s during setup of %s',
domain, domain)
_async_persistent_notification(hass, domain, True)
return False
try:
# Used to indicate to discovery that a setup is ongoing and allow it
# to wait till it is done.
did_lock = False
if not setup_lock.locked():
yield from setup_lock.acquire()
did_lock = True
setup_progress.append(domain)
config = yield from async_prepare_setup_component(hass, config, domain)
if config is None:
return False return False
component = loader.get_component(domain) component = loader.get_component(domain)
missing_deps = [dep for dep in getattr(component, 'DEPENDENCIES', []) if component is None:
if dep not in hass.config.components] _async_persistent_notification(hass, domain)
if missing_deps:
_LOGGER.error(
'Not initializing %s because not all dependencies loaded: %s',
domain, ", ".join(missing_deps))
return False return False
if hasattr(component, 'CONFIG_SCHEMA'): async_comp = hasattr(component, 'async_setup')
try:
config = component.CONFIG_SCHEMA(config)
except vol.MultipleInvalid as ex:
cv.log_exception(_LOGGER, ex, domain, config)
return False
elif hasattr(component, 'PLATFORM_SCHEMA'):
platforms = []
for p_name, p_config in config_per_platform(config, domain):
# Validate component specific platform schema
try:
p_validated = component.PLATFORM_SCHEMA(p_config)
except vol.MultipleInvalid as ex:
cv.log_exception(_LOGGER, ex, domain, p_config)
return False
# Not all platform components follow same pattern for platforms
# So if p_name is None we are not going to validate platform
# (the automation component is one of them)
if p_name is None:
platforms.append(p_validated)
continue
platform = prepare_setup_platform(hass, config, domain,
p_name)
if platform is None:
return False
# Validate platform specific schema
if hasattr(platform, 'PLATFORM_SCHEMA'):
try:
p_validated = platform.PLATFORM_SCHEMA(p_validated)
except vol.MultipleInvalid as ex:
cv.log_exception(_LOGGER, ex, '{}.{}'
.format(domain, p_name), p_validated)
return False
platforms.append(p_validated)
# Create a copy of the configuration with all config for current
# component removed and add validated config back in.
filter_keys = extract_domain_configs(config, domain)
config = {key: value for key, value in config.items()
if key not in filter_keys}
config[domain] = platforms
if not _handle_requirements(hass, component, domain):
return False
_CURRENT_SETUP.append(domain)
try: try:
result = component.setup(hass, config) _LOGGER.info("Setting up %s", domain)
if result is False: if async_comp:
_LOGGER.error('component %s failed to initialize', domain) result = yield from component.async_setup(hass, config)
return False else:
elif result is not True: result = yield from hass.loop.run_in_executor(
_LOGGER.error('component %s did not return boolean if setup ' None, component.setup, hass, config)
'was successful. Disabling component.', domain)
loader.set_component(domain, None)
return False
except Exception: # pylint: disable=broad-except except Exception: # pylint: disable=broad-except
_LOGGER.exception('Error during setup of component %s', domain) _LOGGER.exception('Error during setup of component %s', domain)
_async_persistent_notification(hass, domain, True)
return False
if result is False:
_LOGGER.error('component %s failed to initialize', domain)
_async_persistent_notification(hass, domain, True)
return False
elif result is not True:
_LOGGER.error('component %s did not return boolean if setup '
'was successful. Disabling component.', domain)
_async_persistent_notification(hass, domain, True)
loader.set_component(domain, None)
return False return False
finally:
_CURRENT_SETUP.remove(domain)
hass.config.components.append(component.DOMAIN) hass.config.components.append(component.DOMAIN)
# Assumption: if a component does not depend on groups hass.bus.async_fire(
# it communicates with devices EVENT_COMPONENT_LOADED, {ATTR_COMPONENT: component.DOMAIN}
if group.DOMAIN not in getattr(component, 'DEPENDENCIES', []): )
hass.pool.add_worker()
hass.bus.fire(
EVENT_COMPONENT_LOADED, {ATTR_COMPONENT: component.DOMAIN})
return True return True
finally:
setup_progress.remove(domain)
if did_lock:
setup_lock.release()
def prepare_setup_component(hass: core.HomeAssistant, config: dict,
domain: str):
"""Prepare setup of a component and return processed config."""
return run_coroutine_threadsafe(
async_prepare_setup_component(hass, config, domain), loop=hass.loop
).result()
@asyncio.coroutine
def async_prepare_setup_component(hass: core.HomeAssistant, config: dict,
domain: str):
"""Prepare setup of a component and return processed config.
This method is a coroutine.
"""
# pylint: disable=too-many-return-statements
component = loader.get_component(domain)
missing_deps = [dep for dep in getattr(component, 'DEPENDENCIES', [])
if dep not in hass.config.components]
if missing_deps:
_LOGGER.error(
'Not initializing %s because not all dependencies loaded: %s',
domain, ", ".join(missing_deps))
return None
if hasattr(component, 'CONFIG_SCHEMA'):
try:
config = component.CONFIG_SCHEMA(config)
except vol.Invalid as ex:
async_log_exception(ex, domain, config, hass)
return None
elif hasattr(component, 'PLATFORM_SCHEMA'):
platforms = []
for p_name, p_config in config_per_platform(config, domain):
# Validate component specific platform schema
try:
p_validated = component.PLATFORM_SCHEMA(p_config)
except vol.Invalid as ex:
async_log_exception(ex, domain, config, hass)
continue
# Not all platform components follow same pattern for platforms
# So if p_name is None we are not going to validate platform
# (the automation component is one of them)
if p_name is None:
platforms.append(p_validated)
continue
platform = yield from async_prepare_setup_platform(
hass, config, domain, p_name)
if platform is None:
continue
# Validate platform specific schema
if hasattr(platform, 'PLATFORM_SCHEMA'):
try:
# pylint: disable=no-member
p_validated = platform.PLATFORM_SCHEMA(p_validated)
except vol.Invalid as ex:
async_log_exception(ex, '{}.{}'.format(domain, p_name),
p_validated, hass)
continue
platforms.append(p_validated)
# Create a copy of the configuration with all config for current
# component removed and add validated config back in.
filter_keys = extract_domain_configs(config, domain)
config = {key: value for key, value in config.items()
if key not in filter_keys}
config[domain] = platforms
res = yield from hass.loop.run_in_executor(
None, _handle_requirements, hass, component, domain)
if not res:
return None
return config
def prepare_setup_platform(hass: core.HomeAssistant, config, domain: str, def prepare_setup_platform(hass: core.HomeAssistant, config, domain: str,
platform_name: str) -> Optional[ModuleType]: platform_name: str) -> Optional[ModuleType]:
"""Load a platform and makes sure dependencies are setup.""" """Load a platform and makes sure dependencies are setup."""
_ensure_loader_prepared(hass) return run_coroutine_threadsafe(
async_prepare_setup_platform(hass, config, domain, platform_name),
loop=hass.loop
).result()
@asyncio.coroutine
def async_prepare_setup_platform(hass: core.HomeAssistant, config, domain: str,
platform_name: str) \
-> Optional[ModuleType]:
"""Load a platform and makes sure dependencies are setup.
This method is a coroutine.
"""
if not loader.PREPARED:
yield from hass.loop.run_in_executor(None, loader.prepare, hass)
platform_path = PLATFORM_FORMAT.format(domain, platform_name) platform_path = PLATFORM_FORMAT.format(domain, platform_name)
@@ -193,6 +287,7 @@ def prepare_setup_platform(hass: core.HomeAssistant, config, domain: str,
# Not found # Not found
if platform is None: if platform is None:
_LOGGER.error('Unable to find platform %s', platform_path) _LOGGER.error('Unable to find platform %s', platform_path)
_async_persistent_notification(hass, platform_path)
return None return None
# Already loaded # Already loaded
@@ -201,20 +296,23 @@ def prepare_setup_platform(hass: core.HomeAssistant, config, domain: str,
# Load dependencies # Load dependencies
for component in getattr(platform, 'DEPENDENCIES', []): for component in getattr(platform, 'DEPENDENCIES', []):
if not setup_component(hass, component, config): res = yield from async_setup_component(hass, component, config)
if not res:
_LOGGER.error( _LOGGER.error(
'Unable to prepare setup for platform %s because ' 'Unable to prepare setup for platform %s because '
'dependency %s could not be initialized', platform_path, 'dependency %s could not be initialized', platform_path,
component) component)
_async_persistent_notification(hass, platform_path, True)
return None return None
if not _handle_requirements(hass, platform, platform_path): res = yield from hass.loop.run_in_executor(
None, _handle_requirements, hass, platform, platform_path)
if not res:
return None return None
return platform return platform
# pylint: disable=too-many-branches, too-many-statements, too-many-arguments
def from_config_dict(config: Dict[str, Any], def from_config_dict(config: Dict[str, Any],
hass: Optional[core.HomeAssistant]=None, hass: Optional[core.HomeAssistant]=None,
config_dir: Optional[str]=None, config_dir: Optional[str]=None,
@@ -232,17 +330,58 @@ def from_config_dict(config: Dict[str, Any],
if config_dir is not None: if config_dir is not None:
config_dir = os.path.abspath(config_dir) config_dir = os.path.abspath(config_dir)
hass.config.config_dir = config_dir hass.config.config_dir = config_dir
_mount_local_lib_path(config_dir) mount_local_lib_path(config_dir)
@asyncio.coroutine
def _async_init_from_config_dict(future):
try:
re_hass = yield from async_from_config_dict(
config, hass, config_dir, enable_log, verbose, skip_pip,
log_rotate_days)
future.set_result(re_hass)
# pylint: disable=broad-except
except Exception as exc:
future.set_exception(exc)
# run task
future = asyncio.Future(loop=hass.loop)
hass.async_add_job(_async_init_from_config_dict(future))
hass.loop.run_until_complete(future)
return future.result()
@asyncio.coroutine
def async_from_config_dict(config: Dict[str, Any],
hass: core.HomeAssistant,
config_dir: Optional[str]=None,
enable_log: bool=True,
verbose: bool=False,
skip_pip: bool=False,
log_rotate_days: Any=None) \
-> Optional[core.HomeAssistant]:
"""Try to configure Home Assistant from a config dict.
Dynamically loads required components and its dependencies.
This method is a coroutine.
"""
hass.async_track_tasks()
setup_lock = hass.data.get('setup_lock')
if setup_lock is None:
setup_lock = hass.data['setup_lock'] = asyncio.Lock(loop=hass.loop)
yield from setup_lock.acquire()
core_config = config.get(core.DOMAIN, {}) core_config = config.get(core.DOMAIN, {})
try: try:
conf_util.process_ha_core_config(hass, core_config) yield from conf_util.async_process_ha_core_config(hass, core_config)
except vol.Invalid as ex: except vol.Invalid as ex:
cv.log_exception(_LOGGER, ex, 'homeassistant', core_config) async_log_exception(ex, 'homeassistant', core_config, hass)
return None return None
conf_util.process_ha_config_upgrade(hass) yield from hass.loop.run_in_executor(
None, conf_util.process_ha_config_upgrade, hass)
if enable_log: if enable_log:
enable_logging(hass, verbose, log_rotate_days) enable_logging(hass, verbose, log_rotate_days)
@@ -252,24 +391,30 @@ def from_config_dict(config: Dict[str, Any],
_LOGGER.warning('Skipping pip installation of required modules. ' _LOGGER.warning('Skipping pip installation of required modules. '
'This may cause issues.') 'This may cause issues.')
_ensure_loader_prepared(hass) if not loader.PREPARED:
yield from hass.loop.run_in_executor(None, loader.prepare, hass)
# Make a copy because we are mutating it. # Make a copy because we are mutating it.
# Convert it to defaultdict so components can always have config dict # Use OrderedDict in case original one was one.
# Convert values to dictionaries if they are None # Convert values to dictionaries if they are None
config = defaultdict( new_config = OrderedDict()
dict, {key: value or {} for key, value in config.items()}) for key, value in config.items():
new_config[key] = value or {}
config = new_config
# Filter out the repeating and common config section [homeassistant] # Filter out the repeating and common config section [homeassistant]
components = set(key.split(' ')[0] for key in config.keys() components = set(key.split(' ')[0] for key in config.keys()
if key != core.DOMAIN) if key != core.DOMAIN)
if not core_components.setup(hass, config): # setup components
# pylint: disable=not-an-iterable
res = yield from core_components.async_setup(hass, config)
if not res:
_LOGGER.error('Home Assistant core failed to initialize. ' _LOGGER.error('Home Assistant core failed to initialize. '
'Further initialization aborted.') 'Further initialization aborted.')
return hass return hass
persistent_notification.setup(hass, config) yield from persistent_notification.async_setup(hass, config)
_LOGGER.info('Home Assistant core initialized') _LOGGER.info('Home Assistant core initialized')
@@ -279,7 +424,11 @@ def from_config_dict(config: Dict[str, Any],
# Setup the components # Setup the components
for domain in loader.load_order_components(components): for domain in loader.load_order_components(components):
_setup_component(hass, domain, config) yield from _async_setup_component(hass, domain, config)
setup_lock.release()
yield from hass.async_stop_track_tasks()
return hass return hass
@@ -297,28 +446,71 @@ def from_config_file(config_path: str,
if hass is None: if hass is None:
hass = core.HomeAssistant() hass = core.HomeAssistant()
@asyncio.coroutine
def _async_init_from_config_file(future):
try:
re_hass = yield from async_from_config_file(
config_path, hass, verbose, skip_pip, log_rotate_days)
future.set_result(re_hass)
# pylint: disable=broad-except
except Exception as exc:
future.set_exception(exc)
# run task
future = asyncio.Future(loop=hass.loop)
hass.loop.create_task(_async_init_from_config_file(future))
hass.loop.run_until_complete(future)
return future.result()
@asyncio.coroutine
def async_from_config_file(config_path: str,
hass: core.HomeAssistant,
verbose: bool=False,
skip_pip: bool=True,
log_rotate_days: Any=None):
"""Read the configuration file and try to start all the functionality.
Will add functionality to 'hass' parameter.
This method is a coroutine.
"""
# Set config dir to directory holding config file # Set config dir to directory holding config file
config_dir = os.path.abspath(os.path.dirname(config_path)) config_dir = os.path.abspath(os.path.dirname(config_path))
hass.config.config_dir = config_dir hass.config.config_dir = config_dir
_mount_local_lib_path(config_dir) yield from hass.loop.run_in_executor(
None, mount_local_lib_path, config_dir)
enable_logging(hass, verbose, log_rotate_days) enable_logging(hass, verbose, log_rotate_days)
try: try:
config_dict = conf_util.load_yaml_config_file(config_path) config_dict = yield from hass.loop.run_in_executor(
None, conf_util.load_yaml_config_file, config_path)
except HomeAssistantError: except HomeAssistantError:
return None return None
finally:
clear_secret_cache()
return from_config_dict(config_dict, hass, enable_log=False, hass = yield from async_from_config_dict(
skip_pip=skip_pip) config_dict, hass, enable_log=False, skip_pip=skip_pip)
return hass
def enable_logging(hass: core.HomeAssistant, verbose: bool=False, def enable_logging(hass: core.HomeAssistant, verbose: bool=False,
log_rotate_days=None) -> None: log_rotate_days=None) -> None:
"""Setup the logging.""" """Setup the logging.
Async friendly.
"""
logging.basicConfig(level=logging.INFO) logging.basicConfig(level=logging.INFO)
fmt = ("%(log_color)s%(asctime)s %(levelname)s (%(threadName)s) " fmt = ("%(log_color)s%(asctime)s %(levelname)s (%(threadName)s) "
"[%(name)s] %(message)s%(reset)s") "[%(name)s] %(message)s%(reset)s")
# suppress overly verbose logs from libraries that aren't helpful
logging.getLogger("requests").setLevel(logging.WARNING)
logging.getLogger("urllib3").setLevel(logging.WARNING)
logging.getLogger("aiohttp.access").setLevel(logging.WARNING)
try: try:
from colorlog import ColoredFormatter from colorlog import ColoredFormatter
logging.getLogger().handlers[0].setFormatter(ColoredFormatter( logging.getLogger().handlers[0].setFormatter(ColoredFormatter(
@@ -365,12 +557,63 @@ def enable_logging(hass: core.HomeAssistant, verbose: bool=False,
'Unable to setup error log %s (access denied)', err_log_path) 'Unable to setup error log %s (access denied)', err_log_path)
def _ensure_loader_prepared(hass: core.HomeAssistant) -> None: def log_exception(ex, domain, config, hass):
"""Ensure Home Assistant loader is prepared.""" """Generate log exception for config validation."""
if not loader.PREPARED: run_callback_threadsafe(
loader.prepare(hass) hass.loop, async_log_exception, ex, domain, config, hass).result()
def _mount_local_lib_path(config_dir: str) -> None: @core.callback
"""Add local library to Python Path.""" def _async_persistent_notification(hass: core.HomeAssistant, component: str,
sys.path.insert(0, os.path.join(config_dir, 'deps')) link: Optional[bool]=False):
"""Print a persistent notification.
This method must be run in the event loop.
"""
_PERSISTENT_ERRORS[component] = _PERSISTENT_ERRORS.get(component) or link
_lst = [HA_COMPONENT_URL.format(name.replace('_', '-'), name)
if link else name for name, link in _PERSISTENT_ERRORS.items()]
message = ('The following components and platforms could not be set up:\n'
'* ' + '\n* '.join(list(_lst)) + '\nPlease check your config')
persistent_notification.async_create(
hass, message, 'Invalid config', 'invalid_config')
@core.callback
def async_log_exception(ex, domain, config, hass):
"""Generate log exception for config validation.
This method must be run in the event loop.
"""
message = 'Invalid config for [{}]: '.format(domain)
if hass is not None:
_async_persistent_notification(hass, domain, True)
if 'extra keys not allowed' in ex.error_message:
message += '[{}] is an invalid option for [{}]. Check: {}->{}.'\
.format(ex.path[-1], domain, domain,
'->'.join(str(m) for m in ex.path))
else:
message += '{}.'.format(humanize_error(config, ex))
domain_config = config.get(domain, config)
message += " (See {}:{}). ".format(
getattr(domain_config, '__config_file__', '?'),
getattr(domain_config, '__line__', '?'))
if domain != 'homeassistant':
message += ('Please check the docs at '
'https://home-assistant.io/components/{}/'.format(domain))
_LOGGER.error(message)
def mount_local_lib_path(config_dir: str) -> str:
"""Add local library to Python Path.
Async friendly.
"""
deps_dir = os.path.join(config_dir, 'deps')
if deps_dir not in sys.path:
sys.path.insert(0, os.path.join(config_dir, 'deps'))
return deps_dir

View File

@@ -7,11 +7,11 @@ Component design guidelines:
format "<DOMAIN>.<OBJECT_ID>". format "<DOMAIN>.<OBJECT_ID>".
- Each component should publish services only under its own domain. - Each component should publish services only under its own domain.
""" """
import asyncio
import itertools as it import itertools as it
import logging import logging
import homeassistant.core as ha import homeassistant.core as ha
from homeassistant.helpers.entity import split_entity_id
from homeassistant.helpers.service import extract_entity_ids from homeassistant.helpers.service import extract_entity_ids
from homeassistant.loader import get_component from homeassistant.loader import get_component
from homeassistant.const import ( from homeassistant.const import (
@@ -35,7 +35,7 @@ def is_on(hass, entity_id=None):
entity_ids = hass.states.entity_ids() entity_ids = hass.states.entity_ids()
for entity_id in entity_ids: for entity_id in entity_ids:
domain = split_entity_id(entity_id)[0] domain = ha.split_entity_id(entity_id)[0]
module = get_component(domain) module = get_component(domain)
@@ -80,8 +80,10 @@ def reload_core_config(hass):
hass.services.call(ha.DOMAIN, SERVICE_RELOAD_CORE_CONFIG) hass.services.call(ha.DOMAIN, SERVICE_RELOAD_CORE_CONFIG)
def setup(hass, config): @asyncio.coroutine
def async_setup(hass, config):
"""Setup general services related to Home Assistant.""" """Setup general services related to Home Assistant."""
@asyncio.coroutine
def handle_turn_service(service): def handle_turn_service(service):
"""Method to handle calls to homeassistant.turn_on/off.""" """Method to handle calls to homeassistant.turn_on/off."""
entity_ids = extract_entity_ids(hass, service) entity_ids = extract_entity_ids(hass, service)
@@ -95,7 +97,9 @@ def setup(hass, config):
# Group entity_ids by domain. groupby requires sorted data. # Group entity_ids by domain. groupby requires sorted data.
by_domain = it.groupby(sorted(entity_ids), by_domain = it.groupby(sorted(entity_ids),
lambda item: split_entity_id(item)[0]) lambda item: ha.split_entity_id(item)[0])
tasks = []
for domain, ent_ids in by_domain: for domain, ent_ids in by_domain:
# We want to block for all calls and only return when all calls # We want to block for all calls and only return when all calls
@@ -112,27 +116,34 @@ def setup(hass, config):
# ent_ids is a generator, convert it to a list. # ent_ids is a generator, convert it to a list.
data[ATTR_ENTITY_ID] = list(ent_ids) data[ATTR_ENTITY_ID] = list(ent_ids)
hass.services.call(domain, service.service, data, blocking) tasks.append(hass.services.async_call(
domain, service.service, data, blocking))
hass.services.register(ha.DOMAIN, SERVICE_TURN_OFF, handle_turn_service) yield from asyncio.wait(tasks, loop=hass.loop)
hass.services.register(ha.DOMAIN, SERVICE_TURN_ON, handle_turn_service)
hass.services.register(ha.DOMAIN, SERVICE_TOGGLE, handle_turn_service)
hass.services.async_register(
ha.DOMAIN, SERVICE_TURN_OFF, handle_turn_service)
hass.services.async_register(
ha.DOMAIN, SERVICE_TURN_ON, handle_turn_service)
hass.services.async_register(
ha.DOMAIN, SERVICE_TOGGLE, handle_turn_service)
@asyncio.coroutine
def handle_reload_config(call): def handle_reload_config(call):
"""Service handler for reloading core config.""" """Service handler for reloading core config."""
from homeassistant.exceptions import HomeAssistantError from homeassistant.exceptions import HomeAssistantError
from homeassistant import config as conf_util from homeassistant import config as conf_util
try: try:
path = conf_util.find_config_file(hass.config.config_dir) conf = yield from conf_util.async_hass_config_yaml(hass)
conf = conf_util.load_yaml_config_file(path)
except HomeAssistantError as err: except HomeAssistantError as err:
_LOGGER.error(err) _LOGGER.error(err)
return return
conf_util.process_ha_core_config(hass, conf.get(ha.DOMAIN) or {}) yield from conf_util.async_process_ha_core_config(
hass, conf.get(ha.DOMAIN) or {})
hass.services.register(ha.DOMAIN, SERVICE_RELOAD_CORE_CONFIG, hass.services.async_register(
handle_reload_config) ha.DOMAIN, SERVICE_RELOAD_CORE_CONFIG, handle_reload_config)
return True return True

View File

@@ -20,6 +20,7 @@ from homeassistant.helpers.entity_component import EntityComponent
DOMAIN = 'alarm_control_panel' DOMAIN = 'alarm_control_panel'
SCAN_INTERVAL = 30 SCAN_INTERVAL = 30
ATTR_CHANGED_BY = 'changed_by'
ENTITY_ID_FORMAT = DOMAIN + '.{}' ENTITY_ID_FORMAT = DOMAIN + '.{}'
@@ -124,6 +125,11 @@ class AlarmControlPanel(Entity):
"""Regex for code format or None if no code is required.""" """Regex for code format or None if no code is required."""
return None return None
@property
def changed_by(self):
"""Last change triggered by."""
return None
def alarm_disarm(self, code=None): def alarm_disarm(self, code=None):
"""Send disarm command.""" """Send disarm command."""
raise NotImplementedError() raise NotImplementedError()
@@ -145,5 +151,6 @@ class AlarmControlPanel(Entity):
"""Return the state attributes.""" """Return the state attributes."""
state_attr = { state_attr = {
ATTR_CODE_FORMAT: self.code_format, ATTR_CODE_FORMAT: self.code_format,
ATTR_CHANGED_BY: self.changed_by
} }
return state_attr return state_attr

View File

@@ -6,38 +6,42 @@ https://home-assistant.io/components/alarm_control_panel.alarmdotcom/
""" """
import logging import logging
import voluptuous as vol
import homeassistant.components.alarm_control_panel as alarm import homeassistant.components.alarm_control_panel as alarm
from homeassistant.components.alarm_control_panel import PLATFORM_SCHEMA
from homeassistant.const import ( from homeassistant.const import (
CONF_PASSWORD, CONF_USERNAME, STATE_ALARM_ARMED_AWAY, CONF_PASSWORD, CONF_USERNAME, STATE_ALARM_ARMED_AWAY,
STATE_ALARM_ARMED_HOME, STATE_ALARM_DISARMED, STATE_UNKNOWN) STATE_ALARM_ARMED_HOME, STATE_ALARM_DISARMED, STATE_UNKNOWN, CONF_CODE,
CONF_NAME)
_LOGGER = logging.getLogger(__name__) import homeassistant.helpers.config_validation as cv
REQUIREMENTS = ['https://github.com/Xorso/pyalarmdotcom' REQUIREMENTS = ['https://github.com/Xorso/pyalarmdotcom'
'/archive/0.1.1.zip' '/archive/0.1.1.zip'
'#pyalarmdotcom==0.1.1'] '#pyalarmdotcom==0.1.1']
_LOGGER = logging.getLogger(__name__)
DEFAULT_NAME = 'Alarm.com' DEFAULT_NAME = 'Alarm.com'
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Required(CONF_PASSWORD): cv.string,
vol.Required(CONF_USERNAME): cv.string,
vol.Optional(CONF_CODE): cv.positive_int,
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
})
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup an Alarm.com control panel.""" """Setup an Alarm.com control panel."""
name = config.get(CONF_NAME)
code = config.get(CONF_CODE)
username = config.get(CONF_USERNAME) username = config.get(CONF_USERNAME)
password = config.get(CONF_PASSWORD) password = config.get(CONF_PASSWORD)
if username is None or password is None: add_devices([AlarmDotCom(hass, name, code, username, password)], True)
_LOGGER.error('Must specify username and password!')
return False
add_devices([AlarmDotCom(hass,
config.get('name', DEFAULT_NAME),
config.get('code'),
username,
password)])
# pylint: disable=too-many-arguments, too-many-instance-attributes
# pylint: disable=abstract-method
class AlarmDotCom(alarm.AlarmControlPanel): class AlarmDotCom(alarm.AlarmControlPanel):
"""Represent an Alarm.com status.""" """Represent an Alarm.com status."""
@@ -50,12 +54,17 @@ class AlarmDotCom(alarm.AlarmControlPanel):
self._code = str(code) if code else None self._code = str(code) if code else None
self._username = username self._username = username
self._password = password self._password = password
self._state = STATE_UNKNOWN
@property @property
def should_poll(self): def should_poll(self):
"""No polling needed.""" """No polling needed."""
return True return True
def update(self):
"""Fetch the latest state."""
self._state = self._alarm.state
@property @property
def name(self): def name(self):
"""Return the name of the alarm.""" """Return the name of the alarm."""
@@ -69,18 +78,18 @@ class AlarmDotCom(alarm.AlarmControlPanel):
@property @property
def state(self): def state(self):
"""Return the state of the device.""" """Return the state of the device."""
if self._alarm.state == 'Disarmed': if self._state == 'Disarmed':
return STATE_ALARM_DISARMED return STATE_ALARM_DISARMED
elif self._alarm.state == 'Armed Stay': elif self._state == 'Armed Stay':
return STATE_ALARM_ARMED_HOME return STATE_ALARM_ARMED_HOME
elif self._alarm.state == 'Armed Away': elif self._state == 'Armed Away':
return STATE_ALARM_ARMED_AWAY return STATE_ALARM_ARMED_AWAY
else: else:
return STATE_UNKNOWN return STATE_UNKNOWN
def alarm_disarm(self, code=None): def alarm_disarm(self, code=None):
"""Send disarm command.""" """Send disarm command."""
if not self._validate_code(code, 'arming home'): if not self._validate_code(code, 'disarming home'):
return return
from pyalarmdotcom.pyalarmdotcom import Alarmdotcom from pyalarmdotcom.pyalarmdotcom import Alarmdotcom
# Open another session to alarm.com to fire off the command # Open another session to alarm.com to fire off the command

View File

@@ -0,0 +1,132 @@
"""
Support for Concord232 alarm control panels.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/alarm_control_panel.concord232/
"""
import datetime
import logging
import requests
import voluptuous as vol
import homeassistant.components.alarm_control_panel as alarm
from homeassistant.components.alarm_control_panel import PLATFORM_SCHEMA
from homeassistant.const import (
CONF_HOST, CONF_NAME, CONF_PORT, STATE_ALARM_ARMED_AWAY,
STATE_ALARM_ARMED_HOME, STATE_ALARM_DISARMED, STATE_UNKNOWN)
import homeassistant.helpers.config_validation as cv
REQUIREMENTS = ['concord232==0.14']
_LOGGER = logging.getLogger(__name__)
DEFAULT_HOST = 'localhost'
DEFAULT_NAME = 'CONCORD232'
DEFAULT_PORT = 5007
SCAN_INTERVAL = 1
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Optional(CONF_PORT, default=DEFAULT_PORT): cv.port,
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
vol.Optional(CONF_HOST, default=DEFAULT_HOST): cv.string,
})
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Set up the Concord232 alarm control panel platform."""
name = config.get(CONF_NAME)
host = config.get(CONF_HOST)
port = config.get(CONF_PORT)
url = 'http://{}:{}'.format(host, port)
try:
add_devices([Concord232Alarm(hass, url, name)])
except requests.exceptions.ConnectionError as ex:
_LOGGER.error("Unable to connect to Concord232: %s", str(ex))
return False
class Concord232Alarm(alarm.AlarmControlPanel):
"""Represents the Concord232-based alarm panel."""
def __init__(self, hass, url, name):
"""Initialize the Concord232 alarm panel."""
from concord232 import client as concord232_client
self._state = STATE_UNKNOWN
self._hass = hass
self._name = name
self._url = url
try:
client = concord232_client.Client(self._url)
except requests.exceptions.ConnectionError as ex:
_LOGGER.error("Unable to connect to Concord232: %s", str(ex))
self._alarm = client
self._alarm.partitions = self._alarm.list_partitions()
self._alarm.last_partition_update = datetime.datetime.now()
self.update()
@property
def should_poll(self):
"""Polling needed."""
return True
@property
def name(self):
"""Return the name of the device."""
return self._name
@property
def code_format(self):
"""The characters if code is defined."""
return '[0-9]{4}([0-9]{2})?'
@property
def state(self):
"""Return the state of the device."""
return self._state
def update(self):
"""Update values from API."""
try:
part = self._alarm.list_partitions()[0]
except requests.exceptions.ConnectionError as ex:
_LOGGER.error("Unable to connect to %(host)s: %(reason)s",
dict(host=self._url, reason=ex))
newstate = STATE_UNKNOWN
except IndexError:
_LOGGER.error("Concord232 reports no partitions")
newstate = STATE_UNKNOWN
if part['arming_level'] == 'Off':
newstate = STATE_ALARM_DISARMED
elif 'Home' in part['arming_level']:
newstate = STATE_ALARM_ARMED_HOME
else:
newstate = STATE_ALARM_ARMED_AWAY
if not newstate == self._state:
_LOGGER.info("State Chnage from %s to %s", self._state, newstate)
self._state = newstate
return self._state
def alarm_disarm(self, code=None):
"""Send disarm command."""
self._alarm.disarm(code)
def alarm_arm_home(self, code=None):
"""Send arm home command."""
self._alarm.arm('home')
def alarm_arm_away(self, code=None):
"""Send arm away command."""
self._alarm.arm('auto')
def alarm_trigger(self, code=None):
"""Alarm trigger command."""
raise NotImplementedError()

View File

@@ -10,5 +10,5 @@ import homeassistant.components.alarm_control_panel.manual as manual
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the Demo alarm control panel platform.""" """Setup the Demo alarm control panel platform."""
add_devices([ add_devices([
manual.ManualAlarm(hass, 'Alarm', '1234', 5, 10), manual.ManualAlarm(hass, 'Alarm', '1234', 5, 10, False),
]) ])

View File

@@ -4,28 +4,52 @@ Support for Envisalink-based alarm control panels (Honeywell/DSC).
For more details about this platform, please refer to the documentation at For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/alarm_control_panel.envisalink/ https://home-assistant.io/components/alarm_control_panel.envisalink/
""" """
from os import path
import logging import logging
import voluptuous as vol
import homeassistant.components.alarm_control_panel as alarm import homeassistant.components.alarm_control_panel as alarm
from homeassistant.components.envisalink import (EVL_CONTROLLER, import homeassistant.helpers.config_validation as cv
EnvisalinkDevice, from homeassistant.config import load_yaml_config_file
PARTITION_SCHEMA, from homeassistant.components.envisalink import (
CONF_CODE, EVL_CONTROLLER, EnvisalinkDevice, PARTITION_SCHEMA, CONF_CODE, CONF_PANIC,
CONF_PARTITIONNAME, CONF_PARTITIONNAME, SIGNAL_PARTITION_UPDATE, SIGNAL_KEYPAD_UPDATE)
SIGNAL_PARTITION_UPDATE,
SIGNAL_KEYPAD_UPDATE)
from homeassistant.const import ( from homeassistant.const import (
STATE_ALARM_ARMED_AWAY, STATE_ALARM_ARMED_HOME, STATE_ALARM_DISARMED, STATE_ALARM_ARMED_AWAY, STATE_ALARM_ARMED_HOME, STATE_ALARM_DISARMED,
STATE_UNKNOWN, STATE_ALARM_TRIGGERED) STATE_UNKNOWN, STATE_ALARM_TRIGGERED, STATE_ALARM_PENDING, ATTR_ENTITY_ID)
_LOGGER = logging.getLogger(__name__)
DEPENDENCIES = ['envisalink'] DEPENDENCIES = ['envisalink']
_LOGGER = logging.getLogger(__name__)
DEVICES = []
SERVICE_ALARM_KEYPRESS = 'envisalink_alarm_keypress'
ATTR_KEYPRESS = 'keypress'
ALARM_KEYPRESS_SCHEMA = vol.Schema({
vol.Required(ATTR_ENTITY_ID): cv.entity_ids,
vol.Required(ATTR_KEYPRESS): cv.string
})
def alarm_keypress_handler(service):
"""Map services to methods on Alarm."""
entity_ids = service.data.get(ATTR_ENTITY_ID)
keypress = service.data.get(ATTR_KEYPRESS)
_target_devices = [device for device in DEVICES
if device.entity_id in entity_ids]
for device in _target_devices:
EnvisalinkAlarm.alarm_keypress(device, keypress)
# pylint: disable=unused-argument # pylint: disable=unused-argument
def setup_platform(hass, config, add_devices_callback, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"""Perform the setup for Envisalink alarm panels.""" """Perform the setup for Envisalink alarm panels."""
_configured_partitions = discovery_info['partitions'] _configured_partitions = discovery_info['partitions']
_code = discovery_info[CONF_CODE] _code = discovery_info[CONF_CODE]
_panic_type = discovery_info[CONF_PANIC]
for part_num in _configured_partitions: for part_num in _configured_partitions:
_device_config_data = PARTITION_SCHEMA( _device_config_data = PARTITION_SCHEMA(
_configured_partitions[part_num]) _configured_partitions[part_num])
@@ -33,73 +57,108 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None):
part_num, part_num,
_device_config_data[CONF_PARTITIONNAME], _device_config_data[CONF_PARTITIONNAME],
_code, _code,
_panic_type,
EVL_CONTROLLER.alarm_state['partition'][part_num], EVL_CONTROLLER.alarm_state['partition'][part_num],
EVL_CONTROLLER) EVL_CONTROLLER)
add_devices_callback([_device]) DEVICES.append(_device)
add_devices(DEVICES)
# Register Envisalink specific services
descriptions = load_yaml_config_file(
path.join(path.dirname(__file__), 'services.yaml'))
hass.services.register(alarm.DOMAIN, SERVICE_ALARM_KEYPRESS,
alarm_keypress_handler,
descriptions.get(SERVICE_ALARM_KEYPRESS),
schema=ALARM_KEYPRESS_SCHEMA)
return True return True
class EnvisalinkAlarm(EnvisalinkDevice, alarm.AlarmControlPanel): class EnvisalinkAlarm(EnvisalinkDevice, alarm.AlarmControlPanel):
"""Represents the Envisalink-based alarm panel.""" """Representation of an Envisalink-based alarm panel."""
# pylint: disable=too-many-arguments def __init__(self, partition_number, alarm_name, code, panic_type, info,
def __init__(self, partition_number, alarm_name, code, info, controller): controller):
"""Initialize the alarm panel.""" """Initialize the alarm panel."""
from pydispatch import dispatcher from pydispatch import dispatcher
self._partition_number = partition_number self._partition_number = partition_number
self._code = code self._code = code
_LOGGER.debug('Setting up alarm: ' + alarm_name) self._panic_type = panic_type
_LOGGER.debug("Setting up alarm: %s", alarm_name)
EnvisalinkDevice.__init__(self, alarm_name, info, controller) EnvisalinkDevice.__init__(self, alarm_name, info, controller)
dispatcher.connect(self._update_callback, dispatcher.connect(
signal=SIGNAL_PARTITION_UPDATE, self._update_callback, signal=SIGNAL_PARTITION_UPDATE,
sender=dispatcher.Any) sender=dispatcher.Any)
dispatcher.connect(self._update_callback, dispatcher.connect(
signal=SIGNAL_KEYPAD_UPDATE, self._update_callback, signal=SIGNAL_KEYPAD_UPDATE,
sender=dispatcher.Any) sender=dispatcher.Any)
def _update_callback(self, partition): def _update_callback(self, partition):
"""Update HA state, if needed.""" """Update HA state, if needed."""
if partition is None or int(partition) == self._partition_number: if partition is None or int(partition) == self._partition_number:
self.update_ha_state() self.hass.async_add_job(self.update_ha_state)
@property @property
def code_format(self): def code_format(self):
"""The characters if code is defined.""" """Regex for code format or None if no code is required."""
return self._code if self._code:
return None
else:
return '^\\d{4,6}$'
@property @property
def state(self): def state(self):
"""Return the state of the device.""" """Return the state of the device."""
state = STATE_UNKNOWN
if self._info['status']['alarm']: if self._info['status']['alarm']:
return STATE_ALARM_TRIGGERED state = STATE_ALARM_TRIGGERED
elif self._info['status']['armed_away']: elif self._info['status']['armed_away']:
return STATE_ALARM_ARMED_AWAY state = STATE_ALARM_ARMED_AWAY
elif self._info['status']['armed_stay']: elif self._info['status']['armed_stay']:
return STATE_ALARM_ARMED_HOME state = STATE_ALARM_ARMED_HOME
elif self._info['status']['exit_delay']:
state = STATE_ALARM_PENDING
elif self._info['status']['entry_delay']:
state = STATE_ALARM_PENDING
elif self._info['status']['alpha']: elif self._info['status']['alpha']:
return STATE_ALARM_DISARMED state = STATE_ALARM_DISARMED
else: return state
return STATE_UNKNOWN
def alarm_disarm(self, code=None): def alarm_disarm(self, code=None):
"""Send disarm command.""" """Send disarm command."""
if self._code: if code:
EVL_CONTROLLER.disarm_partition(str(code), EVL_CONTROLLER.disarm_partition(str(code),
self._partition_number) self._partition_number)
else:
EVL_CONTROLLER.disarm_partition(str(self._code),
self._partition_number)
def alarm_arm_home(self, code=None): def alarm_arm_home(self, code=None):
"""Send arm home command.""" """Send arm home command."""
if self._code: if code:
EVL_CONTROLLER.arm_stay_partition(str(code), EVL_CONTROLLER.arm_stay_partition(str(code),
self._partition_number) self._partition_number)
else:
EVL_CONTROLLER.arm_stay_partition(str(self._code),
self._partition_number)
def alarm_arm_away(self, code=None): def alarm_arm_away(self, code=None):
"""Send arm away command.""" """Send arm away command."""
if self._code: if code:
EVL_CONTROLLER.arm_away_partition(str(code), EVL_CONTROLLER.arm_away_partition(str(code),
self._partition_number) self._partition_number)
else:
EVL_CONTROLLER.arm_away_partition(str(self._code),
self._partition_number)
def alarm_trigger(self, code=None): def alarm_trigger(self, code=None):
"""Alarm trigger command. Not possible for us.""" """Alarm trigger command. Will be used to trigger a panic alarm."""
raise NotImplementedError() EVL_CONTROLLER.panic_alarm(self._panic_type)
def alarm_keypress(self, keypress=None):
"""Send custom keypress."""
if keypress:
EVL_CONTROLLER.keypresses_to_partition(self._partition_number,
keypress)

View File

@@ -7,43 +7,61 @@ https://home-assistant.io/components/alarm_control_panel.manual/
import datetime import datetime
import logging import logging
import voluptuous as vol
import homeassistant.components.alarm_control_panel as alarm import homeassistant.components.alarm_control_panel as alarm
import homeassistant.util.dt as dt_util import homeassistant.util.dt as dt_util
from homeassistant.const import ( from homeassistant.const import (
STATE_ALARM_ARMED_AWAY, STATE_ALARM_ARMED_HOME, STATE_ALARM_DISARMED, STATE_ALARM_ARMED_AWAY, STATE_ALARM_ARMED_HOME, STATE_ALARM_DISARMED,
STATE_ALARM_PENDING, STATE_ALARM_TRIGGERED) STATE_ALARM_PENDING, STATE_ALARM_TRIGGERED, CONF_PLATFORM, CONF_NAME,
CONF_CODE, CONF_PENDING_TIME, CONF_TRIGGER_TIME, CONF_DISARM_AFTER_TRIGGER)
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.event import track_point_in_time from homeassistant.helpers.event import track_point_in_time
_LOGGER = logging.getLogger(__name__)
DEFAULT_ALARM_NAME = 'HA Alarm' DEFAULT_ALARM_NAME = 'HA Alarm'
DEFAULT_PENDING_TIME = 60 DEFAULT_PENDING_TIME = 60
DEFAULT_TRIGGER_TIME = 120 DEFAULT_TRIGGER_TIME = 120
DEFAULT_DISARM_AFTER_TRIGGER = False
PLATFORM_SCHEMA = vol.Schema({
vol.Required(CONF_PLATFORM): 'manual',
vol.Optional(CONF_NAME, default=DEFAULT_ALARM_NAME): cv.string,
vol.Optional(CONF_CODE): cv.string,
vol.Optional(CONF_PENDING_TIME, default=DEFAULT_PENDING_TIME):
vol.All(vol.Coerce(int), vol.Range(min=0)),
vol.Optional(CONF_TRIGGER_TIME, default=DEFAULT_TRIGGER_TIME):
vol.All(vol.Coerce(int), vol.Range(min=1)),
vol.Optional(CONF_DISARM_AFTER_TRIGGER,
default=DEFAULT_DISARM_AFTER_TRIGGER): cv.boolean,
})
_LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the manual alarm platform.""" """Setup the manual alarm platform."""
add_devices([ManualAlarm( add_devices([ManualAlarm(
hass, hass,
config.get('name', DEFAULT_ALARM_NAME), config[CONF_NAME],
config.get('code'), config.get(CONF_CODE),
config.get('pending_time', DEFAULT_PENDING_TIME), config.get(CONF_PENDING_TIME, DEFAULT_PENDING_TIME),
config.get('trigger_time', DEFAULT_TRIGGER_TIME), config.get(CONF_TRIGGER_TIME, DEFAULT_TRIGGER_TIME),
config.get(CONF_DISARM_AFTER_TRIGGER, DEFAULT_DISARM_AFTER_TRIGGER)
)]) )])
# pylint: disable=too-many-arguments, too-many-instance-attributes
# pylint: disable=abstract-method
class ManualAlarm(alarm.AlarmControlPanel): class ManualAlarm(alarm.AlarmControlPanel):
""" """
Represents an alarm status. Represents an alarm status.
When armed, will be pending for 'pending_time', after that armed. When armed, will be pending for 'pending_time', after that armed.
When triggered, will be pending for 'trigger_time'. After that will be When triggered, will be pending for 'trigger_time'. After that will be
triggered for 'trigger_time', after that we return to disarmed. triggered for 'trigger_time', after that we return to the previous state
or disarm if `disarm_after_trigger` is true.
""" """
def __init__(self, hass, name, code, pending_time, trigger_time): def __init__(self, hass, name, code, pending_time,
trigger_time, disarm_after_trigger):
"""Initalize the manual alarm panel.""" """Initalize the manual alarm panel."""
self._state = STATE_ALARM_DISARMED self._state = STATE_ALARM_DISARMED
self._hass = hass self._hass = hass
@@ -51,6 +69,8 @@ class ManualAlarm(alarm.AlarmControlPanel):
self._code = str(code) if code else None self._code = str(code) if code else None
self._pending_time = datetime.timedelta(seconds=pending_time) self._pending_time = datetime.timedelta(seconds=pending_time)
self._trigger_time = datetime.timedelta(seconds=trigger_time) self._trigger_time = datetime.timedelta(seconds=trigger_time)
self._disarm_after_trigger = disarm_after_trigger
self._pre_trigger_state = self._state
self._state_ts = None self._state_ts = None
@property @property
@@ -77,7 +97,10 @@ class ManualAlarm(alarm.AlarmControlPanel):
return STATE_ALARM_PENDING return STATE_ALARM_PENDING
elif (self._state_ts + self._pending_time + elif (self._state_ts + self._pending_time +
self._trigger_time) < dt_util.utcnow(): self._trigger_time) < dt_util.utcnow():
return STATE_ALARM_DISARMED if self._disarm_after_trigger:
return STATE_ALARM_DISARMED
else:
return self._pre_trigger_state
return self._state return self._state
@@ -106,7 +129,7 @@ class ManualAlarm(alarm.AlarmControlPanel):
if self._pending_time: if self._pending_time:
track_point_in_time( track_point_in_time(
self._hass, self.update_ha_state, self._hass, self.async_update_ha_state,
self._state_ts + self._pending_time) self._state_ts + self._pending_time)
def alarm_arm_away(self, code=None): def alarm_arm_away(self, code=None):
@@ -120,22 +143,23 @@ class ManualAlarm(alarm.AlarmControlPanel):
if self._pending_time: if self._pending_time:
track_point_in_time( track_point_in_time(
self._hass, self.update_ha_state, self._hass, self.async_update_ha_state,
self._state_ts + self._pending_time) self._state_ts + self._pending_time)
def alarm_trigger(self, code=None): def alarm_trigger(self, code=None):
"""Send alarm trigger command. No code needed.""" """Send alarm trigger command. No code needed."""
self._pre_trigger_state = self._state
self._state = STATE_ALARM_TRIGGERED self._state = STATE_ALARM_TRIGGERED
self._state_ts = dt_util.utcnow() self._state_ts = dt_util.utcnow()
self.update_ha_state() self.update_ha_state()
if self._trigger_time: if self._trigger_time:
track_point_in_time( track_point_in_time(
self._hass, self.update_ha_state, self._hass, self.async_update_ha_state,
self._state_ts + self._pending_time) self._state_ts + self._pending_time)
track_point_in_time( track_point_in_time(
self._hass, self.update_ha_state, self._hass, self.async_update_ha_state,
self._state_ts + self._pending_time + self._trigger_time) self._state_ts + self._pending_time + self._trigger_time)
def _validate_code(self, code, state): def _validate_code(self, code, state):

View File

@@ -13,33 +13,31 @@ import homeassistant.components.mqtt as mqtt
from homeassistant.const import ( from homeassistant.const import (
STATE_ALARM_ARMED_AWAY, STATE_ALARM_ARMED_HOME, STATE_ALARM_DISARMED, STATE_ALARM_ARMED_AWAY, STATE_ALARM_ARMED_HOME, STATE_ALARM_DISARMED,
STATE_ALARM_PENDING, STATE_ALARM_TRIGGERED, STATE_UNKNOWN, STATE_ALARM_PENDING, STATE_ALARM_TRIGGERED, STATE_UNKNOWN,
CONF_NAME) CONF_NAME, CONF_CODE)
from homeassistant.components.mqtt import ( from homeassistant.components.mqtt import (
CONF_STATE_TOPIC, CONF_COMMAND_TOPIC, CONF_QOS) CONF_STATE_TOPIC, CONF_COMMAND_TOPIC, CONF_QOS)
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
DEPENDENCIES = ['mqtt']
CONF_PAYLOAD_DISARM = 'payload_disarm' CONF_PAYLOAD_DISARM = 'payload_disarm'
CONF_PAYLOAD_ARM_HOME = 'payload_arm_home' CONF_PAYLOAD_ARM_HOME = 'payload_arm_home'
CONF_PAYLOAD_ARM_AWAY = 'payload_arm_away' CONF_PAYLOAD_ARM_AWAY = 'payload_arm_away'
CONF_CODE = 'code'
DEFAULT_NAME = "MQTT Alarm" DEFAULT_ARM_AWAY = 'ARM_AWAY'
DEFAULT_DISARM = "DISARM" DEFAULT_ARM_HOME = 'ARM_HOME'
DEFAULT_ARM_HOME = "ARM_HOME" DEFAULT_DISARM = 'DISARM'
DEFAULT_ARM_AWAY = "ARM_AWAY" DEFAULT_NAME = 'MQTT Alarm'
DEPENDENCIES = ['mqtt']
PLATFORM_SCHEMA = mqtt.MQTT_BASE_PLATFORM_SCHEMA.extend({ PLATFORM_SCHEMA = mqtt.MQTT_BASE_PLATFORM_SCHEMA.extend({
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
vol.Required(CONF_STATE_TOPIC): mqtt.valid_subscribe_topic,
vol.Required(CONF_COMMAND_TOPIC): mqtt.valid_publish_topic, vol.Required(CONF_COMMAND_TOPIC): mqtt.valid_publish_topic,
vol.Optional(CONF_PAYLOAD_DISARM, default=DEFAULT_DISARM): cv.string, vol.Required(CONF_STATE_TOPIC): mqtt.valid_subscribe_topic,
vol.Optional(CONF_PAYLOAD_ARM_HOME, default=DEFAULT_ARM_HOME): cv.string,
vol.Optional(CONF_PAYLOAD_ARM_AWAY, default=DEFAULT_ARM_AWAY): cv.string,
vol.Optional(CONF_CODE): cv.string, vol.Optional(CONF_CODE): cv.string,
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
vol.Optional(CONF_PAYLOAD_ARM_AWAY, default=DEFAULT_ARM_AWAY): cv.string,
vol.Optional(CONF_PAYLOAD_ARM_HOME, default=DEFAULT_ARM_HOME): cv.string,
vol.Optional(CONF_PAYLOAD_DISARM, default=DEFAULT_DISARM): cv.string,
}) })
@@ -47,20 +45,18 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the MQTT platform.""" """Setup the MQTT platform."""
add_devices([MqttAlarm( add_devices([MqttAlarm(
hass, hass,
config[CONF_NAME], config.get(CONF_NAME),
config[CONF_STATE_TOPIC], config.get(CONF_STATE_TOPIC),
config[CONF_COMMAND_TOPIC], config.get(CONF_COMMAND_TOPIC),
config[CONF_QOS], config.get(CONF_QOS),
config[CONF_PAYLOAD_DISARM], config.get(CONF_PAYLOAD_DISARM),
config[CONF_PAYLOAD_ARM_HOME], config.get(CONF_PAYLOAD_ARM_HOME),
config[CONF_PAYLOAD_ARM_AWAY], config.get(CONF_PAYLOAD_ARM_AWAY),
config.get(CONF_CODE))]) config.get(CONF_CODE))])
# pylint: disable=too-many-arguments, too-many-instance-attributes
# pylint: disable=abstract-method
class MqttAlarm(alarm.AlarmControlPanel): class MqttAlarm(alarm.AlarmControlPanel):
"""Represent a MQTT alarm status.""" """Representation of a MQTT alarm status."""
def __init__(self, hass, name, state_topic, command_topic, qos, def __init__(self, hass, name, state_topic, command_topic, qos,
payload_disarm, payload_arm_home, payload_arm_away, code): payload_disarm, payload_arm_home, payload_arm_away, code):

View File

@@ -7,22 +7,40 @@ https://home-assistant.io/components/alarm_control_panel.nx584/
import logging import logging
import requests import requests
import voluptuous as vol
import homeassistant.components.alarm_control_panel as alarm import homeassistant.components.alarm_control_panel as alarm
from homeassistant.components.alarm_control_panel import PLATFORM_SCHEMA
from homeassistant.const import ( from homeassistant.const import (
STATE_ALARM_ARMED_AWAY, STATE_ALARM_ARMED_HOME, STATE_ALARM_DISARMED, STATE_ALARM_ARMED_AWAY, STATE_ALARM_ARMED_HOME, STATE_ALARM_DISARMED,
STATE_UNKNOWN) STATE_UNKNOWN, CONF_NAME, CONF_HOST, CONF_PORT)
import homeassistant.helpers.config_validation as cv
REQUIREMENTS = ['pynx584==0.2'] REQUIREMENTS = ['pynx584==0.2']
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
DEFAULT_HOST = 'localhost'
DEFAULT_NAME = 'NX584'
DEFAULT_PORT = 5007
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Optional(CONF_PORT, default=DEFAULT_PORT): cv.port,
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
vol.Optional(CONF_HOST, default=DEFAULT_HOST): cv.string,
})
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup nx584 platform.""" """Setup nx584 platform."""
host = config.get('host', 'localhost:5007') name = config.get(CONF_NAME)
host = config.get(CONF_HOST)
port = config.get(CONF_PORT)
url = 'http://{}:{}'.format(host, port)
try: try:
add_devices([NX584Alarm(hass, host, config.get('name', 'NX584'))]) add_devices([NX584Alarm(hass, url, name)])
except requests.exceptions.ConnectionError as ex: except requests.exceptions.ConnectionError as ex:
_LOGGER.error('Unable to connect to NX584: %s', str(ex)) _LOGGER.error('Unable to connect to NX584: %s', str(ex))
return False return False
@@ -31,17 +49,18 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
class NX584Alarm(alarm.AlarmControlPanel): class NX584Alarm(alarm.AlarmControlPanel):
"""Represents the NX584-based alarm panel.""" """Represents the NX584-based alarm panel."""
def __init__(self, hass, host, name): def __init__(self, hass, url, name):
"""Initalize the nx584 alarm panel.""" """Initalize the nx584 alarm panel."""
from nx584 import client from nx584 import client
self._hass = hass self._hass = hass
self._host = host
self._name = name self._name = name
self._alarm = client.Client('http://%s' % host) self._url = url
self._alarm = client.Client(self._url)
# Do an initial list operation so that we will try to actually # Do an initial list operation so that we will try to actually
# talk to the API and trigger a requests exception for setup_platform() # talk to the API and trigger a requests exception for setup_platform()
# to catch # to catch
self._alarm.list_zones() self._alarm.list_zones()
self._state = STATE_UNKNOWN
@property @property
def should_poll(self): def should_poll(self):
@@ -61,16 +80,20 @@ class NX584Alarm(alarm.AlarmControlPanel):
@property @property
def state(self): def state(self):
"""Return the state of the device.""" """Return the state of the device."""
return self._state
def update(self):
"""Process new events from panel."""
try: try:
part = self._alarm.list_partitions()[0] part = self._alarm.list_partitions()[0]
zones = self._alarm.list_zones() zones = self._alarm.list_zones()
except requests.exceptions.ConnectionError as ex: except requests.exceptions.ConnectionError as ex:
_LOGGER.error('Unable to connect to %(host)s: %(reason)s', _LOGGER.error('Unable to connect to %(host)s: %(reason)s',
dict(host=self._host, reason=ex)) dict(host=self._url, reason=ex))
return STATE_UNKNOWN self._state = STATE_UNKNOWN
except IndexError: except IndexError:
_LOGGER.error('nx584 reports no partitions') _LOGGER.error('nx584 reports no partitions')
return STATE_UNKNOWN self._state = STATE_UNKNOWN
bypassed = False bypassed = False
for zone in zones: for zone in zones:
@@ -82,11 +105,11 @@ class NX584Alarm(alarm.AlarmControlPanel):
break break
if not part['armed']: if not part['armed']:
return STATE_ALARM_DISARMED self._state = STATE_ALARM_DISARMED
elif bypassed: elif bypassed:
return STATE_ALARM_ARMED_HOME self._state = STATE_ALARM_ARMED_HOME
else: else:
return STATE_ALARM_ARMED_AWAY self._state = STATE_ALARM_ARMED_AWAY
def alarm_disarm(self, code=None): def alarm_disarm(self, code=None):
"""Send disarm command.""" """Send disarm command."""
@@ -94,11 +117,11 @@ class NX584Alarm(alarm.AlarmControlPanel):
def alarm_arm_home(self, code=None): def alarm_arm_home(self, code=None):
"""Send arm home command.""" """Send arm home command."""
self._alarm.arm('home') self._alarm.arm('stay')
def alarm_arm_away(self, code=None): def alarm_arm_away(self, code=None):
"""Send arm away command.""" """Send arm away command."""
self._alarm.arm('auto') self._alarm.arm('exit')
def alarm_trigger(self, code=None): def alarm_trigger(self, code=None):
"""Alarm trigger command.""" """Alarm trigger command."""

View File

@@ -0,0 +1,54 @@
alarm_disarm:
description: Send the alarm the command for disarm
fields:
entity_id:
description: Name of alarm control panel to disarm
example: 'alarm_control_panel.downstairs'
code:
description: An optional code to disarm the alarm control panel with
example: 1234
alarm_arm_home:
description: Send the alarm the command for arm home
fields:
entity_id:
description: Name of alarm control panel to arm home
example: 'alarm_control_panel.downstairs'
code:
description: An optional code to arm home the alarm control panel with
example: 1234
alarm_arm_away:
description: Send the alarm the command for arm away
fields:
entity_id:
description: Name of alarm control panel to arm away
example: 'alarm_control_panel.downstairs'
code:
description: An optional code to arm away the alarm control panel with
example: 1234
alarm_trigger:
description: Send the alarm the command for trigger
fields:
entity_id:
description: Name of alarm control panel to trigger
example: 'alarm_control_panel.downstairs'
code:
description: An optional code to trigger the alarm control panel with
example: 1234
envisalink_alarm_keypress:
description: Send custom keypresses to the alarm
fields:
entity_id:
description: Name of the alarm control panel to trigger
example: 'alarm_control_panel.downstairs'
keypress:
description: 'String to send to the alarm panel (1-6 characters)'
example: '*71'

View File

@@ -6,35 +6,41 @@ https://home-assistant.io/components/alarm_control_panel.simplisafe/
""" """
import logging import logging
import voluptuous as vol
import homeassistant.components.alarm_control_panel as alarm import homeassistant.components.alarm_control_panel as alarm
from homeassistant.components.alarm_control_panel import PLATFORM_SCHEMA
from homeassistant.const import ( from homeassistant.const import (
CONF_PASSWORD, CONF_USERNAME, STATE_UNKNOWN, CONF_PASSWORD, CONF_USERNAME, STATE_UNKNOWN, CONF_CODE, CONF_NAME,
STATE_ALARM_DISARMED, STATE_ALARM_ARMED_HOME, STATE_ALARM_ARMED_AWAY) STATE_ALARM_DISARMED, STATE_ALARM_ARMED_HOME, STATE_ALARM_ARMED_AWAY)
import homeassistant.helpers.config_validation as cv
_LOGGER = logging.getLogger(__name__)
REQUIREMENTS = ['https://github.com/w1ll1am23/simplisafe-python/archive/' REQUIREMENTS = ['https://github.com/w1ll1am23/simplisafe-python/archive/'
'586fede0e85fd69e56e516aaa8e97eb644ca8866.zip#' '586fede0e85fd69e56e516aaa8e97eb644ca8866.zip#'
'simplisafe-python==0.0.1'] 'simplisafe-python==0.0.1']
_LOGGER = logging.getLogger(__name__)
DEFAULT_NAME = 'SimpliSafe'
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Required(CONF_PASSWORD): cv.string,
vol.Required(CONF_USERNAME): cv.string,
vol.Optional(CONF_CODE): cv.string,
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
})
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"""Set up the SimpliSafe platform.""" """Set up the SimpliSafe platform."""
name = config.get(CONF_NAME)
code = config.get(CONF_CODE)
username = config.get(CONF_USERNAME) username = config.get(CONF_USERNAME)
password = config.get(CONF_PASSWORD) password = config.get(CONF_PASSWORD)
if username is None or password is None: add_devices([SimpliSafeAlarm(name, username, password, code)])
_LOGGER.error('Must specify username and password!')
return False
add_devices([SimpliSafeAlarm(
config.get('name', "SimpliSafe"),
username,
password,
config.get('code'))])
# pylint: disable=abstract-method
class SimpliSafeAlarm(alarm.AlarmControlPanel): class SimpliSafeAlarm(alarm.AlarmControlPanel):
"""Representation a SimpliSafe alarm.""" """Representation a SimpliSafe alarm."""

View File

@@ -8,7 +8,7 @@ import logging
import homeassistant.components.alarm_control_panel as alarm import homeassistant.components.alarm_control_panel as alarm
from homeassistant.components.verisure import HUB as hub from homeassistant.components.verisure import HUB as hub
from homeassistant.components.verisure import (CONF_ALARM, CONF_CODE_DIGITS)
from homeassistant.const import ( from homeassistant.const import (
STATE_ALARM_ARMED_AWAY, STATE_ALARM_ARMED_HOME, STATE_ALARM_DISARMED, STATE_ALARM_ARMED_AWAY, STATE_ALARM_ARMED_HOME, STATE_ALARM_DISARMED,
STATE_UNKNOWN) STATE_UNKNOWN)
@@ -19,7 +19,7 @@ _LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the Verisure platform.""" """Setup the Verisure platform."""
alarms = [] alarms = []
if int(hub.config.get('alarm', '1')): if int(hub.config.get(CONF_ALARM, 1)):
hub.update_alarms() hub.update_alarms()
alarms.extend([ alarms.extend([
VerisureAlarm(value.id) VerisureAlarm(value.id)
@@ -28,7 +28,6 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
add_devices(alarms) add_devices(alarms)
# pylint: disable=abstract-method
class VerisureAlarm(alarm.AlarmControlPanel): class VerisureAlarm(alarm.AlarmControlPanel):
"""Represent a Verisure alarm status.""" """Represent a Verisure alarm status."""
@@ -36,7 +35,8 @@ class VerisureAlarm(alarm.AlarmControlPanel):
"""Initalize the Verisure alarm panel.""" """Initalize the Verisure alarm panel."""
self._id = device_id self._id = device_id
self._state = STATE_UNKNOWN self._state = STATE_UNKNOWN
self._digits = int(hub.config.get('code_digits', '4')) self._digits = hub.config.get(CONF_CODE_DIGITS)
self._changed_by = None
@property @property
def name(self): def name(self):
@@ -58,6 +58,11 @@ class VerisureAlarm(alarm.AlarmControlPanel):
"""The code format as regex.""" """The code format as regex."""
return '^\\d{%s}$' % self._digits return '^\\d{%s}$' % self._digits
@property
def changed_by(self):
"""Last change triggered by."""
return self._changed_by
def update(self): def update(self):
"""Update alarm status.""" """Update alarm status."""
hub.update_alarms() hub.update_alarms()
@@ -72,6 +77,7 @@ class VerisureAlarm(alarm.AlarmControlPanel):
_LOGGER.error( _LOGGER.error(
'Unknown alarm state %s', 'Unknown alarm state %s',
hub.alarm_status[self._id].status) hub.alarm_status[self._id].status)
self._changed_by = hub.alarm_status[self._id].name
def alarm_disarm(self, code=None): def alarm_disarm(self, code=None):
"""Send disarm command.""" """Send disarm command."""

View File

@@ -4,43 +4,124 @@ Support for Alexa skill service end point.
For more details about this component, please refer to the documentation at For more details about this component, please refer to the documentation at
https://home-assistant.io/components/alexa/ https://home-assistant.io/components/alexa/
""" """
import asyncio
import copy
import enum import enum
import logging import logging
import uuid
from datetime import datetime
import voluptuous as vol
from homeassistant.core import callback
from homeassistant.const import HTTP_BAD_REQUEST from homeassistant.const import HTTP_BAD_REQUEST
from homeassistant.helpers import template, script from homeassistant.helpers import template, script, config_validation as cv
from homeassistant.components.http import HomeAssistantView from homeassistant.components.http import HomeAssistantView
import homeassistant.util.dt as dt_util
_LOGGER = logging.getLogger(__name__)
INTENTS_API_ENDPOINT = '/api/alexa'
FLASH_BRIEFINGS_API_ENDPOINT = '/api/alexa/flash_briefings/{briefing_id}'
CONF_ACTION = 'action'
CONF_CARD = 'card'
CONF_INTENTS = 'intents'
CONF_SPEECH = 'speech'
CONF_TYPE = 'type'
CONF_TITLE = 'title'
CONF_CONTENT = 'content'
CONF_TEXT = 'text'
CONF_FLASH_BRIEFINGS = 'flash_briefings'
CONF_UID = 'uid'
CONF_DATE = 'date'
CONF_TITLE = 'title'
CONF_AUDIO = 'audio'
CONF_TEXT = 'text'
CONF_DISPLAY_URL = 'display_url'
ATTR_UID = 'uid'
ATTR_UPDATE_DATE = 'updateDate'
ATTR_TITLE_TEXT = 'titleText'
ATTR_STREAM_URL = 'streamUrl'
ATTR_MAIN_TEXT = 'mainText'
ATTR_REDIRECTION_URL = 'redirectionURL'
DATE_FORMAT = '%Y-%m-%dT%H:%M:%S.0Z'
DOMAIN = 'alexa' DOMAIN = 'alexa'
DEPENDENCIES = ['http'] DEPENDENCIES = ['http']
_LOGGER = logging.getLogger(__name__)
API_ENDPOINT = '/api/alexa' class SpeechType(enum.Enum):
"""The Alexa speech types."""
CONF_INTENTS = 'intents' plaintext = "PlainText"
CONF_CARD = 'card' ssml = "SSML"
CONF_SPEECH = 'speech'
CONF_ACTION = 'action'
class CardType(enum.Enum):
"""The Alexa card types."""
simple = "Simple"
link_account = "LinkAccount"
CONFIG_SCHEMA = vol.Schema({
DOMAIN: {
CONF_INTENTS: {
cv.string: {
vol.Optional(CONF_ACTION): cv.SCRIPT_SCHEMA,
vol.Optional(CONF_CARD): {
vol.Required(CONF_TYPE): cv.enum(CardType),
vol.Required(CONF_TITLE): cv.template,
vol.Required(CONF_CONTENT): cv.template,
},
vol.Optional(CONF_SPEECH): {
vol.Required(CONF_TYPE): cv.enum(SpeechType),
vol.Required(CONF_TEXT): cv.template,
}
}
},
CONF_FLASH_BRIEFINGS: {
cv.string: vol.All(cv.ensure_list, [{
vol.Required(CONF_UID, default=str(uuid.uuid4())): cv.string,
vol.Optional(CONF_DATE, default=datetime.utcnow()): cv.string,
vol.Required(CONF_TITLE): cv.template,
vol.Optional(CONF_AUDIO): cv.template,
vol.Required(CONF_TEXT, default=""): cv.template,
vol.Optional(CONF_DISPLAY_URL): cv.template,
}]),
}
}
}, extra=vol.ALLOW_EXTRA)
def setup(hass, config): def setup(hass, config):
"""Activate Alexa component.""" """Activate Alexa component."""
hass.wsgi.register_view(AlexaView(hass, intents = config[DOMAIN].get(CONF_INTENTS, {})
config[DOMAIN].get(CONF_INTENTS, {}))) flash_briefings = config[DOMAIN].get(CONF_FLASH_BRIEFINGS, {})
hass.http.register_view(AlexaIntentsView(hass, intents))
hass.http.register_view(AlexaFlashBriefingView(hass, flash_briefings))
return True return True
class AlexaView(HomeAssistantView): class AlexaIntentsView(HomeAssistantView):
"""Handle Alexa requests.""" """Handle Alexa requests."""
url = API_ENDPOINT url = INTENTS_API_ENDPOINT
name = 'api:alexa' name = 'api:alexa'
def __init__(self, hass, intents): def __init__(self, hass, intents):
"""Initialize Alexa view.""" """Initialize Alexa view."""
super().__init__(hass) super().__init__()
intents = copy.deepcopy(intents)
template.attach(hass, intents)
for name, intent in intents.items(): for name, intent in intents.items():
if CONF_ACTION in intent: if CONF_ACTION in intent:
@@ -49,9 +130,10 @@ class AlexaView(HomeAssistantView):
self.intents = intents self.intents = intents
@asyncio.coroutine
def post(self, request): def post(self, request):
"""Handle Alexa.""" """Handle Alexa."""
data = request.json data = yield from request.json()
_LOGGER.debug('Received Alexa request: %s', data) _LOGGER.debug('Received Alexa request: %s', data)
@@ -68,7 +150,7 @@ class AlexaView(HomeAssistantView):
return None return None
intent = req.get('intent') intent = req.get('intent')
response = AlexaResponse(self.hass, intent) response = AlexaResponse(request.app['hass'], intent)
if req_type == 'LaunchRequest': if req_type == 'LaunchRequest':
response.add_speech( response.add_speech(
@@ -97,33 +179,19 @@ class AlexaView(HomeAssistantView):
action = config.get(CONF_ACTION) action = config.get(CONF_ACTION)
if action is not None: if action is not None:
action.run(response.variables) yield from action.async_run(response.variables)
# pylint: disable=unsubscriptable-object # pylint: disable=unsubscriptable-object
if speech is not None: if speech is not None:
response.add_speech(SpeechType[speech['type']], speech['text']) response.add_speech(speech[CONF_TYPE], speech[CONF_TEXT])
if card is not None: if card is not None:
response.add_card(CardType[card['type']], card['title'], response.add_card(card[CONF_TYPE], card[CONF_TITLE],
card['content']) card[CONF_CONTENT])
return self.json(response) return self.json(response)
class SpeechType(enum.Enum):
"""The Alexa speech types."""
plaintext = "PlainText"
ssml = "SSML"
class CardType(enum.Enum):
"""The Alexa card types."""
simple = "Simple"
link_account = "LinkAccount"
class AlexaResponse(object): class AlexaResponse(object):
"""Help generating the response for Alexa.""" """Help generating the response for Alexa."""
@@ -153,8 +221,8 @@ class AlexaResponse(object):
self.card = card self.card = card
return return
card["title"] = self._render(title), card["title"] = title.async_render(self.variables)
card["content"] = self._render(content) card["content"] = content.async_render(self.variables)
self.card = card self.card = card
def add_speech(self, speech_type, text): def add_speech(self, speech_type, text):
@@ -163,9 +231,12 @@ class AlexaResponse(object):
key = 'ssml' if speech_type == SpeechType.ssml else 'text' key = 'ssml' if speech_type == SpeechType.ssml else 'text'
if isinstance(text, template.Template):
text = text.async_render(self.variables)
self.speech = { self.speech = {
'type': speech_type.value, 'type': speech_type.value,
key: self._render(text) key: text
} }
def add_reprompt(self, speech_type, text): def add_reprompt(self, speech_type, text):
@@ -176,7 +247,7 @@ class AlexaResponse(object):
self.reprompt = { self.reprompt = {
'type': speech_type.value, 'type': speech_type.value,
key: self._render(text) key: text.async_render(self.variables)
} }
def as_dict(self): def as_dict(self):
@@ -202,6 +273,68 @@ class AlexaResponse(object):
'response': response, 'response': response,
} }
def _render(self, template_string):
"""Render a response, adding data from intent if available.""" class AlexaFlashBriefingView(HomeAssistantView):
return template.render(self.hass, template_string, self.variables) """Handle Alexa Flash Briefing skill requests."""
url = FLASH_BRIEFINGS_API_ENDPOINT
name = 'api:alexa:flash_briefings'
def __init__(self, hass, flash_briefings):
"""Initialize Alexa view."""
super().__init__()
self.flash_briefings = copy.deepcopy(flash_briefings)
template.attach(hass, self.flash_briefings)
@callback
def get(self, request, briefing_id):
"""Handle Alexa Flash Briefing request."""
_LOGGER.debug('Received Alexa flash briefing request for: %s',
briefing_id)
if self.flash_briefings.get(briefing_id) is None:
err = 'No configured Alexa flash briefing was found for: %s'
_LOGGER.error(err, briefing_id)
return b'', 404
briefing = []
for item in self.flash_briefings.get(briefing_id, []):
output = {}
if item.get(CONF_TITLE) is not None:
if isinstance(item.get(CONF_TITLE), template.Template):
output[ATTR_TITLE_TEXT] = item[CONF_TITLE].async_render()
else:
output[ATTR_TITLE_TEXT] = item.get(CONF_TITLE)
if item.get(CONF_TEXT) is not None:
if isinstance(item.get(CONF_TEXT), template.Template):
output[ATTR_MAIN_TEXT] = item[CONF_TEXT].async_render()
else:
output[ATTR_MAIN_TEXT] = item.get(CONF_TEXT)
if item.get(CONF_UID) is not None:
output[ATTR_UID] = item.get(CONF_UID)
if item.get(CONF_AUDIO) is not None:
if isinstance(item.get(CONF_AUDIO), template.Template):
output[ATTR_STREAM_URL] = item[CONF_AUDIO].async_render()
else:
output[ATTR_STREAM_URL] = item.get(CONF_AUDIO)
if item.get(CONF_DISPLAY_URL) is not None:
if isinstance(item.get(CONF_DISPLAY_URL),
template.Template):
output[ATTR_REDIRECTION_URL] = \
item[CONF_DISPLAY_URL].async_render()
else:
output[ATTR_REDIRECTION_URL] = item.get(CONF_DISPLAY_URL)
if isinstance(item[CONF_DATE], str):
item[CONF_DATE] = dt_util.parse_datetime(item[CONF_DATE])
output[ATTR_UPDATE_DATE] = item[CONF_DATE].strftime(DATE_FORMAT)
briefing.append(output)
return self.json(briefing)

View File

@@ -7,35 +7,43 @@ https://home-assistant.io/components/apcupsd/
import logging import logging
from datetime import timedelta from datetime import timedelta
import voluptuous as vol
from homeassistant.const import (CONF_HOST, CONF_PORT)
import homeassistant.helpers.config_validation as cv
from homeassistant.util import Throttle from homeassistant.util import Throttle
DOMAIN = "apcupsd" REQUIREMENTS = ['apcaccess==0.0.4']
REQUIREMENTS = ("apcaccess==0.0.4",)
CONF_HOST = "host" _LOGGER = logging.getLogger(__name__)
CONF_PORT = "port"
CONF_TYPE = "type"
DEFAULT_HOST = "localhost" CONF_TYPE = 'type'
DATA = None
DEFAULT_HOST = 'localhost'
DEFAULT_PORT = 3551 DEFAULT_PORT = 3551
DOMAIN = 'apcupsd'
KEY_STATUS = "STATUS" KEY_STATUS = 'STATUS'
VALUE_ONLINE = "ONLINE"
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=60) MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=60)
DATA = None VALUE_ONLINE = 'ONLINE'
_LOGGER = logging.getLogger(__name__) CONFIG_SCHEMA = vol.Schema({
DOMAIN: vol.Schema({
vol.Optional(CONF_HOST, default=DEFAULT_HOST): cv.string,
vol.Optional(CONF_PORT, default=DEFAULT_PORT): cv.port,
}),
}, extra=vol.ALLOW_EXTRA)
def setup(hass, config): def setup(hass, config):
"""Use config values to set up a function enabling status retrieval.""" """Use config values to set up a function enabling status retrieval."""
global DATA global DATA
conf = config[DOMAIN]
host = config[DOMAIN].get(CONF_HOST, DEFAULT_HOST) host = conf.get(CONF_HOST)
port = config[DOMAIN].get(CONF_PORT, DEFAULT_PORT) port = conf.get(CONF_PORT)
DATA = APCUPSdData(host, port) DATA = APCUPSdData(host, port)

View File

@@ -4,9 +4,12 @@ Rest API for Home Assistant.
For more details about the RESTful API, please refer to the documentation at For more details about the RESTful API, please refer to the documentation at
https://home-assistant.io/developers/api/ https://home-assistant.io/developers/api/
""" """
import asyncio
import json import json
import logging import logging
import queue
from aiohttp import web
import async_timeout
import homeassistant.core as ha import homeassistant.core as ha
import homeassistant.remote as rem import homeassistant.remote as rem
@@ -20,7 +23,7 @@ from homeassistant.const import (
URL_API_STATES, URL_API_STATES_ENTITY, URL_API_STREAM, URL_API_TEMPLATE, URL_API_STATES, URL_API_STATES_ENTITY, URL_API_STREAM, URL_API_TEMPLATE,
__version__) __version__)
from homeassistant.exceptions import TemplateError from homeassistant.exceptions import TemplateError
from homeassistant.helpers.state import TrackStates from homeassistant.helpers.state import AsyncTrackStates
from homeassistant.helpers import template from homeassistant.helpers import template
from homeassistant.components.http import HomeAssistantView from homeassistant.components.http import HomeAssistantView
@@ -35,20 +38,20 @@ _LOGGER = logging.getLogger(__name__)
def setup(hass, config): def setup(hass, config):
"""Register the API with the HTTP interface.""" """Register the API with the HTTP interface."""
hass.wsgi.register_view(APIStatusView) hass.http.register_view(APIStatusView)
hass.wsgi.register_view(APIEventStream) hass.http.register_view(APIEventStream)
hass.wsgi.register_view(APIConfigView) hass.http.register_view(APIConfigView)
hass.wsgi.register_view(APIDiscoveryView) hass.http.register_view(APIDiscoveryView)
hass.wsgi.register_view(APIStatesView) hass.http.register_view(APIStatesView)
hass.wsgi.register_view(APIEntityStateView) hass.http.register_view(APIEntityStateView)
hass.wsgi.register_view(APIEventListenersView) hass.http.register_view(APIEventListenersView)
hass.wsgi.register_view(APIEventView) hass.http.register_view(APIEventView)
hass.wsgi.register_view(APIServicesView) hass.http.register_view(APIServicesView)
hass.wsgi.register_view(APIDomainServicesView) hass.http.register_view(APIDomainServicesView)
hass.wsgi.register_view(APIEventForwardingView) hass.http.register_view(APIEventForwardingView)
hass.wsgi.register_view(APIComponentsView) hass.http.register_view(APIComponentsView)
hass.wsgi.register_view(APIErrorLogView) hass.http.register_view(APIErrorLogView)
hass.wsgi.register_view(APITemplateView) hass.http.register_view(APITemplateView)
return True return True
@@ -59,6 +62,7 @@ class APIStatusView(HomeAssistantView):
url = URL_API url = URL_API
name = "api:status" name = "api:status"
@ha.callback
def get(self, request): def get(self, request):
"""Retrieve if API is running.""" """Retrieve if API is running."""
return self.json_message('API running.') return self.json_message('API running.')
@@ -70,15 +74,19 @@ class APIEventStream(HomeAssistantView):
url = URL_API_STREAM url = URL_API_STREAM
name = "api:stream" name = "api:stream"
@asyncio.coroutine
def get(self, request): def get(self, request):
"""Provide a streaming interface for the event bus.""" """Provide a streaming interface for the event bus."""
# pylint: disable=no-self-use
hass = request.app['hass']
stop_obj = object() stop_obj = object()
to_write = queue.Queue() to_write = asyncio.Queue(loop=hass.loop)
restrict = request.args.get('restrict') restrict = request.GET.get('restrict')
if restrict: if restrict:
restrict = restrict.split(',') + [EVENT_HOMEASSISTANT_STOP] restrict = restrict.split(',') + [EVENT_HOMEASSISTANT_STOP]
@asyncio.coroutine
def forward_events(event): def forward_events(event):
"""Forward events to the open request.""" """Forward events to the open request."""
if event.event_type == EVENT_TIME_CHANGED: if event.event_type == EVENT_TIME_CHANGED:
@@ -94,20 +102,25 @@ class APIEventStream(HomeAssistantView):
else: else:
data = json.dumps(event, cls=rem.JSONEncoder) data = json.dumps(event, cls=rem.JSONEncoder)
to_write.put(data) yield from to_write.put(data)
def stream(): response = web.StreamResponse()
"""Stream events to response.""" response.content_type = 'text/event-stream'
self.hass.bus.listen(MATCH_ALL, forward_events) yield from response.prepare(request)
unsub_stream = hass.bus.async_listen(MATCH_ALL, forward_events)
try:
_LOGGER.debug('STREAM %s ATTACHED', id(stop_obj)) _LOGGER.debug('STREAM %s ATTACHED', id(stop_obj))
# Fire off one message right away to have browsers fire open event # Fire off one message so browsers fire open event right away
to_write.put(STREAM_PING_PAYLOAD) yield from to_write.put(STREAM_PING_PAYLOAD)
while True: while True:
try: try:
payload = to_write.get(timeout=STREAM_PING_INTERVAL) with async_timeout.timeout(STREAM_PING_INTERVAL,
loop=hass.loop):
payload = yield from to_write.get()
if payload is stop_obj: if payload is stop_obj:
break break
@@ -115,16 +128,14 @@ class APIEventStream(HomeAssistantView):
msg = "data: {}\n\n".format(payload) msg = "data: {}\n\n".format(payload)
_LOGGER.debug('STREAM %s WRITING %s', id(stop_obj), _LOGGER.debug('STREAM %s WRITING %s', id(stop_obj),
msg.strip()) msg.strip())
yield msg.encode("UTF-8") response.write(msg.encode("UTF-8"))
except queue.Empty: yield from response.drain()
to_write.put(STREAM_PING_PAYLOAD) except asyncio.TimeoutError:
except GeneratorExit: yield from to_write.put(STREAM_PING_PAYLOAD)
break
finally:
_LOGGER.debug('STREAM %s RESPONSE CLOSED', id(stop_obj)) _LOGGER.debug('STREAM %s RESPONSE CLOSED', id(stop_obj))
self.hass.bus.remove_listener(MATCH_ALL, forward_events) unsub_stream()
return self.Response(stream(), mimetype='text/event-stream')
class APIConfigView(HomeAssistantView): class APIConfigView(HomeAssistantView):
@@ -133,9 +144,10 @@ class APIConfigView(HomeAssistantView):
url = URL_API_CONFIG url = URL_API_CONFIG
name = "api:config" name = "api:config"
@ha.callback
def get(self, request): def get(self, request):
"""Get current configuration.""" """Get current configuration."""
return self.json(self.hass.config.as_dict()) return self.json(request.app['hass'].config.as_dict())
class APIDiscoveryView(HomeAssistantView): class APIDiscoveryView(HomeAssistantView):
@@ -145,12 +157,14 @@ class APIDiscoveryView(HomeAssistantView):
url = URL_API_DISCOVERY_INFO url = URL_API_DISCOVERY_INFO
name = "api:discovery" name = "api:discovery"
@ha.callback
def get(self, request): def get(self, request):
"""Get discovery info.""" """Get discovery info."""
needs_auth = self.hass.config.api.api_password is not None hass = request.app['hass']
needs_auth = hass.config.api.api_password is not None
return self.json({ return self.json({
'base_url': self.hass.config.api.base_url, 'base_url': hass.config.api.base_url,
'location_name': self.hass.config.location_name, 'location_name': hass.config.location_name,
'requires_api_password': needs_auth, 'requires_api_password': needs_auth,
'version': __version__ 'version': __version__
}) })
@@ -162,53 +176,62 @@ class APIStatesView(HomeAssistantView):
url = URL_API_STATES url = URL_API_STATES
name = "api:states" name = "api:states"
@ha.callback
def get(self, request): def get(self, request):
"""Get current states.""" """Get current states."""
return self.json(self.hass.states.all()) return self.json(request.app['hass'].states.async_all())
class APIEntityStateView(HomeAssistantView): class APIEntityStateView(HomeAssistantView):
"""View to handle EntityState requests.""" """View to handle EntityState requests."""
url = "/api/states/<entity(exist=False):entity_id>" url = "/api/states/{entity_id}"
name = "api:entity-state" name = "api:entity-state"
@ha.callback
def get(self, request, entity_id): def get(self, request, entity_id):
"""Retrieve state of entity.""" """Retrieve state of entity."""
state = self.hass.states.get(entity_id) state = request.app['hass'].states.get(entity_id)
if state: if state:
return self.json(state) return self.json(state)
else: else:
return self.json_message('Entity not found', HTTP_NOT_FOUND) return self.json_message('Entity not found', HTTP_NOT_FOUND)
@asyncio.coroutine
def post(self, request, entity_id): def post(self, request, entity_id):
"""Update state of entity.""" """Update state of entity."""
hass = request.app['hass']
try: try:
new_state = request.json['state'] data = yield from request.json()
except KeyError: except ValueError:
return self.json_message('Invalid JSON specified',
HTTP_BAD_REQUEST)
new_state = data.get('state')
if not new_state:
return self.json_message('No state specified', HTTP_BAD_REQUEST) return self.json_message('No state specified', HTTP_BAD_REQUEST)
attributes = request.json.get('attributes') attributes = data.get('attributes')
force_update = request.json.get('force_update', False) force_update = data.get('force_update', False)
is_new_state = self.hass.states.get(entity_id) is None is_new_state = hass.states.get(entity_id) is None
# Write state # Write state
self.hass.states.set(entity_id, new_state, attributes, force_update) hass.states.async_set(entity_id, new_state, attributes, force_update)
# Read the state back for our response # Read the state back for our response
resp = self.json(self.hass.states.get(entity_id)) status_code = HTTP_CREATED if is_new_state else 200
resp = self.json(hass.states.get(entity_id), status_code)
if is_new_state:
resp.status_code = HTTP_CREATED
resp.headers.add('Location', URL_API_STATES_ENTITY.format(entity_id)) resp.headers.add('Location', URL_API_STATES_ENTITY.format(entity_id))
return resp return resp
@ha.callback
def delete(self, request, entity_id): def delete(self, request, entity_id):
"""Remove entity.""" """Remove entity."""
if self.hass.states.remove(entity_id): if request.app['hass'].states.async_remove(entity_id):
return self.json_message('Entity removed') return self.json_message('Entity removed')
else: else:
return self.json_message('Entity not found', HTTP_NOT_FOUND) return self.json_message('Entity not found', HTTP_NOT_FOUND)
@@ -220,20 +243,23 @@ class APIEventListenersView(HomeAssistantView):
url = URL_API_EVENTS url = URL_API_EVENTS
name = "api:event-listeners" name = "api:event-listeners"
@ha.callback
def get(self, request): def get(self, request):
"""Get event listeners.""" """Get event listeners."""
return self.json(events_json(self.hass)) return self.json(async_events_json(request.app['hass']))
class APIEventView(HomeAssistantView): class APIEventView(HomeAssistantView):
"""View to handle Event requests.""" """View to handle Event requests."""
url = '/api/events/<event_type>' url = '/api/events/{event_type}'
name = "api:event" name = "api:event"
@asyncio.coroutine
def post(self, request, event_type): def post(self, request, event_type):
"""Fire events.""" """Fire events."""
event_data = request.json body = yield from request.text()
event_data = json.loads(body) if body else None
if event_data is not None and not isinstance(event_data, dict): if event_data is not None and not isinstance(event_data, dict):
return self.json_message('Event data should be a JSON object', return self.json_message('Event data should be a JSON object',
@@ -248,7 +274,8 @@ class APIEventView(HomeAssistantView):
if state: if state:
event_data[key] = state event_data[key] = state
self.hass.bus.fire(event_type, event_data, ha.EventOrigin.remote) request.app['hass'].bus.async_fire(event_type, event_data,
ha.EventOrigin.remote)
return self.json_message("Event {} fired.".format(event_type)) return self.json_message("Event {} fired.".format(event_type))
@@ -259,24 +286,30 @@ class APIServicesView(HomeAssistantView):
url = URL_API_SERVICES url = URL_API_SERVICES
name = "api:services" name = "api:services"
@ha.callback
def get(self, request): def get(self, request):
"""Get registered services.""" """Get registered services."""
return self.json(services_json(self.hass)) return self.json(async_services_json(request.app['hass']))
class APIDomainServicesView(HomeAssistantView): class APIDomainServicesView(HomeAssistantView):
"""View to handle DomainServices requests.""" """View to handle DomainServices requests."""
url = "/api/services/<domain>/<service>" url = "/api/services/{domain}/{service}"
name = "api:domain-services" name = "api:domain-services"
@asyncio.coroutine
def post(self, request, domain, service): def post(self, request, domain, service):
"""Call a service. """Call a service.
Returns a list of changed states. Returns a list of changed states.
""" """
with TrackStates(self.hass) as changed_states: hass = request.app['hass']
self.hass.services.call(domain, service, request.json, True) body = yield from request.text()
data = json.loads(body) if body else None
with AsyncTrackStates(hass) as changed_states:
yield from hass.services.async_call(domain, service, data, True)
return self.json(changed_states) return self.json(changed_states)
@@ -288,11 +321,15 @@ class APIEventForwardingView(HomeAssistantView):
name = "api:event-forward" name = "api:event-forward"
event_forwarder = None event_forwarder = None
@asyncio.coroutine
def post(self, request): def post(self, request):
"""Setup an event forwarder.""" """Setup an event forwarder."""
data = request.json hass = request.app['hass']
if data is None: try:
data = yield from request.json()
except ValueError:
return self.json_message("No data received.", HTTP_BAD_REQUEST) return self.json_message("No data received.", HTTP_BAD_REQUEST)
try: try:
host = data['host'] host = data['host']
api_password = data['api_password'] api_password = data['api_password']
@@ -308,21 +345,25 @@ class APIEventForwardingView(HomeAssistantView):
api = rem.API(host, api_password, port) api = rem.API(host, api_password, port)
if not api.validate_api(): valid = yield from hass.loop.run_in_executor(
None, api.validate_api)
if not valid:
return self.json_message("Unable to validate API.", return self.json_message("Unable to validate API.",
HTTP_UNPROCESSABLE_ENTITY) HTTP_UNPROCESSABLE_ENTITY)
if self.event_forwarder is None: if self.event_forwarder is None:
self.event_forwarder = rem.EventForwarder(self.hass) self.event_forwarder = rem.EventForwarder(hass)
self.event_forwarder.connect(api) self.event_forwarder.async_connect(api)
return self.json_message("Event forwarding setup.") return self.json_message("Event forwarding setup.")
@asyncio.coroutine
def delete(self, request): def delete(self, request):
"""Remove event forwarer.""" """Remove event forwarder."""
data = request.json try:
if data is None: data = yield from request.json()
except ValueError:
return self.json_message("No data received.", HTTP_BAD_REQUEST) return self.json_message("No data received.", HTTP_BAD_REQUEST)
try: try:
@@ -339,7 +380,7 @@ class APIEventForwardingView(HomeAssistantView):
if self.event_forwarder is not None: if self.event_forwarder is not None:
api = rem.API(host, None, port) api = rem.API(host, None, port)
self.event_forwarder.disconnect(api) self.event_forwarder.async_disconnect(api)
return self.json_message("Event forwarding cancelled.") return self.json_message("Event forwarding cancelled.")
@@ -350,9 +391,10 @@ class APIComponentsView(HomeAssistantView):
url = URL_API_COMPONENTS url = URL_API_COMPONENTS
name = "api:components" name = "api:components"
@ha.callback
def get(self, request): def get(self, request):
"""Get current loaded components.""" """Get current loaded components."""
return self.json(self.hass.config.components) return self.json(request.app['hass'].config.components)
class APIErrorLogView(HomeAssistantView): class APIErrorLogView(HomeAssistantView):
@@ -361,9 +403,12 @@ class APIErrorLogView(HomeAssistantView):
url = URL_API_ERROR_LOG url = URL_API_ERROR_LOG
name = "api:error-log" name = "api:error-log"
@asyncio.coroutine
def get(self, request): def get(self, request):
"""Serve error log.""" """Serve error log."""
return self.file(request, self.hass.config.path(ERROR_LOG_FILENAME)) resp = yield from self.file(
request, request.app['hass'].config.path(ERROR_LOG_FILENAME))
return resp
class APITemplateView(HomeAssistantView): class APITemplateView(HomeAssistantView):
@@ -372,23 +417,25 @@ class APITemplateView(HomeAssistantView):
url = URL_API_TEMPLATE url = URL_API_TEMPLATE
name = "api:template" name = "api:template"
@asyncio.coroutine
def post(self, request): def post(self, request):
"""Render a template.""" """Render a template."""
try: try:
return template.render(self.hass, request.json['template'], data = yield from request.json()
request.json.get('variables')) tpl = template.Template(data['template'], request.app['hass'])
except TemplateError as ex: return tpl.async_render(data.get('variables'))
except (ValueError, TemplateError) as ex:
return self.json_message('Error rendering template: {}'.format(ex), return self.json_message('Error rendering template: {}'.format(ex),
HTTP_BAD_REQUEST) HTTP_BAD_REQUEST)
def services_json(hass): def async_services_json(hass):
"""Generate services data to JSONify.""" """Generate services data to JSONify."""
return [{"domain": key, "services": value} return [{"domain": key, "services": value}
for key, value in hass.services.services.items()] for key, value in hass.services.async_services().items()]
def events_json(hass): def async_events_json(hass):
"""Generate event data to JSONify.""" """Generate event data to JSONify."""
return [{"event": key, "listener_count": value} return [{"event": key, "listener_count": value}
for key, value in hass.bus.listeners.items()] for key, value in hass.bus.async_listeners().items()]

View File

@@ -6,27 +6,34 @@ https://home-assistant.io/components/arduino/
""" """
import logging import logging
import voluptuous as vol
from homeassistant.const import ( from homeassistant.const import (
EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP) EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP)
from homeassistant.helpers import validate_config from homeassistant.const import CONF_PORT
import homeassistant.helpers.config_validation as cv
REQUIREMENTS = ['PyMata==2.13']
DOMAIN = "arduino"
REQUIREMENTS = ['PyMata==2.12']
BOARD = None
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
BOARD = None
DOMAIN = 'arduino'
CONFIG_SCHEMA = vol.Schema({
DOMAIN: vol.Schema({
vol.Required(CONF_PORT): cv.string,
}),
}, extra=vol.ALLOW_EXTRA)
def setup(hass, config): def setup(hass, config):
"""Setup the Arduino component.""" """Setup the Arduino component."""
if not validate_config(config,
{DOMAIN: ['port']},
_LOGGER):
return False
import serial import serial
global BOARD global BOARD
try: try:
BOARD = ArduinoBoard(config[DOMAIN]['port']) BOARD = ArduinoBoard(config[DOMAIN][CONF_PORT])
except (serial.serialutil.SerialException, FileNotFoundError): except (serial.serialutil.SerialException, FileNotFoundError):
_LOGGER.exception("Your port is not accessible.") _LOGGER.exception("Your port is not accessible.")
return False return False

View File

@@ -4,56 +4,68 @@ Allow to setup simple automation rules via the config file.
For more details about this component, please refer to the documentation at For more details about this component, please refer to the documentation at
https://home-assistant.io/components/automation/ https://home-assistant.io/components/automation/
""" """
import asyncio
from functools import partial
import logging import logging
import os
import voluptuous as vol import voluptuous as vol
from homeassistant.bootstrap import prepare_setup_platform from homeassistant.bootstrap import async_prepare_setup_platform
from homeassistant.const import ATTR_ENTITY_ID, CONF_PLATFORM from homeassistant import config as conf_util
from homeassistant.const import (
ATTR_ENTITY_ID, CONF_PLATFORM, STATE_ON, SERVICE_TURN_ON, SERVICE_TURN_OFF,
SERVICE_TOGGLE)
from homeassistant.components import logbook from homeassistant.components import logbook
from homeassistant.exceptions import HomeAssistantError from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers import extract_domain_configs, script, condition from homeassistant.helpers import extract_domain_configs, script, condition
from homeassistant.helpers.entity import ToggleEntity
from homeassistant.helpers.entity_component import EntityComponent
from homeassistant.loader import get_platform from homeassistant.loader import get_platform
from homeassistant.util.dt import utcnow
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
DOMAIN = 'automation' DOMAIN = 'automation'
ENTITY_ID_FORMAT = DOMAIN + '.{}'
DEPENDENCIES = ['group'] DEPENDENCIES = ['group']
GROUP_NAME_ALL_AUTOMATIONS = 'all automations'
CONF_ALIAS = 'alias' CONF_ALIAS = 'alias'
CONF_HIDE_ENTITY = 'hide_entity'
CONF_CONDITION = 'condition' CONF_CONDITION = 'condition'
CONF_ACTION = 'action' CONF_ACTION = 'action'
CONF_TRIGGER = 'trigger' CONF_TRIGGER = 'trigger'
CONF_CONDITION_TYPE = 'condition_type' CONF_CONDITION_TYPE = 'condition_type'
CONF_INITIAL_STATE = 'initial_state'
CONDITION_USE_TRIGGER_VALUES = 'use_trigger_values' CONDITION_USE_TRIGGER_VALUES = 'use_trigger_values'
CONDITION_TYPE_AND = 'and' CONDITION_TYPE_AND = 'and'
CONDITION_TYPE_OR = 'or' CONDITION_TYPE_OR = 'or'
DEFAULT_CONDITION_TYPE = CONDITION_TYPE_AND DEFAULT_CONDITION_TYPE = CONDITION_TYPE_AND
DEFAULT_HIDE_ENTITY = False
DEFAULT_INITIAL_STATE = True
METHOD_TRIGGER = 'trigger' ATTR_LAST_TRIGGERED = 'last_triggered'
METHOD_IF_ACTION = 'if_action' ATTR_VARIABLES = 'variables'
SERVICE_TRIGGER = 'trigger'
SERVICE_RELOAD = 'reload'
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
def _platform_validator(method, schema): def _platform_validator(config):
"""Generate platform validator for different steps.""" """Validate it is a valid platform."""
def validator(config): platform = get_platform(DOMAIN, config[CONF_PLATFORM])
"""Validate it is a valid platform."""
platform = get_platform(DOMAIN, config[CONF_PLATFORM])
if not hasattr(platform, method): if not hasattr(platform, 'TRIGGER_SCHEMA'):
raise vol.Invalid('invalid method platform') return config
if not hasattr(platform, schema): return getattr(platform, 'TRIGGER_SCHEMA')(config)
return config
return getattr(platform, schema)(config)
return validator
_TRIGGER_SCHEMA = vol.All( _TRIGGER_SCHEMA = vol.All(
cv.ensure_list, cv.ensure_list,
@@ -62,160 +74,353 @@ _TRIGGER_SCHEMA = vol.All(
vol.Schema({ vol.Schema({
vol.Required(CONF_PLATFORM): cv.platform_validator(DOMAIN) vol.Required(CONF_PLATFORM): cv.platform_validator(DOMAIN)
}, extra=vol.ALLOW_EXTRA), }, extra=vol.ALLOW_EXTRA),
_platform_validator(METHOD_TRIGGER, 'TRIGGER_SCHEMA') _platform_validator
), ),
] ]
) )
_CONDITION_SCHEMA = vol.Any( _CONDITION_SCHEMA = vol.All(cv.ensure_list, [cv.CONDITION_SCHEMA])
CONDITION_USE_TRIGGER_VALUES,
vol.All(
cv.ensure_list,
[
vol.All(
vol.Schema({
CONF_PLATFORM: str,
CONF_CONDITION: str,
}, extra=vol.ALLOW_EXTRA),
cv.has_at_least_one_key(CONF_PLATFORM, CONF_CONDITION),
),
]
)
)
PLATFORM_SCHEMA = vol.Schema({ PLATFORM_SCHEMA = vol.Schema({
CONF_ALIAS: cv.string, CONF_ALIAS: cv.string,
vol.Optional(CONF_INITIAL_STATE,
default=DEFAULT_INITIAL_STATE): cv.boolean,
vol.Optional(CONF_HIDE_ENTITY, default=DEFAULT_HIDE_ENTITY): cv.boolean,
vol.Required(CONF_TRIGGER): _TRIGGER_SCHEMA, vol.Required(CONF_TRIGGER): _TRIGGER_SCHEMA,
vol.Required(CONF_CONDITION_TYPE, default=DEFAULT_CONDITION_TYPE): vol.Optional(CONF_CONDITION): _CONDITION_SCHEMA,
vol.All(vol.Lower, vol.Any(CONDITION_TYPE_AND, CONDITION_TYPE_OR)),
CONF_CONDITION: _CONDITION_SCHEMA,
vol.Required(CONF_ACTION): cv.SCRIPT_SCHEMA, vol.Required(CONF_ACTION): cv.SCRIPT_SCHEMA,
}) })
SERVICE_SCHEMA = vol.Schema({
vol.Optional(ATTR_ENTITY_ID): cv.entity_ids,
})
def setup(hass, config): TRIGGER_SERVICE_SCHEMA = vol.Schema({
vol.Optional(ATTR_ENTITY_ID): cv.entity_ids,
vol.Optional(ATTR_VARIABLES, default={}): dict,
})
RELOAD_SERVICE_SCHEMA = vol.Schema({})
def is_on(hass, entity_id=None):
"""
Return true if specified automation entity_id is on.
Check all automation if no entity_id specified.
"""
entity_ids = [entity_id] if entity_id else hass.states.entity_ids(DOMAIN)
return any(hass.states.is_state(entity_id, STATE_ON)
for entity_id in entity_ids)
def turn_on(hass, entity_id=None):
"""Turn on specified automation or all."""
data = {ATTR_ENTITY_ID: entity_id} if entity_id else {}
hass.services.call(DOMAIN, SERVICE_TURN_ON, data)
def turn_off(hass, entity_id=None):
"""Turn off specified automation or all."""
data = {ATTR_ENTITY_ID: entity_id} if entity_id else {}
hass.services.call(DOMAIN, SERVICE_TURN_OFF, data)
def toggle(hass, entity_id=None):
"""Toggle specified automation or all."""
data = {ATTR_ENTITY_ID: entity_id} if entity_id else {}
hass.services.call(DOMAIN, SERVICE_TOGGLE, data)
def trigger(hass, entity_id=None):
"""Trigger specified automation or all."""
data = {ATTR_ENTITY_ID: entity_id} if entity_id else {}
hass.services.call(DOMAIN, SERVICE_TRIGGER, data)
def reload(hass):
"""Reload the automation from config."""
hass.services.call(DOMAIN, SERVICE_RELOAD)
@asyncio.coroutine
def async_setup(hass, config):
"""Setup the automation.""" """Setup the automation."""
success = False component = EntityComponent(_LOGGER, DOMAIN, hass,
group_name=GROUP_NAME_ALL_AUTOMATIONS)
success = yield from _async_process_config(hass, config, component)
if not success:
return False
descriptions = yield from hass.loop.run_in_executor(
None, conf_util.load_yaml_config_file, os.path.join(
os.path.dirname(__file__), 'services.yaml')
)
@asyncio.coroutine
def trigger_service_handler(service_call):
"""Handle automation triggers."""
tasks = []
for entity in component.async_extract_from_service(service_call):
tasks.append(entity.async_trigger(
service_call.data.get(ATTR_VARIABLES), True))
yield from asyncio.wait(tasks, loop=hass.loop)
@asyncio.coroutine
def turn_onoff_service_handler(service_call):
"""Handle automation turn on/off service calls."""
tasks = []
method = 'async_{}'.format(service_call.service)
for entity in component.async_extract_from_service(service_call):
tasks.append(getattr(entity, method)())
yield from asyncio.wait(tasks, loop=hass.loop)
@asyncio.coroutine
def toggle_service_handler(service_call):
"""Handle automation toggle service calls."""
tasks = []
for entity in component.async_extract_from_service(service_call):
if entity.is_on:
tasks.append(entity.async_turn_off())
else:
tasks.append(entity.async_turn_on())
yield from asyncio.wait(tasks, loop=hass.loop)
@asyncio.coroutine
def reload_service_handler(service_call):
"""Remove all automations and load new ones from config."""
conf = yield from component.async_prepare_reload()
if conf is None:
return
yield from _async_process_config(hass, conf, component)
hass.services.async_register(
DOMAIN, SERVICE_TRIGGER, trigger_service_handler,
descriptions.get(SERVICE_TRIGGER), schema=TRIGGER_SERVICE_SCHEMA)
hass.services.async_register(
DOMAIN, SERVICE_RELOAD, reload_service_handler,
descriptions.get(SERVICE_RELOAD), schema=RELOAD_SERVICE_SCHEMA)
hass.services.async_register(
DOMAIN, SERVICE_TOGGLE, toggle_service_handler,
descriptions.get(SERVICE_TOGGLE), schema=SERVICE_SCHEMA)
for service in (SERVICE_TURN_ON, SERVICE_TURN_OFF):
hass.services.async_register(
DOMAIN, service, turn_onoff_service_handler,
descriptions.get(service), schema=SERVICE_SCHEMA)
return True
class AutomationEntity(ToggleEntity):
"""Entity to show status of entity."""
def __init__(self, name, async_attach_triggers, cond_func, async_action,
hidden):
"""Initialize an automation entity."""
self._name = name
self._async_attach_triggers = async_attach_triggers
self._async_detach_triggers = None
self._cond_func = cond_func
self._async_action = async_action
self._enabled = False
self._last_triggered = None
self._hidden = hidden
@property
def name(self):
"""Name of the automation."""
return self._name
@property
def should_poll(self):
"""No polling needed for automation entities."""
return False
@property
def state_attributes(self):
"""Return the entity state attributes."""
return {
ATTR_LAST_TRIGGERED: self._last_triggered
}
@property
def hidden(self) -> bool:
"""Return True if the automation entity should be hidden from UIs."""
return self._hidden
@property
def is_on(self) -> bool:
"""Return True if entity is on."""
return self._enabled
@asyncio.coroutine
def async_turn_on(self, **kwargs) -> None:
"""Turn the entity on and update the state."""
if self._enabled:
return
yield from self.async_enable()
yield from self.async_update_ha_state()
@asyncio.coroutine
def async_turn_off(self, **kwargs) -> None:
"""Turn the entity off."""
if not self._enabled:
return
self._async_detach_triggers()
self._async_detach_triggers = None
self._enabled = False
yield from self.async_update_ha_state()
@asyncio.coroutine
def async_trigger(self, variables, skip_condition=False):
"""Trigger automation.
This method is a coroutine.
"""
if skip_condition or self._cond_func(variables):
yield from self._async_action(self.entity_id, variables)
self._last_triggered = utcnow()
yield from self.async_update_ha_state()
@asyncio.coroutine
def async_remove(self):
"""Remove automation from HASS."""
yield from self.async_turn_off()
yield from super().async_remove()
@asyncio.coroutine
def async_enable(self):
"""Enable this automation entity.
This method is a coroutine.
"""
if self._enabled:
return
self._async_detach_triggers = yield from self._async_attach_triggers(
self.async_trigger)
self._enabled = True
@asyncio.coroutine
def _async_process_config(hass, config, component):
"""Process config and add automations.
This method is a coroutine.
"""
entities = []
tasks = []
for config_key in extract_domain_configs(config, DOMAIN): for config_key in extract_domain_configs(config, DOMAIN):
conf = config[config_key] conf = config[config_key]
for list_no, config_block in enumerate(conf): for list_no, config_block in enumerate(conf):
name = config_block.get(CONF_ALIAS, "{}, {}".format(config_key, name = config_block.get(CONF_ALIAS) or "{} {}".format(config_key,
list_no)) list_no)
success = (_setup_automation(hass, config_block, name, config) or
success)
return success hidden = config_block[CONF_HIDE_ENTITY]
action = _async_get_action(hass, config_block.get(CONF_ACTION, {}),
name)
if CONF_CONDITION in config_block:
cond_func = _async_process_if(hass, config, config_block)
if cond_func is None:
continue
else:
def cond_func(variables):
"""Condition will always pass."""
return True
async_attach_triggers = partial(
_async_process_trigger, hass, config,
config_block.get(CONF_TRIGGER, []), name)
entity = AutomationEntity(name, async_attach_triggers, cond_func,
action, hidden)
if config_block[CONF_INITIAL_STATE]:
tasks.append(entity.async_enable())
entities.append(entity)
if tasks:
yield from asyncio.wait(tasks, loop=hass.loop)
if entities:
yield from component.async_add_entities(entities)
return len(entities) > 0
def _setup_automation(hass, config_block, name, config): def _async_get_action(hass, config, name):
"""Setup one instance of automation."""
action = _get_action(hass, config_block.get(CONF_ACTION, {}), name)
if CONF_CONDITION in config_block:
action = _process_if(hass, config, config_block, action)
if action is None:
return False
_process_trigger(hass, config, config_block.get(CONF_TRIGGER, []), name,
action)
return True
def _get_action(hass, config, name):
"""Return an action based on a configuration.""" """Return an action based on a configuration."""
script_obj = script.Script(hass, config, name) script_obj = script.Script(hass, config, name)
def action(variables=None): @asyncio.coroutine
def action(entity_id, variables):
"""Action to be executed.""" """Action to be executed."""
_LOGGER.info('Executing %s', name) _LOGGER.info('Executing %s', name)
logbook.log_entry(hass, name, 'has been triggered', DOMAIN) logbook.async_log_entry(
script_obj.run(variables) hass, name, 'has been triggered', DOMAIN, entity_id)
yield from script_obj.async_run(variables)
return action return action
def _process_if(hass, config, p_config, action): def _async_process_if(hass, config, p_config):
"""Process if checks.""" """Process if checks."""
cond_type = p_config.get(CONF_CONDITION_TYPE,
DEFAULT_CONDITION_TYPE).lower()
# Deprecated since 0.19 - 5/5/2016
if cond_type != DEFAULT_CONDITION_TYPE:
_LOGGER.warning('Using condition_type: "or" is deprecated. Please use '
'"condition: or" instead.')
if_configs = p_config.get(CONF_CONDITION) if_configs = p_config.get(CONF_CONDITION)
use_trigger = if_configs == CONDITION_USE_TRIGGER_VALUES
if use_trigger:
if_configs = p_config[CONF_TRIGGER]
checks = [] checks = []
for if_config in if_configs: for if_config in if_configs:
# Deprecated except for used by use_trigger_values
# since 0.19 - 5/5/2016
if CONF_PLATFORM in if_config:
if not use_trigger:
_LOGGER.warning("Please switch your condition configuration "
"to use 'condition' instead of 'platform'.")
if_config = dict(if_config)
if_config[CONF_CONDITION] = if_config.pop(CONF_PLATFORM)
# To support use_trigger_values with state trigger accepting
# multiple entity_ids to monitor.
if_entity_id = if_config.get(ATTR_ENTITY_ID)
if isinstance(if_entity_id, list) and len(if_entity_id) == 1:
if_config[ATTR_ENTITY_ID] = if_entity_id[0]
try: try:
checks.append(condition.from_config(if_config)) checks.append(condition.async_from_config(if_config, False))
except HomeAssistantError as ex: except HomeAssistantError as ex:
# Invalid conditions are allowed if we base it on trigger _LOGGER.warning('Invalid condition: %s', ex)
if use_trigger: return None
_LOGGER.warning('Ignoring invalid condition: %s', ex)
else:
_LOGGER.warning('Invalid condition: %s', ex)
return None
if cond_type == CONDITION_TYPE_AND: def if_action(variables=None):
def if_action(variables=None): """AND all conditions."""
"""AND all conditions.""" return all(check(hass, variables) for check in checks)
if all(check(hass, variables) for check in checks):
action(variables)
else:
def if_action(variables=None):
"""OR all conditions."""
if any(check(hass, variables) for check in checks):
action(variables)
return if_action return if_action
def _process_trigger(hass, config, trigger_configs, name, action): @asyncio.coroutine
"""Setup the triggers.""" def _async_process_trigger(hass, config, trigger_configs, name, action):
"""Setup the triggers.
This method is a coroutine.
"""
removes = []
for conf in trigger_configs: for conf in trigger_configs:
platform = _resolve_platform(METHOD_TRIGGER, hass, config, platform = yield from async_prepare_setup_platform(
conf.get(CONF_PLATFORM)) hass, config, DOMAIN, conf.get(CONF_PLATFORM))
if platform is None: if platform is None:
return None
remove = platform.async_trigger(hass, conf, action)
if not remove:
_LOGGER.error("Error setting up trigger %s", name)
continue continue
if platform.trigger(hass, conf, action): _LOGGER.info("Initialized trigger %s", name)
_LOGGER.info("Initialized rule %s", name) removes.append(remove)
else:
_LOGGER.error("Error setting up rule %s", name)
if not removes:
def _resolve_platform(method, hass, config, platform):
"""Find the automation platform."""
if platform is None:
return None
platform = prepare_setup_platform(hass, config, DOMAIN, platform)
if platform is None or not hasattr(platform, method):
_LOGGER.error("Unknown automation platform specified for %s: %s",
method, platform)
return None return None
return platform def remove_triggers():
"""Remove attached triggers."""
for remove in removes:
remove()
return remove_triggers

View File

@@ -8,6 +8,7 @@ import logging
import voluptuous as vol import voluptuous as vol
from homeassistant.core import callback
from homeassistant.const import CONF_PLATFORM from homeassistant.const import CONF_PLATFORM
from homeassistant.helpers import config_validation as cv from homeassistant.helpers import config_validation as cv
@@ -23,21 +24,21 @@ TRIGGER_SCHEMA = vol.Schema({
}) })
def trigger(hass, config, action): def async_trigger(hass, config, action):
"""Listen for events based on configuration.""" """Listen for events based on configuration."""
event_type = config.get(CONF_EVENT_TYPE) event_type = config.get(CONF_EVENT_TYPE)
event_data = config.get(CONF_EVENT_DATA) event_data = config.get(CONF_EVENT_DATA)
@callback
def handle_event(event): def handle_event(event):
"""Listen for events and calls the action when data matches.""" """Listen for events and calls the action when data matches."""
if not event_data or all(val == event.data.get(key) for key, val if not event_data or all(val == event.data.get(key) for key, val
in event_data.items()): in event_data.items()):
action({ hass.async_run_job(action, {
'trigger': { 'trigger': {
'platform': 'event', 'platform': 'event',
'event': event, 'event': event,
}, },
}) })
hass.bus.listen(event_type, handle_event) return hass.bus.async_listen(event_type, handle_event)
return True

View File

@@ -0,0 +1,98 @@
"""
Trigger an automation when a LiteJet switch is released.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/automation.litejet/
"""
import logging
import voluptuous as vol
from homeassistant.core import callback
from homeassistant.const import CONF_PLATFORM
import homeassistant.helpers.config_validation as cv
import homeassistant.util.dt as dt_util
from homeassistant.helpers.event import track_point_in_utc_time
DEPENDENCIES = ['litejet']
_LOGGER = logging.getLogger(__name__)
CONF_NUMBER = 'number'
CONF_HELD_MORE_THAN = 'held_more_than'
CONF_HELD_LESS_THAN = 'held_less_than'
TRIGGER_SCHEMA = vol.Schema({
vol.Required(CONF_PLATFORM): 'litejet',
vol.Required(CONF_NUMBER): cv.positive_int,
vol.Optional(CONF_HELD_MORE_THAN):
vol.All(cv.time_period, cv.positive_timedelta),
vol.Optional(CONF_HELD_LESS_THAN):
vol.All(cv.time_period, cv.positive_timedelta)
})
def async_trigger(hass, config, action):
"""Listen for events based on configuration."""
number = config.get(CONF_NUMBER)
held_more_than = config.get(CONF_HELD_MORE_THAN)
held_less_than = config.get(CONF_HELD_LESS_THAN)
pressed_time = None
cancel_pressed_more_than = None
@callback
def call_action():
"""Call action with right context."""
hass.async_run_job(action, {
'trigger': {
CONF_PLATFORM: 'litejet',
CONF_NUMBER: number,
CONF_HELD_MORE_THAN: held_more_than,
CONF_HELD_LESS_THAN: held_less_than
},
})
# held_more_than and held_less_than: trigger on released (if in time range)
# held_more_than: trigger after pressed with calculation
# held_less_than: trigger on released with calculation
# neither: trigger on pressed
@callback
def pressed_more_than_satisfied(now):
"""Handle the LiteJet's switch's button pressed >= held_more_than."""
call_action()
def pressed():
"""Handle the press of the LiteJet switch's button."""
nonlocal cancel_pressed_more_than, pressed_time
nonlocal held_less_than, held_more_than
pressed_time = dt_util.utcnow()
if held_more_than is None and held_less_than is None:
call_action()
if held_more_than is not None and held_less_than is None:
cancel_pressed_more_than = track_point_in_utc_time(
hass,
pressed_more_than_satisfied,
dt_util.utcnow() + held_more_than)
def released():
"""Handle the release of the LiteJet switch's button."""
nonlocal cancel_pressed_more_than, pressed_time
nonlocal held_less_than, held_more_than
# pylint: disable=not-callable
if cancel_pressed_more_than is not None:
cancel_pressed_more_than()
cancel_pressed_more_than = None
held_time = dt_util.utcnow() - pressed_time
if held_less_than is not None and held_time < held_less_than:
if held_more_than is None or held_time > held_more_than:
call_action()
hass.data['litejet_system'].on_switch_pressed(number, pressed)
hass.data['litejet_system'].on_switch_released(number, released)
def async_remove():
"""Remove all subscriptions used for this trigger."""
return
return async_remove

View File

@@ -6,14 +6,14 @@ at https://home-assistant.io/components/automation/#mqtt-trigger
""" """
import voluptuous as vol import voluptuous as vol
from homeassistant.core import callback
import homeassistant.components.mqtt as mqtt import homeassistant.components.mqtt as mqtt
from homeassistant.const import CONF_PLATFORM from homeassistant.const import (CONF_PLATFORM, CONF_PAYLOAD)
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
DEPENDENCIES = ['mqtt'] DEPENDENCIES = ['mqtt']
CONF_TOPIC = 'topic' CONF_TOPIC = 'topic'
CONF_PAYLOAD = 'payload'
TRIGGER_SCHEMA = vol.Schema({ TRIGGER_SCHEMA = vol.Schema({
vol.Required(CONF_PLATFORM): mqtt.DOMAIN, vol.Required(CONF_PLATFORM): mqtt.DOMAIN,
@@ -22,15 +22,16 @@ TRIGGER_SCHEMA = vol.Schema({
}) })
def trigger(hass, config, action): def async_trigger(hass, config, action):
"""Listen for state changes based on configuration.""" """Listen for state changes based on configuration."""
topic = config[CONF_TOPIC] topic = config.get(CONF_TOPIC)
payload = config.get(CONF_PAYLOAD) payload = config.get(CONF_PAYLOAD)
@callback
def mqtt_automation_listener(msg_topic, msg_payload, qos): def mqtt_automation_listener(msg_topic, msg_payload, qos):
"""Listen for MQTT messages.""" """Listen for MQTT messages."""
if payload is None or payload == msg_payload: if payload is None or payload == msg_payload:
action({ hass.async_run_job(action, {
'trigger': { 'trigger': {
'platform': 'mqtt', 'platform': 'mqtt',
'topic': msg_topic, 'topic': msg_topic,
@@ -39,6 +40,4 @@ def trigger(hass, config, action):
} }
}) })
mqtt.subscribe(hass, topic, mqtt_automation_listener) return mqtt.async_subscribe(hass, topic, mqtt_automation_listener)
return True

View File

@@ -8,10 +8,11 @@ import logging
import voluptuous as vol import voluptuous as vol
from homeassistant.core import callback
from homeassistant.const import ( from homeassistant.const import (
CONF_VALUE_TEMPLATE, CONF_PLATFORM, CONF_ENTITY_ID, CONF_VALUE_TEMPLATE, CONF_PLATFORM, CONF_ENTITY_ID,
CONF_BELOW, CONF_ABOVE) CONF_BELOW, CONF_ABOVE)
from homeassistant.helpers.event import track_state_change from homeassistant.helpers.event import async_track_state_change
from homeassistant.helpers import condition, config_validation as cv from homeassistant.helpers import condition, config_validation as cv
TRIGGER_SCHEMA = vol.All(vol.Schema({ TRIGGER_SCHEMA = vol.All(vol.Schema({
@@ -25,14 +26,16 @@ TRIGGER_SCHEMA = vol.All(vol.Schema({
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
def trigger(hass, config, action): def async_trigger(hass, config, action):
"""Listen for state changes based on configuration.""" """Listen for state changes based on configuration."""
entity_id = config.get(CONF_ENTITY_ID) entity_id = config.get(CONF_ENTITY_ID)
below = config.get(CONF_BELOW) below = config.get(CONF_BELOW)
above = config.get(CONF_ABOVE) above = config.get(CONF_ABOVE)
value_template = config.get(CONF_VALUE_TEMPLATE) value_template = config.get(CONF_VALUE_TEMPLATE)
if value_template is not None:
value_template.hass = hass
# pylint: disable=unused-argument @callback
def state_automation_listener(entity, from_s, to_s): def state_automation_listener(entity, from_s, to_s):
"""Listen for state changes and calls action.""" """Listen for state changes and calls action."""
if to_s is None: if to_s is None:
@@ -48,22 +51,19 @@ def trigger(hass, config, action):
} }
# If new one doesn't match, nothing to do # If new one doesn't match, nothing to do
if not condition.numeric_state( if not condition.async_numeric_state(
hass, to_s, below, above, value_template, variables): hass, to_s, below, above, value_template, variables):
return return
# Only match if old didn't exist or existed but didn't match # Only match if old didn't exist or existed but didn't match
# Written as: skip if old one did exist and matched # Written as: skip if old one did exist and matched
if from_s is not None and condition.numeric_state( if from_s is not None and condition.async_numeric_state(
hass, from_s, below, above, value_template, variables): hass, from_s, below, above, value_template, variables):
return return
variables['trigger']['from_state'] = from_s variables['trigger']['from_state'] = from_s
variables['trigger']['to_state'] = to_s variables['trigger']['to_state'] = to_s
action(variables) hass.async_run_job(action, variables)
track_state_change( return async_track_state_change(hass, entity_id, state_automation_listener)
hass, entity_id, state_automation_listener)
return True

View File

@@ -0,0 +1,34 @@
turn_on:
description: Enable an automation.
fields:
entity_id:
description: Name of the automation to turn on.
example: 'automation.notify_home'
turn_off:
description: Disable an automation.
fields:
entity_id:
description: Name of the automation to turn off.
example: 'automation.notify_home'
toggle:
description: Toggle an automation.
fields:
entity_id:
description: Name of the automation to toggle on/off.
example: 'automation.notify_home'
trigger:
description: Trigger the action of an automation.
fields:
entity_id:
description: Name of the automation to trigger.
example: 'automation.notify_home'
reload:
description: Reload the automation configuration.

View File

@@ -6,10 +6,11 @@ at https://home-assistant.io/components/automation/#state-trigger
""" """
import voluptuous as vol import voluptuous as vol
from homeassistant.core import callback
import homeassistant.util.dt as dt_util import homeassistant.util.dt as dt_util
from homeassistant.const import ( from homeassistant.const import MATCH_ALL, CONF_PLATFORM
EVENT_STATE_CHANGED, EVENT_TIME_CHANGED, MATCH_ALL, CONF_PLATFORM) from homeassistant.helpers.event import (
from homeassistant.helpers.event import track_state_change, track_point_in_time async_track_state_change, async_track_point_in_utc_time)
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
CONF_ENTITY_ID = "entity_id" CONF_ENTITY_ID = "entity_id"
@@ -33,18 +34,23 @@ TRIGGER_SCHEMA = vol.All(
) )
def trigger(hass, config, action): def async_trigger(hass, config, action):
"""Listen for state changes based on configuration.""" """Listen for state changes based on configuration."""
entity_id = config.get(CONF_ENTITY_ID) entity_id = config.get(CONF_ENTITY_ID)
from_state = config.get(CONF_FROM, MATCH_ALL) from_state = config.get(CONF_FROM, MATCH_ALL)
to_state = config.get(CONF_TO) or config.get(CONF_STATE) or MATCH_ALL to_state = config.get(CONF_TO) or config.get(CONF_STATE) or MATCH_ALL
time_delta = config.get(CONF_FOR) time_delta = config.get(CONF_FOR)
async_remove_state_for_cancel = None
async_remove_state_for_listener = None
@callback
def state_automation_listener(entity, from_s, to_s): def state_automation_listener(entity, from_s, to_s):
"""Listen for state changes and calls action.""" """Listen for state changes and calls action."""
nonlocal async_remove_state_for_cancel, async_remove_state_for_listener
def call_action(): def call_action():
"""Call action with right context.""" """Call action with right context."""
action({ hass.async_run_job(action, {
'trigger': { 'trigger': {
'platform': 'state', 'platform': 'state',
'entity_id': entity, 'entity_id': entity,
@@ -58,28 +64,37 @@ def trigger(hass, config, action):
call_action() call_action()
return return
@callback
def state_for_listener(now): def state_for_listener(now):
"""Fire on state changes after a delay and calls action.""" """Fire on state changes after a delay and calls action."""
hass.bus.remove_listener( async_remove_state_for_cancel()
EVENT_STATE_CHANGED, attached_state_for_cancel)
call_action() call_action()
@callback
def state_for_cancel_listener(entity, inner_from_s, inner_to_s): def state_for_cancel_listener(entity, inner_from_s, inner_to_s):
"""Fire on changes and cancel for listener if changed.""" """Fire on changes and cancel for listener if changed."""
if inner_to_s.state == to_s.state: if inner_to_s.state == to_s.state:
return return
hass.bus.remove_listener(EVENT_TIME_CHANGED, async_remove_state_for_listener()
attached_state_for_listener) async_remove_state_for_cancel()
hass.bus.remove_listener(EVENT_STATE_CHANGED,
attached_state_for_cancel)
attached_state_for_listener = track_point_in_time( async_remove_state_for_listener = async_track_point_in_utc_time(
hass, state_for_listener, dt_util.utcnow() + time_delta) hass, state_for_listener, dt_util.utcnow() + time_delta)
attached_state_for_cancel = track_state_change( async_remove_state_for_cancel = async_track_state_change(
hass, entity, state_for_cancel_listener) hass, entity, state_for_cancel_listener)
track_state_change( unsub = async_track_state_change(
hass, entity_id, state_automation_listener, from_state, to_state) hass, entity_id, state_automation_listener, from_state, to_state)
return True def async_remove():
"""Remove state listeners async."""
unsub()
# pylint: disable=not-callable
if async_remove_state_for_cancel is not None:
async_remove_state_for_cancel()
if async_remove_state_for_listener is not None:
async_remove_state_for_listener()
return async_remove

View File

@@ -9,9 +9,10 @@ import logging
import voluptuous as vol import voluptuous as vol
from homeassistant.core import callback
from homeassistant.const import ( from homeassistant.const import (
CONF_EVENT, CONF_OFFSET, CONF_PLATFORM, SUN_EVENT_SUNRISE) CONF_EVENT, CONF_OFFSET, CONF_PLATFORM, SUN_EVENT_SUNRISE)
from homeassistant.helpers.event import track_sunrise, track_sunset from homeassistant.helpers.event import async_track_sunrise, async_track_sunset
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
DEPENDENCIES = ['sun'] DEPENDENCIES = ['sun']
@@ -25,14 +26,15 @@ TRIGGER_SCHEMA = vol.Schema({
}) })
def trigger(hass, config, action): def async_trigger(hass, config, action):
"""Listen for events based on configuration.""" """Listen for events based on configuration."""
event = config.get(CONF_EVENT) event = config.get(CONF_EVENT)
offset = config.get(CONF_OFFSET) offset = config.get(CONF_OFFSET)
@callback
def call_action(): def call_action():
"""Call action with right context.""" """Call action with right context."""
action({ hass.async_run_job(action, {
'trigger': { 'trigger': {
'platform': 'sun', 'platform': 'sun',
'event': event, 'event': event,
@@ -42,8 +44,6 @@ def trigger(hass, config, action):
# Do something to call action # Do something to call action
if event == SUN_EVENT_SUNRISE: if event == SUN_EVENT_SUNRISE:
track_sunrise(hass, call_action, offset) return async_track_sunrise(hass, call_action, offset)
else: else:
track_sunset(hass, call_action, offset) return async_track_sunset(hass, call_action, offset)
return True

View File

@@ -8,10 +8,10 @@ import logging
import voluptuous as vol import voluptuous as vol
from homeassistant.const import ( from homeassistant.core import callback
CONF_VALUE_TEMPLATE, CONF_PLATFORM, MATCH_ALL) from homeassistant.const import CONF_VALUE_TEMPLATE, CONF_PLATFORM
from homeassistant.helpers import condition from homeassistant.helpers import condition
from homeassistant.helpers.event import track_state_change from homeassistant.helpers.event import async_track_state_change
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
@@ -23,22 +23,24 @@ TRIGGER_SCHEMA = IF_ACTION_SCHEMA = vol.Schema({
}) })
def trigger(hass, config, action): def async_trigger(hass, config, action):
"""Listen for state changes based on configuration.""" """Listen for state changes based on configuration."""
value_template = config.get(CONF_VALUE_TEMPLATE) value_template = config.get(CONF_VALUE_TEMPLATE)
value_template.hass = hass
# Local variable to keep track of if the action has already been triggered # Local variable to keep track of if the action has already been triggered
already_triggered = False already_triggered = False
@callback
def state_changed_listener(entity_id, from_s, to_s): def state_changed_listener(entity_id, from_s, to_s):
"""Listen for state changes and calls action.""" """Listen for state changes and calls action."""
nonlocal already_triggered nonlocal already_triggered
template_result = condition.template(hass, value_template) template_result = condition.async_template(hass, value_template)
# Check to see if template returns true # Check to see if template returns true
if template_result and not already_triggered: if template_result and not already_triggered:
already_triggered = True already_triggered = True
action({ hass.async_run_job(action, {
'trigger': { 'trigger': {
'platform': 'template', 'platform': 'template',
'entity_id': entity_id, 'entity_id': entity_id,
@@ -49,5 +51,5 @@ def trigger(hass, config, action):
elif not template_result: elif not template_result:
already_triggered = False already_triggered = False
track_state_change(hass, MATCH_ALL, state_changed_listener) return async_track_state_change(hass, value_template.extract_entities(),
return True state_changed_listener)

View File

@@ -8,9 +8,10 @@ import logging
import voluptuous as vol import voluptuous as vol
from homeassistant.core import callback
from homeassistant.const import CONF_AFTER, CONF_PLATFORM from homeassistant.const import CONF_AFTER, CONF_PLATFORM
from homeassistant.helpers import config_validation as cv from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.event import track_time_change from homeassistant.helpers.event import async_track_time_change
CONF_HOURS = "hours" CONF_HOURS = "hours"
CONF_MINUTES = "minutes" CONF_MINUTES = "minutes"
@@ -28,7 +29,7 @@ TRIGGER_SCHEMA = vol.All(vol.Schema({
CONF_SECONDS, CONF_AFTER)) CONF_SECONDS, CONF_AFTER))
def trigger(hass, config, action): def async_trigger(hass, config, action):
"""Listen for state changes based on configuration.""" """Listen for state changes based on configuration."""
if CONF_AFTER in config: if CONF_AFTER in config:
after = config.get(CONF_AFTER) after = config.get(CONF_AFTER)
@@ -38,16 +39,15 @@ def trigger(hass, config, action):
minutes = config.get(CONF_MINUTES) minutes = config.get(CONF_MINUTES)
seconds = config.get(CONF_SECONDS) seconds = config.get(CONF_SECONDS)
@callback
def time_automation_listener(now): def time_automation_listener(now):
"""Listen for time changes and calls action.""" """Listen for time changes and calls action."""
action({ hass.async_run_job(action, {
'trigger': { 'trigger': {
'platform': 'time', 'platform': 'time',
'now': now, 'now': now,
}, },
}) })
track_time_change(hass, time_automation_listener, return async_track_time_change(hass, time_automation_listener,
hour=hours, minute=minutes, second=seconds) hour=hours, minute=minutes, second=seconds)
return True

View File

@@ -6,9 +6,10 @@ at https://home-assistant.io/components/automation/#zone-trigger
""" """
import voluptuous as vol import voluptuous as vol
from homeassistant.core import callback
from homeassistant.const import ( from homeassistant.const import (
CONF_EVENT, CONF_ENTITY_ID, CONF_ZONE, MATCH_ALL, CONF_PLATFORM) CONF_EVENT, CONF_ENTITY_ID, CONF_ZONE, MATCH_ALL, CONF_PLATFORM)
from homeassistant.helpers.event import track_state_change from homeassistant.helpers.event import async_track_state_change
from homeassistant.helpers import ( from homeassistant.helpers import (
condition, config_validation as cv, location) condition, config_validation as cv, location)
@@ -25,12 +26,13 @@ TRIGGER_SCHEMA = vol.Schema({
}) })
def trigger(hass, config, action): def async_trigger(hass, config, action):
"""Listen for state changes based on configuration.""" """Listen for state changes based on configuration."""
entity_id = config.get(CONF_ENTITY_ID) entity_id = config.get(CONF_ENTITY_ID)
zone_entity_id = config.get(CONF_ZONE) zone_entity_id = config.get(CONF_ZONE)
event = config.get(CONF_EVENT) event = config.get(CONF_EVENT)
@callback
def zone_automation_listener(entity, from_s, to_s): def zone_automation_listener(entity, from_s, to_s):
"""Listen for state changes and calls action.""" """Listen for state changes and calls action."""
if from_s and not location.has_location(from_s) or \ if from_s and not location.has_location(from_s) or \
@@ -47,7 +49,7 @@ def trigger(hass, config, action):
# pylint: disable=too-many-boolean-expressions # pylint: disable=too-many-boolean-expressions
if event == EVENT_ENTER and not from_match and to_match or \ if event == EVENT_ENTER and not from_match and to_match or \
event == EVENT_LEAVE and from_match and not to_match: event == EVENT_LEAVE and from_match and not to_match:
action({ hass.async_run_job(action, {
'trigger': { 'trigger': {
'platform': 'zone', 'platform': 'zone',
'entity_id': entity, 'entity_id': entity,
@@ -58,7 +60,5 @@ def trigger(hass, config, action):
}, },
}) })
track_state_change( return async_track_state_change(hass, entity_id, zone_automation_listener,
hass, entity_id, zone_automation_listener, MATCH_ALL, MATCH_ALL) MATCH_ALL, MATCH_ALL)
return True

View File

@@ -4,8 +4,11 @@ Component to interface with binary sensors.
For more details about this component, please refer to the documentation at For more details about this component, please refer to the documentation at
https://home-assistant.io/components/binary_sensor/ https://home-assistant.io/components/binary_sensor/
""" """
import asyncio
import logging import logging
import voluptuous as vol
from homeassistant.helpers.entity_component import EntityComponent from homeassistant.helpers.entity_component import EntityComponent
from homeassistant.helpers.entity import Entity from homeassistant.helpers.entity import Entity
from homeassistant.const import (STATE_ON, STATE_OFF) from homeassistant.const import (STATE_ON, STATE_OFF)
@@ -25,6 +28,7 @@ SENSOR_CLASSES = [
'moisture', # Specifically a wetness sensor 'moisture', # Specifically a wetness sensor
'motion', # Motion sensor 'motion', # Motion sensor
'moving', # On means moving, Off means stopped 'moving', # On means moving, Off means stopped
'occupancy', # On means occupied, Off means not occupied
'opening', # Door, window, etc. 'opening', # Door, window, etc.
'power', # Power, over-current, etc 'power', # Power, over-current, etc
'safety', # Generic on=unsafe, off=safe 'safety', # Generic on=unsafe, off=safe
@@ -33,14 +37,16 @@ SENSOR_CLASSES = [
'vibration', # On means vibration detected, Off means no vibration 'vibration', # On means vibration detected, Off means no vibration
] ]
SENSOR_CLASSES_SCHEMA = vol.All(vol.Lower, vol.In(SENSOR_CLASSES))
def setup(hass, config):
@asyncio.coroutine
def async_setup(hass, config):
"""Track states and offer events for binary sensors.""" """Track states and offer events for binary sensors."""
component = EntityComponent( component = EntityComponent(
logging.getLogger(__name__), DOMAIN, hass, SCAN_INTERVAL) logging.getLogger(__name__), DOMAIN, hass, SCAN_INTERVAL)
component.setup(config) yield from component.async_setup(config)
return True return True

View File

@@ -4,23 +4,32 @@ Support for tracking the online status of a UPS.
For more details about this platform, please refer to the documentation at For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.apcupsd/ https://home-assistant.io/components/binary_sensor.apcupsd/
""" """
from homeassistant.components import apcupsd import voluptuous as vol
from homeassistant.components.binary_sensor import BinarySensorDevice
from homeassistant.components.binary_sensor import (
BinarySensorDevice, PLATFORM_SCHEMA)
from homeassistant.const import CONF_NAME
import homeassistant.helpers.config_validation as cv
from homeassistant.components import apcupsd
DEFAULT_NAME = 'UPS Online Status'
DEPENDENCIES = [apcupsd.DOMAIN] DEPENDENCIES = [apcupsd.DOMAIN]
DEFAULT_NAME = "UPS Online Status"
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
})
def setup_platform(hass, config, add_entities, discovery_info=None): def setup_platform(hass, config, add_entities, discovery_info=None):
"""Instantiate an OnlineStatus binary sensor entity.""" """Setup an Online Status binary sensor."""
add_entities((OnlineStatus(config, apcupsd.DATA),)) add_entities((OnlineStatus(config, apcupsd.DATA),))
class OnlineStatus(BinarySensorDevice): class OnlineStatus(BinarySensorDevice):
"""Represent UPS online status.""" """Representation of an UPS online status."""
def __init__(self, config, data): def __init__(self, config, data):
"""Initialize the APCUPSd device.""" """Initialize the APCUPSd binary device."""
self._config = config self._config = config
self._data = data self._data = data
self._state = None self._state = None
@@ -29,7 +38,7 @@ class OnlineStatus(BinarySensorDevice):
@property @property
def name(self): def name(self):
"""Return the name of the UPS online status sensor.""" """Return the name of the UPS online status sensor."""
return self._config.get("name", DEFAULT_NAME) return self._config.get(CONF_NAME)
@property @property
def is_on(self): def is_on(self):

View File

@@ -1,5 +1,5 @@
""" """
Support for exposed aREST RESTful API of a device. Support for an exposed aREST RESTful API of a device.
For more details about this platform, please refer to the documentation at For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.arest/ https://home-assistant.io/components/binary_sensor.arest/
@@ -8,34 +8,32 @@ import logging
from datetime import timedelta from datetime import timedelta
import requests import requests
import voluptuous as vol
from homeassistant.components.binary_sensor import (BinarySensorDevice, from homeassistant.components.binary_sensor import (
SENSOR_CLASSES) BinarySensorDevice, PLATFORM_SCHEMA, SENSOR_CLASSES_SCHEMA)
from homeassistant.const import (
CONF_RESOURCE, CONF_PIN, CONF_NAME, CONF_SENSOR_CLASS)
from homeassistant.util import Throttle from homeassistant.util import Throttle
import homeassistant.helpers.config_validation as cv
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
# Return cached results if last scan was less then this time ago
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=30) MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=30)
CONF_RESOURCE = 'resource' PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
CONF_PIN = 'pin' vol.Required(CONF_RESOURCE): cv.url,
vol.Optional(CONF_NAME): cv.string,
vol.Required(CONF_PIN): cv.string,
vol.Optional(CONF_SENSOR_CLASS): SENSOR_CLASSES_SCHEMA,
})
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the aREST binary sensor.""" """Setup the aREST binary sensor."""
resource = config.get(CONF_RESOURCE) resource = config.get(CONF_RESOURCE)
pin = config.get(CONF_PIN) pin = config.get(CONF_PIN)
sensor_class = config.get(CONF_SENSOR_CLASS)
sensor_class = config.get('sensor_class')
if sensor_class not in SENSOR_CLASSES:
_LOGGER.warning('Unknown sensor class: %s', sensor_class)
sensor_class = None
if None in (resource, pin):
_LOGGER.error('Not all required config keys present: %s',
', '.join((CONF_RESOURCE, CONF_PIN)))
return False
try: try:
response = requests.get(resource, timeout=10).json() response = requests.get(resource, timeout=10).json()
@@ -52,14 +50,10 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
arest = ArestData(resource, pin) arest = ArestData(resource, pin)
add_devices([ArestBinarySensor( add_devices([ArestBinarySensor(
arest, arest, resource, config.get(CONF_NAME, response[CONF_NAME]),
resource, sensor_class, pin)])
config.get('name', response['name']),
sensor_class,
pin)])
# pylint: disable=too-many-instance-attributes, too-many-arguments
class ArestBinarySensor(BinarySensorDevice): class ArestBinarySensor(BinarySensorDevice):
"""Implement an aREST binary sensor for a pin.""" """Implement an aREST binary sensor for a pin."""
@@ -98,7 +92,6 @@ class ArestBinarySensor(BinarySensorDevice):
self.arest.update() self.arest.update()
# pylint: disable=too-few-public-methods
class ArestData(object): class ArestData(object):
"""Class for handling the data retrieval for pins.""" """Class for handling the data retrieval for pins."""

View File

@@ -6,32 +6,39 @@ https://home-assistant.io/components/binary_sensor.bloomsky/
""" """
import logging import logging
from homeassistant.components.binary_sensor import BinarySensorDevice import voluptuous as vol
from homeassistant.loader import get_component
DEPENDENCIES = ["bloomsky"] from homeassistant.components.binary_sensor import (
BinarySensorDevice, PLATFORM_SCHEMA)
from homeassistant.const import CONF_MONITORED_CONDITIONS
from homeassistant.loader import get_component
import homeassistant.helpers.config_validation as cv
_LOGGER = logging.getLogger(__name__)
DEPENDENCIES = ['bloomsky']
# These are the available sensors mapped to binary_sensor class # These are the available sensors mapped to binary_sensor class
SENSOR_TYPES = { SENSOR_TYPES = {
"Rain": "moisture", 'Rain': 'moisture',
"Night": None, 'Night': None,
} }
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Optional(CONF_MONITORED_CONDITIONS, default=SENSOR_TYPES):
vol.All(cv.ensure_list, [vol.In(SENSOR_TYPES)]),
})
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the available BloomSky weather binary sensors.""" """Setup the available BloomSky weather binary sensors."""
logger = logging.getLogger(__name__)
bloomsky = get_component('bloomsky') bloomsky = get_component('bloomsky')
sensors = config.get('monitored_conditions', SENSOR_TYPES) # Default needed in case of discovery
sensors = config.get(CONF_MONITORED_CONDITIONS, SENSOR_TYPES)
for device in bloomsky.BLOOMSKY.devices.values(): for device in bloomsky.BLOOMSKY.devices.values():
for variable in sensors: for variable in sensors:
if variable in SENSOR_TYPES: add_devices([BloomSkySensor(bloomsky.BLOOMSKY, device, variable)])
add_devices([BloomSkySensor(bloomsky.BLOOMSKY,
device,
variable)])
else:
logger.error("Cannot find definition for device: %s", variable)
class BloomSkySensor(BinarySensorDevice): class BloomSkySensor(BinarySensorDevice):
@@ -40,10 +47,10 @@ class BloomSkySensor(BinarySensorDevice):
def __init__(self, bs, device, sensor_name): def __init__(self, bs, device, sensor_name):
"""Initialize a BloomSky binary sensor.""" """Initialize a BloomSky binary sensor."""
self._bloomsky = bs self._bloomsky = bs
self._device_id = device["DeviceID"] self._device_id = device['DeviceID']
self._sensor_name = sensor_name self._sensor_name = sensor_name
self._name = "{} {}".format(device["DeviceName"], sensor_name) self._name = '{} {}'.format(device['DeviceName'], sensor_name)
self._unique_id = "bloomsky_binary_sensor {}".format(self._name) self._unique_id = 'bloomsky_binary_sensor {}'.format(self._name)
self.update() self.update()
@property @property
@@ -71,4 +78,4 @@ class BloomSkySensor(BinarySensorDevice):
self._bloomsky.refresh_devices() self._bloomsky.refresh_devices()
self._state = \ self._state = \
self._bloomsky.devices[self._device_id]["Data"][self._sensor_name] self._bloomsky.devices[self._device_id]['Data'][self._sensor_name]

View File

@@ -5,51 +5,53 @@ For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.command_line/ https://home-assistant.io/components/binary_sensor.command_line/
""" """
import logging import logging
from datetime import timedelta
from homeassistant.components.binary_sensor import (BinarySensorDevice, import voluptuous as vol
SENSOR_CLASSES)
from homeassistant.components.binary_sensor import (
BinarySensorDevice, SENSOR_CLASSES_SCHEMA, PLATFORM_SCHEMA)
from homeassistant.components.sensor.command_line import CommandSensorData from homeassistant.components.sensor.command_line import CommandSensorData
from homeassistant.const import CONF_VALUE_TEMPLATE from homeassistant.const import (
from homeassistant.helpers import template CONF_PAYLOAD_OFF, CONF_PAYLOAD_ON, CONF_NAME, CONF_VALUE_TEMPLATE,
CONF_SENSOR_CLASS, CONF_COMMAND)
import homeassistant.helpers.config_validation as cv
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
DEFAULT_NAME = "Binary Command Sensor" DEFAULT_NAME = 'Binary Command Sensor'
DEFAULT_SENSOR_CLASS = None
DEFAULT_PAYLOAD_ON = 'ON' DEFAULT_PAYLOAD_ON = 'ON'
DEFAULT_PAYLOAD_OFF = 'OFF' DEFAULT_PAYLOAD_OFF = 'OFF'
# Return cached results if last scan was less then this time ago SCAN_INTERVAL = 60
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=60)
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Required(CONF_COMMAND): cv.string,
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
vol.Optional(CONF_PAYLOAD_OFF, default=DEFAULT_PAYLOAD_OFF): cv.string,
vol.Optional(CONF_PAYLOAD_ON, default=DEFAULT_PAYLOAD_ON): cv.string,
vol.Optional(CONF_SENSOR_CLASS): SENSOR_CLASSES_SCHEMA,
vol.Optional(CONF_VALUE_TEMPLATE): cv.template,
})
# pylint: disable=unused-argument # pylint: disable=unused-argument
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the Command Sensor.""" """Setup the Command line Binary Sensor."""
if config.get('command') is None: name = config.get(CONF_NAME)
_LOGGER.error('Missing required variable: "command"') command = config.get(CONF_COMMAND)
return False payload_off = config.get(CONF_PAYLOAD_OFF)
payload_on = config.get(CONF_PAYLOAD_ON)
sensor_class = config.get('sensor_class') sensor_class = config.get(CONF_SENSOR_CLASS)
if sensor_class not in SENSOR_CLASSES: value_template = config.get(CONF_VALUE_TEMPLATE)
_LOGGER.warning('Unknown sensor class: %s', sensor_class) if value_template is not None:
sensor_class = DEFAULT_SENSOR_CLASS value_template.hass = hass
data = CommandSensorData(command)
data = CommandSensorData(config.get('command'))
add_devices([CommandBinarySensor( add_devices([CommandBinarySensor(
hass, hass, data, name, sensor_class, payload_on, payload_off,
data, value_template)])
config.get('name', DEFAULT_NAME),
sensor_class,
config.get('payload_on', DEFAULT_PAYLOAD_ON),
config.get('payload_off', DEFAULT_PAYLOAD_OFF),
config.get(CONF_VALUE_TEMPLATE)
)])
# pylint: disable=too-many-arguments, too-many-instance-attributes
class CommandBinarySensor(BinarySensorDevice): class CommandBinarySensor(BinarySensorDevice):
"""Represent a command line binary sensor.""" """Represent a command line binary sensor."""
@@ -87,8 +89,8 @@ class CommandBinarySensor(BinarySensorDevice):
value = self.data.value value = self.data.value
if self._value_template is not None: if self._value_template is not None:
value = template.render_with_possible_json_value( value = self._value_template.render_with_possible_json_value(
self._hass, self._value_template, value, False) value, False)
if value == self._payload_on: if value == self._payload_on:
self._state = True self._state = True
elif value == self._payload_off: elif value == self._payload_off:

View File

@@ -0,0 +1,136 @@
"""
Support for exposing Concord232 elements as sensors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.concord232/
"""
import datetime
import logging
import requests
import voluptuous as vol
from homeassistant.components.binary_sensor import (
BinarySensorDevice, PLATFORM_SCHEMA, SENSOR_CLASSES)
from homeassistant.const import (CONF_HOST, CONF_PORT)
import homeassistant.helpers.config_validation as cv
REQUIREMENTS = ['concord232==0.14']
_LOGGER = logging.getLogger(__name__)
CONF_EXCLUDE_ZONES = 'exclude_zones'
CONF_ZONE_TYPES = 'zone_types'
DEFAULT_HOST = 'localhost'
DEFAULT_NAME = 'Alarm'
DEFAULT_PORT = '5007'
DEFAULT_SSL = False
SCAN_INTERVAL = 1
ZONE_TYPES_SCHEMA = vol.Schema({
cv.positive_int: vol.In(SENSOR_CLASSES),
})
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Optional(CONF_EXCLUDE_ZONES, default=[]):
vol.All(cv.ensure_list, [cv.positive_int]),
vol.Optional(CONF_HOST, default=DEFAULT_HOST): cv.string,
vol.Optional(CONF_PORT, default=DEFAULT_PORT): cv.port,
vol.Optional(CONF_ZONE_TYPES, default={}): ZONE_TYPES_SCHEMA,
})
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Set up the Concord232 binary sensor platform."""
from concord232 import client as concord232_client
host = config.get(CONF_HOST)
port = config.get(CONF_PORT)
exclude = config.get(CONF_EXCLUDE_ZONES)
zone_types = config.get(CONF_ZONE_TYPES)
sensors = []
try:
_LOGGER.debug("Initializing Client")
client = concord232_client.Client('http://{}:{}'.format(host, port))
client.zones = client.list_zones()
client.last_zone_update = datetime.datetime.now()
except requests.exceptions.ConnectionError as ex:
_LOGGER.error("Unable to connect to Concord232: %s", str(ex))
return False
for zone in client.zones:
_LOGGER.info("Loading Zone found: %s", zone['name'])
if zone['number'] not in exclude:
sensors.append(
Concord232ZoneSensor(
hass, client, zone, zone_types.get(zone['number'],
get_opening_type(zone)))
)
add_devices(sensors)
return True
def get_opening_type(zone):
"""Helper function to try to guess sensor type from name."""
if 'MOTION' in zone['name']:
return 'motion'
if 'KEY' in zone['name']:
return 'safety'
if 'SMOKE' in zone['name']:
return 'smoke'
if 'WATER' in zone['name']:
return 'water'
return 'opening'
class Concord232ZoneSensor(BinarySensorDevice):
"""Representation of a Concord232 zone as a sensor."""
def __init__(self, hass, client, zone, zone_type):
"""Initialize the Concord232 binary sensor."""
self._hass = hass
self._client = client
self._zone = zone
self._number = zone['number']
self._zone_type = zone_type
self.update()
@property
def sensor_class(self):
"""Return the class of this sensor, from SENSOR_CLASSES."""
return self._zone_type
@property
def should_poll(self):
"""No polling needed."""
return True
@property
def name(self):
"""Return the name of the binary sensor."""
return self._zone['name']
@property
def is_on(self):
"""Return true if the binary sensor is on."""
# True means "faulted" or "open" or "abnormal state"
return bool(self._zone['state'] == 'Normal')
def update(self):
""""Get updated stats from API."""
last_update = datetime.datetime.now() - self._client.last_zone_update
_LOGGER.debug("Zone: %s ", self._zone)
if last_update > datetime.timedelta(seconds=1):
self._client.zones = self._client.list_zones()
self._client.last_zone_update = datetime.datetime.now()
_LOGGER.debug("Updated from Zone: %s", self._zone['name'])
if hasattr(self._client, 'zones'):
self._zone = next((x for x in self._client.zones
if x['number'] == self._number), None)

View File

@@ -0,0 +1,91 @@
"""
Support for monitoring the state of Digital Ocean droplets.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.digital_ocean/
"""
import logging
import voluptuous as vol
from homeassistant.components.binary_sensor import (
BinarySensorDevice, PLATFORM_SCHEMA)
from homeassistant.components.digital_ocean import (
CONF_DROPLETS, ATTR_CREATED_AT, ATTR_DROPLET_ID, ATTR_DROPLET_NAME,
ATTR_FEATURES, ATTR_IPV4_ADDRESS, ATTR_IPV6_ADDRESS, ATTR_MEMORY,
ATTR_REGION, ATTR_VCPUS)
from homeassistant.loader import get_component
import homeassistant.helpers.config_validation as cv
_LOGGER = logging.getLogger(__name__)
DEFAULT_NAME = 'Droplet'
DEFAULT_SENSOR_CLASS = 'motion'
DEPENDENCIES = ['digital_ocean']
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Required(CONF_DROPLETS): vol.All(cv.ensure_list, [cv.string]),
})
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the Digital Ocean droplet sensor."""
digital_ocean = get_component('digital_ocean')
droplets = config.get(CONF_DROPLETS)
dev = []
for droplet in droplets:
droplet_id = digital_ocean.DIGITAL_OCEAN.get_droplet_id(droplet)
dev.append(DigitalOceanBinarySensor(
digital_ocean.DIGITAL_OCEAN, droplet_id))
add_devices(dev)
class DigitalOceanBinarySensor(BinarySensorDevice):
"""Representation of a Digital Ocean droplet sensor."""
def __init__(self, do, droplet_id):
"""Initialize a new Digital Ocean sensor."""
self._digital_ocean = do
self._droplet_id = droplet_id
self._state = None
self.update()
@property
def name(self):
"""Return the name of the sensor."""
return self.data.name
@property
def is_on(self):
"""Return true if the binary sensor is on."""
return self.data.status == 'active'
@property
def sensor_class(self):
"""Return the class of this sensor."""
return DEFAULT_SENSOR_CLASS
@property
def state_attributes(self):
"""Return the state attributes of the Digital Ocean droplet."""
return {
ATTR_CREATED_AT: self.data.created_at,
ATTR_DROPLET_ID: self.data.id,
ATTR_DROPLET_NAME: self.data.name,
ATTR_FEATURES: self.data.features,
ATTR_IPV4_ADDRESS: self.data.ip_address,
ATTR_IPV6_ADDRESS: self.data.ip_v6_address,
ATTR_MEMORY: self.data.memory,
ATTR_REGION: self.data.region['name'],
ATTR_VCPUS: self.data.vcpus,
}
def update(self):
"""Update state of sensor."""
self._digital_ocean.update()
for droplet in self._digital_ocean.data:
if droplet.id == self._droplet_id:
self.data = droplet

View File

@@ -0,0 +1,72 @@
"""
Support for Ecobee sensors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.ecobee/
"""
from homeassistant.components import ecobee
from homeassistant.components.binary_sensor import BinarySensorDevice
DEPENDENCIES = ['ecobee']
ECOBEE_CONFIG_FILE = 'ecobee.conf'
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the Ecobee sensors."""
if discovery_info is None:
return
data = ecobee.NETWORK
dev = list()
for index in range(len(data.ecobee.thermostats)):
for sensor in data.ecobee.get_remote_sensors(index):
for item in sensor['capability']:
if item['type'] != 'occupancy':
continue
dev.append(EcobeeBinarySensor(sensor['name'], index))
add_devices(dev)
class EcobeeBinarySensor(BinarySensorDevice):
"""Representation of an Ecobee sensor."""
def __init__(self, sensor_name, sensor_index):
"""Initialize the sensor."""
self._name = sensor_name + ' Occupancy'
self.sensor_name = sensor_name
self.index = sensor_index
self._state = None
self._sensor_class = 'occupancy'
self.update()
@property
def name(self):
"""Return the name of the Ecobee sensor."""
return self._name.rstrip()
@property
def is_on(self):
"""Return the status of the sensor."""
return self._state == 'true'
@property
def unique_id(self):
"""Return the unique ID of this sensor."""
return "binary_sensor_ecobee_{}_{}".format(self._name, self.index)
@property
def sensor_class(self):
"""Return the class of this sensor, from SENSOR_CLASSES."""
return self._sensor_class
def update(self):
"""Get the latest state of the sensor."""
data = ecobee.NETWORK
data.update()
for sensor in data.ecobee.get_remote_sensors(self.index):
for item in sensor['capability']:
if (item['type'] == 'occupancy' and
self.sensor_name == sensor['name']):
self._state = item['value']

View File

@@ -4,27 +4,41 @@ Support for EnOcean binary sensors.
For more details about this platform, please refer to the documentation at For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.enocean/ https://home-assistant.io/components/binary_sensor.enocean/
""" """
import logging
from homeassistant.components.binary_sensor import BinarySensorDevice import voluptuous as vol
from homeassistant.components.binary_sensor import (
BinarySensorDevice, PLATFORM_SCHEMA, SENSOR_CLASSES_SCHEMA)
from homeassistant.components import enocean from homeassistant.components import enocean
from homeassistant.const import CONF_NAME from homeassistant.const import (CONF_NAME, CONF_ID, CONF_SENSOR_CLASS)
import homeassistant.helpers.config_validation as cv
DEPENDENCIES = ["enocean"] _LOGGER = logging.getLogger(__name__)
CONF_ID = "id" DEPENDENCIES = ['enocean']
DEFAULT_NAME = 'EnOcean binary sensor'
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Required(CONF_ID): cv.string,
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
vol.Optional(CONF_SENSOR_CLASS, default=None): SENSOR_CLASSES_SCHEMA,
})
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the Binary Sensor platform fo EnOcean.""" """Setup the Binary Sensor platform fo EnOcean."""
dev_id = config.get(CONF_ID, None) dev_id = config.get(CONF_ID)
devname = config.get(CONF_NAME, "EnOcean binary sensor") devname = config.get(CONF_NAME)
add_devices([EnOceanBinarySensor(dev_id, devname)]) sensor_class = config.get(CONF_SENSOR_CLASS)
add_devices([EnOceanBinarySensor(dev_id, devname, sensor_class)])
class EnOceanBinarySensor(enocean.EnOceanDevice, BinarySensorDevice): class EnOceanBinarySensor(enocean.EnOceanDevice, BinarySensorDevice):
"""Representation of EnOcean binary sensors such as wall switches.""" """Representation of EnOcean binary sensors such as wall switches."""
def __init__(self, dev_id, devname): def __init__(self, dev_id, devname, sensor_class):
"""Initialize the EnOcean binary sensor.""" """Initialize the EnOcean binary sensor."""
enocean.EnOceanDevice.__init__(self) enocean.EnOceanDevice.__init__(self)
self.stype = "listener" self.stype = "listener"
@@ -32,12 +46,18 @@ class EnOceanBinarySensor(enocean.EnOceanDevice, BinarySensorDevice):
self.which = -1 self.which = -1
self.onoff = -1 self.onoff = -1
self.devname = devname self.devname = devname
self._sensor_class = sensor_class
@property @property
def name(self): def name(self):
"""The default name for the binary sensor.""" """The default name for the binary sensor."""
return self.devname return self.devname
@property
def sensor_class(self):
"""Return the class of this sensor."""
return self._sensor_class
def value_changed(self, value, value2): def value_changed(self, value, value2):
"""Fire an event with the data that have changed. """Fire an event with the data that have changed.

View File

@@ -35,7 +35,6 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None):
class EnvisalinkBinarySensor(EnvisalinkDevice, BinarySensorDevice): class EnvisalinkBinarySensor(EnvisalinkDevice, BinarySensorDevice):
"""Representation of an Envisalink binary sensor.""" """Representation of an Envisalink binary sensor."""
# pylint: disable=too-many-arguments
def __init__(self, zone_number, zone_name, zone_type, info, controller): def __init__(self, zone_number, zone_name, zone_type, info, controller):
"""Initialize the binary_sensor.""" """Initialize the binary_sensor."""
from pydispatch import dispatcher from pydispatch import dispatcher
@@ -68,4 +67,4 @@ class EnvisalinkBinarySensor(EnvisalinkDevice, BinarySensorDevice):
def _update_callback(self, zone): def _update_callback(self, zone):
"""Update the zone's state, if needed.""" """Update the zone's state, if needed."""
if zone is None or int(zone) == self._zone_number: if zone is None or int(zone) == self._zone_number:
self.update_ha_state() self.hass.async_add_job(self.update_ha_state)

View File

@@ -0,0 +1,224 @@
"""
Provides a binary sensor which is a collection of ffmpeg tools.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.ffmpeg/
"""
import logging
from os import path
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.components.binary_sensor import (
BinarySensorDevice, PLATFORM_SCHEMA, DOMAIN)
from homeassistant.components.ffmpeg import (
get_binary, run_test, CONF_INPUT, CONF_OUTPUT, CONF_EXTRA_ARGUMENTS)
from homeassistant.config import load_yaml_config_file
from homeassistant.const import (EVENT_HOMEASSISTANT_STOP, CONF_NAME,
ATTR_ENTITY_ID)
DEPENDENCIES = ['ffmpeg']
_LOGGER = logging.getLogger(__name__)
SERVICE_RESTART = 'ffmpeg_restart'
FFMPEG_SENSOR_NOISE = 'noise'
FFMPEG_SENSOR_MOTION = 'motion'
MAP_FFMPEG_BIN = [
FFMPEG_SENSOR_NOISE,
FFMPEG_SENSOR_MOTION
]
CONF_TOOL = 'tool'
CONF_PEAK = 'peak'
CONF_DURATION = 'duration'
CONF_RESET = 'reset'
CONF_CHANGES = 'changes'
CONF_REPEAT = 'repeat'
CONF_REPEAT_TIME = 'repeat_time'
DEFAULT_NAME = 'FFmpeg'
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Required(CONF_TOOL): vol.In(MAP_FFMPEG_BIN),
vol.Required(CONF_INPUT): cv.string,
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
vol.Optional(CONF_EXTRA_ARGUMENTS): cv.string,
vol.Optional(CONF_OUTPUT): cv.string,
vol.Optional(CONF_PEAK, default=-30): vol.Coerce(int),
vol.Optional(CONF_DURATION, default=1):
vol.All(vol.Coerce(int), vol.Range(min=1)),
vol.Optional(CONF_RESET, default=10):
vol.All(vol.Coerce(int), vol.Range(min=1)),
vol.Optional(CONF_CHANGES, default=10):
vol.All(vol.Coerce(float), vol.Range(min=0, max=99)),
vol.Optional(CONF_REPEAT, default=0):
vol.All(vol.Coerce(int), vol.Range(min=0)),
vol.Optional(CONF_REPEAT_TIME, default=0):
vol.All(vol.Coerce(int), vol.Range(min=0)),
})
SERVICE_RESTART_SCHEMA = vol.Schema({
vol.Optional(ATTR_ENTITY_ID): cv.entity_ids,
})
def restart(hass, entity_id=None):
"""Restart a ffmpeg process on entity."""
data = {ATTR_ENTITY_ID: entity_id} if entity_id else {}
hass.services.call(DOMAIN, SERVICE_RESTART, data)
# list of all ffmpeg sensors
DEVICES = []
def setup_platform(hass, config, add_entities, discovery_info=None):
"""Create the binary sensor."""
from haffmpeg import SensorNoise, SensorMotion
# check source
if not run_test(hass, config.get(CONF_INPUT)):
return
# generate sensor object
if config.get(CONF_TOOL) == FFMPEG_SENSOR_NOISE:
entity = FFmpegNoise(SensorNoise, config)
else:
entity = FFmpegMotion(SensorMotion, config)
hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP, entity.shutdown_ffmpeg)
# add to system
add_entities([entity])
DEVICES.append(entity)
# exists service?
if hass.services.has_service(DOMAIN, SERVICE_RESTART):
return
descriptions = load_yaml_config_file(
path.join(path.dirname(__file__), 'services.yaml'))
# register service
def _service_handle_restart(service):
"""Handle service binary_sensor.ffmpeg_restart."""
entity_ids = service.data.get('entity_id')
if entity_ids:
_devices = [device for device in DEVICES
if device.entity_id in entity_ids]
else:
_devices = DEVICES
for device in _devices:
device.restart_ffmpeg()
hass.services.register(DOMAIN, SERVICE_RESTART,
_service_handle_restart,
descriptions.get(SERVICE_RESTART),
schema=SERVICE_RESTART_SCHEMA)
class FFmpegBinarySensor(BinarySensorDevice):
"""A binary sensor which use ffmpeg for noise detection."""
def __init__(self, ffobj, config):
"""Constructor for binary sensor noise detection."""
self._state = False
self._config = config
self._name = config.get(CONF_NAME)
self._ffmpeg = ffobj(get_binary(), self._callback)
self._start_ffmpeg(config)
def _callback(self, state):
"""HA-FFmpeg callback for noise detection."""
self._state = state
self.schedule_update_ha_state()
def _start_ffmpeg(self, config):
"""Start a FFmpeg instance."""
raise NotImplementedError
def shutdown_ffmpeg(self, event):
"""For STOP event to shutdown ffmpeg."""
self._ffmpeg.close()
def restart_ffmpeg(self):
"""Restart ffmpeg with new config."""
self._ffmpeg.close()
self._start_ffmpeg(self._config)
@property
def is_on(self):
"""True if the binary sensor is on."""
return self._state
@property
def should_poll(self):
"""Return True if entity has to be polled for state."""
return False
@property
def name(self):
"""Return the name of the entity."""
return self._name
@property
def available(self):
"""Return True if entity is available."""
return self._ffmpeg.is_running
class FFmpegNoise(FFmpegBinarySensor):
"""A binary sensor which use ffmpeg for noise detection."""
def _start_ffmpeg(self, config):
"""Start a FFmpeg instance."""
# init config
self._ffmpeg.set_options(
time_duration=config.get(CONF_DURATION),
time_reset=config.get(CONF_RESET),
peak=config.get(CONF_PEAK),
)
# run
self._ffmpeg.open_sensor(
input_source=config.get(CONF_INPUT),
output_dest=config.get(CONF_OUTPUT),
extra_cmd=config.get(CONF_EXTRA_ARGUMENTS),
)
@property
def sensor_class(self):
"""Return the class of this sensor, from SENSOR_CLASSES."""
return "sound"
class FFmpegMotion(FFmpegBinarySensor):
"""A binary sensor which use ffmpeg for noise detection."""
def _start_ffmpeg(self, config):
"""Start a FFmpeg instance."""
# init config
self._ffmpeg.set_options(
time_reset=config.get(CONF_RESET),
time_repeat=config.get(CONF_REPEAT_TIME),
repeat=config.get(CONF_REPEAT),
changes=config.get(CONF_CHANGES),
)
# run
self._ffmpeg.open_sensor(
input_source=config.get(CONF_INPUT),
extra_cmd=config.get(CONF_EXTRA_ARGUMENTS),
)
@property
def sensor_class(self):
"""Return the class of this sensor, from SENSOR_CLASSES."""
return "motion"

View File

@@ -7,7 +7,8 @@ https://home-assistant.io/components/binary_sensor.homematic/
import logging import logging
from homeassistant.const import STATE_UNKNOWN from homeassistant.const import STATE_UNKNOWN
from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.binary_sensor import BinarySensorDevice
import homeassistant.components.homematic as homematic from homeassistant.components.homematic import HMDevice
from homeassistant.loader import get_component
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@@ -16,11 +17,14 @@ DEPENDENCIES = ['homematic']
SENSOR_TYPES_CLASS = { SENSOR_TYPES_CLASS = {
"Remote": None, "Remote": None,
"ShutterContact": "opening", "ShutterContact": "opening",
"IPShutterContact": "opening",
"Smoke": "smoke", "Smoke": "smoke",
"SmokeV2": "smoke", "SmokeV2": "smoke",
"Motion": "motion", "Motion": "motion",
"MotionV2": "motion", "MotionV2": "motion",
"RemoteMotion": None "RemoteMotion": None,
"WeatherSensor": None,
"TiltSensor": None,
} }
@@ -29,12 +33,16 @@ def setup_platform(hass, config, add_callback_devices, discovery_info=None):
if discovery_info is None: if discovery_info is None:
return return
return homematic.setup_hmdevice_discovery_helper(HMBinarySensor, homematic = get_component("homematic")
discovery_info, return homematic.setup_hmdevice_discovery_helper(
add_callback_devices) hass,
HMBinarySensor,
discovery_info,
add_callback_devices
)
class HMBinarySensor(homematic.HMDevice, BinarySensorDevice): class HMBinarySensor(HMDevice, BinarySensorDevice):
"""Representation of a binary Homematic device.""" """Representation of a binary Homematic device."""
@property @property
@@ -55,44 +63,8 @@ class HMBinarySensor(homematic.HMDevice, BinarySensorDevice):
return "motion" return "motion"
return SENSOR_TYPES_CLASS.get(self._hmdevice.__class__.__name__, None) return SENSOR_TYPES_CLASS.get(self._hmdevice.__class__.__name__, None)
def _check_hm_to_ha_object(self):
"""Check if possible to use the HM Object as this HA type."""
from pyhomematic.devicetypes.sensors import HMBinarySensor\
as pyHMBinarySensor
# Check compatibility from HMDevice
if not super()._check_hm_to_ha_object():
return False
# check if the Homematic device correct for this HA device
if not isinstance(self._hmdevice, pyHMBinarySensor):
_LOGGER.critical("This %s can't be use as binary", self._name)
return False
# if exists user value?
if self._state and self._state not in self._hmdevice.BINARYNODE:
_LOGGER.critical("This %s have no binary with %s", self._name,
self._state)
return False
# only check and give a warning to the user
if self._state is None and len(self._hmdevice.BINARYNODE) > 1:
_LOGGER.critical("%s have multiple binary params. It use all "
"binary nodes as one. Possible param values: %s",
self._name, str(self._hmdevice.BINARYNODE))
return False
return True
def _init_data_struct(self): def _init_data_struct(self):
"""Generate a data struct (self._data) from the Homematic metadata.""" """Generate a data struct (self._data) from the Homematic metadata."""
super()._init_data_struct()
# object have 1 binary
if self._state is None and len(self._hmdevice.BINARYNODE) == 1:
for value in self._hmdevice.BINARYNODE:
self._state = value
# add state to data struct # add state to data struct
if self._state: if self._state:
_LOGGER.debug("%s init datastruct with main node '%s'", self._name, _LOGGER.debug("%s init datastruct with main node '%s'", self._name,

View File

@@ -0,0 +1,71 @@
"""
Support for ISY994 binary sensors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.isy994/
"""
import logging
from typing import Callable # noqa
from homeassistant.components.binary_sensor import BinarySensorDevice, DOMAIN
import homeassistant.components.isy994 as isy
from homeassistant.const import STATE_ON, STATE_OFF
from homeassistant.helpers.typing import ConfigType
_LOGGER = logging.getLogger(__name__)
VALUE_TO_STATE = {
False: STATE_OFF,
True: STATE_ON,
}
UOM = ['2', '78']
STATES = [STATE_OFF, STATE_ON, 'true', 'false']
# pylint: disable=unused-argument
def setup_platform(hass, config: ConfigType,
add_devices: Callable[[list], None], discovery_info=None):
"""Setup the ISY994 binary sensor platform."""
if isy.ISY is None or not isy.ISY.connected:
_LOGGER.error('A connection has not been made to the ISY controller.')
return False
devices = []
for node in isy.filter_nodes(isy.SENSOR_NODES, units=UOM,
states=STATES):
devices.append(ISYBinarySensorDevice(node))
for program in isy.PROGRAMS.get(DOMAIN, []):
try:
status = program[isy.KEY_STATUS]
except (KeyError, AssertionError):
pass
else:
devices.append(ISYBinarySensorProgram(program.name, status))
add_devices(devices)
class ISYBinarySensorDevice(isy.ISYDevice, BinarySensorDevice):
"""Representation of an ISY994 binary sensor device."""
def __init__(self, node) -> None:
"""Initialize the ISY994 binary sensor device."""
isy.ISYDevice.__init__(self, node)
@property
def is_on(self) -> bool:
"""Get whether the ISY994 binary sensor device is on."""
return bool(self.value)
class ISYBinarySensorProgram(ISYBinarySensorDevice):
"""Representation of an ISY994 binary sensor program."""
def __init__(self, name, node) -> None:
"""Initialize the ISY994 binary sensor program."""
ISYBinarySensorDevice.__init__(self, node)
self._name = name

View File

@@ -5,17 +5,14 @@ For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.knx/ https://home-assistant.io/components/binary_sensor.knx/
""" """
from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.binary_sensor import BinarySensorDevice
from homeassistant.components.knx import ( from homeassistant.components.knx import (KNXConfig, KNXGroupAddress)
KNXConfig, KNXGroupAddress)
DEPENDENCIES = ["knx"] DEPENDENCIES = ['knx']
def setup_platform(hass, config, add_entities, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the KNX binary sensor platform.""" """Setup the KNX binary sensor platform."""
add_entities([ add_devices([KNXSwitch(hass, KNXConfig(config))])
KNXSwitch(hass, KNXConfig(config))
])
class KNXSwitch(KNXGroupAddress, BinarySensorDevice): class KNXSwitch(KNXGroupAddress, BinarySensorDevice):

View File

@@ -0,0 +1,61 @@
"""
Support for Modbus Coil sensors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.modbus/
"""
import logging
import voluptuous as vol
import homeassistant.components.modbus as modbus
from homeassistant.const import CONF_NAME
from homeassistant.components.binary_sensor import BinarySensorDevice
from homeassistant.helpers import config_validation as cv
from homeassistant.components.sensor import PLATFORM_SCHEMA
_LOGGER = logging.getLogger(__name__)
DEPENDENCIES = ['modbus']
CONF_COIL = "coil"
CONF_COILS = "coils"
CONF_SLAVE = "slave"
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Required(CONF_COILS): [{
vol.Required(CONF_COIL): cv.positive_int,
vol.Required(CONF_NAME): cv.string,
vol.Optional(CONF_SLAVE): cv.positive_int
}]
})
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup Modbus binary sensors."""
sensors = []
for coil in config.get(CONF_COILS):
sensors.append(ModbusCoilSensor(
coil.get(CONF_NAME),
coil.get(CONF_SLAVE),
coil.get(CONF_COIL)))
add_devices(sensors)
class ModbusCoilSensor(BinarySensorDevice):
"""Modbus coil sensor."""
def __init__(self, name, slave, coil):
"""Initialize the modbus coil sensor."""
self._name = name
self._slave = int(slave) if slave else None
self._coil = int(coil)
self._value = None
@property
def is_on(self):
"""Return the state of the sensor."""
return self._value
def update(self):
"""Update the state of the sensor."""
result = modbus.HUB.read_coils(self._slave, self._coil, 1)
self._value = result.bits[0]

View File

@@ -8,51 +8,50 @@ import logging
import voluptuous as vol import voluptuous as vol
from homeassistant.core import callback
import homeassistant.components.mqtt as mqtt import homeassistant.components.mqtt as mqtt
from homeassistant.components.binary_sensor import (BinarySensorDevice, from homeassistant.components.binary_sensor import (
SENSOR_CLASSES) BinarySensorDevice, SENSOR_CLASSES)
from homeassistant.const import CONF_NAME, CONF_VALUE_TEMPLATE from homeassistant.const import (
from homeassistant.components.mqtt import CONF_STATE_TOPIC, CONF_QOS CONF_NAME, CONF_VALUE_TEMPLATE, CONF_PAYLOAD_ON, CONF_PAYLOAD_OFF,
from homeassistant.helpers import template CONF_SENSOR_CLASS)
from homeassistant.components.mqtt import (CONF_STATE_TOPIC, CONF_QOS)
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
DEPENDENCIES = ['mqtt']
CONF_SENSOR_CLASS = 'sensor_class'
CONF_PAYLOAD_ON = 'payload_on'
CONF_PAYLOAD_OFF = 'payload_off'
DEFAULT_NAME = 'MQTT Binary sensor' DEFAULT_NAME = 'MQTT Binary sensor'
DEFAULT_PAYLOAD_ON = 'ON'
DEFAULT_PAYLOAD_OFF = 'OFF' DEFAULT_PAYLOAD_OFF = 'OFF'
DEFAULT_PAYLOAD_ON = 'ON'
DEPENDENCIES = ['mqtt']
PLATFORM_SCHEMA = mqtt.MQTT_RO_PLATFORM_SCHEMA.extend({ PLATFORM_SCHEMA = mqtt.MQTT_RO_PLATFORM_SCHEMA.extend({
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string, vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
vol.Optional(CONF_PAYLOAD_OFF, default=DEFAULT_PAYLOAD_OFF): cv.string,
vol.Optional(CONF_PAYLOAD_ON, default=DEFAULT_PAYLOAD_ON): cv.string,
vol.Optional(CONF_SENSOR_CLASS, default=None): vol.Optional(CONF_SENSOR_CLASS, default=None):
vol.Any(vol.In(SENSOR_CLASSES), vol.SetTo(None)), vol.Any(vol.In(SENSOR_CLASSES), vol.SetTo(None)),
vol.Optional(CONF_PAYLOAD_ON, default=DEFAULT_PAYLOAD_ON): cv.string,
vol.Optional(CONF_PAYLOAD_OFF, default=DEFAULT_PAYLOAD_OFF): cv.string,
}) })
# pylint: disable=unused-argument # pylint: disable=unused-argument
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"""Add MQTT binary sensor.""" """Setup the MQTT binary sensor."""
value_template = config.get(CONF_VALUE_TEMPLATE)
if value_template is not None:
value_template.hass = hass
add_devices([MqttBinarySensor( add_devices([MqttBinarySensor(
hass, hass,
config[CONF_NAME], config.get(CONF_NAME),
config[CONF_STATE_TOPIC], config.get(CONF_STATE_TOPIC),
config[CONF_SENSOR_CLASS], config.get(CONF_SENSOR_CLASS),
config[CONF_QOS], config.get(CONF_QOS),
config[CONF_PAYLOAD_ON], config.get(CONF_PAYLOAD_ON),
config[CONF_PAYLOAD_OFF], config.get(CONF_PAYLOAD_OFF),
config.get(CONF_VALUE_TEMPLATE) value_template
)]) )])
# pylint: disable=too-many-arguments, too-many-instance-attributes
class MqttBinarySensor(BinarySensorDevice): class MqttBinarySensor(BinarySensorDevice):
"""Representation a binary sensor that is updated by MQTT.""" """Representation a binary sensor that is updated by MQTT."""
@@ -68,17 +67,18 @@ class MqttBinarySensor(BinarySensorDevice):
self._payload_off = payload_off self._payload_off = payload_off
self._qos = qos self._qos = qos
@callback
def message_received(topic, payload, qos): def message_received(topic, payload, qos):
"""A new MQTT message has been received.""" """A new MQTT message has been received."""
if value_template is not None: if value_template is not None:
payload = template.render_with_possible_json_value( payload = value_template.async_render_with_possible_json_value(
hass, value_template, payload) payload)
if payload == self._payload_on: if payload == self._payload_on:
self._state = True self._state = True
self.update_ha_state() hass.async_add_job(self.async_update_ha_state())
elif payload == self._payload_off: elif payload == self._payload_off:
self._state = False self._state = False
self.update_ha_state() hass.async_add_job(self.async_update_ha_state())
mqtt.subscribe(hass, self._state_topic, message_received, self._qos) mqtt.subscribe(hass, self._state_topic, message_received, self._qos)

View File

@@ -22,7 +22,11 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
if discovery_info is None: if discovery_info is None:
return return
for gateway in mysensors.GATEWAYS.values(): gateways = hass.data.get(mysensors.MYSENSORS_GATEWAYS)
if not gateways:
return
for gateway in gateways:
# Define the S_TYPES and V_TYPES that the platform should handle as # Define the S_TYPES and V_TYPES that the platform should handle as
# states. Map them in a dict of lists. # states. Map them in a dict of lists.
pres = gateway.const.Presentation pres = gateway.const.Presentation
@@ -32,7 +36,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
pres.S_MOTION: [set_req.V_TRIPPED], pres.S_MOTION: [set_req.V_TRIPPED],
pres.S_SMOKE: [set_req.V_TRIPPED], pres.S_SMOKE: [set_req.V_TRIPPED],
} }
if float(gateway.version) >= 1.5: if float(gateway.protocol_version) >= 1.5:
map_sv_types.update({ map_sv_types.update({
pres.S_SPRINKLER: [set_req.V_TRIPPED], pres.S_SPRINKLER: [set_req.V_TRIPPED],
pres.S_WATER_LEAK: [set_req.V_TRIPPED], pres.S_WATER_LEAK: [set_req.V_TRIPPED],
@@ -66,7 +70,7 @@ class MySensorsBinarySensor(
pres.S_MOTION: 'motion', pres.S_MOTION: 'motion',
pres.S_SMOKE: 'smoke', pres.S_SMOKE: 'smoke',
} }
if float(self.gateway.version) >= 1.5: if float(self.gateway.protocol_version) >= 1.5:
class_map.update({ class_map.update({
pres.S_SPRINKLER: 'sprinkler', pres.S_SPRINKLER: 'sprinkler',
pres.S_WATER_LEAK: 'leak', pres.S_WATER_LEAK: 'leak',

View File

@@ -4,40 +4,97 @@ Support for Nest Thermostat Binary Sensors.
For more details about this platform, please refer to the documentation at For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.nest/ https://home-assistant.io/components/binary_sensor.nest/
""" """
from itertools import chain
import logging
import voluptuous as vol import voluptuous as vol
import homeassistant.components.nest as nest from homeassistant.components.binary_sensor import (
from homeassistant.components.binary_sensor import BinarySensorDevice BinarySensorDevice, PLATFORM_SCHEMA)
from homeassistant.components.sensor.nest import NestSensor from homeassistant.components.sensor.nest import NestSensor
from homeassistant.const import ( from homeassistant.const import (CONF_SCAN_INTERVAL, CONF_MONITORED_CONDITIONS)
CONF_PLATFORM, CONF_SCAN_INTERVAL, CONF_MONITORED_CONDITIONS from homeassistant.components.nest import (
) DATA_NEST, is_thermostat, is_camera)
import homeassistant.helpers.config_validation as cv
DEPENDENCIES = ['nest'] DEPENDENCIES = ['nest']
BINARY_TYPES = ['fan',
'hvac_ac_state',
'hvac_aux_heater_state',
'hvac_heater_state',
'hvac_heat_x2_state',
'hvac_heat_x3_state',
'hvac_alt_heat_state',
'hvac_alt_heat_x2_state',
'hvac_emer_heat_state',
'online']
PLATFORM_SCHEMA = vol.Schema({ BINARY_TYPES = ['online']
vol.Required(CONF_PLATFORM): nest.DOMAIN,
CLIMATE_BINARY_TYPES = ['fan',
'is_using_emergency_heat',
'is_locked',
'has_leaf']
CAMERA_BINARY_TYPES = [
'motion_detected',
'sound_detected',
'person_detected']
_BINARY_TYPES_DEPRECATED = [
'hvac_ac_state',
'hvac_aux_heater_state',
'hvac_heater_state',
'hvac_heat_x2_state',
'hvac_heat_x3_state',
'hvac_alt_heat_state',
'hvac_alt_heat_x2_state',
'hvac_emer_heat_state']
_VALID_BINARY_SENSOR_TYPES = BINARY_TYPES + CLIMATE_BINARY_TYPES \
+ CAMERA_BINARY_TYPES
_VALID_BINARY_SENSOR_TYPES_WITH_DEPRECATED = _VALID_BINARY_SENSOR_TYPES \
+ _BINARY_TYPES_DEPRECATED
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Optional(CONF_SCAN_INTERVAL): vol.Optional(CONF_SCAN_INTERVAL):
vol.All(vol.Coerce(int), vol.Range(min=1)), vol.All(vol.Coerce(int), vol.Range(min=1)),
vol.Required(CONF_MONITORED_CONDITIONS): [vol.In(BINARY_TYPES)], vol.Required(CONF_MONITORED_CONDITIONS):
vol.All(cv.ensure_list,
[vol.In(_VALID_BINARY_SENSOR_TYPES_WITH_DEPRECATED)])
}) })
_LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup Nest binary sensors.""" """Setup Nest binary sensors."""
for structure, device in nest.devices(): nest = hass.data[DATA_NEST]
add_devices([NestBinarySensor(structure, device, variable) conf = config.get(CONF_MONITORED_CONDITIONS, _VALID_BINARY_SENSOR_TYPES)
for variable in config[CONF_MONITORED_CONDITIONS]])
for variable in conf:
if variable in _BINARY_TYPES_DEPRECATED:
wstr = (variable + " is no a longer supported "
"monitored_conditions. See "
"https://home-assistant.io/components/binary_sensor.nest/ "
"for valid options, or remove monitored_conditions "
"entirely to get a reasonable default")
_LOGGER.error(wstr)
sensors = []
device_chain = chain(nest.devices(),
nest.protect_devices(),
nest.camera_devices())
for structure, device in device_chain:
sensors += [NestBinarySensor(structure, device, variable)
for variable in conf
if variable in BINARY_TYPES]
sensors += [NestBinarySensor(structure, device, variable)
for variable in conf
if variable in CLIMATE_BINARY_TYPES
and is_thermostat(device)]
if is_camera(device):
sensors += [NestBinarySensor(structure, device, variable)
for variable in conf
if variable in CAMERA_BINARY_TYPES]
for activity_zone in device.activity_zones:
sensors += [NestActivityZoneSensor(structure,
device,
activity_zone)]
add_devices(sensors, True)
class NestBinarySensor(NestSensor, BinarySensorDevice): class NestBinarySensor(NestSensor, BinarySensorDevice):
@@ -46,4 +103,26 @@ class NestBinarySensor(NestSensor, BinarySensorDevice):
@property @property
def is_on(self): def is_on(self):
"""True if the binary sensor is on.""" """True if the binary sensor is on."""
return bool(getattr(self.device, self.variable)) return self._state
def update(self):
"""Retrieve latest state."""
self._state = bool(getattr(self.device, self.variable))
class NestActivityZoneSensor(NestBinarySensor):
"""Represents a Nest binary sensor for activity in a zone."""
def __init__(self, structure, device, zone):
"""Initialize the sensor."""
super(NestActivityZoneSensor, self).__init__(structure, device, None)
self.zone = zone
@property
def name(self):
"""Return the name of the nest, if any."""
return "{} {} activity".format(self._name, self.zone.name)
def update(self):
"""Retrieve latest state."""
self._state = self.device.has_ongoing_motion_in_zone(self.zone.zone_id)

View File

@@ -0,0 +1,133 @@
"""
Support for the Netatmo binary sensors.
The binary sensors based on events seen by the NetatmoCamera
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.netatmo/
"""
import logging
import voluptuous as vol
from homeassistant.components.binary_sensor import (
BinarySensorDevice, PLATFORM_SCHEMA)
from homeassistant.components.netatmo import WelcomeData
from homeassistant.loader import get_component
from homeassistant.const import CONF_MONITORED_CONDITIONS, CONF_TIMEOUT
from homeassistant.helpers import config_validation as cv
DEPENDENCIES = ["netatmo"]
_LOGGER = logging.getLogger(__name__)
# These are the available sensors mapped to binary_sensor class
SENSOR_TYPES = {
"Someone known": "motion",
"Someone unknown": "motion",
"Motion": "motion",
}
CONF_HOME = 'home'
CONF_CAMERAS = 'cameras'
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Optional(CONF_HOME): cv.string,
vol.Optional(CONF_TIMEOUT): cv.positive_int,
vol.Optional(CONF_CAMERAS, default=[]):
vol.All(cv.ensure_list, [cv.string]),
vol.Optional(CONF_MONITORED_CONDITIONS, default=SENSOR_TYPES.keys()):
vol.All(cv.ensure_list, [vol.In(SENSOR_TYPES)]),
})
# pylint: disable=unused-argument
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup access to Netatmo binary sensor."""
netatmo = get_component('netatmo')
home = config.get(CONF_HOME, None)
timeout = config.get(CONF_TIMEOUT, 15)
import lnetatmo
try:
data = WelcomeData(netatmo.NETATMO_AUTH, home)
if data.get_camera_names() == []:
return None
except lnetatmo.NoDevice:
return None
sensors = config.get(CONF_MONITORED_CONDITIONS, SENSOR_TYPES)
for camera_name in data.get_camera_names():
if CONF_CAMERAS in config:
if config[CONF_CAMERAS] != [] and \
camera_name not in config[CONF_CAMERAS]:
continue
for variable in sensors:
add_devices([WelcomeBinarySensor(data, camera_name, home, timeout,
variable)])
class WelcomeBinarySensor(BinarySensorDevice):
"""Represent a single binary sensor in a Netatmo Welcome device."""
def __init__(self, data, camera_name, home, timeout, sensor):
"""Setup for access to the Netatmo camera events."""
self._data = data
self._camera_name = camera_name
self._home = home
self._timeout = timeout
if home:
self._name = home + ' / ' + camera_name
else:
self._name = camera_name
self._sensor_name = sensor
self._name += ' ' + sensor
camera_id = data.welcomedata.cameraByName(camera=camera_name,
home=home)['id']
self._unique_id = "Welcome_binary_sensor {0} - {1}".format(self._name,
camera_id)
self.update()
@property
def name(self):
"""The name of the Netatmo device and this sensor."""
return self._name
@property
def unique_id(self):
"""Return the unique ID for this sensor."""
return self._unique_id
@property
def sensor_class(self):
"""Return the class of this sensor, from SENSOR_CLASSES."""
return SENSOR_TYPES.get(self._sensor_name)
@property
def is_on(self):
"""Return true if binary sensor is on."""
return self._state
def update(self):
"""Request an update from the Netatmo API."""
self._data.update()
self._data.welcomedata.updateEvent(home=self._data.home)
if self._sensor_name == "Someone known":
self._state =\
self._data.welcomedata.someoneKnownSeen(self._home,
self._camera_name,
self._timeout*60)
elif self._sensor_name == "Someone unknown":
self._state =\
self._data.welcomedata.someoneUnknownSeen(self._home,
self._camera_name,
self._timeout*60)
elif self._sensor_name == "Motion":
self._state =\
self._data.welcomedata.motionDetected(self._home,
self._camera_name,
self._timeout*60)
else:
return None

View File

@@ -1,41 +1,56 @@
""" """
Support for exposing nx584 elements as sensors. Support for exposing NX584 elements as sensors.
For more details about this platform, please refer to the documentation at For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.nx584/ https://home-assistant.io/components/binary_sensor.nx584/
""" """
import logging import logging
import threading import threading
import time import time
import requests import requests
import voluptuous as vol
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
SENSOR_CLASSES, BinarySensorDevice) SENSOR_CLASSES, BinarySensorDevice, PLATFORM_SCHEMA)
from homeassistant.const import (CONF_HOST, CONF_PORT)
import homeassistant.helpers.config_validation as cv
REQUIREMENTS = ['pynx584==0.2'] REQUIREMENTS = ['pynx584==0.2']
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
CONF_EXCLUDE_ZONES = 'exclude_zones'
CONF_ZONE_TYPES = 'zone_types'
DEFAULT_HOST = 'localhost'
DEFAULT_PORT = '5007'
DEFAULT_SSL = False
ZONE_TYPES_SCHEMA = vol.Schema({
cv.positive_int: vol.In(SENSOR_CLASSES),
})
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Optional(CONF_EXCLUDE_ZONES, default=[]):
vol.All(cv.ensure_list, [cv.positive_int]),
vol.Optional(CONF_HOST, default=DEFAULT_HOST): cv.string,
vol.Optional(CONF_PORT, default=DEFAULT_PORT): cv.port,
vol.Optional(CONF_ZONE_TYPES, default={}): ZONE_TYPES_SCHEMA,
})
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup nx584 binary sensor platform.""" """Setup the NX584 binary sensor platform."""
from nx584 import client as nx584_client from nx584 import client as nx584_client
host = config.get('host', 'localhost:5007') host = config.get(CONF_HOST)
exclude = config.get('exclude_zones', []) port = config.get(CONF_PORT)
zone_types = config.get('zone_types', {}) exclude = config.get(CONF_EXCLUDE_ZONES)
zone_types = config.get(CONF_ZONE_TYPES)
if not all(isinstance(zone, int) for zone in exclude):
_LOGGER.error('Invalid excluded zone specified (use zone number)')
return False
if not all(isinstance(zone, int) and ztype in SENSOR_CLASSES
for zone, ztype in zone_types.items()):
_LOGGER.error('Invalid zone_types entry')
return False
try: try:
client = nx584_client.Client('http://%s' % host) client = nx584_client.Client('http://{}:{}'.format(host, port))
zones = client.list_zones() zones = client.list_zones()
except requests.exceptions.ConnectionError as ex: except requests.exceptions.ConnectionError as ex:
_LOGGER.error('Unable to connect to NX584: %s', str(ex)) _LOGGER.error('Unable to connect to NX584: %s', str(ex))
@@ -43,7 +58,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
version = [int(v) for v in client.get_version().split('.')] version = [int(v) for v in client.get_version().split('.')]
if version < [1, 1]: if version < [1, 1]:
_LOGGER.error('NX584 is too old to use for sensors (>=0.2 required)') _LOGGER.error("NX584 is too old to use for sensors (>=0.2 required)")
return False return False
zone_sensors = { zone_sensors = {
@@ -57,13 +72,12 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
watcher = NX584Watcher(client, zone_sensors) watcher = NX584Watcher(client, zone_sensors)
watcher.start() watcher.start()
else: else:
_LOGGER.warning('No zones found on NX584') _LOGGER.warning("No zones found on NX584")
return True return True
class NX584ZoneSensor(BinarySensorDevice): class NX584ZoneSensor(BinarySensorDevice):
"""Represents a NX584 zone as a sensor.""" """Representation of a NX584 zone as a sensor."""
def __init__(self, zone, zone_type): def __init__(self, zone, zone_type):
"""Initialize the nx594 binary sensor.""" """Initialize the nx594 binary sensor."""
@@ -96,7 +110,7 @@ class NX584Watcher(threading.Thread):
"""Event listener thread to process NX584 events.""" """Event listener thread to process NX584 events."""
def __init__(self, client, zone_sensors): def __init__(self, client, zone_sensors):
"""Initialize nx584 watcher thread.""" """Initialize NX584 watcher thread."""
super(NX584Watcher, self).__init__() super(NX584Watcher, self).__init__()
self.daemon = True self.daemon = True
self._client = client self._client = client
@@ -109,7 +123,7 @@ class NX584Watcher(threading.Thread):
if not zone_sensor: if not zone_sensor:
return return
zone_sensor._zone['state'] = event['zone_state'] zone_sensor._zone['state'] = event['zone_state']
zone_sensor.update_ha_state() zone_sensor.schedule_update_ha_state()
def _process_events(self, events): def _process_events(self, events):
for event in events: for event in events:
@@ -130,5 +144,5 @@ class NX584Watcher(threading.Thread):
try: try:
self._run() self._run()
except requests.exceptions.ConnectionError: except requests.exceptions.ConnectionError:
_LOGGER.error('Failed to reach NX584 server') _LOGGER.error("Failed to reach NX584 server")
time.sleep(10) time.sleep(10)

View File

@@ -5,61 +5,70 @@ For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.octoprint/ https://home-assistant.io/components/binary_sensor.octoprint/
""" """
import logging import logging
import requests import requests
import voluptuous as vol
from homeassistant.const import CONF_NAME, STATE_ON, STATE_OFF from homeassistant.const import (
from homeassistant.components.binary_sensor import BinarySensorDevice CONF_NAME, STATE_ON, STATE_OFF, CONF_MONITORED_CONDITIONS)
from homeassistant.components.binary_sensor import (
BinarySensorDevice, PLATFORM_SCHEMA)
from homeassistant.loader import get_component from homeassistant.loader import get_component
import homeassistant.helpers.config_validation as cv
DEPENDENCIES = ["octoprint"]
_LOGGER = logging.getLogger(__name__)
DEPENDENCIES = ['octoprint']
DEFAULT_NAME = 'OctoPrint'
SENSOR_TYPES = { SENSOR_TYPES = {
# API Endpoint, Group, Key, unit # API Endpoint, Group, Key, unit
"Printing": ["printer", "state", "printing", None], 'Printing': ['printer', 'state', 'printing', None],
"Printing Error": ["printer", "state", "error", None] 'Printing Error': ['printer', 'state', 'error', None]
} }
_LOGGER = logging.getLogger(__name__) PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Optional(CONF_MONITORED_CONDITIONS, default=SENSOR_TYPES):
vol.All(cv.ensure_list, [vol.In(SENSOR_TYPES)]),
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
})
# pylint: disable=unused-argument # pylint: disable=unused-argument
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the available OctoPrint binary sensors.""" """Setup the available OctoPrint binary sensors."""
octoprint = get_component('octoprint') octoprint = get_component('octoprint')
name = config.get(CONF_NAME, "OctoPrint") name = config.get(CONF_NAME)
monitored_conditions = config.get("monitored_conditions", monitored_conditions = config.get(CONF_MONITORED_CONDITIONS,
SENSOR_TYPES.keys()) SENSOR_TYPES.keys())
devices = [] devices = []
for octo_type in monitored_conditions: for octo_type in monitored_conditions:
if octo_type in SENSOR_TYPES: new_sensor = OctoPrintBinarySensor(octoprint.OCTOPRINT,
new_sensor = OctoPrintBinarySensor(octoprint.OCTOPRINT, octo_type,
octo_type, SENSOR_TYPES[octo_type][2],
SENSOR_TYPES[octo_type][2], name,
name, SENSOR_TYPES[octo_type][3],
SENSOR_TYPES[octo_type][3], SENSOR_TYPES[octo_type][0],
SENSOR_TYPES[octo_type][0], SENSOR_TYPES[octo_type][1],
SENSOR_TYPES[octo_type][1], 'flags')
"flags") devices.append(new_sensor)
devices.append(new_sensor)
else:
_LOGGER.error("Unknown OctoPrint sensor type: %s", octo_type)
add_devices(devices) add_devices(devices)
# pylint: disable=too-many-instance-attributes
class OctoPrintBinarySensor(BinarySensorDevice): class OctoPrintBinarySensor(BinarySensorDevice):
"""Representation an OctoPrint binary sensor.""" """Representation an OctoPrint binary sensor."""
# pylint: disable=too-many-arguments def __init__(self, api, condition, sensor_type, sensor_name, unit,
def __init__(self, api, condition, sensor_type, sensor_name, endpoint, group, tool=None):
unit, endpoint, group, tool=None):
"""Initialize a new OctoPrint sensor.""" """Initialize a new OctoPrint sensor."""
self.sensor_name = sensor_name self.sensor_name = sensor_name
if tool is None: if tool is None:
self._name = sensor_name + ' ' + condition self._name = '{} {}'.format(sensor_name, condition)
else: else:
self._name = sensor_name + ' ' + condition self._name = '{} {}'.format(sensor_name, condition)
self.sensor_type = sensor_type self.sensor_type = sensor_type
self.api = api self.api = api
self._state = False self._state = False

View File

@@ -6,47 +6,75 @@ https://home-assistant.io/components/binary_sensor.rest/
""" """
import logging import logging
from homeassistant.components.binary_sensor import (BinarySensorDevice, import voluptuous as vol
SENSOR_CLASSES) from requests.auth import HTTPBasicAuth, HTTPDigestAuth
from homeassistant.components.binary_sensor import (
BinarySensorDevice, SENSOR_CLASSES_SCHEMA, PLATFORM_SCHEMA)
from homeassistant.components.sensor.rest import RestData from homeassistant.components.sensor.rest import RestData
from homeassistant.const import CONF_VALUE_TEMPLATE from homeassistant.const import (
from homeassistant.helpers import template CONF_PAYLOAD, CONF_NAME, CONF_VALUE_TEMPLATE, CONF_METHOD, CONF_RESOURCE,
CONF_SENSOR_CLASS, CONF_VERIFY_SSL, CONF_USERNAME, CONF_PASSWORD,
CONF_HEADERS, CONF_AUTHENTICATION, HTTP_BASIC_AUTHENTICATION,
HTTP_DIGEST_AUTHENTICATION)
import homeassistant.helpers.config_validation as cv
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
DEFAULT_NAME = 'REST Binary Sensor'
DEFAULT_METHOD = 'GET' DEFAULT_METHOD = 'GET'
DEFAULT_NAME = 'REST Binary Sensor'
DEFAULT_VERIFY_SSL = True
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Required(CONF_RESOURCE): cv.url,
vol.Optional(CONF_AUTHENTICATION):
vol.In([HTTP_BASIC_AUTHENTICATION, HTTP_DIGEST_AUTHENTICATION]),
vol.Optional(CONF_HEADERS): {cv.string: cv.string},
vol.Optional(CONF_METHOD, default=DEFAULT_METHOD): vol.In(['POST', 'GET']),
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
vol.Optional(CONF_PASSWORD): cv.string,
vol.Optional(CONF_PAYLOAD): cv.string,
vol.Optional(CONF_SENSOR_CLASS): SENSOR_CLASSES_SCHEMA,
vol.Optional(CONF_USERNAME): cv.string,
vol.Optional(CONF_VALUE_TEMPLATE): cv.template,
vol.Optional(CONF_VERIFY_SSL, default=DEFAULT_VERIFY_SSL): cv.boolean,
})
# pylint: disable=unused-variable
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the REST binary sensor.""" """Setup the REST binary sensor."""
resource = config.get('resource', None) name = config.get(CONF_NAME)
method = config.get('method', DEFAULT_METHOD) resource = config.get(CONF_RESOURCE)
payload = config.get('payload', None) method = config.get(CONF_METHOD)
verify_ssl = config.get('verify_ssl', True) payload = config.get(CONF_PAYLOAD)
verify_ssl = config.get(CONF_VERIFY_SSL)
username = config.get(CONF_USERNAME)
password = config.get(CONF_PASSWORD)
headers = config.get(CONF_HEADERS)
sensor_class = config.get(CONF_SENSOR_CLASS)
value_template = config.get(CONF_VALUE_TEMPLATE)
if value_template is not None:
value_template.hass = hass
sensor_class = config.get('sensor_class') if username and password:
if sensor_class not in SENSOR_CLASSES: if config.get(CONF_AUTHENTICATION) == HTTP_DIGEST_AUTHENTICATION:
_LOGGER.warning('Unknown sensor class: %s', sensor_class) auth = HTTPDigestAuth(username, password)
sensor_class = None else:
auth = HTTPBasicAuth(username, password)
else:
auth = None
rest = RestData(method, resource, payload, verify_ssl) rest = RestData(method, resource, auth, headers, payload, verify_ssl)
rest.update() rest.update()
if rest.data is None: if rest.data is None:
_LOGGER.error('Unable to fetch REST data') _LOGGER.error("Unable to fetch REST data from %s", resource)
return False return False
add_devices([RestBinarySensor( add_devices([RestBinarySensor(
hass, hass, rest, name, sensor_class, value_template)])
rest,
config.get('name', DEFAULT_NAME),
sensor_class,
config.get(CONF_VALUE_TEMPLATE))])
# pylint: disable=too-many-arguments
class RestBinarySensor(BinarySensorDevice): class RestBinarySensor(BinarySensorDevice):
"""Representation of a REST binary sensor.""" """Representation of a REST binary sensor."""
@@ -78,8 +106,8 @@ class RestBinarySensor(BinarySensorDevice):
return False return False
if self._value_template is not None: if self._value_template is not None:
response = template.render_with_possible_json_value( response = self._value_template.\
self._hass, self._value_template, self.rest.data, False) async_render_with_possible_json_value(self.rest.data, False)
try: try:
return bool(int(response)) return bool(int(response))

View File

@@ -6,16 +6,37 @@ https://home-assistant.io/components/binary_sensor.rpi_gpio/
""" """
import logging import logging
import homeassistant.components.rpi_gpio as rpi_gpio import voluptuous as vol
from homeassistant.components.binary_sensor import BinarySensorDevice
from homeassistant.const import DEVICE_DEFAULT_NAME import homeassistant.components.rpi_gpio as rpi_gpio
from homeassistant.components.binary_sensor import (
BinarySensorDevice, PLATFORM_SCHEMA)
from homeassistant.const import DEVICE_DEFAULT_NAME
import homeassistant.helpers.config_validation as cv
_LOGGER = logging.getLogger(__name__)
CONF_BOUNCETIME = 'bouncetime'
CONF_INVERT_LOGIC = 'invert_logic'
CONF_PORTS = 'ports'
CONF_PULL_MODE = 'pull_mode'
DEFAULT_PULL_MODE = "UP"
DEFAULT_BOUNCETIME = 50 DEFAULT_BOUNCETIME = 50
DEFAULT_INVERT_LOGIC = False DEFAULT_INVERT_LOGIC = False
DEFAULT_PULL_MODE = 'UP'
DEPENDENCIES = ['rpi_gpio'] DEPENDENCIES = ['rpi_gpio']
_LOGGER = logging.getLogger(__name__)
_SENSORS_SCHEMA = vol.Schema({
cv.positive_int: cv.string,
})
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Required(CONF_PORTS): _SENSORS_SCHEMA,
vol.Optional(CONF_BOUNCETIME, default=DEFAULT_BOUNCETIME): cv.positive_int,
vol.Optional(CONF_INVERT_LOGIC, default=DEFAULT_INVERT_LOGIC): cv.boolean,
vol.Optional(CONF_PULL_MODE, default=DEFAULT_PULL_MODE): cv.string,
})
# pylint: disable=unused-argument # pylint: disable=unused-argument
@@ -33,7 +54,6 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
add_devices(binary_sensors) add_devices(binary_sensors)
# pylint: disable=too-many-arguments, too-many-instance-attributes
class RPiGPIOBinarySensor(BinarySensorDevice): class RPiGPIOBinarySensor(BinarySensorDevice):
"""Represent a binary sensor that uses Raspberry Pi GPIO.""" """Represent a binary sensor that uses Raspberry Pi GPIO."""
@@ -52,7 +72,7 @@ class RPiGPIOBinarySensor(BinarySensorDevice):
def read_gpio(port): def read_gpio(port):
"""Read state from GPIO.""" """Read state from GPIO."""
self._state = rpi_gpio.read_input(self._port) self._state = rpi_gpio.read_input(self._port)
self.update_ha_state() self.schedule_update_ha_state()
rpi_gpio.edge_detect(self._port, read_gpio, self._bouncetime) rpi_gpio.edge_detect(self._port, read_gpio, self._bouncetime)

View File

@@ -0,0 +1,9 @@
# Describes the format for available binary_sensor services
ffmpeg_restart:
description: Send a restart command to a ffmpeg based sensor (party mode).
fields:
entity_id:
description: Name(s) of entites that will restart. Platform dependent.
example: 'binary_sensor.ffmpeg_noise'

View File

@@ -0,0 +1,52 @@
"""
Support for SleepIQ sensors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.sleepiq/
"""
from homeassistant.components import sleepiq
from homeassistant.components.binary_sensor import BinarySensorDevice
DEPENDENCIES = ['sleepiq']
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the SleepIQ sensors."""
if discovery_info is None:
return
data = sleepiq.DATA
data.update()
dev = list()
for bed_id, _ in data.beds.items():
for side in sleepiq.SIDES:
dev.append(IsInBedBinarySensor(data, bed_id, side))
add_devices(dev)
class IsInBedBinarySensor(sleepiq.SleepIQSensor, BinarySensorDevice):
"""Implementation of a SleepIQ presence sensor."""
def __init__(self, sleepiq_data, bed_id, side):
"""Initialize the sensor."""
sleepiq.SleepIQSensor.__init__(self, sleepiq_data, bed_id, side)
self.type = sleepiq.IS_IN_BED
self._state = None
self._name = sleepiq.SENSOR_TYPES[self.type]
self.update()
@property
def is_on(self):
"""Return the status of the sensor."""
return self._state is True
@property
def sensor_class(self):
"""Return the class of this sensor."""
return "occupancy"
def update(self):
"""Get the latest data from SleepIQ and updates the states."""
sleepiq.SleepIQSensor.update(self)
self._state = self.side.is_in_bed

View File

@@ -7,21 +7,20 @@ https://home-assistant.io/components/binary_sensor.tcp/
import logging import logging
from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.binary_sensor import BinarySensorDevice
from homeassistant.components.sensor.tcp import Sensor, CONF_VALUE_ON from homeassistant.components.sensor.tcp import (
TcpSensor, CONF_VALUE_ON, PLATFORM_SCHEMA)
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({})
def setup_platform(hass, config, add_entities, discovery_info=None):
"""Create the binary sensor."""
if not BinarySensor.validate_config(config):
return False
add_entities((BinarySensor(hass, config),))
class BinarySensor(BinarySensorDevice, Sensor): def setup_platform(hass, config, add_devices, discovery_info=None):
"""Set up the TCP binary sensor."""
add_devices([TcpBinarySensor(hass, config)])
class TcpBinarySensor(BinarySensorDevice, TcpSensor):
"""A binary sensor which is on when its state == CONF_VALUE_ON.""" """A binary sensor which is on when its state == CONF_VALUE_ON."""
required = (CONF_VALUE_ON,) required = (CONF_VALUE_ON,)

View File

@@ -4,56 +4,51 @@ Support for exposing a templated binary sensor.
For more details about this platform, please refer to the documentation at For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.template/ https://home-assistant.io/components/binary_sensor.template/
""" """
import asyncio
import logging import logging
from homeassistant.components.binary_sensor import (BinarySensorDevice, import voluptuous as vol
ENTITY_ID_FORMAT,
SENSOR_CLASSES) from homeassistant.core import callback
from homeassistant.const import (ATTR_FRIENDLY_NAME, CONF_VALUE_TEMPLATE, from homeassistant.components.binary_sensor import (
ATTR_ENTITY_ID, MATCH_ALL) BinarySensorDevice, ENTITY_ID_FORMAT, PLATFORM_SCHEMA,
from homeassistant.exceptions import TemplateError SENSOR_CLASSES_SCHEMA)
from homeassistant.helpers.entity import generate_entity_id from homeassistant.const import (
from homeassistant.helpers import template ATTR_FRIENDLY_NAME, ATTR_ENTITY_ID, CONF_VALUE_TEMPLATE,
from homeassistant.helpers.event import track_state_change CONF_SENSOR_CLASS, CONF_SENSORS)
from homeassistant.util import slugify from homeassistant.exceptions import TemplateError
from homeassistant.helpers.entity import async_generate_entity_id
from homeassistant.helpers.event import async_track_state_change
import homeassistant.helpers.config_validation as cv
CONF_SENSORS = 'sensors'
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
SENSOR_SCHEMA = vol.Schema({
vol.Required(CONF_VALUE_TEMPLATE): cv.template,
vol.Optional(ATTR_FRIENDLY_NAME): cv.string,
vol.Optional(ATTR_ENTITY_ID): cv.entity_ids,
vol.Optional(CONF_SENSOR_CLASS, default=None): SENSOR_CLASSES_SCHEMA
})
def setup_platform(hass, config, add_devices, discovery_info=None): PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Required(CONF_SENSORS): vol.Schema({cv.slug: SENSOR_SCHEMA}),
})
@asyncio.coroutine
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
"""Setup template binary sensors.""" """Setup template binary sensors."""
sensors = [] sensors = []
if config.get(CONF_SENSORS) is None:
_LOGGER.error('Missing configuration data for binary_sensor platform')
return False
for device, device_config in config[CONF_SENSORS].items(): for device, device_config in config[CONF_SENSORS].items():
value_template = device_config[CONF_VALUE_TEMPLATE]
if device != slugify(device): entity_ids = (device_config.get(ATTR_ENTITY_ID) or
_LOGGER.error('Found invalid key for binary_sensor.template: %s. ' value_template.extract_entities())
'Use %s instead', device, slugify(device))
continue
if not isinstance(device_config, dict):
_LOGGER.error('Missing configuration data for binary_sensor %s',
device)
continue
friendly_name = device_config.get(ATTR_FRIENDLY_NAME, device) friendly_name = device_config.get(ATTR_FRIENDLY_NAME, device)
sensor_class = device_config.get('sensor_class') sensor_class = device_config.get(CONF_SENSOR_CLASS)
value_template = device_config.get(CONF_VALUE_TEMPLATE)
if sensor_class not in SENSOR_CLASSES: if value_template is not None:
_LOGGER.error('Sensor class is not valid') value_template.hass = hass
continue
if value_template is None:
_LOGGER.error(
'Missing %s for sensor %s', CONF_VALUE_TEMPLATE, device)
continue
entity_ids = device_config.get(ATTR_ENTITY_ID, MATCH_ALL)
sensors.append( sensors.append(
BinarySensorTemplate( BinarySensorTemplate(
@@ -67,34 +62,32 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
if not sensors: if not sensors:
_LOGGER.error('No sensors added') _LOGGER.error('No sensors added')
return False return False
add_devices(sensors)
yield from async_add_devices(sensors, True)
return True return True
class BinarySensorTemplate(BinarySensorDevice): class BinarySensorTemplate(BinarySensorDevice):
"""A virtual binary sensor that triggers from another sensor.""" """A virtual binary sensor that triggers from another sensor."""
# pylint: disable=too-many-arguments
def __init__(self, hass, device, friendly_name, sensor_class, def __init__(self, hass, device, friendly_name, sensor_class,
value_template, entity_ids): value_template, entity_ids):
"""Initialize the Template binary sensor.""" """Initialize the Template binary sensor."""
self.hass = hass self.hass = hass
self.entity_id = generate_entity_id(ENTITY_ID_FORMAT, device, self.entity_id = async_generate_entity_id(ENTITY_ID_FORMAT, device,
hass=hass) hass=hass)
self._name = friendly_name self._name = friendly_name
self._sensor_class = sensor_class self._sensor_class = sensor_class
self._template = value_template self._template = value_template
self._state = None self._state = None
self.update() @callback
def template_bsensor_state_listener(entity, old_state, new_state): def template_bsensor_state_listener(entity, old_state, new_state):
"""Called when the target device changes state.""" """Called when the target device changes state."""
self.update_ha_state(True) hass.async_add_job(self.async_update_ha_state, True)
track_state_change(hass, entity_ids, async_track_state_change(
template_bsensor_state_listener) hass, entity_ids, template_bsensor_state_listener)
@property @property
def name(self): def name(self):
@@ -116,11 +109,11 @@ class BinarySensorTemplate(BinarySensorDevice):
"""No polling needed.""" """No polling needed."""
return False return False
def update(self): @asyncio.coroutine
"""Get the latest data and update the state.""" def async_update(self):
"""Update the state from the template."""
try: try:
self._state = template.render(self.hass, self._state = self._template.async_render().lower() == 'true'
self._template).lower() == 'true'
except TemplateError as ex: except TemplateError as ex:
if ex.args and ex.args[0].startswith( if ex.args and ex.args[0].startswith(
"UndefinedError: 'None' has no attribute"): "UndefinedError: 'None' has no attribute"):

View File

@@ -0,0 +1,128 @@
"""
Support for monitoring if a sensor value is below/above a threshold.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.threshold/
"""
import asyncio
import logging
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.components.binary_sensor import (
BinarySensorDevice, PLATFORM_SCHEMA, SENSOR_CLASSES_SCHEMA)
from homeassistant.const import (
CONF_NAME, CONF_ENTITY_ID, CONF_TYPE, STATE_UNKNOWN, CONF_SENSOR_CLASS,
ATTR_ENTITY_ID)
from homeassistant.core import callback
from homeassistant.helpers.event import async_track_state_change
_LOGGER = logging.getLogger(__name__)
ATTR_SENSOR_VALUE = 'sensor_value'
ATTR_THRESHOLD = 'threshold'
ATTR_TYPE = 'type'
CONF_LOWER = 'lower'
CONF_THRESHOLD = 'threshold'
CONF_UPPER = 'upper'
DEFAULT_NAME = 'Threshold'
SENSOR_TYPES = [CONF_LOWER, CONF_UPPER]
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Required(CONF_ENTITY_ID): cv.entity_id,
vol.Required(CONF_THRESHOLD): vol.Coerce(float),
vol.Required(CONF_TYPE): vol.In(SENSOR_TYPES),
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
vol.Optional(CONF_SENSOR_CLASS, default=None): SENSOR_CLASSES_SCHEMA,
})
@asyncio.coroutine
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
"""Set up the Threshold sensor."""
entity_id = config.get(CONF_ENTITY_ID)
name = config.get(CONF_NAME)
threshold = config.get(CONF_THRESHOLD)
limit_type = config.get(CONF_TYPE)
sensor_class = config.get(CONF_SENSOR_CLASS)
yield from async_add_devices(
[ThresholdSensor(hass, entity_id, name, threshold, limit_type,
sensor_class)], True)
return True
class ThresholdSensor(BinarySensorDevice):
"""Representation of a Threshold sensor."""
def __init__(self, hass, entity_id, name, threshold, limit_type,
sensor_class):
"""Initialize the Threshold sensor."""
self._hass = hass
self._entity_id = entity_id
self.is_upper = limit_type == 'upper'
self._name = name
self._threshold = threshold
self._sensor_class = sensor_class
self._deviation = False
self.sensor_value = 0
@callback
# pylint: disable=invalid-name
def async_threshold_sensor_state_listener(
entity, old_state, new_state):
"""Called when the sensor changes state."""
if new_state.state == STATE_UNKNOWN:
return
try:
self.sensor_value = float(new_state.state)
except ValueError:
_LOGGER.error("State is not numerical")
hass.async_add_job(self.async_update_ha_state, True)
async_track_state_change(
hass, entity_id, async_threshold_sensor_state_listener)
@property
def name(self):
"""Return the name of the sensor."""
return self._name
@property
def is_on(self):
"""Return true if sensor is on."""
return self._deviation
@property
def should_poll(self):
"""No polling needed."""
return False
@property
def sensor_class(self):
"""Return the sensor class of the sensor."""
return self._sensor_class
@property
def state_attributes(self):
"""Return the state attributes of the sensor."""
return {
ATTR_ENTITY_ID: self._entity_id,
ATTR_SENSOR_VALUE: self.sensor_value,
ATTR_THRESHOLD: self._threshold,
ATTR_TYPE: CONF_UPPER if self.is_upper else CONF_LOWER,
}
@asyncio.coroutine
def async_update(self):
"""Get the latest data and updates the states."""
if self.is_upper:
self._deviation = bool(self.sensor_value > self._threshold)
else:
self._deviation = bool(self.sensor_value < self._threshold)

View File

@@ -0,0 +1,147 @@
"""
A sensor that monitors trands in other components.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.trend/
"""
import asyncio
import logging
import voluptuous as vol
from homeassistant.core import callback
import homeassistant.helpers.config_validation as cv
from homeassistant.components.binary_sensor import (
BinarySensorDevice,
ENTITY_ID_FORMAT,
PLATFORM_SCHEMA,
SENSOR_CLASSES_SCHEMA)
from homeassistant.const import (
ATTR_FRIENDLY_NAME,
ATTR_ENTITY_ID,
CONF_SENSOR_CLASS,
STATE_UNKNOWN,)
from homeassistant.helpers.entity import generate_entity_id
from homeassistant.helpers.event import track_state_change
_LOGGER = logging.getLogger(__name__)
CONF_SENSORS = 'sensors'
CONF_ATTRIBUTE = 'attribute'
CONF_INVERT = 'invert'
SENSOR_SCHEMA = vol.Schema({
vol.Required(ATTR_ENTITY_ID): cv.entity_id,
vol.Optional(CONF_ATTRIBUTE): cv.string,
vol.Optional(ATTR_FRIENDLY_NAME): cv.string,
vol.Optional(CONF_INVERT, default=False): cv.boolean,
vol.Optional(CONF_SENSOR_CLASS, default=None): SENSOR_CLASSES_SCHEMA
})
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Required(CONF_SENSORS): vol.Schema({cv.slug: SENSOR_SCHEMA}),
})
# pylint: disable=unused-argument
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the trend sensors."""
sensors = []
for device, device_config in config[CONF_SENSORS].items():
entity_id = device_config[ATTR_ENTITY_ID]
attribute = device_config.get(CONF_ATTRIBUTE)
friendly_name = device_config.get(ATTR_FRIENDLY_NAME, device)
sensor_class = device_config[CONF_SENSOR_CLASS]
invert = device_config[CONF_INVERT]
sensors.append(
SensorTrend(
hass,
device,
friendly_name,
entity_id,
attribute,
sensor_class,
invert)
)
if not sensors:
_LOGGER.error("No sensors added")
return False
add_devices(sensors)
return True
class SensorTrend(BinarySensorDevice):
"""Representation of a trend Sensor."""
def __init__(self, hass, device_id, friendly_name,
target_entity, attribute, sensor_class, invert):
"""Initialize the sensor."""
self._hass = hass
self.entity_id = generate_entity_id(ENTITY_ID_FORMAT, device_id,
hass=hass)
self._name = friendly_name
self._target_entity = target_entity
self._attribute = attribute
self._sensor_class = sensor_class
self._invert = invert
self._state = None
self.from_state = None
self.to_state = None
@callback
def trend_sensor_state_listener(entity, old_state, new_state):
"""Called when the target device changes state."""
self.from_state = old_state
self.to_state = new_state
hass.async_add_job(self.async_update_ha_state(True))
track_state_change(hass, target_entity,
trend_sensor_state_listener)
@property
def name(self):
"""Return the name of the sensor."""
return self._name
@property
def is_on(self):
"""Return true if sensor is on."""
return self._state
@property
def sensor_class(self):
"""Return the sensor class of the sensor."""
return self._sensor_class
@property
def should_poll(self):
"""No polling needed."""
return False
@asyncio.coroutine
def async_update(self):
"""Get the latest data and update the states."""
if self.from_state is None or self.to_state is None:
return
if (self.from_state.state == STATE_UNKNOWN or
self.to_state.state == STATE_UNKNOWN):
return
try:
if self._attribute:
from_value = float(
self.from_state.attributes.get(self._attribute))
to_value = float(
self.to_state.attributes.get(self._attribute))
else:
from_value = float(self.from_state.state)
to_value = float(self.to_state.state)
self._state = to_value > from_value
if self._invert:
self._state = not self._state
except (ValueError, TypeError) as ex:
self._state = None
_LOGGER.error(ex)

View File

@@ -16,9 +16,9 @@ DEPENDENCIES = ['vera']
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, add_devices_callback, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"""Perform the setup for Vera controller devices.""" """Perform the setup for Vera controller devices."""
add_devices_callback( add_devices(
VeraBinarySensor(device, VERA_CONTROLLER) VeraBinarySensor(device, VERA_CONTROLLER)
for device in VERA_DEVICES['binary_sensor']) for device in VERA_DEVICES['binary_sensor'])

View File

@@ -45,10 +45,10 @@ class WemoBinarySensor(BinarySensorDevice):
_LOGGER.info( _LOGGER.info(
'Subscription update for %s', 'Subscription update for %s',
_device) _device)
self.update()
if not hasattr(self, 'hass'): if not hasattr(self, 'hass'):
self.update()
return return
self.update_ha_state(True) self.schedule_update_ha_state()
@property @property
def should_poll(self): def should_poll(self):

View File

@@ -1,19 +1,16 @@
""" """
Support for Wink sensors. Support for Wink binary sensors.
For more details about this platform, please refer to the documentation at For more details about this platform, please refer to the documentation at
at https://home-assistant.io/components/sensor.wink/ at https://home-assistant.io/components/binary_sensor.wink/
""" """
import logging
import json
from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.binary_sensor import BinarySensorDevice
from homeassistant.components.sensor.wink import WinkDevice from homeassistant.components.sensor.wink import WinkDevice
from homeassistant.const import CONF_ACCESS_TOKEN
from homeassistant.helpers.entity import Entity from homeassistant.helpers.entity import Entity
from homeassistant.loader import get_component from homeassistant.loader import get_component
REQUIREMENTS = ['python-wink==0.7.11', 'pubnub==3.8.2'] DEPENDENCIES = ['wink']
# These are the available sensors mapped to binary_sensor class # These are the available sensors mapped to binary_sensor class
SENSOR_TYPES = { SENSOR_TYPES = {
@@ -21,7 +18,11 @@ SENSOR_TYPES = {
"brightness": "light", "brightness": "light",
"vibration": "vibration", "vibration": "vibration",
"loudness": "sound", "loudness": "sound",
"liquid_detected": "moisture" "liquid_detected": "moisture",
"motion": "motion",
"presence": "occupancy",
"co_detected": "gas",
"smoke_detected": "smoke"
} }
@@ -29,56 +30,50 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the Wink binary sensor platform.""" """Setup the Wink binary sensor platform."""
import pywink import pywink
if discovery_info is None:
token = config.get(CONF_ACCESS_TOKEN)
if token is None:
logging.getLogger(__name__).error(
"Missing wink access_token. "
"Get one at https://winkbearertoken.appspot.com/")
return
pywink.set_bearer_token(token)
for sensor in pywink.get_sensors(): for sensor in pywink.get_sensors():
if sensor.capability() in SENSOR_TYPES: if sensor.capability() in SENSOR_TYPES:
add_devices([WinkBinarySensorDevice(sensor)]) add_devices([WinkBinarySensorDevice(sensor, hass)])
for key in pywink.get_keys(): for key in pywink.get_keys():
add_devices([WinkBinarySensorDevice(key)]) add_devices([WinkBinarySensorDevice(key, hass)])
for sensor in pywink.get_smoke_and_co_detectors():
add_devices([WinkBinarySensorDevice(sensor, hass)])
class WinkBinarySensorDevice(WinkDevice, BinarySensorDevice, Entity): class WinkBinarySensorDevice(WinkDevice, BinarySensorDevice, Entity):
"""Representation of a Wink binary sensor.""" """Representation of a Wink binary sensor."""
def __init__(self, wink): def __init__(self, wink, hass):
"""Initialize the Wink binary sensor.""" """Initialize the Wink binary sensor."""
super().__init__(wink) super().__init__(wink, hass)
wink = get_component('wink') wink = get_component('wink')
self._unit_of_measurement = self.wink.UNIT self._unit_of_measurement = self.wink.UNIT
self.capability = self.wink.capability() self.capability = self.wink.capability()
def _pubnub_update(self, message, channel):
if 'data' in message:
json_data = json.dumps(message.get('data'))
else:
json_data = message
self.wink.pubnub_update(json.loads(json_data))
self.update_ha_state()
@property @property
def is_on(self): def is_on(self):
"""Return true if the binary sensor is on.""" """Return true if the binary sensor is on."""
if self.capability == "loudness": if self.capability == "loudness":
return self.wink.loudness_boolean() state = self.wink.loudness_boolean()
elif self.capability == "vibration": elif self.capability == "vibration":
return self.wink.vibration_boolean() state = self.wink.vibration_boolean()
elif self.capability == "brightness": elif self.capability == "brightness":
return self.wink.brightness_boolean() state = self.wink.brightness_boolean()
elif self.capability == "liquid_detected": elif self.capability == "liquid_detected":
return self.wink.liquid_boolean() state = self.wink.liquid_boolean()
elif self.capability == "motion":
state = self.wink.motion_boolean()
elif self.capability == "presence":
state = self.wink.presence_boolean()
elif self.capability == "co_detected":
state = self.wink.co_detected_boolean()
elif self.capability == "smoke_detected":
state = self.wink.smoke_detected_boolean()
else: else:
return self.wink.state() state = self.wink.state()
return state
@property @property
def sensor_class(self): def sensor_class(self):

View File

@@ -4,18 +4,27 @@ Contains functionality to use a ZigBee device as a binary sensor.
For more details about this platform, please refer to the documentation at For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.zigbee/ https://home-assistant.io/components/binary_sensor.zigbee/
""" """
import voluptuous as vol
from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.binary_sensor import BinarySensorDevice
from homeassistant.components.zigbee import ( from homeassistant.components.zigbee import (
ZigBeeDigitalIn, ZigBeeDigitalInConfig) ZigBeeDigitalIn, ZigBeeDigitalInConfig, PLATFORM_SCHEMA)
DEPENDENCIES = ["zigbee"] CONF_ON_STATE = 'on_state'
DEFAULT_ON_STATE = 'high'
DEPENDENCIES = ['zigbee']
STATES = ['high', 'low']
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Optional(CONF_ON_STATE): vol.In(STATES),
})
def setup_platform(hass, config, add_entities, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the ZigBee binary sensor platform.""" """Setup the ZigBee binary sensor platform."""
add_entities([ add_devices([ZigBeeBinarySensor(hass, ZigBeeDigitalInConfig(config))])
ZigBeeBinarySensor(hass, ZigBeeDigitalInConfig(config))
])
class ZigBeeBinarySensor(ZigBeeDigitalIn, BinarySensorDevice): class ZigBeeBinarySensor(ZigBeeDigitalIn, BinarySensorDevice):

View File

@@ -36,8 +36,8 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
if discovery_info is None or zwave.NETWORK is None: if discovery_info is None or zwave.NETWORK is None:
return return
node = zwave.NETWORK.nodes[discovery_info[zwave.ATTR_NODE_ID]] node = zwave.NETWORK.nodes[discovery_info[zwave.const.ATTR_NODE_ID]]
value = node.values[discovery_info[zwave.ATTR_VALUE_ID]] value = node.values[discovery_info[zwave.const.ATTR_VALUE_ID]]
value.set_change_verified(False) value.set_change_verified(False)
# Make sure that we have values for the key before converting to int # Make sure that we have values for the key before converting to int
@@ -58,7 +58,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
]) ])
return return
if value.command_class == zwave.COMMAND_CLASS_SENSOR_BINARY: if value.command_class == zwave.const.COMMAND_CLASS_SENSOR_BINARY:
add_devices([ZWaveBinarySensor(value, None)]) add_devices([ZWaveBinarySensor(value, None)])
@@ -96,7 +96,7 @@ class ZWaveBinarySensor(BinarySensorDevice, zwave.ZWaveDeviceEntity, Entity):
"""Called when a value has changed on the network.""" """Called when a value has changed on the network."""
if self._value.value_id == value.value_id or \ if self._value.value_id == value.value_id or \
self._value.node == value.node: self._value.node == value.node:
self.update_ha_state() self.schedule_update_ha_state()
class ZWaveTriggerSensor(ZWaveBinarySensor, Entity): class ZWaveTriggerSensor(ZWaveBinarySensor, Entity):
@@ -112,19 +112,19 @@ class ZWaveTriggerSensor(ZWaveBinarySensor, Entity):
# If it's active make sure that we set the timeout tracker # If it's active make sure that we set the timeout tracker
if sensor_value.data: if sensor_value.data:
track_point_in_time( track_point_in_time(
self._hass, self.update_ha_state, self._hass, self.async_update_ha_state,
self.invalidate_after) self.invalidate_after)
def value_changed(self, value): def value_changed(self, value):
"""Called when a value has changed on the network.""" """Called when a value has changed on the network."""
if self._value.value_id == value.value_id: if self._value.value_id == value.value_id:
self.update_ha_state() self.schedule_update_ha_state()
if value.data: if value.data:
# only allow this value to be true for re_arm secs # only allow this value to be true for re_arm secs
self.invalidate_after = dt_util.utcnow() + datetime.timedelta( self.invalidate_after = dt_util.utcnow() + datetime.timedelta(
seconds=self.re_arm_sec) seconds=self.re_arm_sec)
track_point_in_time( track_point_in_time(
self._hass, self.update_ha_state, self._hass, self.async_update_ha_state,
self.invalidate_after) self.invalidate_after)
@property @property

View File

@@ -8,30 +8,34 @@ import logging
from datetime import timedelta from datetime import timedelta
import requests import requests
import voluptuous as vol
from homeassistant.const import CONF_API_KEY from homeassistant.const import CONF_API_KEY
from homeassistant.helpers import validate_config, discovery from homeassistant.helpers import discovery
from homeassistant.util import Throttle from homeassistant.util import Throttle
import homeassistant.helpers.config_validation as cv
DOMAIN = "bloomsky"
BLOOMSKY = None
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
BLOOMSKY = None
BLOOMSKY_TYPE = ['camera', 'binary_sensor', 'sensor']
DOMAIN = 'bloomsky'
# The BloomSky only updates every 5-8 minutes as per the API spec so there's # The BloomSky only updates every 5-8 minutes as per the API spec so there's
# no point in polling the API more frequently # no point in polling the API more frequently
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=300) MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=300)
CONFIG_SCHEMA = vol.Schema({
DOMAIN: vol.Schema({
vol.Required(CONF_API_KEY): cv.string,
}),
}, extra=vol.ALLOW_EXTRA)
# pylint: disable=unused-argument,too-few-public-methods
# pylint: disable=unused-argument
def setup(hass, config): def setup(hass, config):
"""Setup BloomSky component.""" """Setup BloomSky component."""
if not validate_config(
config,
{DOMAIN: [CONF_API_KEY]},
_LOGGER):
return False
api_key = config[DOMAIN][CONF_API_KEY] api_key = config[DOMAIN][CONF_API_KEY]
global BLOOMSKY global BLOOMSKY
@@ -40,7 +44,7 @@ def setup(hass, config):
except RuntimeError: except RuntimeError:
return False return False
for component in 'camera', 'binary_sensor', 'sensor': for component in BLOOMSKY_TYPE:
discovery.load_platform(hass, component, DOMAIN, {}, config) discovery.load_platform(hass, component, DOMAIN, {}, config)
return True return True
@@ -50,19 +54,19 @@ class BloomSky(object):
"""Handle all communication with the BloomSky API.""" """Handle all communication with the BloomSky API."""
# API documentation at http://weatherlution.com/bloomsky-api/ # API documentation at http://weatherlution.com/bloomsky-api/
API_URL = "https://api.bloomsky.com/api/skydata" API_URL = 'https://api.bloomsky.com/api/skydata'
def __init__(self, api_key): def __init__(self, api_key):
"""Initialize the BookSky.""" """Initialize the BookSky."""
self._api_key = api_key self._api_key = api_key
self.devices = {} self.devices = {}
_LOGGER.debug("Initial bloomsky device load...") _LOGGER.debug("Initial BloomSky device load...")
self.refresh_devices() self.refresh_devices()
@Throttle(MIN_TIME_BETWEEN_UPDATES) @Throttle(MIN_TIME_BETWEEN_UPDATES)
def refresh_devices(self): def refresh_devices(self):
"""Use the API to retreive a list of devices.""" """Use the API to retrieve a list of devices."""
_LOGGER.debug("Fetching bloomsky update") _LOGGER.debug("Fetching BloomSky update")
response = requests.get(self.API_URL, response = requests.get(self.API_URL,
headers={"Authorization": self._api_key}, headers={"Authorization": self._api_key},
timeout=10) timeout=10)
@@ -73,5 +77,5 @@ class BloomSky(object):
return return
# Create dictionary keyed off of the device unique id # Create dictionary keyed off of the device unique id
self.devices.update({ self.devices.update({
device["DeviceID"]: device for device in response.json() device['DeviceID']: device for device in response.json()
}) })

View File

@@ -0,0 +1,183 @@
"""
Support for Google Calendar event device sensors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/calendar/
"""
import logging
import re
from homeassistant.components.google import (CONF_OFFSET,
CONF_DEVICE_ID,
CONF_NAME)
from homeassistant.const import STATE_OFF, STATE_ON
from homeassistant.helpers.config_validation import time_period_str
from homeassistant.helpers.entity import Entity, generate_entity_id
from homeassistant.helpers.entity_component import EntityComponent
from homeassistant.helpers.template import DATE_STR_FORMAT
from homeassistant.util import dt
_LOGGER = logging.getLogger(__name__)
DOMAIN = 'calendar'
ENTITY_ID_FORMAT = DOMAIN + '.{}'
def setup(hass, config):
"""Track states and offer events for calendars."""
component = EntityComponent(
logging.getLogger(__name__), DOMAIN, hass, 60, DOMAIN)
component.setup(config)
return True
DEFAULT_CONF_TRACK_NEW = True
DEFAULT_CONF_OFFSET = '!!'
# pylint: disable=too-many-instance-attributes
class CalendarEventDevice(Entity):
"""A calendar event device."""
# Classes overloading this must set data to an object
# with an update() method
data = None
# pylint: disable=too-many-arguments
def __init__(self, hass, data):
"""Create the Calendar Event Device."""
self._name = data.get(CONF_NAME)
self.dev_id = data.get(CONF_DEVICE_ID)
self._offset = data.get(CONF_OFFSET, DEFAULT_CONF_OFFSET)
self.entity_id = generate_entity_id(ENTITY_ID_FORMAT,
self.dev_id,
hass=hass)
self._cal_data = {
'all_day': False,
'offset_time': dt.dt.timedelta(),
'message': '',
'start': None,
'end': None,
'location': '',
'description': '',
}
self.update()
def offset_reached(self):
"""Have we reached the offset time specified in the event title."""
if self._cal_data['start'] is None or \
self._cal_data['offset_time'] == dt.dt.timedelta():
return False
return self._cal_data['start'] + self._cal_data['offset_time'] <= \
dt.now(self._cal_data['start'].tzinfo)
@property
def name(self):
"""Return the name of the entity."""
return self._name
@property
def device_state_attributes(self):
"""State Attributes for HA."""
start = self._cal_data.get('start', None)
end = self._cal_data.get('end', None)
start = start.strftime(DATE_STR_FORMAT) if start is not None else None
end = end.strftime(DATE_STR_FORMAT) if end is not None else None
return {
'message': self._cal_data.get('message', ''),
'all_day': self._cal_data.get('all_day', False),
'offset_reached': self.offset_reached(),
'start_time': start,
'end_time': end,
'location': self._cal_data.get('location', None),
'description': self._cal_data.get('description', None),
}
@property
def state(self):
"""Return the state of the calendar event."""
start = self._cal_data.get('start', None)
end = self._cal_data.get('end', None)
if start is None or end is None:
return STATE_OFF
now = dt.now()
if start <= now and end > now:
return STATE_ON
if now >= end:
self.cleanup()
return STATE_OFF
def cleanup(self):
"""Cleanup any start/end listeners that were setup."""
self._cal_data = {
'all_day': False,
'offset_time': 0,
'message': '',
'start': None,
'end': None,
'location': None,
'description': None
}
def update(self):
"""Search for the next event."""
if not self.data or not self.data.update():
# update cached, don't do anything
return
if not self.data.event:
# we have no event to work on, make sure we're clean
self.cleanup()
return
def _get_date(date):
"""Get the dateTime from date or dateTime as a local."""
if 'date' in date:
return dt.as_utc(dt.dt.datetime.combine(
dt.parse_date(date['date']), dt.dt.time()))
else:
return dt.parse_datetime(date['dateTime'])
start = _get_date(self.data.event['start'])
end = _get_date(self.data.event['end'])
summary = self.data.event['summary']
# check if we have an offset tag in the message
# time is HH:MM or MM
reg = '{}([+-]?[0-9]{{0,2}}(:[0-9]{{0,2}})?)'.format(self._offset)
search = re.search(reg, summary)
if search and search.group(1):
time = search.group(1)
if ':' not in time:
if time[0] == '+' or time[0] == '-':
time = '{}0:{}'.format(time[0], time[1:])
else:
time = '0:{}'.format(time)
offset_time = time_period_str(time)
summary = (summary[:search.start()] + summary[search.end():]) \
.strip()
else:
offset_time = dt.dt.timedelta() # default it
# cleanup the string so we don't have a bunch of double+ spaces
self._cal_data['message'] = re.sub(' +', '', summary).strip()
self._cal_data['offset_time'] = offset_time
self._cal_data['location'] = self.data.event.get('location', '')
self._cal_data['description'] = self.data.event.get('description', '')
self._cal_data['start'] = start
self._cal_data['end'] = end
self._cal_data['all_day'] = 'date' in self.data.event['start']

View File

@@ -0,0 +1,82 @@
"""
Demo platform that has two fake binary sensors.
For more details about this platform, please refer to the documentation
https://home-assistant.io/components/demo/
"""
import homeassistant.util.dt as dt_util
from homeassistant.components.calendar import CalendarEventDevice
from homeassistant.components.google import CONF_DEVICE_ID, CONF_NAME
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the Demo binary sensor platform."""
calendar_data_future = DemoGoogleCalendarDataFuture()
calendar_data_current = DemoGoogleCalendarDataCurrent()
add_devices([
DemoGoogleCalendar(hass, calendar_data_future, {
CONF_NAME: 'Future Event',
CONF_DEVICE_ID: 'future_event',
}),
DemoGoogleCalendar(hass, calendar_data_current, {
CONF_NAME: 'Current Event',
CONF_DEVICE_ID: 'current_event',
}),
])
class DemoGoogleCalendarData(object):
"""Setup base class for data."""
# pylint: disable=no-self-use
def update(self):
"""Return true so entity knows we have new data."""
return True
class DemoGoogleCalendarDataFuture(DemoGoogleCalendarData):
"""Setup future data event."""
def __init__(self):
"""Set the event to a future event."""
one_hour_from_now = dt_util.now() \
+ dt_util.dt.timedelta(minutes=30)
self.event = {
'start': {
'dateTime': one_hour_from_now.isoformat()
},
'end': {
'dateTime': (one_hour_from_now + dt_util.dt.
timedelta(minutes=60)).isoformat()
},
'summary': 'Future Event',
}
class DemoGoogleCalendarDataCurrent(DemoGoogleCalendarData):
"""Create a current event we're in the middle of."""
def __init__(self):
"""Set the event data."""
middle_of_event = dt_util.now() \
- dt_util.dt.timedelta(minutes=30)
self.event = {
'start': {
'dateTime': middle_of_event.isoformat()
},
'end': {
'dateTime': (middle_of_event + dt_util.dt.
timedelta(minutes=60)).isoformat()
},
'summary': 'Current Event',
}
class DemoGoogleCalendar(CalendarEventDevice):
"""A Demo binary sensor."""
def __init__(self, hass, calendar_data, data):
"""The same as a google calendar but without the api calls."""
self.data = calendar_data
super().__init__(hass, data)

View File

@@ -0,0 +1,79 @@
"""
Support for Google Calendar Search binary sensors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.google_calendar/
"""
# pylint: disable=import-error
import logging
from datetime import timedelta
from homeassistant.components.calendar import CalendarEventDevice
from homeassistant.components.google import (CONF_CAL_ID, CONF_ENTITIES,
CONF_TRACK, TOKEN_FILE,
GoogleCalendarService)
from homeassistant.util import Throttle, dt
DEFAULT_GOOGLE_SEARCH_PARAMS = {
'orderBy': 'startTime',
'maxResults': 1,
'singleEvents': True,
}
# Return cached results if last scan was less then this time ago
MIN_TIME_BETWEEN_UPDATES = timedelta(minutes=15)
_LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, add_devices, disc_info=None):
"""Setup the calendar platform for event devices."""
if disc_info is None:
return
if not any([data[CONF_TRACK] for data in disc_info[CONF_ENTITIES]]):
return
calendar_service = GoogleCalendarService(hass.config.path(TOKEN_FILE))
add_devices([GoogleCalendarEventDevice(hass, calendar_service,
disc_info[CONF_CAL_ID], data)
for data in disc_info[CONF_ENTITIES] if data[CONF_TRACK]])
# pylint: disable=too-many-instance-attributes
class GoogleCalendarEventDevice(CalendarEventDevice):
"""A calendar event device."""
def __init__(self, hass, calendar_service, calendar, data):
"""Create the Calendar event device."""
self.data = GoogleCalendarData(calendar_service, calendar,
data.get('search', None))
super().__init__(hass, data)
class GoogleCalendarData(object):
"""Class to utilize calendar service object to get next event."""
def __init__(self, calendar_service, calendar_id, search=None):
"""Setup how we are going to search the google calendar."""
self.calendar_service = calendar_service
self.calendar_id = calendar_id
self.search = search
self.event = None
@Throttle(MIN_TIME_BETWEEN_UPDATES)
def update(self):
"""Get the latest data."""
service = self.calendar_service.get()
params = dict(DEFAULT_GOOGLE_SEARCH_PARAMS)
params['timeMin'] = dt.utcnow().isoformat('T')
params['calendarId'] = self.calendar_id
if self.search:
params['q'] = self.search
events = service.events() # pylint: disable=no-member
result = events.list(**params).execute()
items = result.get('items', [])
self.event = items[0] if len(items) == 1 else None
return True

View File

@@ -5,13 +5,15 @@ Component to interface with cameras.
For more details about this component, please refer to the documentation at For more details about this component, please refer to the documentation at
https://home-assistant.io/components/camera/ https://home-assistant.io/components/camera/
""" """
import asyncio
import logging import logging
import time
from aiohttp import web
from homeassistant.helpers.entity import Entity from homeassistant.helpers.entity import Entity
from homeassistant.helpers.entity_component import EntityComponent from homeassistant.helpers.entity_component import EntityComponent
from homeassistant.helpers.config_validation import PLATFORM_SCHEMA # noqa from homeassistant.helpers.config_validation import PLATFORM_SCHEMA # noqa
from homeassistant.components.http import HomeAssistantView from homeassistant.components.http import HomeAssistantView, KEY_AUTHENTICATED
DOMAIN = 'camera' DOMAIN = 'camera'
DEPENDENCIES = ['http'] DEPENDENCIES = ['http']
@@ -25,17 +27,16 @@ STATE_IDLE = 'idle'
ENTITY_IMAGE_URL = '/api/camera_proxy/{0}?token={1}' ENTITY_IMAGE_URL = '/api/camera_proxy/{0}?token={1}'
# pylint: disable=too-many-branches @asyncio.coroutine
def setup(hass, config): def async_setup(hass, config):
"""Setup the camera component.""" """Setup the camera component."""
component = EntityComponent( component = EntityComponent(
logging.getLogger(__name__), DOMAIN, hass, SCAN_INTERVAL) logging.getLogger(__name__), DOMAIN, hass, SCAN_INTERVAL)
hass.wsgi.register_view(CameraImageView(hass, component.entities)) hass.http.register_view(CameraImageView(component.entities))
hass.wsgi.register_view(CameraMjpegStream(hass, component.entities)) hass.http.register_view(CameraMjpegStream(component.entities))
component.setup(config)
yield from component.async_setup(config)
return True return True
@@ -80,33 +81,58 @@ class Camera(Entity):
"""Return bytes of camera image.""" """Return bytes of camera image."""
raise NotImplementedError() raise NotImplementedError()
def mjpeg_stream(self, response): @asyncio.coroutine
"""Generate an HTTP MJPEG stream from camera images.""" def async_camera_image(self):
def stream(): """Return bytes of camera image.
"""Stream images as mjpeg stream."""
try:
last_image = None
while True:
img_bytes = self.camera_image()
if img_bytes is not None and img_bytes != last_image: This method must be run in the event loop.
yield bytes( """
'--jpegboundary\r\n' image = yield from self.hass.loop.run_in_executor(
'Content-Type: image/jpeg\r\n' None, self.camera_image)
'Content-Length: {}\r\n\r\n'.format( return image
len(img_bytes)), 'utf-8') + img_bytes + b'\r\n'
last_image = img_bytes @asyncio.coroutine
def handle_async_mjpeg_stream(self, request):
"""Generate an HTTP MJPEG stream from camera images.
time.sleep(0.5) This method must be run in the event loop.
except GeneratorExit: """
pass response = web.StreamResponse()
return response( response.content_type = ('multipart/x-mixed-replace; '
stream(), 'boundary=--jpegboundary')
content_type=('multipart/x-mixed-replace; ' yield from response.prepare(request)
'boundary=--jpegboundary')
) def write(img_bytes):
"""Write image to stream."""
response.write(bytes(
'--jpegboundary\r\n'
'Content-Type: image/jpeg\r\n'
'Content-Length: {}\r\n\r\n'.format(
len(img_bytes)), 'utf-8') + img_bytes + b'\r\n')
last_image = None
try:
while True:
img_bytes = yield from self.async_camera_image()
if not img_bytes:
break
if img_bytes is not None and img_bytes != last_image:
write(img_bytes)
# Chrome seems to always ignore first picture,
# print it twice.
if last_image is None:
write(img_bytes)
last_image = img_bytes
yield from response.drain()
yield from asyncio.sleep(.5)
finally:
yield from response.write_eof()
@property @property
def state(self): def state(self):
@@ -139,27 +165,29 @@ class CameraView(HomeAssistantView):
requires_auth = False requires_auth = False
def __init__(self, hass, entities): def __init__(self, entities):
"""Initialize a basic camera view.""" """Initialize a basic camera view."""
super().__init__(hass)
self.entities = entities self.entities = entities
@asyncio.coroutine
def get(self, request, entity_id): def get(self, request, entity_id):
"""Start a get request.""" """Start a get request."""
camera = self.entities.get(entity_id) camera = self.entities.get(entity_id)
if camera is None: if camera is None:
return self.Response(status=404) return web.Response(status=404)
authenticated = (request.authenticated or authenticated = (request[KEY_AUTHENTICATED] or
request.args.get('token') == camera.access_token) request.GET.get('token') == camera.access_token)
if not authenticated: if not authenticated:
return self.Response(status=401) return web.Response(status=401)
return self.handle(camera) response = yield from self.handle(request, camera)
return response
def handle(self, camera): @asyncio.coroutine
def handle(self, request, camera):
"""Hanlde the camera request.""" """Hanlde the camera request."""
raise NotImplementedError() raise NotImplementedError()
@@ -167,25 +195,27 @@ class CameraView(HomeAssistantView):
class CameraImageView(CameraView): class CameraImageView(CameraView):
"""Camera view to serve an image.""" """Camera view to serve an image."""
url = "/api/camera_proxy/<entity(domain=camera):entity_id>" url = "/api/camera_proxy/{entity_id}"
name = "api:camera:image" name = "api:camera:image"
def handle(self, camera): @asyncio.coroutine
def handle(self, request, camera):
"""Serve camera image.""" """Serve camera image."""
response = camera.camera_image() image = yield from camera.async_camera_image()
if response is None: if image is None:
return self.Response(status=500) return web.Response(status=500)
return self.Response(response) return web.Response(body=image)
class CameraMjpegStream(CameraView): class CameraMjpegStream(CameraView):
"""Camera View to serve an MJPEG stream.""" """Camera View to serve an MJPEG stream."""
url = "/api/camera_proxy_stream/<entity(domain=camera):entity_id>" url = "/api/camera_proxy_stream/{entity_id}"
name = "api:camera:stream" name = "api:camera:stream"
def handle(self, camera): @asyncio.coroutine
def handle(self, request, camera):
"""Serve camera image.""" """Serve camera image."""
return camera.mjpeg_stream(self.Response) yield from camera.handle_async_mjpeg_stream(request)

View File

@@ -0,0 +1,79 @@
"""
This component provides basic support for Amcrest IP cameras.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/camera.amcrest/
"""
import logging
import voluptuous as vol
import homeassistant.loader as loader
from homeassistant.components.camera import (Camera, PLATFORM_SCHEMA)
from homeassistant.const import (
CONF_HOST, CONF_NAME, CONF_USERNAME, CONF_PASSWORD, CONF_PORT)
from homeassistant.helpers import config_validation as cv
REQUIREMENTS = ['amcrest==1.0.0']
_LOGGER = logging.getLogger(__name__)
DEFAULT_PORT = 80
DEFAULT_NAME = 'Amcrest Camera'
NOTIFICATION_ID = 'amcrest_notification'
NOTIFICATION_TITLE = 'Amcrest Camera Setup'
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Required(CONF_HOST): cv.string,
vol.Required(CONF_USERNAME): cv.string,
vol.Required(CONF_PASSWORD): cv.string,
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
vol.Optional(CONF_PORT, default=DEFAULT_PORT): cv.port,
})
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Set up an Amcrest IP Camera."""
from amcrest import AmcrestCamera
data = AmcrestCamera(
config.get(CONF_HOST), config.get(CONF_PORT),
config.get(CONF_USERNAME), config.get(CONF_PASSWORD))
persistent_notification = loader.get_component('persistent_notification')
try:
data.camera.current_time
# pylint: disable=broad-except
except Exception as ex:
_LOGGER.error("Unable to connect to Amcrest camera: %s", str(ex))
persistent_notification.create(
hass, 'Error: {}<br />'
'You will need to restart hass after fixing.'
''.format(ex),
title=NOTIFICATION_TITLE,
notification_id=NOTIFICATION_ID)
return False
add_devices([AmcrestCam(config, data)])
return True
class AmcrestCam(Camera):
"""An implementation of an Amcrest IP camera."""
def __init__(self, device_info, data):
"""Initialize an Amcrest camera."""
super(AmcrestCam, self).__init__()
self._name = device_info.get(CONF_NAME)
self._data = data
def camera_image(self):
"""Return a still image reponse from the camera."""
# Send the request to snap a picture and return raw jpg data
response = self._data.camera.snapshot()
return response.data
@property
def name(self):
"""Return the name of this camera."""
return self._name

View File

@@ -11,15 +11,15 @@ import requests
from homeassistant.components.camera import Camera from homeassistant.components.camera import Camera
from homeassistant.loader import get_component from homeassistant.loader import get_component
DEPENDENCIES = ["bloomsky"] DEPENDENCIES = ['bloomsky']
# pylint: disable=unused-argument # pylint: disable=unused-argument
def setup_platform(hass, config, add_devices_callback, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup access to BloomSky cameras.""" """Setup access to BloomSky cameras."""
bloomsky = get_component('bloomsky') bloomsky = get_component('bloomsky')
for device in bloomsky.BLOOMSKY.devices.values(): for device in bloomsky.BLOOMSKY.devices.values():
add_devices_callback([BloomSkyCamera(bloomsky.BLOOMSKY, device)]) add_devices([BloomSkyCamera(bloomsky.BLOOMSKY, device)])
class BloomSkyCamera(Camera): class BloomSkyCamera(Camera):
@@ -28,8 +28,8 @@ class BloomSkyCamera(Camera):
def __init__(self, bs, device): def __init__(self, bs, device):
"""Setup for access to the BloomSky camera images.""" """Setup for access to the BloomSky camera images."""
super(BloomSkyCamera, self).__init__() super(BloomSkyCamera, self).__init__()
self._name = device["DeviceName"] self._name = device['DeviceName']
self._id = device["DeviceID"] self._id = device['DeviceID']
self._bloomsky = bs self._bloomsky = bs
self._url = "" self._url = ""
self._last_url = "" self._last_url = ""
@@ -42,7 +42,7 @@ class BloomSkyCamera(Camera):
def camera_image(self): def camera_image(self):
"""Update the camera's image if it has changed.""" """Update the camera's image if it has changed."""
try: try:
self._url = self._bloomsky.devices[self._id]["Data"]["ImageURL"] self._url = self._bloomsky.devices[self._id]['Data']['ImageURL']
self._bloomsky.refresh_devices() self._bloomsky.refresh_devices()
# If the URL hasn't changed then the image hasn't changed. # If the URL hasn't changed then the image hasn't changed.
if self._url != self._last_url: if self._url != self._last_url:

Some files were not shown because too many files have changed in this diff Show More