mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
commit
ebc0ed1e22
@ -72,19 +72,19 @@ class AbodeSensor(AbodeDevice):
|
|||||||
@property
|
@property
|
||||||
def state(self):
|
def state(self):
|
||||||
"""Return the state of the sensor."""
|
"""Return the state of the sensor."""
|
||||||
if self._sensor_type == "temp":
|
if self._sensor_type == CONST.TEMP_STATUS_KEY:
|
||||||
return self._device.temp
|
return self._device.temp
|
||||||
if self._sensor_type == "humidity":
|
if self._sensor_type == CONST.HUMI_STATUS_KEY:
|
||||||
return self._device.humidity
|
return self._device.humidity
|
||||||
if self._sensor_type == "lux":
|
if self._sensor_type == CONST.LUX_STATUS_KEY:
|
||||||
return self._device.lux
|
return self._device.lux
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def unit_of_measurement(self):
|
def unit_of_measurement(self):
|
||||||
"""Return the units of measurement."""
|
"""Return the units of measurement."""
|
||||||
if self._sensor_type == "temp":
|
if self._sensor_type == CONST.TEMP_STATUS_KEY:
|
||||||
return self._device.temp_unit
|
return self._device.temp_unit
|
||||||
if self._sensor_type == "humidity":
|
if self._sensor_type == CONST.HUMI_STATUS_KEY:
|
||||||
return self._device.humidity_unit
|
return self._device.humidity_unit
|
||||||
if self._sensor_type == "lux":
|
if self._sensor_type == CONST.LUX_STATUS_KEY:
|
||||||
return self._device.lux_unit
|
return self._device.lux_unit
|
||||||
|
@ -752,10 +752,11 @@ class AlexaThermostatController(AlexaCapability):
|
|||||||
supported_modes.append(thermostat_mode)
|
supported_modes.append(thermostat_mode)
|
||||||
|
|
||||||
preset_modes = self.entity.attributes.get(climate.ATTR_PRESET_MODES)
|
preset_modes = self.entity.attributes.get(climate.ATTR_PRESET_MODES)
|
||||||
for mode in preset_modes:
|
if preset_modes:
|
||||||
thermostat_mode = API_THERMOSTAT_PRESETS.get(mode)
|
for mode in preset_modes:
|
||||||
if thermostat_mode:
|
thermostat_mode = API_THERMOSTAT_PRESETS.get(mode)
|
||||||
supported_modes.append(thermostat_mode)
|
if thermostat_mode:
|
||||||
|
supported_modes.append(thermostat_mode)
|
||||||
|
|
||||||
# Return False for supportsScheduling until supported with event listener in handler.
|
# Return False for supportsScheduling until supported with event listener in handler.
|
||||||
configuration = {"supportsScheduling": False}
|
configuration = {"supportsScheduling": False}
|
||||||
|
@ -152,6 +152,8 @@ class DeconzLight(DeconzDevice, Light):
|
|||||||
|
|
||||||
if ATTR_TRANSITION in kwargs:
|
if ATTR_TRANSITION in kwargs:
|
||||||
data["transitiontime"] = int(kwargs[ATTR_TRANSITION] * 10)
|
data["transitiontime"] = int(kwargs[ATTR_TRANSITION] * 10)
|
||||||
|
elif "IKEA" in (self._device.manufacturer or ""):
|
||||||
|
data["transitiontime"] = 0
|
||||||
|
|
||||||
if ATTR_FLASH in kwargs:
|
if ATTR_FLASH in kwargs:
|
||||||
if kwargs[ATTR_FLASH] == FLASH_SHORT:
|
if kwargs[ATTR_FLASH] == FLASH_SHORT:
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"name": "Home Assistant Frontend",
|
"name": "Home Assistant Frontend",
|
||||||
"documentation": "https://www.home-assistant.io/integrations/frontend",
|
"documentation": "https://www.home-assistant.io/integrations/frontend",
|
||||||
"requirements": [
|
"requirements": [
|
||||||
"home-assistant-frontend==20191119.5"
|
"home-assistant-frontend==20191119.6"
|
||||||
],
|
],
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
"api",
|
"api",
|
||||||
|
@ -547,13 +547,18 @@ class NetatmoData:
|
|||||||
self.data = {}
|
self.data = {}
|
||||||
self.station_data = self.data_class(self.auth)
|
self.station_data = self.data_class(self.auth)
|
||||||
self.station = station
|
self.station = station
|
||||||
|
self.station_id = None
|
||||||
|
if station:
|
||||||
|
station_data = self.station_data.stationByName(self.station)
|
||||||
|
if station_data:
|
||||||
|
self.station_id = station_data.get("_id")
|
||||||
self._next_update = time()
|
self._next_update = time()
|
||||||
self._update_in_progress = threading.Lock()
|
self._update_in_progress = threading.Lock()
|
||||||
|
|
||||||
def get_module_infos(self):
|
def get_module_infos(self):
|
||||||
"""Return all modules available on the API as a dict."""
|
"""Return all modules available on the API as a dict."""
|
||||||
if self.station is not None:
|
if self.station_id is not None:
|
||||||
return self.station_data.getModules(station=self.station)
|
return self.station_data.getModules(station_id=self.station_id)
|
||||||
return self.station_data.getModules()
|
return self.station_data.getModules()
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
@ -579,7 +584,7 @@ class NetatmoData:
|
|||||||
return
|
return
|
||||||
|
|
||||||
data = self.station_data.lastData(
|
data = self.station_data.lastData(
|
||||||
station=self.station, exclude=3600, byId=True
|
station=self.station_id, exclude=3600, byId=True
|
||||||
)
|
)
|
||||||
if not data:
|
if not data:
|
||||||
self._next_update = time() + NETATMO_UPDATE_INTERVAL
|
self._next_update = time() + NETATMO_UPDATE_INTERVAL
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
"""Support to embed Plex."""
|
"""Support to embed Plex."""
|
||||||
import asyncio
|
import asyncio
|
||||||
|
import functools
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import plexapi.exceptions
|
import plexapi.exceptions
|
||||||
@ -16,7 +17,6 @@ from homeassistant.const import (
|
|||||||
CONF_TOKEN,
|
CONF_TOKEN,
|
||||||
CONF_URL,
|
CONF_URL,
|
||||||
CONF_VERIFY_SSL,
|
CONF_VERIFY_SSL,
|
||||||
EVENT_HOMEASSISTANT_START,
|
|
||||||
EVENT_HOMEASSISTANT_STOP,
|
EVENT_HOMEASSISTANT_STOP,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers import config_validation as cv
|
from homeassistant.helpers import config_validation as cv
|
||||||
@ -37,6 +37,7 @@ from .const import (
|
|||||||
DISPATCHERS,
|
DISPATCHERS,
|
||||||
DOMAIN as PLEX_DOMAIN,
|
DOMAIN as PLEX_DOMAIN,
|
||||||
PLATFORMS,
|
PLATFORMS,
|
||||||
|
PLATFORMS_COMPLETED,
|
||||||
PLEX_MEDIA_PLAYER_OPTIONS,
|
PLEX_MEDIA_PLAYER_OPTIONS,
|
||||||
PLEX_SERVER_CONFIG,
|
PLEX_SERVER_CONFIG,
|
||||||
PLEX_UPDATE_PLATFORMS_SIGNAL,
|
PLEX_UPDATE_PLATFORMS_SIGNAL,
|
||||||
@ -72,18 +73,21 @@ CONFIG_SCHEMA = vol.Schema({PLEX_DOMAIN: SERVER_CONFIG_SCHEMA}, extra=vol.ALLOW_
|
|||||||
_LOGGER = logging.getLogger(__package__)
|
_LOGGER = logging.getLogger(__package__)
|
||||||
|
|
||||||
|
|
||||||
def setup(hass, config):
|
async def async_setup(hass, config):
|
||||||
"""Set up the Plex component."""
|
"""Set up the Plex component."""
|
||||||
hass.data.setdefault(PLEX_DOMAIN, {SERVERS: {}, DISPATCHERS: {}, WEBSOCKETS: {}})
|
hass.data.setdefault(
|
||||||
|
PLEX_DOMAIN,
|
||||||
|
{SERVERS: {}, DISPATCHERS: {}, WEBSOCKETS: {}, PLATFORMS_COMPLETED: {}},
|
||||||
|
)
|
||||||
|
|
||||||
plex_config = config.get(PLEX_DOMAIN, {})
|
plex_config = config.get(PLEX_DOMAIN, {})
|
||||||
if plex_config:
|
if plex_config:
|
||||||
_setup_plex(hass, plex_config)
|
_async_setup_plex(hass, plex_config)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def _setup_plex(hass, config):
|
def _async_setup_plex(hass, config):
|
||||||
"""Pass configuration to a config flow."""
|
"""Pass configuration to a config flow."""
|
||||||
server_config = dict(config)
|
server_config = dict(config)
|
||||||
if MP_DOMAIN in server_config:
|
if MP_DOMAIN in server_config:
|
||||||
@ -141,11 +145,7 @@ async def async_setup_entry(hass, entry):
|
|||||||
)
|
)
|
||||||
server_id = plex_server.machine_identifier
|
server_id = plex_server.machine_identifier
|
||||||
hass.data[PLEX_DOMAIN][SERVERS][server_id] = plex_server
|
hass.data[PLEX_DOMAIN][SERVERS][server_id] = plex_server
|
||||||
|
hass.data[PLEX_DOMAIN][PLATFORMS_COMPLETED][server_id] = set()
|
||||||
for platform in PLATFORMS:
|
|
||||||
hass.async_create_task(
|
|
||||||
hass.config_entries.async_forward_entry_setup(entry, platform)
|
|
||||||
)
|
|
||||||
|
|
||||||
entry.add_update_listener(async_options_updated)
|
entry.add_update_listener(async_options_updated)
|
||||||
|
|
||||||
@ -167,19 +167,25 @@ async def async_setup_entry(hass, entry):
|
|||||||
)
|
)
|
||||||
hass.data[PLEX_DOMAIN][WEBSOCKETS][server_id] = websocket
|
hass.data[PLEX_DOMAIN][WEBSOCKETS][server_id] = websocket
|
||||||
|
|
||||||
async def async_start_websocket_session(_):
|
def start_websocket_session(platform, _):
|
||||||
await websocket.listen()
|
hass.data[PLEX_DOMAIN][PLATFORMS_COMPLETED][server_id].add(platform)
|
||||||
|
if hass.data[PLEX_DOMAIN][PLATFORMS_COMPLETED][server_id] == PLATFORMS:
|
||||||
|
hass.loop.create_task(websocket.listen())
|
||||||
|
|
||||||
def close_websocket_session(_):
|
def close_websocket_session(_):
|
||||||
websocket.close()
|
websocket.close()
|
||||||
|
|
||||||
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_START, async_start_websocket_session)
|
|
||||||
|
|
||||||
unsub = hass.bus.async_listen_once(
|
unsub = hass.bus.async_listen_once(
|
||||||
EVENT_HOMEASSISTANT_STOP, close_websocket_session
|
EVENT_HOMEASSISTANT_STOP, close_websocket_session
|
||||||
)
|
)
|
||||||
hass.data[PLEX_DOMAIN][DISPATCHERS][server_id].append(unsub)
|
hass.data[PLEX_DOMAIN][DISPATCHERS][server_id].append(unsub)
|
||||||
|
|
||||||
|
for platform in PLATFORMS:
|
||||||
|
task = hass.async_create_task(
|
||||||
|
hass.config_entries.async_forward_entry_setup(entry, platform)
|
||||||
|
)
|
||||||
|
task.add_done_callback(functools.partial(start_websocket_session, platform))
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,7 +9,8 @@ DEFAULT_SSL = False
|
|||||||
DEFAULT_VERIFY_SSL = True
|
DEFAULT_VERIFY_SSL = True
|
||||||
|
|
||||||
DISPATCHERS = "dispatchers"
|
DISPATCHERS = "dispatchers"
|
||||||
PLATFORMS = ["media_player", "sensor"]
|
PLATFORMS = frozenset(["media_player", "sensor"])
|
||||||
|
PLATFORMS_COMPLETED = "platforms_completed"
|
||||||
SERVERS = "servers"
|
SERVERS = "servers"
|
||||||
WEBSOCKETS = "websockets"
|
WEBSOCKETS = "websockets"
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"""Constants used by Home Assistant components."""
|
"""Constants used by Home Assistant components."""
|
||||||
MAJOR_VERSION = 0
|
MAJOR_VERSION = 0
|
||||||
MINOR_VERSION = 102
|
MINOR_VERSION = 102
|
||||||
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, 6, 1)
|
REQUIRED_PYTHON_VER = (3, 6, 1)
|
||||||
|
@ -11,7 +11,7 @@ contextvars==2.4;python_version<"3.7"
|
|||||||
cryptography==2.8
|
cryptography==2.8
|
||||||
distro==1.4.0
|
distro==1.4.0
|
||||||
hass-nabucasa==0.29
|
hass-nabucasa==0.29
|
||||||
home-assistant-frontend==20191119.5
|
home-assistant-frontend==20191119.6
|
||||||
importlib-metadata==0.23
|
importlib-metadata==0.23
|
||||||
jinja2>=2.10.3
|
jinja2>=2.10.3
|
||||||
netdisco==2.6.0
|
netdisco==2.6.0
|
||||||
|
@ -655,7 +655,7 @@ hole==0.5.0
|
|||||||
holidays==0.9.11
|
holidays==0.9.11
|
||||||
|
|
||||||
# homeassistant.components.frontend
|
# homeassistant.components.frontend
|
||||||
home-assistant-frontend==20191119.5
|
home-assistant-frontend==20191119.6
|
||||||
|
|
||||||
# homeassistant.components.zwave
|
# homeassistant.components.zwave
|
||||||
homeassistant-pyozw==0.1.4
|
homeassistant-pyozw==0.1.4
|
||||||
|
@ -222,7 +222,7 @@ hole==0.5.0
|
|||||||
holidays==0.9.11
|
holidays==0.9.11
|
||||||
|
|
||||||
# homeassistant.components.frontend
|
# homeassistant.components.frontend
|
||||||
home-assistant-frontend==20191119.5
|
home-assistant-frontend==20191119.6
|
||||||
|
|
||||||
# homeassistant.components.zwave
|
# homeassistant.components.zwave
|
||||||
homeassistant-pyozw==0.1.4
|
homeassistant-pyozw==0.1.4
|
||||||
|
Loading…
x
Reference in New Issue
Block a user