Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.48.1 #8351

Merged
merged 9 commits into from
Jul 5, 2017
Merged

0.48.1 #8351

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
2 changes: 1 addition & 1 deletion homeassistant/components/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def post(self, request, entity_id):

new_state = data.get('state')

if not new_state:
if new_state is None:
return self.json_message('No state specified', HTTP_BAD_REQUEST)

attributes = data.get('attributes')
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/camera/arlo.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def __init__(self, hass, camera, device_info):
"""Initialize an Arlo camera."""
super().__init__()
self._camera = camera
self._base_stn = hass.data['arlo'].base_stations[0]
self._base_stn = hass.data[DATA_ARLO].base_stations[0]
self._name = self._camera.name
self._motion_status = False
self._ffmpeg = hass.data[DATA_FFMPEG]
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/frontend/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
FINGERPRINTS = {
"compatibility.js": "8e4c44b5f4288cc48ec1ba94a9bec812",
"core.js": "d4a7cb8c80c62b536764e0e81385f6aa",
"frontend.html": "f170a7221615ca2839cb8fd51a82f50a",
"frontend.html": "bdcde4695ce32595a9e1d813b9d7c5f9",
"mdi.html": "c92bd28c434865d6cabb34cd3c0a3e4c",
"micromarkdown-js.html": "93b5ec4016f0bba585521cf4d18dec1a",
"panels/ha-panel-automation.html": "4f98839bb082885657bbcd0ac04fc680",
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/frontend/www_static/frontend.html

Large diffs are not rendered by default.

Binary file modified homeassistant/components/frontend/www_static/frontend.html.gz
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
4 changes: 4 additions & 0 deletions homeassistant/components/mqtt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,10 @@ def async_setup(hass, config):
client_cert = conf.get(CONF_CLIENT_CERT)
tls_insecure = conf.get(CONF_TLS_INSECURE)
protocol = conf[CONF_PROTOCOL]

# hbmqtt requires a client id to be set.
if client_id is None:
client_id = 'home-assistant'
elif broker_config:
# If no broker passed in, auto config to internal server
broker, port, username, password, certificate, protocol = broker_config
Expand Down
18 changes: 9 additions & 9 deletions homeassistant/components/remote/harmony.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

DEFAULT_PORT = 5222
DEVICES = []
CONF_DEVICE_CACHE = 'device_cache'
CONF_DEVICE_CACHE = 'harmony_device_cache'

SERVICE_SYNC = 'harmony_sync'

Expand Down Expand Up @@ -69,7 +69,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
port)

# Ignore hub name when checking if this hub is known - ip and port only
if host and host[1:] in set([h[1:] for h in DEVICES]):
if host and host[1:] in (h.host for h in DEVICES):
_LOGGER.debug("Discovered host already known: %s", host)
return
elif CONF_HOST in config:
Expand Down Expand Up @@ -147,7 +147,7 @@ def __init__(self, name, host, port, activity, out_path, token):

_LOGGER.debug("HarmonyRemote device init started for: %s", name)
self._name = name
self._ip = host
self.host = host
self._port = port
self._state = None
self._current_activity = None
Expand Down Expand Up @@ -182,7 +182,7 @@ def update(self):
name = self._name
_LOGGER.debug("Polling %s for current activity", name)
state = pyharmony.ha_get_current_activity(
self._token, self._config, self._ip, self._port)
self._token, self._config, self.host, self._port)
_LOGGER.debug("%s current activity reported as: %s", name, state)
self._current_activity = state
self._state = bool(state != 'PowerOff')
Expand All @@ -197,30 +197,30 @@ def turn_on(self, **kwargs):

if activity:
pyharmony.ha_start_activity(
self._token, self._ip, self._port, self._config, activity)
self._token, self.host, self._port, self._config, activity)
self._state = True
else:
_LOGGER.error("No activity specified with turn_on service")

def turn_off(self):
"""Start the PowerOff activity."""
import pyharmony
pyharmony.ha_power_off(self._token, self._ip, self._port)
pyharmony.ha_power_off(self._token, self.host, self._port)

def send_command(self, **kwargs):
"""Send a set of commands to one device."""
import pyharmony
pyharmony.ha_send_commands(
self._token, self._ip, self._port, kwargs[ATTR_DEVICE],
self._token, self.host, self._port, kwargs[ATTR_DEVICE],
kwargs[ATTR_COMMAND], int(kwargs[ATTR_NUM_REPEATS]),
float(kwargs[ATTR_DELAY_SECS]))

