Skip to content
Merged

0.60.1 #11470

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
76 changes: 40 additions & 36 deletions homeassistant/components/alexa/smart_home.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def async_api_turn_on(hass, config, request, entity):

yield from hass.services.async_call(domain, SERVICE_TURN_ON, {
ATTR_ENTITY_ID: entity.entity_id
}, blocking=True)
}, blocking=False)

return api_message(request)

Expand All @@ -261,7 +261,7 @@ def async_api_turn_off(hass, config, request, entity):

yield from hass.services.async_call(domain, SERVICE_TURN_OFF, {
ATTR_ENTITY_ID: entity.entity_id
}, blocking=True)
}, blocking=False)

return api_message(request)

Expand All @@ -276,7 +276,7 @@ def async_api_set_brightness(hass, config, request, entity):
yield from hass.services.async_call(entity.domain, SERVICE_TURN_ON, {
ATTR_ENTITY_ID: entity.entity_id,
light.ATTR_BRIGHTNESS_PCT: brightness,
}, blocking=True)
}, blocking=False)

return api_message(request)

Expand All @@ -300,7 +300,7 @@ def async_api_adjust_brightness(hass, config, request, entity):
yield from hass.services.async_call(entity.domain, SERVICE_TURN_ON, {
ATTR_ENTITY_ID: entity.entity_id,
light.ATTR_BRIGHTNESS_PCT: brightness,
}, blocking=True)
}, blocking=False)

return api_message(request)

Expand All @@ -321,14 +321,14 @@ def async_api_set_color(hass, config, request, entity):
yield from hass.services.async_call(entity.domain, SERVICE_TURN_ON, {
ATTR_ENTITY_ID: entity.entity_id,
light.ATTR_RGB_COLOR: rgb,
}, blocking=True)
}, blocking=False)
else:
xyz = color_util.color_RGB_to_xy(*rgb)
yield from hass.services.async_call(entity.domain, SERVICE_TURN_ON, {
ATTR_ENTITY_ID: entity.entity_id,
light.ATTR_XY_COLOR: (xyz[0], xyz[1]),
light.ATTR_BRIGHTNESS: xyz[2],
}, blocking=True)
}, blocking=False)

return api_message(request)

Expand All @@ -343,7 +343,7 @@ def async_api_set_color_temperature(hass, config, request, entity):
yield from hass.services.async_call(entity.domain, SERVICE_TURN_ON, {
ATTR_ENTITY_ID: entity.entity_id,
light.ATTR_KELVIN: kelvin,
}, blocking=True)
}, blocking=False)

return api_message(request)

Expand All @@ -361,7 +361,7 @@ def async_api_decrease_color_temp(hass, config, request, entity):
yield from hass.services.async_call(entity.domain, SERVICE_TURN_ON, {
ATTR_ENTITY_ID: entity.entity_id,
light.ATTR_COLOR_TEMP: value,
}, blocking=True)
}, blocking=False)

return api_message(request)

Expand All @@ -379,7 +379,7 @@ def async_api_increase_color_temp(hass, config, request, entity):
yield from hass.services.async_call(entity.domain, SERVICE_TURN_ON, {
ATTR_ENTITY_ID: entity.entity_id,
light.ATTR_COLOR_TEMP: value,
}, blocking=True)
}, blocking=False)

return api_message(request)

Expand All @@ -391,7 +391,7 @@ def async_api_activate(hass, config, request, entity):
"""Process a activate request."""
yield from hass.services.async_call(entity.domain, SERVICE_TURN_ON, {
ATTR_ENTITY_ID: entity.entity_id
}, blocking=True)
}, blocking=False)

return api_message(request)

Expand Down Expand Up @@ -421,8 +421,8 @@ def async_api_set_percentage(hass, config, request, entity):
service = SERVICE_SET_COVER_POSITION
data[cover.ATTR_POSITION] = percentage

yield from hass.services.async_call(entity.domain, service,
data, blocking=True)
yield from hass.services.async_call(
entity.domain, service, data, blocking=False)

return api_message(request)

Expand Down Expand Up @@ -469,8 +469,8 @@ def async_api_adjust_percentage(hass, config, request, entity):

data[cover.ATTR_POSITION] = max(0, percentage_delta + current)

yield from hass.services.async_call(entity.domain, service,
data, blocking=True)
yield from hass.services.async_call(
entity.domain, service, data, blocking=False)

return api_message(request)

Expand All @@ -482,7 +482,7 @@ def async_api_lock(hass, config, request, entity):
"""Process a lock request."""
yield from hass.services.async_call(entity.domain, SERVICE_LOCK, {
ATTR_ENTITY_ID: entity.entity_id
}, blocking=True)
}, blocking=False)

