mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
commit
4a559cd4df
@ -123,7 +123,7 @@ def _set_location(hass, data, location_name):
|
|||||||
)
|
)
|
||||||
|
|
||||||
return web.Response(
|
return web.Response(
|
||||||
body="Setting location for {}".format(device),
|
text="Setting location for {}".format(device),
|
||||||
status=HTTP_OK
|
status=HTTP_OK
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ async def handle_webhook(hass, webhook_id, request):
|
|||||||
data = WEBHOOK_SCHEMA(dict(await request.post()))
|
data = WEBHOOK_SCHEMA(dict(await request.post()))
|
||||||
except vol.MultipleInvalid as error:
|
except vol.MultipleInvalid as error:
|
||||||
return web.Response(
|
return web.Response(
|
||||||
body=error.error_message,
|
text=error.error_message,
|
||||||
status=HTTP_UNPROCESSABLE_ENTITY
|
status=HTTP_UNPROCESSABLE_ENTITY
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ async def handle_webhook(hass, webhook_id, request):
|
|||||||
)
|
)
|
||||||
|
|
||||||
return web.Response(
|
return web.Response(
|
||||||
body='Setting location for {}'.format(device),
|
text='Setting location for {}'.format(device),
|
||||||
status=HTTP_OK
|
status=HTTP_OK
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -224,7 +224,12 @@ class HomeKitEntity(Entity):
|
|||||||
if service['iid'] != self._iid:
|
if service['iid'] != self._iid:
|
||||||
continue
|
continue
|
||||||
for char in service['characteristics']:
|
for char in service['characteristics']:
|
||||||
|
try:
|
||||||
uuid = CharacteristicsTypes.get_uuid(char['type'])
|
uuid = CharacteristicsTypes.get_uuid(char['type'])
|
||||||
|
except KeyError:
|
||||||
|
# If a KeyError is raised its a non-standard
|
||||||
|
# characteristic. We must ignore it in this case.
|
||||||
|
continue
|
||||||
if uuid not in characteristic_types:
|
if uuid not in characteristic_types:
|
||||||
continue
|
continue
|
||||||
self._setup_characteristic(char)
|
self._setup_characteristic(char)
|
||||||
|
@ -101,7 +101,7 @@ async def handle_webhook(hass, webhook_id, request):
|
|||||||
location_name
|
location_name
|
||||||
)
|
)
|
||||||
return web.Response(
|
return web.Response(
|
||||||
body='Setting location to not home',
|
text='Setting location to not home',
|
||||||
status=HTTP_OK
|
status=HTTP_OK
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ async def handle_webhook(hass, webhook_id, request):
|
|||||||
# before the previous zone was exited. The enter message will
|
# before the previous zone was exited. The enter message will
|
||||||
# be sent first, then the exit message will be sent second.
|
# be sent first, then the exit message will be sent second.
|
||||||
return web.Response(
|
return web.Response(
|
||||||
body='Ignoring exit from {} (already in {})'.format(
|
text='Ignoring exit from {} (already in {})'.format(
|
||||||
location_name, current_state
|
location_name, current_state
|
||||||
),
|
),
|
||||||
status=HTTP_OK
|
status=HTTP_OK
|
||||||
@ -120,14 +120,14 @@ async def handle_webhook(hass, webhook_id, request):
|
|||||||
# In the app, a test message can be sent. Just return something to
|
# In the app, a test message can be sent. Just return something to
|
||||||
# the user to let them know that it works.
|
# the user to let them know that it works.
|
||||||
return web.Response(
|
return web.Response(
|
||||||
body='Received test message.',
|
text='Received test message.',
|
||||||
status=HTTP_OK
|
status=HTTP_OK
|
||||||
)
|
)
|
||||||
|
|
||||||
_LOGGER.error('Received unidentified message from Locative: %s',
|
_LOGGER.error('Received unidentified message from Locative: %s',
|
||||||
direction)
|
direction)
|
||||||
return web.Response(
|
return web.Response(
|
||||||
body='Received unidentified message: {}'.format(direction),
|
text='Received unidentified message: {}'.format(direction),
|
||||||
status=HTTP_UNPROCESSABLE_ENTITY
|
status=HTTP_UNPROCESSABLE_ENTITY
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ class VerisureDoorlock(LockDevice):
|
|||||||
"$.doorLockStatusList[?(@.deviceLabel=='%s')].lockedState",
|
"$.doorLockStatusList[?(@.deviceLabel=='%s')].lockedState",
|
||||||
self._device_label)
|
self._device_label)
|
||||||
if status == 'UNLOCKED':
|
if status == 'UNLOCKED':
|
||||||
self._state = None
|
self._state = STATE_UNLOCKED
|
||||||
elif status == 'LOCKED':
|
elif status == 'LOCKED':
|
||||||
self._state = STATE_LOCKED
|
self._state = STATE_LOCKED
|
||||||
elif status != 'PENDING':
|
elif status != 'PENDING':
|
||||||
|
@ -4,10 +4,12 @@ Support for monitoring the Transmission BitTorrent client API.
|
|||||||
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.transmission/
|
https://home-assistant.io/components/sensor.transmission/
|
||||||
"""
|
"""
|
||||||
|
from datetime import timedelta
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from homeassistant.components.transmission import (
|
from homeassistant.components.transmission import (
|
||||||
DATA_TRANSMISSION, SENSOR_TYPES, SCAN_INTERVAL)
|
DATA_TRANSMISSION, SENSOR_TYPES)
|
||||||
from homeassistant.const import STATE_IDLE
|
from homeassistant.const import STATE_IDLE
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
from homeassistant.util import Throttle
|
from homeassistant.util import Throttle
|
||||||
@ -18,6 +20,8 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
|
|
||||||
DEFAULT_NAME = 'Transmission'
|
DEFAULT_NAME = 'Transmission'
|
||||||
|
|
||||||
|
SCAN_INTERVAL = timedelta(seconds=120)
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the Transmission sensors."""
|
"""Set up the Transmission sensors."""
|
||||||
|
@ -16,6 +16,7 @@ from homeassistant.const import (
|
|||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers import location
|
from homeassistant.helpers import location
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
|
from homeassistant.util import Throttle
|
||||||
|
|
||||||
REQUIREMENTS = ['WazeRouteCalculator==0.6']
|
REQUIREMENTS = ['WazeRouteCalculator==0.6']
|
||||||
|
|
||||||
@ -40,6 +41,7 @@ ICON = 'mdi:car'
|
|||||||
REGIONS = ['US', 'NA', 'EU', 'IL', 'AU']
|
REGIONS = ['US', 'NA', 'EU', 'IL', 'AU']
|
||||||
|
|
||||||
SCAN_INTERVAL = timedelta(minutes=5)
|
SCAN_INTERVAL = timedelta(minutes=5)
|
||||||
|
MIN_TIME_BETWEEN_UPDATES = timedelta(minutes=5)
|
||||||
|
|
||||||
TRACKABLE_DOMAINS = ['device_tracker', 'sensor', 'zone']
|
TRACKABLE_DOMAINS = ['device_tracker', 'sensor', 'zone']
|
||||||
|
|
||||||
@ -67,7 +69,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||||||
sensor = WazeTravelTime(name, origin, destination, region,
|
sensor = WazeTravelTime(name, origin, destination, region,
|
||||||
incl_filter, excl_filter, realtime)
|
incl_filter, excl_filter, realtime)
|
||||||
|
|
||||||
add_entities([sensor])
|
add_entities([sensor], True)
|
||||||
|
|
||||||
# Wait until start event is sent to load this component.
|
# Wait until start event is sent to load this component.
|
||||||
hass.bus.listen_once(
|
hass.bus.listen_once(
|
||||||
@ -182,6 +184,7 @@ class WazeTravelTime(Entity):
|
|||||||
|
|
||||||
return friendly_name
|
return friendly_name
|
||||||
|
|
||||||
|
@Throttle(MIN_TIME_BETWEEN_UPDATES)
|
||||||
def update(self):
|
def update(self):
|
||||||
"""Fetch new state data for the sensor."""
|
"""Fetch new state data for the sensor."""
|
||||||
import WazeRouteCalculator
|
import WazeRouteCalculator
|
||||||
|
@ -4,10 +4,12 @@ Support for setting the Transmission BitTorrent client Turtle Mode.
|
|||||||
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/switch.transmission/
|
https://home-assistant.io/components/switch.transmission/
|
||||||
"""
|
"""
|
||||||
|
from datetime import timedelta
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from homeassistant.components.transmission import (
|
from homeassistant.components.transmission import (
|
||||||
DATA_TRANSMISSION, SCAN_INTERVAL)
|
DATA_TRANSMISSION)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
STATE_OFF, STATE_ON)
|
STATE_OFF, STATE_ON)
|
||||||
from homeassistant.helpers.entity import ToggleEntity
|
from homeassistant.helpers.entity import ToggleEntity
|
||||||
@ -19,6 +21,8 @@ _LOGGING = logging.getLogger(__name__)
|
|||||||
|
|
||||||
DEFAULT_NAME = 'Transmission Turtle Mode'
|
DEFAULT_NAME = 'Transmission Turtle Mode'
|
||||||
|
|
||||||
|
SCAN_INTERVAL = timedelta(seconds=120)
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the Transmission switch."""
|
"""Set up the Transmission switch."""
|
||||||
|
@ -15,7 +15,8 @@ from homeassistant.const import (
|
|||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
CONF_PASSWORD,
|
CONF_PASSWORD,
|
||||||
CONF_PORT,
|
CONF_PORT,
|
||||||
CONF_USERNAME
|
CONF_USERNAME,
|
||||||
|
CONF_SCAN_INTERVAL
|
||||||
)
|
)
|
||||||
from homeassistant.helpers import discovery, config_validation as cv
|
from homeassistant.helpers import discovery, config_validation as cv
|
||||||
from homeassistant.helpers.event import track_time_interval
|
from homeassistant.helpers.event import track_time_interval
|
||||||
@ -42,6 +43,8 @@ SENSOR_TYPES = {
|
|||||||
'started_torrents': ['Started Torrents', None],
|
'started_torrents': ['Started Torrents', None],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFAULT_SCAN_INTERVAL = timedelta(seconds=120)
|
||||||
|
|
||||||
CONFIG_SCHEMA = vol.Schema({
|
CONFIG_SCHEMA = vol.Schema({
|
||||||
DOMAIN: vol.Schema({
|
DOMAIN: vol.Schema({
|
||||||
vol.Required(CONF_HOST): cv.string,
|
vol.Required(CONF_HOST): cv.string,
|
||||||
@ -50,20 +53,21 @@ CONFIG_SCHEMA = vol.Schema({
|
|||||||
vol.Optional(CONF_PORT, default=DEFAULT_PORT): cv.port,
|
vol.Optional(CONF_PORT, default=DEFAULT_PORT): cv.port,
|
||||||
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
|
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
|
||||||
vol.Optional(TURTLE_MODE, default=False): cv.boolean,
|
vol.Optional(TURTLE_MODE, default=False): cv.boolean,
|
||||||
|
vol.Optional(CONF_SCAN_INTERVAL, default=DEFAULT_SCAN_INTERVAL):
|
||||||
|
cv.time_period,
|
||||||
vol.Optional(CONF_MONITORED_CONDITIONS, default=['current_status']):
|
vol.Optional(CONF_MONITORED_CONDITIONS, default=['current_status']):
|
||||||
vol.All(cv.ensure_list, [vol.In(SENSOR_TYPES)]),
|
vol.All(cv.ensure_list, [vol.In(SENSOR_TYPES)]),
|
||||||
})
|
})
|
||||||
}, extra=vol.ALLOW_EXTRA)
|
}, extra=vol.ALLOW_EXTRA)
|
||||||
|
|
||||||
SCAN_INTERVAL = timedelta(minutes=2)
|
|
||||||
|
|
||||||
|
|
||||||
def setup(hass, config):
|
def setup(hass, config):
|
||||||
"""Set up the Transmission Component."""
|
"""Set up the Transmission Component."""
|
||||||
host = config[DOMAIN][CONF_HOST]
|
host = config[DOMAIN][CONF_HOST]
|
||||||
username = config[DOMAIN][CONF_USERNAME]
|
username = config[DOMAIN].get(CONF_USERNAME)
|
||||||
password = config[DOMAIN][CONF_PASSWORD]
|
password = config[DOMAIN].get(CONF_PASSWORD)
|
||||||
port = config[DOMAIN][CONF_PORT]
|
port = config[DOMAIN][CONF_PORT]
|
||||||
|
scan_interval = config[DOMAIN][CONF_SCAN_INTERVAL]
|
||||||
|
|
||||||
import transmissionrpc
|
import transmissionrpc
|
||||||
from transmissionrpc.error import TransmissionError
|
from transmissionrpc.error import TransmissionError
|
||||||
@ -85,7 +89,7 @@ def setup(hass, config):
|
|||||||
"""Get the latest data from Transmission."""
|
"""Get the latest data from Transmission."""
|
||||||
tm_data.update()
|
tm_data.update()
|
||||||
|
|
||||||
track_time_interval(hass, refresh, SCAN_INTERVAL)
|
track_time_interval(hass, refresh, scan_interval)
|
||||||
|
|
||||||
sensorconfig = {
|
sensorconfig = {
|
||||||
'sensors': config[DOMAIN][CONF_MONITORED_CONDITIONS],
|
'sensors': config[DOMAIN][CONF_MONITORED_CONDITIONS],
|
||||||
|
@ -16,7 +16,7 @@ from homeassistant.helpers.discovery import async_load_platform
|
|||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
REQUIREMENTS = ['zm-py==0.3.1']
|
REQUIREMENTS = ['zm-py==0.3.3']
|
||||||
|
|
||||||
CONF_PATH_ZMS = 'path_zms'
|
CONF_PATH_ZMS = 'path_zms'
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"""Constants used by Home Assistant components."""
|
"""Constants used by Home Assistant components."""
|
||||||
MAJOR_VERSION = 0
|
MAJOR_VERSION = 0
|
||||||
MINOR_VERSION = 87
|
MINOR_VERSION = 87
|
||||||
PATCH_VERSION = '0'
|
PATCH_VERSION = '1'
|
||||||
__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)
|
||||||
|
@ -1792,4 +1792,4 @@ zigpy-xbee==0.1.1
|
|||||||
zigpy==0.2.0
|
zigpy==0.2.0
|
||||||
|
|
||||||
# homeassistant.components.zoneminder
|
# homeassistant.components.zoneminder
|
||||||
zm-py==0.3.1
|
zm-py==0.3.3
|
||||||
|
Loading…
x
Reference in New Issue
Block a user