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
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ def state(self):
return STATE_ALARM_ARMED_HOME
elif self._alarm.state.lower() == 'armed away':
return STATE_ALARM_ARMED_AWAY
else:
return STATE_UNKNOWN
return STATE_UNKNOWN

@asyncio.coroutine
def async_alarm_disarm(self, code=None):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ def code_format(self):
"""Regex for code format or None if no code is required."""
if self._code:
return None
else:
return '^\\d{4,6}$'
return '^\\d{4,6}$'

@property
def state(self):
Expand Down
3 changes: 1 addition & 2 deletions homeassistant/components/alarm_control_panel/manual.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ def state(self):
self._trigger_time) < dt_util.utcnow():
if self._disarm_after_trigger:
return STATE_ALARM_DISARMED
else:
return self._pre_trigger_state
return self._pre_trigger_state

return self._state

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ def name(self):
"""Return the name of the device."""
if self._name is not None:
return self._name
else:
return 'Alarm {}'.format(self.simplisafe.location_id())
return 'Alarm {}'.format(self.simplisafe.location_id())

@property
def code_format(self):
Expand Down
9 changes: 4 additions & 5 deletions homeassistant/components/binary_sensor/flic.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,10 @@ def _queued_event_check(self, click_type, time_diff):
"Queued %s dropped for %s. Time in queue was %s",
click_type, self.address, time_string)
return True
else:
_LOGGER.info(
"Queued %s allowed for %s. Time in queue was %s",
click_type, self.address, time_string)
return False
_LOGGER.info(
"Queued %s allowed for %s. Time in queue was %s",
click_type, self.address, time_string)
return False

def _on_up_down(self, channel, click_type, was_queued, time_diff):
"""Update device state, if event was not queued."""
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/binary_sensor/homematic.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
return

devices = []
for config in discovery_info[ATTR_DISCOVER_DEVICES]:
new_device = HMBinarySensor(hass, config)
for conf in discovery_info[ATTR_DISCOVER_DEVICES]:
new_device = HMBinarySensor(hass, conf)
new_device.link_homematic()
devices.append(new_device)

Expand Down
3 changes: 1 addition & 2 deletions homeassistant/components/binary_sensor/netatmo.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,7 @@ def device_class(self):
return WELCOME_SENSOR_TYPES.get(self._sensor_name)
elif self._cameratype == 'NOC':
return PRESENCE_SENSOR_TYPES.get(self._sensor_name)
else:
return TAG_SENSOR_TYPES.get(self._sensor_name)
return TAG_SENSOR_TYPES.get(self._sensor_name)

@property
def is_on(self):
Expand Down
16 changes: 8 additions & 8 deletions homeassistant/components/binary_sensor/ping.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,14 @@ def ping(self):
'avg': rtt_avg,
'max': rtt_max,
'mdev': ''}
else:
match = PING_MATCHER.search(str(out).split('\n')[-1])
rtt_min, rtt_avg, rtt_max, rtt_mdev = match.groups()
return {
'min': rtt_min,
'avg': rtt_avg,
'max': rtt_max,
'mdev': rtt_mdev}

match = PING_MATCHER.search(str(out).split('\n')[-1])
rtt_min, rtt_avg, rtt_max, rtt_mdev = match.groups()
return {
'min': rtt_min,
'avg': rtt_avg,
'max': rtt_max,
'mdev': rtt_mdev}
except (subprocess.CalledProcessError, AttributeError):
return False

Expand Down
3 changes: 1 addition & 2 deletions homeassistant/components/binary_sensor/volvooncall.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ def is_on(self):
return bool(val)
elif self._attribute in ['doors', 'windows']:
return any([val[key] for key in val if 'Open' in key])
else:
return val != 'Normal'
return val != 'Normal'

@property
def device_class(self):
Expand Down
3 changes: 1 addition & 2 deletions homeassistant/components/calendar/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,7 @@ def _get_date(date):
if 'date' in date:
return dt.start_of_local_day(dt.dt.datetime.combine(
dt.parse_date(date['date']), dt.dt.time.min))
else:
return dt.as_local(dt.parse_datetime(date['dateTime']))
return dt.as_local(dt.parse_datetime(date['dateTime']))