def sync(self):
"""Sync the Harmony device with the web service."""
import pyharmony
_LOGGER.debug("Syncing hub with Harmony servers")
pyharmony.ha_sync(self._token, self._ip, self._port)
pyharmony.ha_sync(self._token, self.host, self._port)
self._config = pyharmony.ha_get_config(
self._token, self._ip, self._port)
self._token, self.host, self._port)
_LOGGER.debug("Writing hub config to file: %s", self._config_path)
pyharmony.ha_write_config_file(self._config, self._config_path)
4 changes: 2 additions & 2 deletions homeassistant/components/sensor/arlo.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from homeassistant.helpers import config_validation as cv
from homeassistant.components.arlo import (
CONF_ATTRIBUTION, DEFAULT_BRAND)
CONF_ATTRIBUTION, DEFAULT_BRAND, DATA_ARLO)

from homeassistant.const import (
ATTR_ATTRIBUTION, CONF_MONITORED_CONDITIONS, STATE_UNKNOWN)
Expand Down Expand Up @@ -40,7 +40,7 @@
@asyncio.coroutine
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
"""Set up an Arlo IP sensor."""
arlo = hass.data.get('arlo')
arlo = hass.data.get(DATA_ARLO)
if not arlo:
return False

Expand Down
29 changes: 6 additions & 23 deletions homeassistant/components/snips.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@
}, extra=vol.ALLOW_EXTRA)

INTENT_SCHEMA = vol.Schema({
vol.Required('text'): str,
vol.Required('input'): str,
vol.Required('intent'): {
vol.Required('intent_name'): str
vol.Required('intentName'): str
},
vol.Optional('slots'): [{
vol.Required('slot_name'): str,
vol.Required('slotName'): str,
vol.Required('value'): {
vol.Required('kind'): str,
vol.Required('value'): cv.match_all
Expand Down Expand Up @@ -95,7 +95,7 @@ def handle_intent(self, payload):
LOGGER.error('Intent has invalid schema: %s. %s', err, response)
return

intent = response['intent']['intent_name'].split('__')[-1]
intent = response['intent']['intentName'].split('__')[-1]
config = self.intents.get(intent)

if config is None:
Expand All @@ -113,26 +113,9 @@ def parse_slots(self, response):
parameters = {}

for slot in response.get('slots', []):
key = slot['slot_name']
value = self.get_value(slot['value'])
key = slot['slotName']
value = slot['value']['value']
if value is not None:
parameters[key] = value

return parameters

@staticmethod
def get_value(value):
"""Return the value of a given slot."""
kind = value['kind']

if kind == "Custom":
return value["value"]
elif kind == "Builtin":
try:
return value["value"]["value"]
except KeyError:
return None
else:
LOGGER.warning('Received unknown slot type: %s', kind)

return None
2 changes: 1 addition & 1 deletion homeassistant/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""Constants used by Home Assistant components."""
MAJOR_VERSION = 0
MINOR_VERSION = 48
PATCH_VERSION = 0
PATCH_VERSION = 1
__short_version__ = '{}.{}'.format(MAJOR_VERSION, MINOR_VERSION)
__version__ = '{}.{}'.format(__short_version__, PATCH_VERSION)
REQUIRED_PYTHON_VER = (3, 4, 2)
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1079,7 +1079,7 @@ def is_allowed_path(self, path: str) -> bool:
"""Check if the path is valid for access from outside."""
parent = pathlib.Path(path).parent
try:
parent.resolve() # pylint: disable=no-member
parent = parent.resolve() # pylint: disable=no-member
except (FileNotFoundError, RuntimeError, PermissionError):
return False

Expand Down
17 changes: 17 additions & 0 deletions tests/components/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,23 @@ def test_api_state_change_with_bad_data(hass, mock_api_client):
assert resp.status == 400


# pylint: disable=invalid-name
@asyncio.coroutine
def test_api_state_change_to_zero_value(hass, mock_api_client):
"""Test if changing a state to a zero value is possible."""
resp = yield from mock_api_client.post(
const.URL_API_STATES_ENTITY.format("test_entity.with_zero_state"),
json={'state': 0})

assert resp.status == 201

resp = yield from mock_api_client.post(
const.URL_API_STATES_ENTITY.format("test_entity.with_zero_state"),
json={'state': 0.})

assert resp.status == 200


# pylint: disable=invalid-name
@asyncio.coroutine
def test_api_state_change_push(hass, mock_api_client):
Expand Down
Loading