return api_message(request)

Expand All @@ -495,7 +495,7 @@ def async_api_unlock(hass, config, request, entity):
"""Process a unlock request."""
yield from hass.services.async_call(entity.domain, SERVICE_UNLOCK, {
ATTR_ENTITY_ID: entity.entity_id
}, blocking=True)
}, blocking=False)

return api_message(request)

Expand All @@ -512,8 +512,9 @@ def async_api_set_volume(hass, config, request, entity):
media_player.ATTR_MEDIA_VOLUME_LEVEL: volume,
}

yield from hass.services.async_call(entity.domain, SERVICE_VOLUME_SET,
data, blocking=True)
yield from hass.services.async_call(
entity.domain, SERVICE_VOLUME_SET,
data, blocking=False)

return api_message(request)

Expand All @@ -540,9 +541,9 @@ def async_api_adjust_volume(hass, config, request, entity):
media_player.ATTR_MEDIA_VOLUME_LEVEL: volume,
}

yield from hass.services.async_call(entity.domain,
media_player.SERVICE_VOLUME_SET,
data, blocking=True)
yield from hass.services.async_call(
entity.domain, media_player.SERVICE_VOLUME_SET,
data, blocking=False)

return api_message(request)

Expand All @@ -559,9 +560,9 @@ def async_api_set_mute(hass, config, request, entity):
media_player.ATTR_MEDIA_VOLUME_MUTED: mute,
}

yield from hass.services.async_call(entity.domain,
media_player.SERVICE_VOLUME_MUTE,
data, blocking=True)
yield from hass.services.async_call(
entity.domain, media_player.SERVICE_VOLUME_MUTE,
data, blocking=False)

return api_message(request)

Expand All @@ -575,8 +576,9 @@ def async_api_play(hass, config, request, entity):
ATTR_ENTITY_ID: entity.entity_id
}

yield from hass.services.async_call(entity.domain, SERVICE_MEDIA_PLAY,
data, blocking=True)
yield from hass.services.async_call(
entity.domain, SERVICE_MEDIA_PLAY,
data, blocking=False)

return api_message(request)

Expand All @@ -590,8 +592,9 @@ def async_api_pause(hass, config, request, entity):
ATTR_ENTITY_ID: entity.entity_id
}

yield from hass.services.async_call(entity.domain, SERVICE_MEDIA_PAUSE,
data, blocking=True)
yield from hass.services.async_call(
entity.domain, SERVICE_MEDIA_PAUSE,
data, blocking=False)

return api_message(request)

Expand All @@ -605,8 +608,9 @@ def async_api_stop(hass, config, request, entity):
ATTR_ENTITY_ID: entity.entity_id
}

yield from hass.services.async_call(entity.domain, SERVICE_MEDIA_STOP,
data, blocking=True)
yield from hass.services.async_call(
entity.domain, SERVICE_MEDIA_STOP,
data, blocking=False)

return api_message(request)

Expand All @@ -620,9 +624,9 @@ def async_api_next(hass, config, request, entity):
ATTR_ENTITY_ID: entity.entity_id
}

yield from hass.services.async_call(entity.domain,
SERVICE_MEDIA_NEXT_TRACK,
data, blocking=True)
yield from hass.services.async_call(
entity.domain, SERVICE_MEDIA_NEXT_TRACK,
data, blocking=False)

return api_message(request)

Expand All @@ -636,8 +640,8 @@ def async_api_previous(hass, config, request, entity):
ATTR_ENTITY_ID: entity.entity_id
}

yield from hass.services.async_call(entity.domain,
SERVICE_MEDIA_PREVIOUS_TRACK,
data, blocking=True)
yield from hass.services.async_call(
entity.domain, SERVICE_MEDIA_PREVIOUS_TRACK,
data, blocking=False)

return api_message(request)
9 changes: 8 additions & 1 deletion homeassistant/components/binary_sensor/concord232.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
_LOGGER.error("Unable to connect to Concord232: %s", str(ex))
return False

# The order of zones returned by client.list_zones() can vary.
# When the zones are not named, this can result in the same entity
# name mapping to different sensors in an unpredictable way. Sort
# the zones by zone number to prevent this.

client.zones.sort(key=lambda zone: zone['number'])

for zone in client.zones:
_LOGGER.info("Loading Zone found: %s", zone['name'])
if zone['number'] not in exclude:
Expand Down Expand Up @@ -118,7 +125,7 @@ def name(self):
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')
return bool(self._zone['state'] != 'Normal')

