Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -13,7 +13,7 @@
from homeassistant.components.alarm_control_panel import PLATFORM_SCHEMA
from homeassistant.const import (
CONF_CODE, CONF_NAME, CONF_PASSWORD, CONF_USERNAME, STATE_ALARM_ARMED_AWAY,
STATE_ALARM_ARMED_HOME, STATE_ALARM_DISARMED, STATE_UNKNOWN)
STATE_ALARM_ARMED_HOME, STATE_ALARM_DISARMED)
from homeassistant.helpers.aiohttp_client import async_get_clientsession
import homeassistant.helpers.config_validation as cv

Expand Down Expand Up @@ -57,7 +57,7 @@ def __init__(self, hass, name, code, username, password):
self._username = username
self._password = password
self._websession = async_get_clientsession(self._hass)
self._state = STATE_UNKNOWN
self._state = None
self._alarm = Alarmdotcom(
username, password, self._websession, hass.loop)

Expand Down Expand Up @@ -93,7 +93,7 @@ def state(self):
return STATE_ALARM_ARMED_HOME
if self._alarm.state.lower() == 'armed away':
return STATE_ALARM_ARMED_AWAY
return STATE_UNKNOWN
return None

@property
def device_state_attributes(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
CONF_HOST, CONF_NAME, CONF_PORT, STATE_ALARM_ARMED_AWAY,
STATE_ALARM_ARMED_HOME, STATE_ALARM_DISARMED)


REQUIREMENTS = ['concord232==0.15']

_LOGGER = logging.getLogger(__name__)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from homeassistant.const import (
CONF_PASSWORD, CONF_USERNAME, STATE_ALARM_ARMED_AWAY,
STATE_ALARM_ARMED_HOME, STATE_ALARM_ARMED_NIGHT, STATE_ALARM_DISARMED,
STATE_ALARM_ARMING, STATE_ALARM_DISARMING, STATE_UNKNOWN, CONF_NAME,
STATE_ALARM_ARMING, STATE_ALARM_DISARMING, CONF_NAME,
STATE_ALARM_ARMED_CUSTOM_BYPASS)


Expand Down Expand Up @@ -52,7 +52,7 @@ def __init__(self, name, username, password):
self._name = name
self._username = username
self._password = password
self._state = STATE_UNKNOWN
self._state = None
self._client = TotalConnectClient.TotalConnectClient(
username, password)

Expand Down Expand Up @@ -85,7 +85,7 @@ def update(self):
elif status == self._client.DISARMING:
state = STATE_ALARM_DISARMING
else:
state = STATE_UNKNOWN
state = None

self._state = state

Expand Down
5 changes: 2 additions & 3 deletions homeassistant/components/alarm_control_panel/verisure.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
from homeassistant.components.verisure import CONF_ALARM, CONF_CODE_DIGITS
from homeassistant.components.verisure import HUB as hub
from homeassistant.const import (
STATE_ALARM_ARMED_AWAY, STATE_ALARM_ARMED_HOME, STATE_ALARM_DISARMED,
STATE_UNKNOWN)
STATE_ALARM_ARMED_AWAY, STATE_ALARM_ARMED_HOME, STATE_ALARM_DISARMED)

_LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -44,7 +43,7 @@ class VerisureAlarm(alarm.AlarmControlPanel):

def __init__(self):
"""Initialize the Verisure alarm panel."""
self._state = STATE_UNKNOWN
self._state = None
self._digits = hub.config.get(CONF_CODE_DIGITS)
self._changed_by = None

Expand Down
5 changes: 2 additions & 3 deletions homeassistant/components/alarm_control_panel/wink.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
import homeassistant.components.alarm_control_panel as alarm
from homeassistant.components.wink import DOMAIN, WinkDevice
from homeassistant.const import (
STATE_ALARM_ARMED_AWAY, STATE_ALARM_ARMED_HOME, STATE_ALARM_DISARMED,
STATE_UNKNOWN)
STATE_ALARM_ARMED_AWAY, STATE_ALARM_ARMED_HOME, STATE_ALARM_DISARMED)

_LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -52,7 +51,7 @@ def state(self):
elif wink_state == "night":
state = STATE_ALARM_ARMED_HOME
else:
state = STATE_UNKNOWN
state = None
return state