start = _get_date(self.data.event['start'])
end = _get_date(self.data.event['end'])
Expand Down
3 changes: 1 addition & 2 deletions homeassistant/components/camera/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,7 @@ def state(self):
return STATE_RECORDING
elif self.is_streaming:
return STATE_STREAMING
else:
return STATE_IDLE
return STATE_IDLE

def enable_motion_detection(self):
"""Enable motion detection in the camera."""
Expand Down
3 changes: 1 addition & 2 deletions homeassistant/components/camera/netatmo.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ def model(self):
return "Presence"
elif self._cameratype == "NACamera":
return "Welcome"
else:
return None
return None

@property
def unique_id(self):
Expand Down
11 changes: 4 additions & 7 deletions homeassistant/components/climate/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,16 +398,14 @@ def state(self):
"""Return the current state."""
if self.current_operation:
return self.current_operation
else:
return STATE_UNKNOWN
return STATE_UNKNOWN

@property
def precision(self):
"""Return the precision of the system."""
if self.unit_of_measurement == TEMP_CELSIUS:
return PRECISION_TENTHS
else:
return PRECISION_WHOLE
return PRECISION_WHOLE

@property
def state_attributes(self):
Expand Down Expand Up @@ -709,6 +707,5 @@ def _convert_for_display(self, temp):
return round(temp * 2) / 2.0
elif self.precision == PRECISION_TENTHS:
return round(temp, 1)
else:
# PRECISION_WHOLE as a fall back
return round(temp)
# PRECISION_WHOLE as a fall back
return round(temp)
28 changes: 10 additions & 18 deletions homeassistant/components/climate/ecobee.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,16 +151,14 @@ def target_temperature_low(self):
"""Return the lower bound temperature we try to reach."""
if self.current_operation == STATE_AUTO:
return int(self.thermostat['runtime']['desiredHeat'] / 10)
else:
return None
return None

@property
def target_temperature_high(self):
"""Return the upper bound temperature we try to reach."""
if self.current_operation == STATE_AUTO:
return int(self.thermostat['runtime']['desiredCool'] / 10)
else:
return None
return None

@property
def target_temperature(self):
Expand All @@ -171,8 +169,7 @@ def target_temperature(self):
return int(self.thermostat['runtime']['desiredHeat'] / 10)
elif self.current_operation == STATE_COOL:
return int(self.thermostat['runtime']['desiredCool'] / 10)
else:
return None
return None

@property
def desired_fan_mode(self):
Expand All @@ -184,8 +181,7 @@ def fan(self):
"""Return the current fan state."""
if 'fan' in self.thermostat['equipmentStatus']:
return STATE_ON
else:
return STATE_OFF
return STATE_OFF

@property
def current_hold_mode(self):
Expand All @@ -199,15 +195,13 @@ def current_hold_mode(self):
int(event['startDate'][0:4]) <= 1:
# A temporary hold from away climate is a hold
return 'away'
else:
# A permanent hold from away climate is away_mode
return None
# A permanent hold from away climate is away_mode
return None
elif event['holdClimateRef'] != "":
# Any other hold based on climate
return event['holdClimateRef']
else:
# Any hold not based on a climate is a temp hold
return TEMPERATURE_HOLD
# Any hold not based on a climate is a temp hold
return TEMPERATURE_HOLD
elif event['type'].startswith('auto'):
# All auto modes are treated as holds
return event['type'][4:].lower()
Expand All @@ -222,8 +216,7 @@ def current_operation(self):
if self.operation_mode == 'auxHeatOnly' or \
self.operation_mode == 'heatPump':
return STATE_HEAT
else:
return self.operation_mode
return self.operation_mode

@property
def operation_list(self):
Expand Down Expand Up @@ -384,8 +377,7 @@ def hold_preference(self):
# add further conditions if other hold durations should be
# supported; note that this should not include 'indefinite'
# as an indefinite away hold is interpreted as away_mode
else:
return 'nextTransition'
return 'nextTransition'

