mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
commit
60aacff827
@ -113,15 +113,17 @@ def async_from_config_dict(config: Dict[str, Any],
|
|||||||
yield from hass.async_add_job(loader.prepare, hass)
|
yield from hass.async_add_job(loader.prepare, hass)
|
||||||
|
|
||||||
# Make a copy because we are mutating it.
|
# Make a copy because we are mutating it.
|
||||||
new_config = OrderedDict()
|
config = OrderedDict(config)
|
||||||
for key, value in config.items():
|
|
||||||
new_config[key] = value or {}
|
|
||||||
config = new_config
|
|
||||||
|
|
||||||
# Merge packages
|
# Merge packages
|
||||||
conf_util.merge_packages_config(
|
conf_util.merge_packages_config(
|
||||||
config, core_config.get(conf_util.CONF_PACKAGES, {}))
|
config, core_config.get(conf_util.CONF_PACKAGES, {}))
|
||||||
|
|
||||||
|
# Ensure we have no None values after merge
|
||||||
|
for key, value in config.items():
|
||||||
|
if not value:
|
||||||
|
config[key] = {}
|
||||||
|
|
||||||
hass.config_entries = config_entries.ConfigEntries(hass, config)
|
hass.config_entries = config_entries.ConfigEntries(hass, config)
|
||||||
yield from hass.config_entries.async_load()
|
yield from hass.config_entries.async_load()
|
||||||
|
|
||||||
|
@ -240,13 +240,13 @@ class SensiboClimate(ClimateDevice):
|
|||||||
def min_temp(self):
|
def min_temp(self):
|
||||||
"""Return the minimum temperature."""
|
"""Return the minimum temperature."""
|
||||||
return self._temperatures_list[0] \
|
return self._temperatures_list[0] \
|
||||||
if self._temperatures_list else super().min_temp()
|
if self._temperatures_list else super().min_temp
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def max_temp(self):
|
def max_temp(self):
|
||||||
"""Return the maximum temperature."""
|
"""Return the maximum temperature."""
|
||||||
return self._temperatures_list[-1] \
|
return self._temperatures_list[-1] \
|
||||||
if self._temperatures_list else super().max_temp()
|
if self._temperatures_list else super().max_temp
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def async_set_temperature(self, **kwargs):
|
def async_set_temperature(self, **kwargs):
|
||||||
|
@ -24,7 +24,7 @@ from homeassistant.core import callback
|
|||||||
from homeassistant.helpers.translation import async_get_translations
|
from homeassistant.helpers.translation import async_get_translations
|
||||||
from homeassistant.loader import bind_hass
|
from homeassistant.loader import bind_hass
|
||||||
|
|
||||||
REQUIREMENTS = ['home-assistant-frontend==20180309.0']
|
REQUIREMENTS = ['home-assistant-frontend==20180310.0']
|
||||||
|
|
||||||
DOMAIN = 'frontend'
|
DOMAIN = 'frontend'
|
||||||
DEPENDENCIES = ['api', 'websocket_api', 'http', 'system_log']
|
DEPENDENCIES = ['api', 'websocket_api', 'http', 'system_log']
|
||||||
|
@ -221,7 +221,7 @@ class LIFXManager(object):
|
|||||||
tasks = []
|
tasks = []
|
||||||
for light in self.service_to_entities(service):
|
for light in self.service_to_entities(service):
|
||||||
if service.service == SERVICE_LIFX_SET_STATE:
|
if service.service == SERVICE_LIFX_SET_STATE:
|
||||||
task = light.async_set_state(**service.data)
|
task = light.set_state(**service.data)
|
||||||
tasks.append(self.hass.async_add_job(task))
|
tasks.append(self.hass.async_add_job(task))
|
||||||
if tasks:
|
if tasks:
|
||||||
await asyncio.wait(tasks, loop=self.hass.loop)
|
await asyncio.wait(tasks, loop=self.hass.loop)
|
||||||
|
@ -26,7 +26,7 @@ from homeassistant.components.light import (
|
|||||||
Light, PLATFORM_SCHEMA)
|
Light, PLATFORM_SCHEMA)
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
REQUIREMENTS = ['yeelight==0.3.3']
|
REQUIREMENTS = ['yeelight==0.4.0']
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ from homeassistant.util import Throttle
|
|||||||
from homeassistant.util.json import load_json, save_json
|
from homeassistant.util.json import load_json, save_json
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
REQUIREMENTS = ['pysabnzbd==0.0.3']
|
REQUIREMENTS = ['pysabnzbd==1.0.1']
|
||||||
|
|
||||||
_CONFIGURING = {}
|
_CONFIGURING = {}
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
@ -82,7 +82,7 @@ async def async_update_queue(sab_api):
|
|||||||
|
|
||||||
This ensures that the queue info only gets updated once for all sensors
|
This ensures that the queue info only gets updated once for all sensors
|
||||||
"""
|
"""
|
||||||
await sab_api.refresh_queue()
|
await sab_api.refresh_data()
|
||||||
|
|
||||||
|
|
||||||
def request_configuration(host, name, hass, config, async_add_devices,
|
def request_configuration(host, name, hass, config, async_add_devices,
|
||||||
|
@ -4,6 +4,7 @@ Sensor from an SQL Query.
|
|||||||
For more details about this platform, please refer to the documentation at
|
For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/sensor.sql/
|
https://home-assistant.io/components/sensor.sql/
|
||||||
"""
|
"""
|
||||||
|
import decimal
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
@ -131,17 +132,20 @@ class SQLSensor(Entity):
|
|||||||
try:
|
try:
|
||||||
sess = self.sessionmaker()
|
sess = self.sessionmaker()
|
||||||
result = sess.execute(self._query)
|
result = sess.execute(self._query)
|
||||||
|
self._attributes = {}
|
||||||
|
|
||||||
if not result.returns_rows or result.rowcount == 0:
|
if not result.returns_rows or result.rowcount == 0:
|
||||||
_LOGGER.warning("%s returned no results", self._query)
|
_LOGGER.warning("%s returned no results", self._query)
|
||||||
self._state = None
|
self._state = None
|
||||||
self._attributes = {}
|
|
||||||
return
|
return
|
||||||
|
|
||||||
for res in result:
|
for res in result:
|
||||||
_LOGGER.debug("result = %s", res.items())
|
_LOGGER.debug("result = %s", res.items())
|
||||||
data = res[self._column_name]
|
data = res[self._column_name]
|
||||||
self._attributes = {k: v for k, v in res.items()}
|
for key, value in res.items():
|
||||||
|
if isinstance(value, decimal.Decimal):
|
||||||
|
value = float(decimal)
|
||||||
|
self._attributes[key] = value
|
||||||
except sqlalchemy.exc.SQLAlchemyError as err:
|
except sqlalchemy.exc.SQLAlchemyError as err:
|
||||||
_LOGGER.error("Error executing query %s: %s", self._query, err)
|
_LOGGER.error("Error executing query %s: %s", self._query, err)
|
||||||
return
|
return
|
||||||
|
@ -554,7 +554,7 @@ class WinkAuthCallbackView(HomeAssistantView):
|
|||||||
from aiohttp import web
|
from aiohttp import web
|
||||||
|
|
||||||
hass = request.app['hass']
|
hass = request.app['hass']
|
||||||
data = request.GET
|
data = request.query
|
||||||
|
|
||||||
response_message = """Wink has been successfully authorized!
|
response_message = """Wink has been successfully authorized!
|
||||||
You can close this window now! For the best results you should reboot
|
You can close this window now! For the best results you should reboot
|
||||||
|
@ -182,19 +182,19 @@ def setup(hass, config):
|
|||||||
|
|
||||||
gateway_only_schema = _add_gateway_to_schema(xiaomi, vol.Schema({}))
|
gateway_only_schema = _add_gateway_to_schema(xiaomi, vol.Schema({}))
|
||||||
|
|
||||||
hass.services.async_register(
|
hass.services.register(
|
||||||
DOMAIN, SERVICE_PLAY_RINGTONE, play_ringtone_service,
|
DOMAIN, SERVICE_PLAY_RINGTONE, play_ringtone_service,
|
||||||
schema=_add_gateway_to_schema(xiaomi, SERVICE_SCHEMA_PLAY_RINGTONE))
|
schema=_add_gateway_to_schema(xiaomi, SERVICE_SCHEMA_PLAY_RINGTONE))
|
||||||
|
|
||||||
hass.services.async_register(
|
hass.services.register(
|
||||||
DOMAIN, SERVICE_STOP_RINGTONE, stop_ringtone_service,
|
DOMAIN, SERVICE_STOP_RINGTONE, stop_ringtone_service,
|
||||||
schema=gateway_only_schema)
|
schema=gateway_only_schema)
|
||||||
|
|
||||||
hass.services.async_register(
|
hass.services.register(
|
||||||
DOMAIN, SERVICE_ADD_DEVICE, add_device_service,
|
DOMAIN, SERVICE_ADD_DEVICE, add_device_service,
|
||||||
schema=gateway_only_schema)
|
schema=gateway_only_schema)
|
||||||
|
|
||||||
hass.services.async_register(
|
hass.services.register(
|
||||||
DOMAIN, SERVICE_REMOVE_DEVICE, remove_device_service,
|
DOMAIN, SERVICE_REMOVE_DEVICE, remove_device_service,
|
||||||
schema=_add_gateway_to_schema(xiaomi, SERVICE_SCHEMA_REMOVE_DEVICE))
|
schema=_add_gateway_to_schema(xiaomi, SERVICE_SCHEMA_REMOVE_DEVICE))
|
||||||
|
|
||||||
|
@ -562,6 +562,9 @@ def merge_packages_config(config, packages, _log_pkg_error=_log_pkg_error):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if merge_type == 'dict':
|
if merge_type == 'dict':
|
||||||
|
if comp_conf is None:
|
||||||
|
comp_conf = OrderedDict()
|
||||||
|
|
||||||
if not isinstance(comp_conf, dict):
|
if not isinstance(comp_conf, dict):
|
||||||
_log_pkg_error(
|
_log_pkg_error(
|
||||||
pack_name, comp_name, config,
|
pack_name, comp_name, config,
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"""Constants used by Home Assistant components."""
|
"""Constants used by Home Assistant components."""
|
||||||
MAJOR_VERSION = 0
|
MAJOR_VERSION = 0
|
||||||
MINOR_VERSION = 65
|
MINOR_VERSION = 65
|
||||||
PATCH_VERSION = '1'
|
PATCH_VERSION = '2'
|
||||||
__short_version__ = '{}.{}'.format(MAJOR_VERSION, MINOR_VERSION)
|
__short_version__ = '{}.{}'.format(MAJOR_VERSION, MINOR_VERSION)
|
||||||
__version__ = '{}.{}'.format(__short_version__, PATCH_VERSION)
|
__version__ = '{}.{}'.format(__short_version__, PATCH_VERSION)
|
||||||
REQUIRED_PYTHON_VER = (3, 5, 3)
|
REQUIRED_PYTHON_VER = (3, 5, 3)
|
||||||
|
@ -326,6 +326,11 @@ def check_ha_config_file(config_dir):
|
|||||||
config, core_config.get(CONF_PACKAGES, {}), _pack_error)
|
config, core_config.get(CONF_PACKAGES, {}), _pack_error)
|
||||||
del core_config[CONF_PACKAGES]
|
del core_config[CONF_PACKAGES]
|
||||||
|
|
||||||
|
# Ensure we have no None values after merge
|
||||||
|
for key, value in config.items():
|
||||||
|
if not value:
|
||||||
|
config[key] = {}
|
||||||
|
|
||||||
# Filter out repeating config sections
|
# Filter out repeating config sections
|
||||||
components = set(key.split(' ')[0] for key in config.keys())
|
components = set(key.split(' ')[0] for key in config.keys())
|
||||||
|
|
||||||
|
@ -353,7 +353,7 @@ hipnotify==1.0.8
|
|||||||
holidays==0.9.3
|
holidays==0.9.3
|
||||||
|
|
||||||
# homeassistant.components.frontend
|
# homeassistant.components.frontend
|
||||||
home-assistant-frontend==20180309.0
|
home-assistant-frontend==20180310.0
|
||||||
|
|
||||||
# homeassistant.components.camera.onvif
|
# homeassistant.components.camera.onvif
|
||||||
http://github.com/tgaugry/suds-passworddigest-py3/archive/86fc50e39b4d2b8997481967d6a7fe1c57118999.zip#suds-passworddigest-py3==0.1.2a
|
http://github.com/tgaugry/suds-passworddigest-py3/archive/86fc50e39b4d2b8997481967d6a7fe1c57118999.zip#suds-passworddigest-py3==0.1.2a
|
||||||
@ -863,7 +863,7 @@ pyqwikswitch==0.4
|
|||||||
pyrainbird==0.1.3
|
pyrainbird==0.1.3
|
||||||
|
|
||||||
# homeassistant.components.sensor.sabnzbd
|
# homeassistant.components.sensor.sabnzbd
|
||||||
pysabnzbd==0.0.3
|
pysabnzbd==1.0.1
|
||||||
|
|
||||||
# homeassistant.components.climate.sensibo
|
# homeassistant.components.climate.sensibo
|
||||||
pysensibo==1.0.2
|
pysensibo==1.0.2
|
||||||
@ -1292,7 +1292,7 @@ yahoo-finance==1.4.0
|
|||||||
yahooweather==0.10
|
yahooweather==0.10
|
||||||
|
|
||||||
# homeassistant.components.light.yeelight
|
# homeassistant.components.light.yeelight
|
||||||
yeelight==0.3.3
|
yeelight==0.4.0
|
||||||
|
|
||||||
# homeassistant.components.light.yeelightsunflower
|
# homeassistant.components.light.yeelightsunflower
|
||||||
yeelightsunflower==0.0.8
|
yeelightsunflower==0.0.8
|
||||||
|
@ -78,7 +78,7 @@ hbmqtt==0.9.1
|
|||||||
holidays==0.9.3
|
holidays==0.9.3
|
||||||
|
|
||||||
# homeassistant.components.frontend
|
# homeassistant.components.frontend
|
||||||
home-assistant-frontend==20180309.0
|
home-assistant-frontend==20180310.0
|
||||||
|
|
||||||
# homeassistant.components.influxdb
|
# homeassistant.components.influxdb
|
||||||
# homeassistant.components.sensor.influxdb
|
# homeassistant.components.sensor.influxdb
|
||||||
|
@ -29,7 +29,7 @@ class TestSQLSensor(unittest.TestCase):
|
|||||||
'db_url': 'sqlite://',
|
'db_url': 'sqlite://',
|
||||||
'queries': [{
|
'queries': [{
|
||||||
'name': 'count_tables',
|
'name': 'count_tables',
|
||||||
'query': 'SELECT count(*) value FROM sqlite_master;',
|
'query': 'SELECT 5 as value',
|
||||||
'column': 'value',
|
'column': 'value',
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
@ -38,7 +38,8 @@ class TestSQLSensor(unittest.TestCase):
|
|||||||
assert setup_component(self.hass, 'sensor', config)
|
assert setup_component(self.hass, 'sensor', config)
|
||||||
|
|
||||||
state = self.hass.states.get('sensor.count_tables')
|
state = self.hass.states.get('sensor.count_tables')
|
||||||
self.assertEqual(state.state, '0')
|
assert state.state == '5'
|
||||||
|
assert state.attributes['value'] == 5
|
||||||
|
|
||||||
def test_invalid_query(self):
|
def test_invalid_query(self):
|
||||||
"""Test the SQL sensor for invalid queries."""
|
"""Test the SQL sensor for invalid queries."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user