Skip to content
Merged

0.72 #15088

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
148 commits
Select commit Hold shift + click to select a range
29e659c
Fixed SI units for current consumption
vandenberghev Mar 13, 2018
855ed2b
Version bump to 0.72.0.dev0
balloob Jun 3, 2018
aec425d
Weather Platform - IPMA (#14716)
dgomes Jun 3, 2018
39843a7
Add additional 86sw model identifier of the LAN protocol V2 (#14799)
syssi Jun 4, 2018
1d23f7f
Allow Kodi live streams to be recognized as paused (#14623)
quthla Jun 4, 2018
bd1b1a9
Update syntax (#14812)
fabaff Jun 4, 2018
816efa0
Use pihole module to get data (#14809)
fabaff Jun 4, 2018
2da6d3c
Merge branch 'dev' of https://github.com/home-assistant/home-assistan…
Jun 4, 2018
61a41bb
Fix issue #14426: [homeassistant.components.sensor] smappee: Error on…
Jun 4, 2018
e370d52
Bump python-miio version (Closes: #13749) (#14796)
syssi Jun 4, 2018
ad9621e
Use hass iconset (#14185)
balloob Jun 5, 2018
b3b4f74
Further cleanup frontend (#14805)
balloob Jun 5, 2018
640e499
netatmo api is now in pip as pyatmo (#14824)
jabesq Jun 5, 2018
cb6c869
Action parameter doesn't longer have to be the first parameter (#14815)
GruberMischa Jun 5, 2018
21d05a8
Fixes an issue in Xiaomi TV platform that would some TVs not sleep co…
simse Jun 5, 2018
f1aba55
Limit to 3 decimals (fixes #14773)
fabaff Jun 5, 2018
549abd9
Improved Fritz!Box thermostat support (#14789)
thomaskr Jun 5, 2018
1036394
Add Freebox device tracker (#12727)
stilllman Jun 5, 2018
4bccb0d
Merge pull request #14831 from home-assistant/sim-sensor
dgomes Jun 5, 2018
a6880c4
Migrate entity registry to using websocket (#14830)
balloob Jun 6, 2018
fa2e6ad
Route themes and translations over websocket (#14828)
balloob Jun 6, 2018
6d26915
Feature/gearbest library update (Closes: #14813) (#14833)
HerrHofrat Jun 6, 2018
bef1526
Ignore the mistaken long_both_click event of the 86sw (Closes: #14802…
syssi Jun 6, 2018
d8adb4b
Bump frontend to 20180607.0
balloob Jun 7, 2018
bf74cab
Fix non awaited test (#14854)
balloob Jun 7, 2018
0b405c3
Update Hue flow title (#14852)
balloob Jun 7, 2018
83ce945
Upgrade Mastodon.py to 1.3.0 (#14858)
fabaff Jun 7, 2018
6b2b92a
Improvements to LIFX reliability (#14848)
amelchio Jun 7, 2018
f696331
Add general sound mode support (#14729)
starkillerOG Jun 7, 2018
d14d2fe
Add IBM Watson IoT Platform component (#13664)
mtreinish Jun 7, 2018
a6c1192
Upgrade aiohttp to 3.3.0 (#14766)
fabaff Jun 7, 2018
bb4d177
Add min_temp and max_temp to MQTT climate device (#14690)
PhilRW Jun 7, 2018
67d137c
Store config entry id in entity registry (#14851)
balloob Jun 7, 2018
50321a2
Catch ConnectionError (fixes #14241) (#14748)
fabaff Jun 7, 2018
90a5116
Don't run unnecessary methods in executor pool (#14853)
balloob Jun 7, 2018
1a7e8c8
Wireless tags platform (#13495)
sergeymaysak Jun 7, 2018
d4cc806
Fix door/window sensor support of the Xiaomi Aqara LAN protocol V2 (C…
syssi Jun 7, 2018
87d5583
zha: handle "step_with_on_off" cluster command in LevelListener. (#14…
Adminiuga Jun 7, 2018
10317a0
Rename Hive hub friendly name (#14747)
SteveEdson Jun 7, 2018
fe018fd
Add set_default_level to logger (#14703)
dale3h Jun 7, 2018
0748466
Zone - Hass configuration name is optional (#14449)
Kane610 Jun 7, 2018
bb00689
Fix unit conversion (#14730)
dgomes Jun 8, 2018
e3fba79
Disable volume control for Onkyo when unavailable (Closes: #14774) (#…
snikch Jun 8, 2018
b657cff
Add netgear_lte component (#14687)
amelchio Jun 8, 2018
6af9950
Add support for new hass.io panel (#14873)
balloob Jun 8, 2018
d3d9d9e
Add color_status sensor for Nest Protect (#14868)
awarecan Jun 9, 2018
f242418
UVC camera platform handling unavailable NVR or cameras better (#14864)
exxamalte Jun 9, 2018
5f65f67
Removed semicolon
Jun 9, 2018
d7b7370
Samsung TV can't turn off after idle period (#14587)
ejel Jun 9, 2018
5393b07
Discover Qubino ZMHTDx smart meter switches (#14884)
turbokongen Jun 9, 2018
bc0d075
Add missing mapping of RotaryHandleSensorIP states (#14885)
hanzoh Jun 9, 2018
20caeb5
Add entity registry support to media_player.snapcast (#14895)
jedi7 Jun 10, 2018
f3e55ce
Allow different identifiers for the CPU temperature (fixes #10104) (#…
fabaff Jun 10, 2018
8aca2e8
Make RainMachine async (#14879)
bachya Jun 10, 2018
ce7e9e3
Add Uptime Robot sensor (#14631)
ludeeus Jun 10, 2018
dc447a7
Upgrade pyuptimerobot to 0.0.5
fabaff Jun 10, 2018
5f4aa6d
Upgrade python_opendata_transport to 0.1.3 (#14905)
fabaff Jun 10, 2018
54e8783
Upgrade psutil to 5.4.6 (#14892)
fabaff Jun 10, 2018
ce0ca7f
Upgrade sendgrid to 5.4.0 (#14891)
fabaff Jun 10, 2018
703b435
Upgrade python-mystrom to 0.4.4 (#14889)
fabaff Jun 10, 2018
7d9ef97
Upgrade pylast to 2.3.0 (#14888)
fabaff Jun 10, 2018
716ab04
Added daily and hourly modes to Openweathermap (#14875)
Yevgenium Jun 10, 2018
b4e5695
Bump to denonavr 0.7.3 (#14907)
klada Jun 10, 2018
d5bbb6f
Add api_host option to Konnected config (#14896)
heythisisnate Jun 10, 2018
1da3003
Add support for the Unitymedia Horizon HD Recorder (#14275)
benleb Jun 10, 2018
1c561ea
Add support for multiple Doorbird stations (#13994)
oblogic7 Jun 10, 2018
576c806
Update mqtt_eventstream.py (#14923)
molobrakos Jun 11, 2018
30111ea
Upgrade python-nest, add security_state sensor, nest.set_mode service…
awarecan Jun 12, 2018
be4776d
Add more test cases for samsungtv (#14900)
ejel Jun 12, 2018
cdc5388
Refactored Arlo component and enhanced Arlo API queries and times (#1…
tchellomello Jun 12, 2018
c18033b
Use cv.time_period instead of cv.time_period_str (#14938)
awarecan Jun 12, 2018
6755ae2
Add support for KIWI Door Locks (#14485)
c7h Jun 12, 2018
89d008d
Fix snapcast uuid to be more unique (#14925)
jedi7 Jun 12, 2018
3153b0c
Bump frontend to 20180613.0
balloob Jun 13, 2018
a373793
pytradfri 5.5.1: Improved 3rd party bulb support (#14887)
Hate-Usernames Jun 13, 2018
2ac23c8
Epson projector support (#14841)
pszafer Jun 13, 2018
176ef41
Add scan_interval to RainMachine (#14945)
bachya Jun 13, 2018
fecce20
Myq update from 0.0.8 to 0.0.11 (#14947)
arraylabs Jun 13, 2018
cb646e4
Upgrade pylint to 1.9.2 (#14916)
scop Jun 13, 2018
65b0ec6
Update python-wink to 1.8.0 (#14894)
vickyg3 Jun 13, 2018
08adfd8
Add unique_id for mqtt binary sensor (#14929)
ciotlosm Jun 13, 2018
d549e26
Make Yi platform async (#14944)
bachya Jun 13, 2018
e014a84
Nest config flow (#14921)
balloob Jun 13, 2018
cccd0de
Fix Facebox face data parsing (#14951)
robmarkcole Jun 13, 2018
cdd111d
Add sensor.nsw_fuel_station component (#14757)
nickw444 Jun 14, 2018
0e7d284
Make AirVisual platform async + other adjustments (#14943)
bachya Jun 14, 2018
c36c3f0
Add support for ZhongHong HVAC Controllers (#14552)
crhan Jun 14, 2018
b2440a6
Fix tests (#14959)
balloob Jun 14, 2018
c8e0de1
add relative time option to simulated sensors (#14038)
Shou Jun 14, 2018
2c6e6c2
Add config entry for Sonos + Cast (#14955)
balloob Jun 14, 2018
d6d685a
Fix smappee component - "Error on device update" (#14883)
bachya Jun 15, 2018
1128104
Adhere to scan_interval in platforms when setup via config entry (#14…
balloob Jun 15, 2018
3cd4cb7
Add Calendar API endpoint to get events (#14702)
titilambert Jun 15, 2018
f744a29
Add calendar panel, add tests (#14973)
balloob Jun 15, 2018
47a344f
Bump frontend to 20180615.0
balloob Jun 15, 2018
c917470
Xiaomi Cameras - multiple models (#14244)
vaidyasr Jun 15, 2018
940577e
Fix binary_sensor.skybell state update when there are no events (#14927)
trisk Jun 15, 2018
ac13a27
Deconz make groups configurable (#14704)
Kane610 Jun 15, 2018
8a777f6
Show notification when user configures Nest client_id/secret (#14970)
balloob Jun 15, 2018
9efa31e
Eight Sleep add REM type, Update async syntax, Catch API quirks (#14937)
mezz64 Jun 15, 2018
d0cbbe6
Return ISO formated datetime in forecast (#14975)
Jun 15, 2018
4bd7a7e
Remove inline pylint disables for messages disabled in pylintrc (#14978)
scop Jun 15, 2018
2ec295a
Add availability to Rflink entities. (#14977)
aequitas Jun 15, 2018
2839f0f
Upgrade ring_doorbell to 0.2.1 to fix oauth issues (#14984)
tchellomello Jun 16, 2018
7d9bce2
Fix extended package support (#14980)
cdce8p Jun 16, 2018
17308a2
Upgraded PyArlo to 0.1.7 (#14987)
tchellomello Jun 16, 2018
ff4da05
Upgraded python-amcrest to 1.2.3 (#14988)
tchellomello Jun 16, 2018
3ee8f58
Upgraded RainCloudy to version 0.0.5 (#14986)
tchellomello Jun 16, 2018
0b114f0
Do not mount deps folder when running in virtual env (#14993)
balloob Jun 16, 2018
abf07b6
Refactoring camera component to use async/await syntax. (#14990)
awarecan Jun 16, 2018
f101f6b
Merge remote-tracking branch 'origin/master' into dev
balloob Jun 16, 2018
87f9f17
Version bump to 0.72.0b0
balloob Jun 16, 2018
1f50e33
Bump frontend to 20180616.0
balloob Jun 16, 2018
bdf6257
Remove load power attribute for channel USB (#14996)
syssi Jun 16, 2018
a013908
Switch to own packaged version of spotipy (#14997)
andrey-git Jun 16, 2018
8e185bc
Bump pyhs100 version (#15001)
rytilahti Jun 16, 2018
5d82f48
Add experimental UI backend (#15002)
balloob Jun 16, 2018
65970a2
Version bump to 0.72.0b1
balloob Jun 16, 2018
7238205
Frontend bump to 20180617.0
balloob Jun 17, 2018
471d6e4
Version bump to 0.72.0b2
balloob Jun 17, 2018
da3695d
Update test_http.py
pvizeli Jun 17, 2018
1642502
Update translations
balloob Jun 18, 2018
86c6b4d
Fix panel URL authentication for Hass.io (#15024)
pvizeli Jun 17, 2018
5a3ea74
Bump frontend to 20180618.0
balloob Jun 18, 2018
ef39bca
Fix linode I/O in state property (#15010)
MartinHjelmare Jun 18, 2018
e29dfa8
Upgrade aiohttp to 3.3.2 (#15025)
fabaff Jun 18, 2018
e0cea2d
Make zone entries work without radius (#15032)
balloob Jun 18, 2018
60179a1
Bugfix empty entity lists (#15035)
pvizeli Jun 18, 2018
ef5b2a2
Version bump to 0.72.0b3
balloob Jun 18, 2018
9800b74
Version bump to 0.72.0b4
balloob Jun 18, 2018
3b4f7b4
Update frontend to 20180619.0
balloob Jun 19, 2018
659616a
Version bump to 0.72.0b5
balloob Jun 19, 2018
49845d9
Rename experimental UI to lovelace (#15065)
balloob Jun 20, 2018
c84f1d7
Version bump to 0.72.0b6
balloob Jun 20, 2018
e98e7e2
Update frontend to 20180621.0
balloob Jun 21, 2018
4b5d578
X10 (#14741)
teharris1 Jun 21, 2018
617647c
Fix MQTT Light with RGB and Brightness (#15053)
thinkl33t Jun 21, 2018
302717e
Update Neato Library And Reduce Cloud Calls (#15072)
dshokouhi Jun 21, 2018
a4b843e
Version bump to 0.72.0b7
balloob Jun 21, 2018
0df99f8
Bump frontend to 20180621.1
balloob Jun 21, 2018
35b609d
Allow writing commit with version bump
balloob Jun 21, 2018
6e5a2a7
Bumped version to 0.72.0b8
balloob Jun 21, 2018
6456f66
Frontend bump to 20180621.2
balloob Jun 21, 2018
0ea2d99
Bumped version to 0.72.0b9
balloob Jun 21, 2018
124495d
Update frontend to 20180622.0
balloob Jun 22, 2018
7325847
Bumped version to 0.72.0
balloob Jun 22, 2018
a02d798
Use older syntax for version bump
balloob Jun 22, 2018
66110a7
Bump frontend to 20180622.1
balloob Jun 22, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
27 changes: 23 additions & 4 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ omit =
homeassistant/components/coinbase.py
homeassistant/components/sensor/coinbase.py

homeassistant/components/cast/*
homeassistant/components/*/cast.py

homeassistant/components/comfoconnect.py
homeassistant/components/*/comfoconnect.py

Expand Down Expand Up @@ -97,7 +100,7 @@ omit =
homeassistant/components/*/envisalink.py

homeassistant/components/fritzbox.py
homeassistant/components/*/fritzbox.py
homeassistant/components/switch/fritzbox.py

homeassistant/components/eufy.py
homeassistant/components/*/eufy.py
Expand Down Expand Up @@ -195,12 +198,15 @@ omit =
homeassistant/components/neato.py
homeassistant/components/*/neato.py

homeassistant/components/nest.py
homeassistant/components/nest/__init__.py
homeassistant/components/*/nest.py

homeassistant/components/netatmo.py
homeassistant/components/*/netatmo.py

homeassistant/components/netgear_lte.py
homeassistant/components/*/netgear_lte.py

homeassistant/components/octoprint.py
homeassistant/components/*/octoprint.py

Expand Down Expand Up @@ -249,6 +255,9 @@ omit =
homeassistant/components/smappee.py
homeassistant/components/*/smappee.py

homeassistant/components/sonos/__init__.py
homeassistant/components/*/sonos.py

homeassistant/components/tado.py
homeassistant/components/*/tado.py

Expand Down Expand Up @@ -311,6 +320,9 @@ omit =
homeassistant/components/wink/*
homeassistant/components/*/wink.py

homeassistant/components/wirelesstag.py
homeassistant/components/*/wirelesstag.py

homeassistant/components/xiaomi_aqara.py
homeassistant/components/*/xiaomi_aqara.py

Expand Down Expand Up @@ -348,6 +360,7 @@ omit =
homeassistant/components/binary_sensor/ping.py
homeassistant/components/binary_sensor/rest.py
homeassistant/components/binary_sensor/tapsaff.py
homeassistant/components/binary_sensor/uptimerobot.py
homeassistant/components/browser.py
homeassistant/components/calendar/caldav.py
homeassistant/components/calendar/todoist.py
Expand All @@ -363,6 +376,7 @@ omit =
homeassistant/components/camera/rpi_camera.py
homeassistant/components/camera/synology.py
homeassistant/components/camera/xeoma.py
homeassistant/components/camera/xiaomi.py
homeassistant/components/camera/yi.py
homeassistant/components/climate/econet.py
homeassistant/components/climate/ephember.py
Expand All @@ -378,6 +392,7 @@ omit =
homeassistant/components/climate/sensibo.py
homeassistant/components/climate/touchline.py
homeassistant/components/climate/venstar.py
homeassistant/components/climate/zhong_hong.py
homeassistant/components/cover/garadget.py
homeassistant/components/cover/gogogate2.py
homeassistant/components/cover/homematic.py
Expand All @@ -397,6 +412,7 @@ omit =
homeassistant/components/device_tracker/bt_home_hub_5.py
homeassistant/components/device_tracker/cisco_ios.py
homeassistant/components/device_tracker/ddwrt.py
homeassistant/components/device_tracker/freebox.py
homeassistant/components/device_tracker/fritz.py
homeassistant/components/device_tracker/google_maps.py
homeassistant/components/device_tracker/gpslogger.py
Expand Down Expand Up @@ -462,6 +478,7 @@ omit =
homeassistant/components/light/yeelightsunflower.py
homeassistant/components/light/zengge.py
homeassistant/components/lirc.py
homeassistant/components/lock/kiwi.py
homeassistant/components/lock/lockitron.py
homeassistant/components/lock/nello.py
homeassistant/components/lock/nuki.py
Expand All @@ -472,7 +489,6 @@ omit =
homeassistant/components/media_player/aquostv.py
homeassistant/components/media_player/bluesound.py
homeassistant/components/media_player/braviatv.py
homeassistant/components/media_player/cast.py
homeassistant/components/media_player/channels.py
homeassistant/components/media_player/clementine.py
homeassistant/components/media_player/cmus.py
Expand All @@ -481,10 +497,12 @@ omit =
homeassistant/components/media_player/directv.py
homeassistant/components/media_player/dunehd.py
homeassistant/components/media_player/emby.py
homeassistant/components/media_player/epson.py
homeassistant/components/media_player/firetv.py
homeassistant/components/media_player/frontier_silicon.py
homeassistant/components/media_player/gpmdp.py
homeassistant/components/media_player/gstreamer.py
homeassistant/components/media_player/horizon.py
homeassistant/components/media_player/itunes.py
homeassistant/components/media_player/kodi.py
homeassistant/components/media_player/lg_netcast.py
Expand All @@ -506,7 +524,6 @@ omit =
homeassistant/components/media_player/russound_rnet.py
homeassistant/components/media_player/snapcast.py
homeassistant/components/media_player/songpal.py
homeassistant/components/media_player/sonos.py
homeassistant/components/media_player/spotify.py
homeassistant/components/media_player/squeezebox.py
homeassistant/components/media_player/ue_smart_radio.py
Expand Down Expand Up @@ -644,6 +661,7 @@ omit =
homeassistant/components/sensor/nederlandse_spoorwegen.py
homeassistant/components/sensor/netdata.py
homeassistant/components/sensor/neurio_energy.py
homeassistant/components/sensor/nsw_fuel_station.py
homeassistant/components/sensor/nut.py
homeassistant/components/sensor/nzbget.py
homeassistant/components/sensor/ohmconnect.py
Expand Down Expand Up @@ -748,6 +766,7 @@ omit =
homeassistant/components/tts/picotts.py
homeassistant/components/vacuum/mqtt.py
homeassistant/components/vacuum/roomba.py
homeassistant/components/watson_iot.py
homeassistant/components/weather/bom.py
homeassistant/components/weather/buienradar.py
homeassistant/components/weather/darksky.py
Expand Down
1 change: 1 addition & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ homeassistant/components/sensor/filter.py @dgomes
homeassistant/components/sensor/gearbest.py @HerrHofrat
homeassistant/components/sensor/irish_rail_transport.py @ttroy50
homeassistant/components/sensor/miflora.py @danielhiversen @ChristianKuehnel
homeassistant/components/sensor/nsw_fuel_station.py @nickw444
homeassistant/components/sensor/pollen.py @bachya
homeassistant/components/sensor/qnap.py @colinodell
homeassistant/components/sensor/sma.py @kellerza
Expand Down
29 changes: 10 additions & 19 deletions homeassistant/bootstrap.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Provide methods to bootstrap a Home Assistant instance."""
import asyncio
import logging
import logging.handlers
import os
Expand All @@ -17,7 +16,7 @@
from homeassistant.const import EVENT_HOMEASSISTANT_CLOSE
from homeassistant.setup import async_setup_component
from homeassistant.util.logging import AsyncHandler
from homeassistant.util.package import async_get_user_site, get_user_site
from homeassistant.util.package import async_get_user_site, is_virtual_env
from homeassistant.util.yaml import clear_secret_cache
from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers.signal import async_register_signal_handling
Expand Down Expand Up @@ -53,8 +52,9 @@ def from_config_dict(config: Dict[str, Any],
if config_dir is not None:
config_dir = os.path.abspath(config_dir)
hass.config.config_dir = config_dir
hass.loop.run_until_complete(
async_mount_local_lib_path(config_dir, hass.loop))
if not is_virtual_env():
hass.loop.run_until_complete(
async_mount_local_lib_path(config_dir))

# run task
hass = hass.loop.run_until_complete(
Expand Down Expand Up @@ -197,7 +197,9 @@ async def async_from_config_file(config_path: str,
# Set config dir to directory holding config file
config_dir = os.path.abspath(os.path.dirname(config_path))
hass.config.config_dir = config_dir
await async_mount_local_lib_path(config_dir, hass.loop)

if not is_virtual_env():
await async_mount_local_lib_path(config_dir)

async_enable_logging(hass, verbose, log_rotate_days, log_file,
log_no_color)
Expand All @@ -211,9 +213,8 @@ async def async_from_config_file(config_path: str,
finally:
clear_secret_cache()

hass = await async_from_config_dict(
return await async_from_config_dict(
config_dict, hass, enable_log=False, skip_pip=skip_pip)
return hass


@core.callback
Expand Down Expand Up @@ -308,23 +309,13 @@ async def async_stop_async_handler(event):
"Unable to setup error log %s (access denied)", err_log_path)


def mount_local_lib_path(config_dir: str) -> str:
"""Add local library to Python Path."""
deps_dir = os.path.join(config_dir, 'deps')
lib_dir = get_user_site(deps_dir)
if lib_dir not in sys.path:
sys.path.insert(0, lib_dir)
return deps_dir


async def async_mount_local_lib_path(config_dir: str,
loop: asyncio.AbstractEventLoop) -> str:
async def async_mount_local_lib_path(config_dir: str) -> str:
"""Add local library to Python Path.

This function is a coroutine.
"""
deps_dir = os.path.join(config_dir, 'deps')
lib_dir = await async_get_user_site(deps_dir, loop=loop)
lib_dir = await async_get_user_site(deps_dir)
if lib_dir not in sys.path:
sys.path.insert(0, lib_dir)
return deps_dir
57 changes: 30 additions & 27 deletions homeassistant/components/alarm_control_panel/arlo.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/alarm_control_panel.arlo/
"""
import asyncio
import logging

import voluptuous as vol

import homeassistant.helpers.config_validation as cv
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.components.alarm_control_panel import (
AlarmControlPanel, PLATFORM_SCHEMA)
from homeassistant.components.arlo import (DATA_ARLO, CONF_ATTRIBUTION)
from homeassistant.components.arlo import (
DATA_ARLO, CONF_ATTRIBUTION, SIGNAL_UPDATE_ARLO)
from homeassistant.const import (
ATTR_ATTRIBUTION, STATE_ALARM_ARMED_AWAY, STATE_ALARM_ARMED_HOME,
STATE_ALARM_DISARMED)
Expand All @@ -36,21 +38,20 @@
})


@asyncio.coroutine
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Set up the Arlo Alarm Control Panels."""
data = hass.data[DATA_ARLO]
arlo = hass.data[DATA_ARLO]

if not data.base_stations:
if not arlo.base_stations:
return

home_mode_name = config.get(CONF_HOME_MODE_NAME)
away_mode_name = config.get(CONF_AWAY_MODE_NAME)
base_stations = []
for base_station in data.base_stations:
for base_station in arlo.base_stations:
base_stations.append(ArloBaseStation(base_station, home_mode_name,
away_mode_name))
async_add_devices(base_stations, True)
add_devices(base_stations, True)


class ArloBaseStation(AlarmControlPanel):
Expand All @@ -68,37 +69,39 @@ def icon(self):
"""Return icon."""
return ICON

async def async_added_to_hass(self):
"""Register callbacks."""
async_dispatcher_connect(
self.hass, SIGNAL_UPDATE_ARLO, self._update_callback)

@callback
def _update_callback(self):
"""Call update method."""
self.async_schedule_update_ha_state(True)

@property
def state(self):
"""Return the state of the device."""
return self._state

def update(self):
"""Update the state of the device."""
# PyArlo sometimes returns None for mode. So retry 3 times before
# returning None.
num_retries = 3
i = 0
while i < num_retries:
mode = self._base_station.mode
if mode:
self._state = self._get_state_from_mode(mode)
return
i += 1
self._state = None

@asyncio.coroutine
def async_alarm_disarm(self, code=None):
_LOGGER.debug("Updating Arlo Alarm Control Panel %s", self.name)
mode = self._base_station.mode
if mode:
self._state = self._get_state_from_mode(mode)
else:
self._state = None

async def async_alarm_disarm(self, code=None):
"""Send disarm command."""
self._base_station.mode = DISARMED

@asyncio.coroutine
def async_alarm_arm_away(self, code=None):
async def async_alarm_arm_away(self, code=None):
"""Send arm away command. Uses custom mode."""
self._base_station.mode = self._away_mode_name

@asyncio.coroutine
def async_alarm_arm_home(self, code=None):
async def async_alarm_arm_home(self, code=None):
"""Send arm home command. Uses custom mode."""
self._base_station.mode = self._home_mode_name

Expand All @@ -125,4 +128,4 @@ def _get_state_from_mode(self, mode):
return STATE_ALARM_ARMED_HOME
elif mode == self._away_mode_name:
return STATE_ALARM_ARMED_AWAY
return None
return mode
2 changes: 1 addition & 1 deletion homeassistant/components/amcrest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from homeassistant.helpers import discovery
import homeassistant.helpers.config_validation as cv

REQUIREMENTS = ['amcrest==1.2.2']
REQUIREMENTS = ['amcrest==1.2.3']
DEPENDENCIES = ['ffmpeg']

_LOGGER = logging.getLogger(__name__)
Expand Down
Loading