@property
def climate_list(self):
Expand Down
18 changes: 9 additions & 9 deletions homeassistant/components/climate/generic_thermostat.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ def current_operation(self):
if self.ac_mode:
cooling = self._active and self._is_device_active
return STATE_COOL if cooling else STATE_IDLE
else:
heating = self._active and self._is_device_active
return STATE_HEAT if heating else STATE_IDLE

heating = self._active and self._is_device_active
return STATE_HEAT if heating else STATE_IDLE

@property
def target_temperature(self):
Expand All @@ -159,19 +159,19 @@ def min_temp(self):
# pylint: disable=no-member
if self._min_temp:
return self._min_temp
else:
# get default temp from super class
return ClimateDevice.min_temp.fget(self)

# get default temp from super class
return ClimateDevice.min_temp.fget(self)

@property
def max_temp(self):
"""Return the maximum temperature."""
# pylint: disable=no-member
if self._max_temp:
return self._max_temp
else:
# Get default temp from super class
return ClimateDevice.max_temp.fget(self)

# Get default temp from super class
return ClimateDevice.max_temp.fget(self)

@asyncio.coroutine
def _async_sensor_changed(self, entity_id, old_state, new_state):
Expand Down
7 changes: 3 additions & 4 deletions homeassistant/components/climate/honeywell.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ def setup_platform(hass, config, add_devices, discovery_info=None):

if region == 'us':
return _setup_us(username, password, config, add_devices)
else:
return _setup_round(username, password, config, add_devices)

return _setup_round(username, password, config, add_devices)


def _setup_round(username, password, config, add_devices):
Expand Down Expand Up @@ -251,8 +251,7 @@ def target_temperature(self):
"""Return the temperature we try to reach."""
if self._device.system_mode == 'cool':
return self._device.setpoint_cool
else:
return self._device.setpoint_heat
return self._device.setpoint_heat

@property
def current_operation(self: ClimateDevice) -> str:
Expand Down
17 changes: 6 additions & 11 deletions homeassistant/components/climate/nest.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,14 @@ def current_operation(self):
return self._mode
elif self._mode == STATE_HEAT_COOL:
return STATE_AUTO
else:
return STATE_UNKNOWN
return STATE_UNKNOWN

@property
def target_temperature(self):
"""Return the temperature we try to reach."""
if self._mode != STATE_HEAT_COOL and not self.is_away_mode_on:
return self._target_temperature
else:
return None
return None

@property
def target_temperature_low(self):
Expand All @@ -129,8 +127,7 @@ def target_temperature_low(self):
return self._eco_temperature[0]
if self._mode == STATE_HEAT_COOL:
return self._target_temperature[0]
else:
return None
return None

@property
def target_temperature_high(self):
Expand All @@ -141,8 +138,7 @@ def target_temperature_high(self):
return self._eco_temperature[1]
if self._mode == STATE_HEAT_COOL:
return self._target_temperature[1]
else:
return None
return None

@property
def is_away_mode_on(self):
Expand Down Expand Up @@ -188,9 +184,8 @@ def current_fan_mode(self):
if self._has_fan:
# Return whether the fan is on
return STATE_ON if self._fan else STATE_AUTO
else:
# No Fan available so disable slider
return None
# No Fan available so disable slider
return None

@property
def fan_list(self):
Expand Down
3 changes: 1 addition & 2 deletions homeassistant/components/climate/oem.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ def current_operation(self):
"""Return current operation i.e. heat, cool, idle."""
if self._state:
return STATE_HEAT
else:
return STATE_IDLE
return STATE_IDLE

@property
def current_temperature(self):
Expand Down
5 changes: 2 additions & 3 deletions homeassistant/components/climate/sensibo.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,8 @@ def target_temperature_step(self):
# We are working in same units as the a/c unit. Use whole degrees
# like the API supports.
return 1
else:
# Unit conversion is going on. No point to stick to specific steps.
return None
# Unit conversion is going on. No point to stick to specific steps.
return None

@property
def current_operation(self):
Expand Down
Loading