Skip to content
Merged

0.75.0 #15806

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
127 commits
Select commit Hold shift + click to select a range
dd7890c
Version bump to 0.75.0.dev0
balloob Jul 16, 2018
ad4cba7
Extract SSL context creation to helper (#15483)
balloob Jul 16, 2018
0b2aff6
Delay setup of waze travel time component (#15455)
squirtbrnr Jul 17, 2018
7eb5cd1
Bump pyarlo==0.2.0, fixes #15486 (#15503)
lukiffer Jul 17, 2018
8797cb7
Add current user WS command (#15485)
balloob Jul 17, 2018
db3cdb2
Update HomeKit module code (#15502)
mjg59 Jul 17, 2018
b0a3207
Add onboarding support (#15492)
balloob Jul 17, 2018
d2f4bce
Bump frontend to 20180717.0
balloob Jul 17, 2018
e31dd44
Pylint 2 fixes (#15487)
scop Jul 17, 2018
2022d39
Disallow use insecure_example auth provider in configuration.yml (#15…
awarecan Jul 17, 2018
9292d92
Add Tuya climate platform (#15500)
huangyupeng Jul 17, 2018
4ab502a
Support latest tplink Archer D9 Firmware version / Device Scanner (#1…
JackNova Jul 17, 2018
7d7c210
Customizable command timeout (#15442)
mu4yu3 Jul 17, 2018
24d2261
Add check_untyped_defs (#15510)
andrey-git Jul 17, 2018
2781796
Remove some unused imports (#15529)
scop Jul 18, 2018
98722e1
Decouple emulated hue from http server (#15530)
balloob Jul 18, 2018
058081b
Moon translate (#15498)
pvizeli Jul 18, 2018
bf17ed0
More pylint 2 fixes (#15516)
scop Jul 18, 2018
e62e2bb
Make sure that only pypi dependencies are used (#15490)
andrey-git Jul 18, 2018
e427f9e
RFC: Only use supported light properties (#15484)
amelchio Jul 18, 2018
9c5bbfe
Cleanup of HomematicIP Cloud code (#15475)
worm-ee Jul 18, 2018
06c3f75
Implement locate service for neato (#15467)
dshokouhi Jul 18, 2018
26375a3
Make RS room thermostat discoverable (#15451)
turbokongen Jul 18, 2018
6834e00
Add support for Tahoma Soke Sensor (#15441)
fucm Jul 18, 2018
e5f0da7
Mini-Remote events (#15523)
teharris1 Jul 18, 2018
a8c7425
Update pyatmo (#15540)
gieljnssns Jul 18, 2018
dfe1749
Bump frontend to 20180718.0
balloob Jul 18, 2018
4650366
Don't be so strict client-side (#15546)
balloob Jul 18, 2018
22d961d
Update reading when device is added (#15548)
quthla Jul 18, 2018
2a76a08
Allow CORS requests to token endpoint (#15519)
balloob Jul 19, 2018
8b04d48
Update config entry id in entity registry (#15531)
balloob Jul 19, 2018
396895d
Added WS endpoint for changing homeassistant password. (#15527)
jeradM Jul 19, 2018
33ee91a
Bump frontend to 20180719.0
balloob Jul 19, 2018
a42288d
Upgrade to simplisafe-python v2 to use new SimpliSafe API (#15542)
Jul 19, 2018
2fcacbf
Allow auth providers to influence is_active (#15557)
balloob Jul 19, 2018
a0193e8
Upgrade pymysensors to 0.16.0 (#15554)
MartinHjelmare Jul 19, 2018
ea18e06
Remove relative time from state machine (#15560)
balloob Jul 19, 2018
2f7b797
More pylint 2 fixes (#15565)
scop Jul 20, 2018
f2a99e8
Add Tuya fan support (#15525)
huangyupeng Jul 20, 2018
f1286f8
Reset failed login attempts counter when login success (#15564)
awarecan Jul 20, 2018
3341c5c
Update the frontend to 20180720.0
balloob Jul 20, 2018
5cf9cd6
light.tplink: initialize min & max mireds only once, avoid i/o outsid…
rytilahti Jul 20, 2018
9a83890
fix aiohttp InvalidURL exception when fetching media player image (#1…
azogue Jul 20, 2018
7bc2362
Merge branch 'master' into dev
balloob Jul 20, 2018
ee8a815
Allow MQTT Switch to have an optional state configuration (#15430)
PrimusNZ Jul 20, 2018
d1b16e2
Add unique_id to netgear_lte sensors (#15584)
amelchio Jul 21, 2018
6f6d86c
Add relay addr & chan config to alarmdecoder zones (#15242)
digiblur Jul 21, 2018
ae2ee8f
Update pyhomematic, fixes #15054, #15190 (#15603)
danielperna84 Jul 21, 2018
ef3a830
Throttle unavailability warnings for tplink light/switch (#15591)
amelchio Jul 21, 2018
33f1577
Frontend component should auto load auth coomponent (#15606)
awarecan Jul 22, 2018
4de847f
Bugfix HomeKit name and serial_number (#15600)
cdce8p Jul 22, 2018
75f40cc
Remove entity picture of Tuya entity (#15611)
balloob Jul 22, 2018
a38c0d6
Upgrade mypy to 0.620 (#15612)
scop Jul 22, 2018
b7c336a
Pylint cleanups (#15626)
scop Jul 23, 2018
140a874
Add typing to homeassistant/*.py and homeassistant/util/ (#15569)
andrey-git Jul 23, 2018
1325682
Use case insensitive comparison for Sonos model check (#15604)
amelchio Jul 23, 2018
fddfb9e
Refresh Sonos source list on changes (#15605)
amelchio Jul 23, 2018
3acbd5a
The tense is wrong (#15614)
sherazlodhi Jul 23, 2018
50b6c59
Suppress error between 00:00 and 01:00 (#15555)
starkillerOG Jul 23, 2018
ea2ff6a
Use async_create_task (#15633)
balloob Jul 23, 2018
4e7dbf9
Allow system users to refresh tokens (#15574)
balloob Jul 23, 2018
8213b14
WIP: Hass.io sent token to supervisor (#15536)
balloob Jul 23, 2018
f3dfc43
Fix aiohttp connection reset errors (#15577)
pvizeli Jul 23, 2018
3204501
Cast/Sonos: create config entry if manually configured (#15630)
balloob Jul 23, 2018
1b94fe3
Add ability to set Zwave protection commandclass (#15390)
turbokongen Jul 23, 2018
bc481fa
Update Neato library to allow for dynamic endpoints (#15639)
dshokouhi Jul 23, 2018
45c35ce
Fix typo `asayn_init` instead of `async_init` (#15645)
wingy3181 Jul 24, 2018
d7690c5
Add ipban for failed login attempt in new login flow (#15551)
awarecan Jul 24, 2018
c1f5ead
Add Tuya cover and scene platform (#15587)
huangyupeng Jul 24, 2018
fbeaa57
Update smappy library version (#15636)
visibilityspots Jul 24, 2018
d9cf8fc
Allow changing entity ID (#15637)
balloob Jul 24, 2018
264c618
Bump frontend to 20180724.0
balloob Jul 24, 2018
2eb125e
Downgrade netatmo warning log to info (#15652)
glpatcern Jul 24, 2018
45a7ca6
Add turn_on/off service to camera (#15051)
awarecan Jul 24, 2018
0cc9798
Allow defining default turn-on values for lights in the profiles file…
kalmard0 Jul 24, 2018
cbb5d34
Added user credentials to current_user ws endpoint. (#15558)
jeradM Jul 25, 2018
397f551
Import collections abstract base classes from collections.abc (#15649)
scop Jul 25, 2018
68f03dc
Auth typing improvements (#15640)
scop Jul 25, 2018
169c8d7
Fix CORS duplicate registration (#15670)
balloob Jul 25, 2018
2824efd
Fix CORS duplicate registration (#15670)
balloob Jul 25, 2018
588fd19
Bumped version to 0.74.2
balloob Jul 25, 2018
9ecbf86
Add spider thermostat (#15499)
peternijssen Jul 25, 2018
95dc06c
Add Brunt Cover Device (#15653)
eavanvalkenburg Jul 25, 2018
1c42cab
Pylint 2 useless-return fixes (#15677)
scop Jul 25, 2018
9fb8bc8
Allow Nest Cam turn on/off (#15681)
awarecan Jul 25, 2018
eee9b50
Upgrade pylint to 2.0.1 (#15683)
scop Jul 26, 2018
feb8aff
Bump frontend to 20180726.0
balloob Jul 26, 2018
974fe4d
Fix frontend tests
balloob Jul 26, 2018
e30510a
Fixes a bug with showing a subset of Pollen index conditions (#15694)
bachya Jul 26, 2018
33f3e72
Add spider power plug component (#15682)
peternijssen Jul 27, 2018
a99b447
Add support for P5 FutureNow light platform (#15662)
juhaniemi Jul 27, 2018
b2f4bbf
Only log change to use access token warning once (#15690)
awarecan Jul 27, 2018
cd6544d
Add support for alarm_control_panel to MQTT Discovery. (#15689)
rorr73 Jul 27, 2018
944f4f7
Add Magicseaweed API support (#15132)
jcconnell Jul 27, 2018
29e668e
Upgrade pyvera to 0.2.44 (#15708)
alanfischer Jul 28, 2018
867f807
Remove IHC XML Element from discovery data (#15719)
dingusdk Jul 28, 2018
c7f4bda
Context (#15674)
balloob Jul 29, 2018
93d6fb8
Break up components/auth (#15713)
awarecan Jul 29, 2018
a2b793c
Add a component for Sisyphus Kinetic Art Tables (#14472)
jkeljo Jul 29, 2018
1d68f4e
Command Line Sensor - json_attributes (#15679)
Jul 29, 2018
1a97ba1
Upgrade youtube_dl to 2018.07.21 (#15718)
fabaff Jul 29, 2018
baa974a
Upgrade numpy to 1.15.0 (#15722)
fabaff Jul 29, 2018
5849381
Upgrade spiderpy to 1.2.0 (#15729)
peternijssen Jul 29, 2018
28ad001
Upgrade beautifulsoup4 to 4.6.1 (#15727)
fabaff Jul 29, 2018
491bc00
Upgrade mutagen to 1.41.0 (#15739)
fabaff Jul 29, 2018
4b257c3
Upgrade sqlalchemy to 1.2.10 (#15737)
fabaff Jul 29, 2018
a8dd81e
Upgrade voluptuous to 0.11.3 (#15735)
fabaff Jul 29, 2018
316ef89
Upgrade youtube_dl to 2018.07.29 (#15734)
fabaff Jul 29, 2018
4013a90
Upgrade pyowm to 2.9.0 (#15736)
fabaff Jul 29, 2018
681082a
Various updates (#15738)
fabaff Jul 29, 2018
48ba13b
Denonavr version push to 0.7.5 (#15743)
starkillerOG Jul 29, 2018
3959f82
Make FutureNow light remember last brightness when turning on (#15733)
juhaniemi Jul 30, 2018
8dbe78a
Add Genie Aladdin Connect cover component (#15699)
shoejosh Jul 30, 2018
460bb69
Add mvglive option to store multiple departures in attributes (#15454)
DavidMStraub Jul 30, 2018
744c277
Add other wemo motion sensor identifier (#15627)
danielfaulknor Jul 30, 2018
1e5596b
Remove self type hints (#15732)
awarecan Jul 30, 2018
be61e2e
Merge branch 'dev' into rc
balloob Jul 30, 2018
5e71f0f
Bumped version to 0.75.0b0
balloob Jul 30, 2018
163cd72
Bumped version to 0.75.0b1
balloob Aug 2, 2018
3ed47b0
Update translations
balloob Aug 2, 2018
a5112f3
Update frontend to 20180802.0
balloob Aug 2, 2018
8d23590
Bump frontend to 20180803.0
balloob Aug 3, 2018
0f84431
Fix Min/Max Kelvin color temp attribute for Google (#15697)
bryanyork Aug 2, 2018
cdb86ed
Only report color temp when in the correct color mode (#15791)
Kane610 Aug 3, 2018
c63fd97
Return True from Nest setup (#15797)
balloob Aug 2, 2018
6028db2
Bumped version to 0.75.0
balloob Aug 3, 2018
b8981b2
Merge remote-tracking branch 'origin/master' into rc
balloob Aug 3, 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
  •  
  •  
  •  
10 changes: 10 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,9 @@ omit =
homeassistant/components/scsgate.py
homeassistant/components/*/scsgate.py

homeassistant/components/sisyphus.py
homeassistant/components/*/sisyphus.py

homeassistant/components/skybell.py
homeassistant/components/*/skybell.py

Expand Down Expand Up @@ -346,6 +349,9 @@ omit =
homeassistant/components/tuya.py
homeassistant/components/*/tuya.py

homeassistant/components/spider.py
homeassistant/components/*/spider.py

homeassistant/components/alarm_control_panel/alarmdotcom.py
homeassistant/components/alarm_control_panel/canary.py
homeassistant/components/alarm_control_panel/concord232.py
Expand Down Expand Up @@ -398,6 +404,8 @@ omit =
homeassistant/components/climate/touchline.py
homeassistant/components/climate/venstar.py
homeassistant/components/climate/zhong_hong.py
homeassistant/components/cover/aladdin_connect.py
homeassistant/components/cover/brunt.py
homeassistant/components/cover/garadget.py
homeassistant/components/cover/gogogate2.py
homeassistant/components/cover/homematic.py
Expand Down Expand Up @@ -461,6 +469,7 @@ omit =
homeassistant/components/light/decora_wifi.py
homeassistant/components/light/decora.py
homeassistant/components/light/flux_led.py
homeassistant/components/light/futurenow.py
homeassistant/components/light/greenwave.py
homeassistant/components/light/hue.py
homeassistant/components/light/hyperion.py
Expand Down Expand Up @@ -657,6 +666,7 @@ omit =
homeassistant/components/sensor/loopenergy.py
homeassistant/components/sensor/luftdaten.py
homeassistant/components/sensor/lyft.py
homeassistant/components/sensor/magicseaweed.py
homeassistant/components/sensor/metoffice.py
homeassistant/components/sensor/miflora.py
homeassistant/components/sensor/mitemp_bt.py
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contributing to Home Assistant

Everybody is invited and welcome to contribute to Home Assistant. There is a lot to do...if you are not a developer perhaps you would like to help with the documentation on [home-assistant.io](https://home-assistant.io/)? If you are a developer and have devices in your home which aren't working with Home Assistant yet, why not spent a couple of hours and help to integrate them?
Everybody is invited and welcome to contribute to Home Assistant. There is a lot to do...if you are not a developer perhaps you would like to help with the documentation on [home-assistant.io](https://home-assistant.io/)? If you are a developer and have devices in your home which aren't working with Home Assistant yet, why not spend a couple of hours and help to integrate them?

The process is straight-forward.

Expand Down
12 changes: 6 additions & 6 deletions homeassistant/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import sys
import threading

from typing import Optional, List, Dict, Any # noqa #pylint: disable=unused-import
from typing import List, Dict, Any # noqa pylint: disable=unused-import


from homeassistant import monkey_patch
Expand All @@ -20,7 +20,7 @@
)


def attempt_use_uvloop():
def attempt_use_uvloop() -> None:
"""Attempt to use uvloop."""
import asyncio

Expand Down Expand Up @@ -280,11 +280,11 @@ def setup_and_run_hass(config_dir: str,
# Imported here to avoid importing asyncio before monkey patch
from homeassistant.util.async_ import run_callback_threadsafe

def open_browser(event):
"""Open the webinterface in a browser."""
if hass.config.api is not None:
def open_browser(_: Any) -> None:
"""Open the web interface in a browser."""
if hass.config.api is not None: # type: ignore
import webbrowser
webbrowser.open(hass.config.api.base_url)
webbrowser.open(hass.config.api.base_url) # type: ignore

run_callback_threadsafe(
hass.loop,
Expand Down
28 changes: 15 additions & 13 deletions homeassistant/auth/providers/homeassistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from collections import OrderedDict
import hashlib
import hmac
from typing import Dict # noqa: F401 pylint: disable=unused-import

import voluptuous as vol

Expand Down Expand Up @@ -68,12 +69,12 @@ def users(self):
"""Return users."""
return self._data['users']

def validate_login(self, username, password):
def validate_login(self, username: str, password: str) -> None:
"""Validate a username and password.

Raises InvalidAuth if auth invalid.
"""
password = self.hash_password(password)
hashed = self.hash_password(password)

found = None

Expand All @@ -84,33 +85,33 @@ def validate_login(self, username, password):

if found is None:
# Do one more compare to make timing the same as if user was found.
hmac.compare_digest(password, password)
hmac.compare_digest(hashed, hashed)
raise InvalidAuth

if not hmac.compare_digest(password,
if not hmac.compare_digest(hashed,
base64.b64decode(found['password'])):
raise InvalidAuth

def hash_password(self, password, for_storage=False):
def hash_password(self, password: str, for_storage: bool = False) -> bytes:
"""Encode a password."""
hashed = hashlib.pbkdf2_hmac(
'sha512', password.encode(), self._data['salt'].encode(), 100000)
if for_storage:
hashed = base64.b64encode(hashed).decode()
hashed = base64.b64encode(hashed)
return hashed

def add_auth(self, username, password):
def add_auth(self, username: str, password: str) -> None:
"""Add a new authenticated user/pass."""
if any(user['username'] == username for user in self.users):
raise InvalidUser

self.users.append({
'username': username,
'password': self.hash_password(password, True),
'password': self.hash_password(password, True).decode(),
})

@callback
def async_remove_auth(self, username):
def async_remove_auth(self, username: str) -> None:
"""Remove authentication."""
index = None
for i, user in enumerate(self.users):
Expand All @@ -123,14 +124,15 @@ def async_remove_auth(self, username):

self.users.pop(index)

def change_password(self, username, new_password):
def change_password(self, username: str, new_password: str) -> None:
"""Update the password.

Raises InvalidUser if user cannot be found.
"""
for user in self.users:
if user['username'] == username:
user['password'] = self.hash_password(new_password, True)
user['password'] = self.hash_password(
new_password, True).decode()
break
else:
raise InvalidUser
Expand Down Expand Up @@ -160,7 +162,7 @@ async def async_credential_flow(self):
"""Return a flow to login."""
return LoginFlow(self)

async def async_validate_login(self, username, password):
async def async_validate_login(self, username: str, password: str):
"""Helper to validate a username and password."""
if self.data is None:
await self.async_initialize()
Expand Down Expand Up @@ -225,7 +227,7 @@ async def async_step_init(self, user_input=None):
data=user_input
)

schema = OrderedDict()
schema = OrderedDict() # type: Dict[str, type]
schema['username'] = str
schema['password'] = str

Expand Down
8 changes: 4 additions & 4 deletions homeassistant/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ async def async_from_config_file(config_path: str,
@core.callback
def async_enable_logging(hass: core.HomeAssistant,
verbose: bool = False,
log_rotate_days=None,
log_file=None,
log_rotate_days: Optional[int] = None,
log_file: Optional[str] = None,
log_no_color: bool = False) -> None:
"""Set up the logging.

Expand Down Expand Up @@ -291,9 +291,9 @@ def async_enable_logging(hass: core.HomeAssistant,

async_handler = AsyncHandler(hass.loop, err_handler)

async def async_stop_async_handler(event):
async def async_stop_async_handler(_: Any) -> None:
"""Cleanup async handler."""
logging.getLogger('').removeHandler(async_handler)
logging.getLogger('').removeHandler(async_handler) # type: ignore
await async_handler.async_close(blocking=True)

hass.bus.async_listen_once(
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def async_handle_turn_service(service):
def async_handle_core_service(call):
"""Service handler for handling core services."""
if call.service == SERVICE_HOMEASSISTANT_STOP:
hass.async_add_job(hass.async_stop())
hass.async_create_task(hass.async_stop())
return

try:
Expand All @@ -183,7 +183,7 @@ def async_handle_core_service(call):
return

if call.service == SERVICE_HOMEASSISTANT_RESTART:
hass.async_add_job(hass.async_stop(RESTART_EXIT_CODE))
hass.async_create_task(hass.async_stop(RESTART_EXIT_CODE))

hass.services.async_register(
ha.DOMAIN, SERVICE_HOMEASSISTANT_STOP, async_handle_core_service)
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/abode.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
]


class AbodeSystem(object):
class AbodeSystem:
"""Abode System class."""

def __init__(self, username, password, cache,
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/ads/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def handle_write_data_by_name(call):
)


class AdsHub(object):
class AdsHub:
"""Representation of an ADS connection."""

def __init__(self, ads_client):
Expand Down
13 changes: 7 additions & 6 deletions homeassistant/components/alarm_control_panel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def async_alarm_disarm(self, code=None):

This method must be run in the event loop and returns a coroutine.
"""
return self.hass.async_add_job(self.alarm_disarm, code)
return self.hass.async_add_executor_job(self.alarm_disarm, code)

def alarm_arm_home(self, code=None):
"""Send arm home command."""
Expand All @@ -198,7 +198,7 @@ def async_alarm_arm_home(self, code=None):

This method must be run in the event loop and returns a coroutine.
"""
return self.hass.async_add_job(self.alarm_arm_home, code)
return self.hass.async_add_executor_job(self.alarm_arm_home, code)

def alarm_arm_away(self, code=None):
"""Send arm away command."""
Expand All @@ -209,7 +209,7 @@ def async_alarm_arm_away(self, code=None):

This method must be run in the event loop and returns a coroutine.
"""
return self.hass.async_add_job(self.alarm_arm_away, code)
return self.hass.async_add_executor_job(self.alarm_arm_away, code)

def alarm_arm_night(self, code=None):
"""Send arm night command."""
Expand All @@ -220,7 +220,7 @@ def async_alarm_arm_night(self, code=None):

This method must be run in the event loop and returns a coroutine.
"""
return self.hass.async_add_job(self.alarm_arm_night, code)
return self.hass.async_add_executor_job(self.alarm_arm_night, code)

def alarm_trigger(self, code=None):
"""Send alarm trigger command."""
Expand All @@ -231,7 +231,7 @@ def async_alarm_trigger(self, code=None):

This method must be run in the event loop and returns a coroutine.
"""
return self.hass.async_add_job(self.alarm_trigger, code)
return self.hass.async_add_executor_job(self.alarm_trigger, code)

def alarm_arm_custom_bypass(self, code=None):
"""Send arm custom bypass command."""
Expand All @@ -242,7 +242,8 @@ def async_alarm_arm_custom_bypass(self, code=None):

This method must be run in the event loop and returns a coroutine.
"""
return self.hass.async_add_job(self.alarm_arm_custom_bypass, code)
return self.hass.async_add_executor_job(
self.alarm_arm_custom_bypass, code)

@property
def state_attributes(self):
Expand Down
6 changes: 3 additions & 3 deletions homeassistant/components/alarm_control_panel/alarmdotcom.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def code_format(self):
"""Return one or more digits/characters."""
if self._code is None:
return None
elif isinstance(self._code, str) and re.search('^\\d+$', self._code):
if isinstance(self._code, str) and re.search('^\\d+$', self._code):
return 'Number'
return 'Any'

Expand All @@ -92,9 +92,9 @@ def state(self):
"""Return the state of the device."""
if self._alarm.state.lower() == 'disarmed':
return STATE_ALARM_DISARMED
elif self._alarm.state.lower() == 'armed stay':
if self._alarm.state.lower() == 'armed stay':
return STATE_ALARM_ARMED_HOME
elif self._alarm.state.lower() == 'armed away':
if self._alarm.state.lower() == 'armed away':
return STATE_ALARM_ARMED_AWAY
return STATE_UNKNOWN

Expand Down
6 changes: 3 additions & 3 deletions homeassistant/components/alarm_control_panel/arlo.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ def _get_state_from_mode(self, mode):
"""Convert Arlo mode to Home Assistant state."""
if mode == ARMED:
return STATE_ALARM_ARMED_AWAY
elif mode == DISARMED:
if mode == DISARMED:
return STATE_ALARM_DISARMED
elif mode == self._home_mode_name:
if mode == self._home_mode_name:
return STATE_ALARM_ARMED_HOME
elif mode == self._away_mode_name:
if mode == self._away_mode_name:
return STATE_ALARM_ARMED_AWAY
return mode
4 changes: 2 additions & 2 deletions homeassistant/components/alarm_control_panel/canary.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ def state(self):
mode = location.mode
if mode.name == LOCATION_MODE_AWAY:
return STATE_ALARM_ARMED_AWAY
elif mode.name == LOCATION_MODE_HOME:
if mode.name == LOCATION_MODE_HOME:
return STATE_ALARM_ARMED_HOME
elif mode.name == LOCATION_MODE_NIGHT:
if mode.name == LOCATION_MODE_NIGHT:
return STATE_ALARM_ARMED_NIGHT
return None

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/alarm_control_panel/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
https://home-assistant.io/components/demo/
"""
import datetime
import homeassistant.components.alarm_control_panel.manual as manual
from homeassistant.components.alarm_control_panel import manual
from homeassistant.const import (
STATE_ALARM_ARMED_AWAY, STATE_ALARM_ARMED_CUSTOM_BYPASS,
STATE_ALARM_ARMED_HOME, STATE_ALARM_ARMED_NIGHT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

_LOGGER = logging.getLogger(__name__)

HMIP_OPEN = 'OPEN'
HMIP_ZONE_AWAY = 'EXTERNAL'
HMIP_ZONE_HOME = 'INTERNAL'

Expand Down Expand Up @@ -57,14 +56,18 @@ def __init__(self, home, device):
@property
def state(self):
"""Return the state of the device."""
from homematicip.base.enums import WindowState

if self._device.active:
if (self._device.sabotage or self._device.motionDetected or
self._device.windowState == HMIP_OPEN):
self._device.windowState == WindowState.OPEN):
return STATE_ALARM_TRIGGERED

if self._device.label == HMIP_ZONE_HOME:
active = self._home.get_security_zones_activation()
if active == (True, True):
return STATE_ALARM_ARMED_AWAY
if active == (False, True):
return STATE_ALARM_ARMED_HOME
return STATE_ALARM_ARMED_AWAY

return STATE_ALARM_DISARMED

Expand All @@ -79,10 +82,3 @@ async def async_alarm_arm_home(self, code=None):
async def async_alarm_arm_away(self, code=None):
"""Send arm away command."""
await self._home.set_security_zones_activation(True, True)

@property
def device_state_attributes(self):
"""Return the state attributes of the alarm control device."""
# The base class is loading the battery property, but device doesn't
# have this property - base class needs clean-up.
return None
Loading