def update(self):
"""Get updated stats from API."""
Expand Down
18 changes: 13 additions & 5 deletions homeassistant/components/binary_sensor/isy994.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,9 @@ def setup_platform(hass, config: ConfigType,
node.nid, node.parent_nid)
else:
device_type = _detect_device_type(node)
if device_type in ['moisture', 'opening']:
subnode_id = int(node.nid[-1])
# Leak and door/window sensors work the same way with negative
# nodes and heartbeat nodes
subnode_id = int(node.nid[-1])
if device_type == 'opening':
# Door/window sensors use an optional "negative" node
if subnode_id == 4:
# Subnode 4 is the heartbeat node, which we will represent
# as a separate binary_sensor
Expand All @@ -74,6 +73,14 @@ def setup_platform(hass, config: ConfigType,
devices.append(device)
elif subnode_id == 2:
parent_device.add_negative_node(node)
elif device_type == 'moisture':
# Moisure nodes have a subnode 2, but we ignore it because it's
# just the inverse of the primary node.
if subnode_id == 4:
# Heartbeat node
device = ISYBinarySensorHeartbeat(node, parent_device)
parent_device.add_heartbeat_device(device)
devices.append(device)
else:
# We don't yet have any special logic for other sensor types,
# so add the nodes as individual devices
Expand Down Expand Up @@ -165,7 +172,8 @@ def add_negative_node(self, child) -> None:
"""
self._negative_node = child

if not _is_val_unknown(self._negative_node):
# pylint: disable=protected-access
if not _is_val_unknown(self._negative_node.status._val):
# If the negative node has a value, it means the negative node is
# in use for this device. Therefore, we cannot determine the state
# of the sensor until we receive our first ON event.
Expand Down
6 changes: 3 additions & 3 deletions homeassistant/components/calendar/caldav.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
CONF_CALENDARS = 'calendars'
CONF_CUSTOM_CALENDARS = 'custom_calendars'
CONF_CALENDAR = 'calendar'
CONF_ALL_DAY = 'all_day'
CONF_SEARCH = 'search'

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Required(CONF_URL): vol.Url,
# pylint: disable=no-value-for-parameter
vol.Required(CONF_URL): vol.Url(),
vol.Optional(CONF_CALENDARS, default=[]):
vol.All(cv.ensure_list, vol.Schema([
cv.string
Expand Down Expand Up @@ -88,7 +88,7 @@ def setup_platform(hass, config, add_devices, disc_info=None):
WebDavCalendarEventDevice(hass,
device_data,
calendar,
cust_calendar.get(CONF_ALL_DAY),
True,
cust_calendar.get(CONF_SEARCH))
)

Expand Down
5 changes: 3 additions & 2 deletions homeassistant/components/frontend/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,9 +582,10 @@ def _is_latest(js_option, request):
from user_agents import parse
useragent = parse(request.headers.get('User-Agent'))

# on iOS every browser is a Safari which we support from version 10.
# on iOS every browser is a Safari which we support from version 11.
if useragent.os.family == 'iOS':
return useragent.os.version[0] >= 10
# Was >= 10, temp setting it to 12 to work around issue #11387
return useragent.os.version[0] >= 12

family_min_version = {
'Chrome': 50, # Probably can reduce this
Expand Down
9 changes: 5 additions & 4 deletions homeassistant/components/homematic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@
vol.Optional(CONF_PATH, default=DEFAULT_PATH): cv.string,
vol.Optional(CONF_RESOLVENAMES, default=DEFAULT_RESOLVENAMES):
vol.In(CONF_RESOLVENAMES_OPTIONS),
vol.Optional(CONF_USERNAME, default=DEFAULT_USERNAME): cv.string,
vol.Optional(CONF_PASSWORD, default=DEFAULT_PASSWORD): cv.string,
vol.Optional(CONF_CALLBACK_IP): cv.string,
vol.Optional(CONF_CALLBACK_PORT): cv.port,
}},
Expand Down Expand Up @@ -747,10 +749,6 @@ def device_state_attributes(self):
"""Return device specific state attributes."""
attr = {}

# No data available
if not self.available:
return attr

# Generate a dictionary with attributes
for node, data in HM_ATTRIBUTE_SUPPORT.items():
# Is an attribute and exists for this object
Expand Down Expand Up @@ -806,6 +804,9 @@ def _hm_event_callback(self, device, caller, attribute, value):
if attribute == 'UNREACH':
self._available = bool(value)
has_changed = True
elif not self.available:
self._available = False
has_changed = True

# If it has changed data point, update HASS
if has_changed:
Expand Down
2 changes: 2 additions & 0 deletions homeassistant/components/hue.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ def __init__(self, host, hass, filename, allow_unreachable=False,
self.allow_hue_groups = allow_hue_groups

self.bridge = None
self.lights = {}
self.lightgroups = {}

self.configured = False
self.config_request_id = None
Expand Down
Loading