def alarm_disarm(self, code=None):
Expand Down
3 changes: 1 addition & 2 deletions homeassistant/components/binary_sensor/maxcube.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

from homeassistant.components.binary_sensor import BinarySensorDevice
from homeassistant.components.maxcube import DATA_KEY
from homeassistant.const import STATE_UNKNOWN

_LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -40,7 +39,7 @@ def __init__(self, handler, name, rf_address):
self._sensor_type = 'window'
self._rf_address = rf_address
self._cubehandle = handler
self._state = STATE_UNKNOWN
self._state = None

@property
def should_poll(self):
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/climate/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import homeassistant.helpers.config_validation as cv
from homeassistant.const import (
ATTR_ENTITY_ID, ATTR_TEMPERATURE, SERVICE_TURN_ON, SERVICE_TURN_OFF,
STATE_ON, STATE_OFF, STATE_UNKNOWN, TEMP_CELSIUS, PRECISION_WHOLE,
STATE_ON, STATE_OFF, TEMP_CELSIUS, PRECISION_WHOLE,
PRECISION_TENTHS)

DEFAULT_MIN_TEMP = 7
Expand Down Expand Up @@ -208,7 +208,7 @@ def state(self):
return self.current_operation
if self.is_on:
return STATE_ON
return STATE_UNKNOWN
return None

@property
def precision(self):
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/climate/nest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
SUPPORT_OPERATION_MODE, SUPPORT_AWAY_MODE, SUPPORT_FAN_MODE)
from homeassistant.const import (
TEMP_CELSIUS, TEMP_FAHRENHEIT,
CONF_SCAN_INTERVAL, STATE_ON, STATE_OFF, STATE_UNKNOWN)
CONF_SCAN_INTERVAL, STATE_ON, STATE_OFF)
from homeassistant.helpers.dispatcher import async_dispatcher_connect

DEPENDENCIES = ['nest']
Expand Down Expand Up @@ -163,7 +163,7 @@ def current_operation(self):
return self._mode
if self._mode == NEST_MODE_HEAT_COOL:
return STATE_AUTO
return STATE_UNKNOWN
return None

@property
def target_temperature(self):
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/cover/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
SERVICE_OPEN_COVER, SERVICE_CLOSE_COVER, SERVICE_SET_COVER_POSITION,
SERVICE_STOP_COVER, SERVICE_OPEN_COVER_TILT, SERVICE_CLOSE_COVER_TILT,
SERVICE_STOP_COVER_TILT, SERVICE_SET_COVER_TILT_POSITION, STATE_OPEN,
STATE_CLOSED, STATE_UNKNOWN, STATE_OPENING, STATE_CLOSING, ATTR_ENTITY_ID)
STATE_CLOSED, STATE_OPENING, STATE_CLOSING, ATTR_ENTITY_ID)

_LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -178,7 +178,7 @@ def state(self):
closed = self.is_closed

if closed is None:
return STATE_UNKNOWN
return None

return STATE_CLOSED if closed else STATE_OPEN

Expand Down
8 changes: 4 additions & 4 deletions homeassistant/components/cover/garadget.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from homeassistant.helpers.event import track_utc_time_change
from homeassistant.const import (
CONF_DEVICE, CONF_USERNAME, CONF_PASSWORD, CONF_ACCESS_TOKEN, CONF_NAME,
STATE_UNKNOWN, STATE_CLOSED, STATE_OPEN, CONF_COVERS)
STATE_CLOSED, STATE_OPEN, CONF_COVERS)

_LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -83,7 +83,7 @@ def __init__(self, hass, args):
self.obtained_token = False
self._username = args['username']
self._password = args['password']
self._state = STATE_UNKNOWN
self._state = None
self.time_in_state = None
self.signal = None
self.sensor = None
Expand Down Expand Up @@ -156,7 +156,7 @@ def device_state_attributes(self):
@property
def is_closed(self):
"""Return if the cover is closed."""
if self._state == STATE_UNKNOWN:
if self._state is None:
return None
return self._state == STATE_CLOSED

