mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 11:47:06 +00:00
commit
cbf65220aa
@ -18,7 +18,7 @@ from homeassistant.const import (
|
|||||||
from homeassistant.helpers import discovery
|
from homeassistant.helpers import discovery
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
REQUIREMENTS = ['amcrest==1.2.0']
|
REQUIREMENTS = ['amcrest==1.2.1']
|
||||||
DEPENDENCIES = ['ffmpeg']
|
DEPENDENCIES = ['ffmpeg']
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
@ -18,7 +18,7 @@ from homeassistant.components.discovery import SERVICE_APPLE_TV
|
|||||||
from homeassistant.loader import get_component
|
from homeassistant.loader import get_component
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
REQUIREMENTS = ['pyatv==0.3.2']
|
REQUIREMENTS = ['pyatv==0.3.4']
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -62,6 +62,7 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None):
|
|||||||
entity[CONF_COMMAND_ON],
|
entity[CONF_COMMAND_ON],
|
||||||
entity[CONF_COMMAND_OFF])
|
entity[CONF_COMMAND_OFF])
|
||||||
device.hass = hass
|
device.hass = hass
|
||||||
|
device.is_lighting4 = (packet_id[2:4] == '13')
|
||||||
sensors.append(device)
|
sensors.append(device)
|
||||||
rfxtrx.RFX_DEVICES[device_id] = device
|
rfxtrx.RFX_DEVICES[device_id] = device
|
||||||
|
|
||||||
@ -94,6 +95,8 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None):
|
|||||||
|
|
||||||
pkt_id = "".join("{0:02x}".format(x) for x in event.data)
|
pkt_id = "".join("{0:02x}".format(x) for x in event.data)
|
||||||
sensor = RfxtrxBinarySensor(event, pkt_id)
|
sensor = RfxtrxBinarySensor(event, pkt_id)
|
||||||
|
sensor.hass = hass
|
||||||
|
sensor.is_lighting4 = (pkt_id[2:4] == '13')
|
||||||
rfxtrx.RFX_DEVICES[device_id] = sensor
|
rfxtrx.RFX_DEVICES[device_id] = sensor
|
||||||
add_devices_callback([sensor])
|
add_devices_callback([sensor])
|
||||||
_LOGGER.info("Added binary sensor %s "
|
_LOGGER.info("Added binary sensor %s "
|
||||||
@ -111,12 +114,12 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None):
|
|||||||
slugify(event.device.id_string.lower()),
|
slugify(event.device.id_string.lower()),
|
||||||
event.device.__class__.__name__,
|
event.device.__class__.__name__,
|
||||||
event.device.subtype)
|
event.device.subtype)
|
||||||
|
if sensor.is_lighting4:
|
||||||
if sensor.is_pt2262:
|
if sensor.data_bits is not None:
|
||||||
cmd = rfxtrx.get_pt2262_cmd(device_id, sensor.data_bits)
|
cmd = rfxtrx.get_pt2262_cmd(device_id, sensor.data_bits)
|
||||||
_LOGGER.info("applying cmd %s to device_id: %s)",
|
sensor.apply_cmd(int(cmd, 16))
|
||||||
cmd, sensor.masked_id)
|
else:
|
||||||
sensor.apply_cmd(int(cmd, 16))
|
sensor.update_state(True)
|
||||||
else:
|
else:
|
||||||
rfxtrx.apply_received_command(event)
|
rfxtrx.apply_received_command(event)
|
||||||
|
|
||||||
@ -151,6 +154,7 @@ class RfxtrxBinarySensor(BinarySensorDevice):
|
|||||||
self._device_class = device_class
|
self._device_class = device_class
|
||||||
self._off_delay = off_delay
|
self._off_delay = off_delay
|
||||||
self._state = False
|
self._state = False
|
||||||
|
self.is_lighting4 = False
|
||||||
self.delay_listener = None
|
self.delay_listener = None
|
||||||
self._data_bits = data_bits
|
self._data_bits = data_bits
|
||||||
self._cmd_on = cmd_on
|
self._cmd_on = cmd_on
|
||||||
@ -170,11 +174,6 @@ class RfxtrxBinarySensor(BinarySensorDevice):
|
|||||||
"""Return the device name."""
|
"""Return the device name."""
|
||||||
return self._name
|
return self._name
|
||||||
|
|
||||||
@property
|
|
||||||
def is_pt2262(self):
|
|
||||||
"""Return true if the device is PT2262-based."""
|
|
||||||
return self._data_bits is not None
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def masked_id(self):
|
def masked_id(self):
|
||||||
"""Return the masked device id (isolated address bits)."""
|
"""Return the masked device id (isolated address bits)."""
|
||||||
|
@ -273,31 +273,38 @@ class TadoClimate(ClimateDevice):
|
|||||||
else:
|
else:
|
||||||
self._device_is_active = True
|
self._device_is_active = True
|
||||||
|
|
||||||
|
overlay = False
|
||||||
|
overlay_data = None
|
||||||
|
termination = self._current_operation
|
||||||
|
cooling = False
|
||||||
|
fan_speed = CONST_MODE_OFF
|
||||||
|
|
||||||
|
if 'overlay' in data:
|
||||||
|
overlay_data = data['overlay']
|
||||||
|
overlay = overlay_data is not None
|
||||||
|
|
||||||
|
if overlay:
|
||||||
|
termination = overlay_data['termination']['type']
|
||||||
|
|
||||||
|
if 'setting' in overlay_data:
|
||||||
|
setting_data = overlay_data['setting']
|
||||||
|
setting = setting is not None
|
||||||
|
|
||||||
|
if setting:
|
||||||
|
if 'mode' in setting_data:
|
||||||
|
cooling = setting_data['mode'] == 'COOL'
|
||||||
|
|
||||||
|
if 'fanSpeed' in setting_data:
|
||||||
|
fan_speed = setting_data['fanSpeed']
|
||||||
|
|
||||||
if self._device_is_active:
|
if self._device_is_active:
|
||||||
overlay = False
|
|
||||||
overlay_data = None
|
|
||||||
termination = self._current_operation
|
|
||||||
cooling = False
|
|
||||||
fan_speed = CONST_MODE_OFF
|
|
||||||
|
|
||||||
if 'overlay' in data:
|
|
||||||
overlay_data = data['overlay']
|
|
||||||
overlay = overlay_data is not None
|
|
||||||
|
|
||||||
if overlay:
|
|
||||||
termination = overlay_data['termination']['type']
|
|
||||||
|
|
||||||
if 'setting' in overlay_data:
|
|
||||||
cooling = overlay_data['setting']['mode'] == 'COOL'
|
|
||||||
fan_speed = overlay_data['setting']['fanSpeed']
|
|
||||||
|
|
||||||
# If you set mode manualy to off, there will be an overlay
|
# If you set mode manualy to off, there will be an overlay
|
||||||
# and a termination, but we want to see the mode "OFF"
|
# and a termination, but we want to see the mode "OFF"
|
||||||
|
|
||||||
self._overlay_mode = termination
|
self._overlay_mode = termination
|
||||||
self._current_operation = termination
|
self._current_operation = termination
|
||||||
self._cooling = cooling
|
|
||||||
self._current_fan = fan_speed
|
self._cooling = cooling
|
||||||
|
self._current_fan = fan_speed
|
||||||
|
|
||||||
def _control_heating(self):
|
def _control_heating(self):
|
||||||
"""Send new target temperature to mytado."""
|
"""Send new target temperature to mytado."""
|
||||||
|
@ -391,7 +391,8 @@ class Tplink5DeviceScanner(TplinkDeviceScanner):
|
|||||||
"Cache-Control": "no-cache"
|
"Cache-Control": "no-cache"
|
||||||
}
|
}
|
||||||
|
|
||||||
password_md5 = hashlib.md5(self.password).hexdigest().upper()
|
password_md5 = hashlib.md5(
|
||||||
|
self.password.encode('utf')).hexdigest().upper()
|
||||||
|
|
||||||
# create a session to handle cookie easier
|
# create a session to handle cookie easier
|
||||||
session = requests.session()
|
session = requests.session()
|
||||||
|
@ -115,8 +115,8 @@ class UbusDeviceScanner(DeviceScanner):
|
|||||||
|
|
||||||
return self.mac2name.get(device.upper(), None)
|
return self.mac2name.get(device.upper(), None)
|
||||||
|
|
||||||
@Throttle(MIN_TIME_BETWEEN_SCANS)
|
|
||||||
@_refresh_on_acccess_denied
|
@_refresh_on_acccess_denied
|
||||||
|
@Throttle(MIN_TIME_BETWEEN_SCANS)
|
||||||
def _update_info(self):
|
def _update_info(self):
|
||||||
"""Ensure the information from the Luci router is up to date.
|
"""Ensure the information from the Luci router is up to date.
|
||||||
|
|
||||||
|
@ -19,6 +19,8 @@ REQUIREMENTS = ['face_recognition==0.2.0']
|
|||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
ATTR_LOCATION = 'location'
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
"""Set up the Dlib Face detection platform."""
|
"""Set up the Dlib Face detection platform."""
|
||||||
@ -68,4 +70,7 @@ class DlibFaceDetectEntity(ImageProcessingFaceEntity):
|
|||||||
image = face_recognition.load_image_file(fak_file)
|
image = face_recognition.load_image_file(fak_file)
|
||||||
face_locations = face_recognition.face_locations(image)
|
face_locations = face_recognition.face_locations(image)
|
||||||
|
|
||||||
|
face_locations = [{ATTR_LOCATION: location}
|
||||||
|
for location in face_locations]
|
||||||
|
|
||||||
self.process_faces(face_locations, len(face_locations))
|
self.process_faces(face_locations, len(face_locations))
|
||||||
|
@ -94,20 +94,25 @@ class KeyboardRemote(threading.Thread):
|
|||||||
if self.dev is not None:
|
if self.dev is not None:
|
||||||
_LOGGER.debug("Keyboard connected, %s", self.device_id)
|
_LOGGER.debug("Keyboard connected, %s", self.device_id)
|
||||||
else:
|
else:
|
||||||
id_folder = '/dev/input/by-id/'
|
|
||||||
device_names = [InputDevice(file_name).name
|
|
||||||
for file_name in list_devices()]
|
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
'Keyboard not connected, %s.\n\
|
'Keyboard not connected, %s.\n\
|
||||||
Check /dev/input/event* permissions.\
|
Check /dev/input/event* permissions.',
|
||||||
Possible device names are:\n %s.\n \
|
self.device_id
|
||||||
Possible device descriptors are %s:\n %s',
|
|
||||||
self.device_id,
|
|
||||||
device_names,
|
|
||||||
id_folder,
|
|
||||||
os.listdir(id_folder)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
id_folder = '/dev/input/by-id/'
|
||||||
|
|
||||||
|
if os.path.isdir(id_folder):
|
||||||
|
device_names = [InputDevice(file_name).name
|
||||||
|
for file_name in list_devices()]
|
||||||
|
_LOGGER.debug(
|
||||||
|
'Possible device names are:\n %s.\n \
|
||||||
|
Possible device descriptors are %s:\n %s',
|
||||||
|
device_names,
|
||||||
|
id_folder,
|
||||||
|
os.listdir(id_folder)
|
||||||
|
)
|
||||||
|
|
||||||
threading.Thread.__init__(self)
|
threading.Thread.__init__(self)
|
||||||
self.stopped = threading.Event()
|
self.stopped = threading.Event()
|
||||||
self.hass = hass
|
self.hass = hass
|
||||||
|
@ -159,12 +159,18 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
|||||||
|
|
||||||
def lifxwhite(device):
|
def lifxwhite(device):
|
||||||
"""Return whether this is a white-only bulb."""
|
"""Return whether this is a white-only bulb."""
|
||||||
return not aiolifx().products.features_map[device.product]["color"]
|
features = aiolifx().products.features_map.get(device.product, None)
|
||||||
|
if features:
|
||||||
|
return not features["color"]
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
def lifxmultizone(device):
|
def lifxmultizone(device):
|
||||||
"""Return whether this is a multizone bulb/strip."""
|
"""Return whether this is a multizone bulb/strip."""
|
||||||
return aiolifx().products.features_map[device.product]["multizone"]
|
features = aiolifx().products.features_map.get(device.product, None)
|
||||||
|
if features:
|
||||||
|
return features["multizone"]
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
def find_hsbk(**kwargs):
|
def find_hsbk(**kwargs):
|
||||||
|
@ -17,6 +17,7 @@ from homeassistant.const import (CONF_DOMAINS, CONF_ENTITIES, CONF_EXCLUDE,
|
|||||||
TEMP_CELSIUS, TEMP_FAHRENHEIT)
|
TEMP_CELSIUS, TEMP_FAHRENHEIT)
|
||||||
from homeassistant import core as hacore
|
from homeassistant import core as hacore
|
||||||
from homeassistant.helpers import state as state_helper
|
from homeassistant.helpers import state as state_helper
|
||||||
|
from homeassistant.util.temperature import fahrenheit_to_celsius
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -198,6 +199,8 @@ class Metrics:
|
|||||||
metric = self._metric(*metric)
|
metric = self._metric(*metric)
|
||||||
try:
|
try:
|
||||||
value = state_helper.state_as_number(state)
|
value = state_helper.state_as_number(state)
|
||||||
|
if unit == TEMP_FAHRENHEIT:
|
||||||
|
value = fahrenheit_to_celsius(value)
|
||||||
metric.labels(**self._labels(state)).set(value)
|
metric.labels(**self._labels(state)).set(value)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
@ -213,6 +216,9 @@ class Metrics:
|
|||||||
value = state_helper.state_as_number(state)
|
value = state_helper.state_as_number(state)
|
||||||
metric.labels(**self._labels(state)).set(value)
|
metric.labels(**self._labels(state)).set(value)
|
||||||
|
|
||||||
|
def _handle_zwave(self, state):
|
||||||
|
self._battery(state)
|
||||||
|
|
||||||
|
|
||||||
class PrometheusView(HomeAssistantView):
|
class PrometheusView(HomeAssistantView):
|
||||||
"""Handle Prometheus requests."""
|
"""Handle Prometheus requests."""
|
||||||
|
@ -44,6 +44,11 @@ class AppleTVRemote(remote.RemoteDevice):
|
|||||||
"""Return the name of the device."""
|
"""Return the name of the device."""
|
||||||
return self._name
|
return self._name
|
||||||
|
|
||||||
|
@property
|
||||||
|
def unique_id(self):
|
||||||
|
"""Return an unique ID."""
|
||||||
|
return self._atv.metadata.device_id
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_on(self):
|
def is_on(self):
|
||||||
"""Return true if device is on."""
|
"""Return true if device is on."""
|
||||||
|
@ -247,10 +247,8 @@ def get_pt2262_device(device_id):
|
|||||||
"""Look for the device which id matches the given device_id parameter."""
|
"""Look for the device which id matches the given device_id parameter."""
|
||||||
for dev_id, device in RFX_DEVICES.items():
|
for dev_id, device in RFX_DEVICES.items():
|
||||||
try:
|
try:
|
||||||
if (device.is_pt2262 and
|
if device.masked_id == get_pt2262_deviceid(device_id,
|
||||||
device.masked_id == get_pt2262_deviceid(
|
device.data_bits):
|
||||||
device_id,
|
|
||||||
device.data_bits)):
|
|
||||||
_LOGGER.info("rfxtrx: found matching device %s for %s",
|
_LOGGER.info("rfxtrx: found matching device %s for %s",
|
||||||
device_id,
|
device_id,
|
||||||
get_pt2262_deviceid(device_id, device.data_bits))
|
get_pt2262_deviceid(device_id, device.data_bits))
|
||||||
@ -414,11 +412,6 @@ class RfxtrxDevice(Entity):
|
|||||||
"""Return is the device must fire event."""
|
"""Return is the device must fire event."""
|
||||||
return self._should_fire_event
|
return self._should_fire_event
|
||||||
|
|
||||||
@property
|
|
||||||
def is_pt2262(self):
|
|
||||||
"""Return true if the device is PT2262-based."""
|
|
||||||
return False
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_on(self):
|
def is_on(self):
|
||||||
"""Return true if device is on."""
|
"""Return true if device is on."""
|
||||||
|
@ -84,7 +84,7 @@ STATION_SCHEMA = vol.Schema({
|
|||||||
vol.Required(ATTR_FREE_BIKES): cv.positive_int,
|
vol.Required(ATTR_FREE_BIKES): cv.positive_int,
|
||||||
vol.Required(ATTR_EMPTY_SLOTS): cv.positive_int,
|
vol.Required(ATTR_EMPTY_SLOTS): cv.positive_int,
|
||||||
vol.Required(ATTR_LATITUDE): cv.latitude,
|
vol.Required(ATTR_LATITUDE): cv.latitude,
|
||||||
vol.Required(ATTR_LONGITUDE): cv.latitude,
|
vol.Required(ATTR_LONGITUDE): cv.longitude,
|
||||||
vol.Required(ATTR_ID): cv.string,
|
vol.Required(ATTR_ID): cv.string,
|
||||||
vol.Required(ATTR_NAME): cv.string,
|
vol.Required(ATTR_NAME): cv.string,
|
||||||
vol.Required(ATTR_TIMESTAMP): cv.string,
|
vol.Required(ATTR_TIMESTAMP): cv.string,
|
||||||
|
@ -15,6 +15,7 @@ from homeassistant.components.switch import DOMAIN, SwitchDevice
|
|||||||
from homeassistant.const import CONF_NAME, CONF_PLATFORM
|
from homeassistant.const import CONF_NAME, CONF_PLATFORM
|
||||||
from homeassistant.helpers.event import track_time_change
|
from homeassistant.helpers.event import track_time_change
|
||||||
from homeassistant.helpers.sun import get_astral_event_date
|
from homeassistant.helpers.sun import get_astral_event_date
|
||||||
|
from homeassistant.util import slugify
|
||||||
from homeassistant.util.color import (
|
from homeassistant.util.color import (
|
||||||
color_temperature_to_rgb, color_RGB_to_xy,
|
color_temperature_to_rgb, color_RGB_to_xy,
|
||||||
color_temperature_kelvin_to_mired)
|
color_temperature_kelvin_to_mired)
|
||||||
@ -111,7 +112,8 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
"""Update lights."""
|
"""Update lights."""
|
||||||
flux.flux_update()
|
flux.flux_update()
|
||||||
|
|
||||||
hass.services.register(DOMAIN, name + '_update', update)
|
service_name = slugify("{} {}".format(name, 'update'))
|
||||||
|
hass.services.register(DOMAIN, service_name, update)
|
||||||
|
|
||||||
|
|
||||||
class FluxSwitch(SwitchDevice):
|
class FluxSwitch(SwitchDevice):
|
||||||
|
@ -581,6 +581,8 @@ class BaseTelegramBotEntity:
|
|||||||
data[ATTR_FROM_LAST] = msg_data['from']['last_name']
|
data[ATTR_FROM_LAST] = msg_data['from']['last_name']
|
||||||
if 'chat' in msg_data:
|
if 'chat' in msg_data:
|
||||||
data[ATTR_CHAT_ID] = msg_data['chat']['id']
|
data[ATTR_CHAT_ID] = msg_data['chat']['id']
|
||||||
|
elif ATTR_MESSAGE in msg_data and 'chat' in msg_data[ATTR_MESSAGE]:
|
||||||
|
data[ATTR_CHAT_ID] = msg_data[ATTR_MESSAGE]['chat']['id']
|
||||||
|
|
||||||
return True, data
|
return True, data
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ from homeassistant import const as ha_const
|
|||||||
from homeassistant.helpers import discovery, entity
|
from homeassistant.helpers import discovery, entity
|
||||||
from homeassistant.util import slugify
|
from homeassistant.util import slugify
|
||||||
|
|
||||||
REQUIREMENTS = ['bellows==0.3.2']
|
REQUIREMENTS = ['bellows==0.3.4']
|
||||||
|
|
||||||
DOMAIN = 'zha'
|
DOMAIN = 'zha'
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"""Constants used by Home Assistant components."""
|
"""Constants used by Home Assistant components."""
|
||||||
MAJOR_VERSION = 0
|
MAJOR_VERSION = 0
|
||||||
MINOR_VERSION = 49
|
MINOR_VERSION = 49
|
||||||
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, 4, 2)
|
REQUIRED_PYTHON_VER = (3, 4, 2)
|
||||||
|
@ -61,7 +61,7 @@ aiopvapi==1.4
|
|||||||
alarmdecoder==0.12.1.0
|
alarmdecoder==0.12.1.0
|
||||||
|
|
||||||
# homeassistant.components.amcrest
|
# homeassistant.components.amcrest
|
||||||
amcrest==1.2.0
|
amcrest==1.2.1
|
||||||
|
|
||||||
# homeassistant.components.media_player.anthemav
|
# homeassistant.components.media_player.anthemav
|
||||||
anthemav==1.1.8
|
anthemav==1.1.8
|
||||||
@ -92,7 +92,7 @@ batinfo==0.4.2
|
|||||||
beautifulsoup4==4.6.0
|
beautifulsoup4==4.6.0
|
||||||
|
|
||||||
# homeassistant.components.zha
|
# homeassistant.components.zha
|
||||||
bellows==0.3.2
|
bellows==0.3.4
|
||||||
|
|
||||||
# homeassistant.components.blink
|
# homeassistant.components.blink
|
||||||
blinkpy==0.6.0
|
blinkpy==0.6.0
|
||||||
@ -519,7 +519,7 @@ pyasn1-modules==0.0.9
|
|||||||
pyasn1==0.2.3
|
pyasn1==0.2.3
|
||||||
|
|
||||||
# homeassistant.components.apple_tv
|
# homeassistant.components.apple_tv
|
||||||
pyatv==0.3.2
|
pyatv==0.3.4
|
||||||
|
|
||||||
# homeassistant.components.device_tracker.bbox
|
# homeassistant.components.device_tracker.bbox
|
||||||
# homeassistant.components.sensor.bbox
|
# homeassistant.components.sensor.bbox
|
||||||
|
Loading…
x
Reference in New Issue
Block a user