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