Expand Down Expand Up @@ -226,7 +226,7 @@ def update(self):
try:
status = self._get_variable('doorStatus')
_LOGGER.debug("Current Status: %s", status['status'])
self._state = STATES_MAP.get(status['status'], STATE_UNKNOWN)
self._state = STATES_MAP.get(status['status'], None)
self.time_in_state = status['time']
self.signal = status['signal']
self.sensor = status['sensor']
Expand Down
5 changes: 2 additions & 3 deletions homeassistant/components/cover/wink.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/cover.wink/
"""
from homeassistant.components.cover import CoverDevice, STATE_UNKNOWN, \
ATTR_POSITION
from homeassistant.components.cover import CoverDevice, ATTR_POSITION
from homeassistant.components.wink import WinkDevice, DOMAIN

DEPENDENCIES = ['wink']
Expand Down Expand Up @@ -54,7 +53,7 @@ def current_cover_position(self):
"""Return the current position of cover shutter."""
if self.wink.state() is not None:
return int(self.wink.state()*100)
return STATE_UNKNOWN
return None

@property
def is_closed(self):
Expand Down
7 changes: 3 additions & 4 deletions homeassistant/components/fan/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@

from homeassistant.components import group
from homeassistant.const import (SERVICE_TURN_ON, SERVICE_TOGGLE,
SERVICE_TURN_OFF, ATTR_ENTITY_ID,
STATE_UNKNOWN)
SERVICE_TURN_OFF, ATTR_ENTITY_ID)
from homeassistant.loader import bind_hass
from homeassistant.helpers.entity import ToggleEntity
from homeassistant.helpers.entity_component import EntityComponent
Expand Down Expand Up @@ -94,7 +93,7 @@ def is_on(hass, entity_id: str = None) -> bool:
"""Return if the fans are on based on the statemachine."""
entity_id = entity_id or ENTITY_ID_ALL_FANS
state = hass.states.get(entity_id)
return state.attributes[ATTR_SPEED] not in [SPEED_OFF, STATE_UNKNOWN]
return state.attributes[ATTR_SPEED] not in [SPEED_OFF, None]


async def async_setup(hass, config: dict):
Expand Down Expand Up @@ -199,7 +198,7 @@ def async_oscillate(self, oscillating: bool):
@property
def is_on(self):
"""Return true if the entity is on."""
return self.speed not in [SPEED_OFF, STATE_UNKNOWN]
return self.speed not in [SPEED_OFF, None]

@property
def speed(self) -> str:
Expand Down
3 changes: 1 addition & 2 deletions homeassistant/components/fan/comfoconnect.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from homeassistant.components.fan import (
FanEntity, SPEED_OFF, SPEED_LOW, SPEED_MEDIUM, SPEED_HIGH,
SUPPORT_SET_SPEED)
from homeassistant.const import STATE_UNKNOWN
from homeassistant.helpers.dispatcher import (dispatcher_connect)

_LOGGER = logging.getLogger(__name__)
Expand Down Expand Up @@ -79,7 +78,7 @@ def speed(self):
speed = self._ccb.data[SENSOR_FAN_SPEED_MODE]
return SPEED_MAPPING[speed]
except KeyError:
return STATE_UNKNOWN
return None

@property
def speed_list(self):
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/fan/wink.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import logging

from homeassistant.components.fan import (
SPEED_HIGH, SPEED_LOW, SPEED_MEDIUM, STATE_UNKNOWN, SUPPORT_DIRECTION,
SPEED_HIGH, SPEED_LOW, SPEED_MEDIUM, SUPPORT_DIRECTION,
SUPPORT_SET_SPEED, FanEntity)
from homeassistant.components.wink import DOMAIN, WinkDevice

Expand Down Expand Up @@ -71,7 +71,7 @@ def speed(self) -> str:
return SPEED_MEDIUM
if SPEED_HIGH == current_wink_speed:
return SPEED_HIGH
return STATE_UNKNOWN
return None

@property
def current_direction(self):
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/hdmi_cec.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from homeassistant.helpers import discovery
from homeassistant.components.media_player import DOMAIN as MEDIA_PLAYER
from homeassistant.components.switch import DOMAIN as SWITCH
from homeassistant.const import (EVENT_HOMEASSISTANT_START, STATE_UNKNOWN,
from homeassistant.const import (EVENT_HOMEASSISTANT_START,
EVENT_HOMEASSISTANT_STOP, STATE_ON,
STATE_OFF, CONF_DEVICES, CONF_PLATFORM,
STATE_PLAYING, STATE_IDLE,
Expand Down Expand Up @@ -324,7 +324,7 @@ def __init__(self, device, logical) -> None:
"""Initialize the device."""
self._device = device
self._icon = None
self._state = STATE_UNKNOWN
self._state = None
self._logical_address = logical
self.entity_id = "%s.%d" % (DOMAIN, self._logical_address)

Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/homekit/type_locks.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from pyhap.const import CATEGORY_DOOR_LOCK

from homeassistant.components.lock import (
ATTR_ENTITY_ID, DOMAIN, STATE_LOCKED, STATE_UNLOCKED, STATE_UNKNOWN)
from homeassistant.const import ATTR_CODE
ATTR_ENTITY_ID, DOMAIN, STATE_LOCKED, STATE_UNLOCKED)
from homeassistant.const import ATTR_CODE, STATE_UNKNOWN

from . import TYPES
from .accessories import HomeAccessory
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/image_processing/openalpr_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import homeassistant.helpers.config_validation as cv
from homeassistant.core import split_entity_id, callback
from homeassistant.const import STATE_UNKNOWN, CONF_REGION
from homeassistant.const import CONF_REGION
from homeassistant.components.image_processing import (
PLATFORM_SCHEMA, ImageProcessingEntity, CONF_CONFIDENCE, CONF_SOURCE,
CONF_ENTITY_ID, CONF_NAME, ATTR_ENTITY_ID, ATTR_CONFIDENCE)
Expand Down Expand Up @@ -82,7 +82,7 @@ def __init__(self):
def state(self):
"""Return the state of the entity."""
confidence = 0
plate = STATE_UNKNOWN
plate = None

# search high plate
for i_pl, i_co in self.plates.items():
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/lock/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import homeassistant.helpers.config_validation as cv
from homeassistant.const import (
ATTR_CODE, ATTR_CODE_FORMAT, ATTR_ENTITY_ID, STATE_LOCKED, STATE_UNLOCKED,
STATE_UNKNOWN, SERVICE_LOCK, SERVICE_UNLOCK, SERVICE_OPEN)
SERVICE_LOCK, SERVICE_UNLOCK, SERVICE_OPEN)
from homeassistant.components import group

ATTR_CHANGED_BY = 'changed_by'
Expand Down Expand Up @@ -150,5 +150,5 @@ def state(self):
"""Return the state."""
locked = self.is_locked
if locked is None:
return STATE_UNKNOWN
return None
return STATE_LOCKED if locked else STATE_UNLOCKED
8 changes: 4 additions & 4 deletions homeassistant/components/lock/verisure.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
CONF_LOCKS, CONF_DEFAULT_LOCK_CODE, CONF_CODE_DIGITS)
from homeassistant.components.lock import LockDevice
from homeassistant.const import (
ATTR_CODE, STATE_LOCKED, STATE_UNKNOWN, STATE_UNLOCKED)
ATTR_CODE, STATE_LOCKED, STATE_UNLOCKED)

_LOGGER = logging.getLogger(__name__)

Expand All @@ -36,7 +36,7 @@ class VerisureDoorlock(LockDevice):
def __init__(self, device_label):
"""Initialize the Verisure lock."""
self._device_label = device_label
self._state = STATE_UNKNOWN
self._state = None
self._digits = hub.config.get(CONF_CODE_DIGITS)
self._changed_by = None
self._change_timestamp = 0
Expand Down Expand Up @@ -80,7 +80,7 @@ def update(self):
"$.doorLockStatusList[?(@.deviceLabel=='%s')].lockedState",
self._device_label)
if status == 'UNLOCKED':
self._state = STATE_UNLOCKED
self._state = None
elif status == 'LOCKED':
self._state = STATE_LOCKED
elif status != 'PENDING':
Expand All @@ -96,7 +96,7 @@ def is_locked(self):

def unlock(self, **kwargs):
"""Send unlock command."""
if self._state == STATE_UNLOCKED:
if self._state is None:
return

code = kwargs.get(ATTR_CODE, self._default_lock_code)
Expand Down
Loading