mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
commit
e59eea3044
@ -97,12 +97,15 @@ async def async_send_changereport_message(
|
|||||||
_LOGGER.debug("Sent: %s", json.dumps(message_serialized))
|
_LOGGER.debug("Sent: %s", json.dumps(message_serialized))
|
||||||
_LOGGER.debug("Received (%s): %s", response.status, response_text)
|
_LOGGER.debug("Received (%s): %s", response.status, response_text)
|
||||||
|
|
||||||
if response.status == 202 and not invalidate_access_token:
|
if response.status == 202:
|
||||||
return
|
return
|
||||||
|
|
||||||
response_json = json.loads(response_text)
|
response_json = json.loads(response_text)
|
||||||
|
|
||||||
if response_json["payload"]["code"] == "INVALID_ACCESS_TOKEN_EXCEPTION":
|
if (
|
||||||
|
response_json["payload"]["code"] == "INVALID_ACCESS_TOKEN_EXCEPTION"
|
||||||
|
and not invalidate_access_token
|
||||||
|
):
|
||||||
config.async_invalidate_access_token()
|
config.async_invalidate_access_token()
|
||||||
return await async_send_changereport_message(
|
return await async_send_changereport_message(
|
||||||
hass, config, alexa_entity, invalidate_access_token=False
|
hass, config, alexa_entity, invalidate_access_token=False
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
},
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"step": {
|
"step": {
|
||||||
"async_step_deconz_devices": {
|
"deconz_devices": {
|
||||||
"data": {
|
"data": {
|
||||||
"allow_clip_sensor": "Allow deCONZ CLIP sensors",
|
"allow_clip_sensor": "Allow deCONZ CLIP sensors",
|
||||||
"allow_deconz_groups": "Allow deCONZ light groups"
|
"allow_deconz_groups": "Allow deCONZ light groups"
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
},
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"step": {
|
"step": {
|
||||||
"async_step_deconz_devices": {
|
"deconz_devices": {
|
||||||
"description": "Configure visibility of deCONZ device types",
|
"description": "Configure visibility of deCONZ device types",
|
||||||
"data": {
|
"data": {
|
||||||
"allow_clip_sensor": "Allow deCONZ CLIP sensors",
|
"allow_clip_sensor": "Allow deCONZ CLIP sensors",
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"name": "Harmony",
|
"name": "Harmony",
|
||||||
"documentation": "https://www.home-assistant.io/components/harmony",
|
"documentation": "https://www.home-assistant.io/components/harmony",
|
||||||
"requirements": [
|
"requirements": [
|
||||||
"aioharmony==0.1.11"
|
"aioharmony==0.1.13"
|
||||||
],
|
],
|
||||||
"dependencies": [],
|
"dependencies": [],
|
||||||
"codeowners": [
|
"codeowners": [
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"name": "Isy994",
|
"name": "Isy994",
|
||||||
"documentation": "https://www.home-assistant.io/components/isy994",
|
"documentation": "https://www.home-assistant.io/components/isy994",
|
||||||
"requirements": [
|
"requirements": [
|
||||||
"PyISY==1.1.1"
|
"PyISY==1.1.2"
|
||||||
],
|
],
|
||||||
"dependencies": [],
|
"dependencies": [],
|
||||||
"codeowners": []
|
"codeowners": []
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"config": {
|
"config": {
|
||||||
"error": {
|
"error": {
|
||||||
"name_exists": "Name already exists"
|
"name_exists": "Location already exists"
|
||||||
},
|
},
|
||||||
"step": {
|
"step": {
|
||||||
"user": {
|
"user": {
|
||||||
|
@ -12,9 +12,15 @@ from .const import DOMAIN, HOME_LOCATION_NAME, CONF_TRACK_HOME
|
|||||||
@callback
|
@callback
|
||||||
def configured_instances(hass):
|
def configured_instances(hass):
|
||||||
"""Return a set of configured SimpliSafe instances."""
|
"""Return a set of configured SimpliSafe instances."""
|
||||||
return set(
|
entites = []
|
||||||
entry.data[CONF_NAME] for entry in hass.config_entries.async_entries(DOMAIN)
|
for entry in hass.config_entries.async_entries(DOMAIN):
|
||||||
)
|
if entry.data.get("track_home"):
|
||||||
|
entites.append("home")
|
||||||
|
continue
|
||||||
|
entites.append(
|
||||||
|
f"{entry.data.get(CONF_LATITUDE)}-{entry.data.get(CONF_LONGITUDE)}"
|
||||||
|
)
|
||||||
|
return set(entites)
|
||||||
|
|
||||||
|
|
||||||
class MetFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
class MetFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
@ -32,11 +38,13 @@ class MetFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
self._errors = {}
|
self._errors = {}
|
||||||
|
|
||||||
if user_input is not None:
|
if user_input is not None:
|
||||||
if user_input[CONF_NAME] not in configured_instances(self.hass):
|
if (
|
||||||
|
f"{user_input.get(CONF_LATITUDE)}-{user_input.get(CONF_LONGITUDE)}"
|
||||||
|
not in configured_instances(self.hass)
|
||||||
|
):
|
||||||
return self.async_create_entry(
|
return self.async_create_entry(
|
||||||
title=user_input[CONF_NAME], data=user_input
|
title=user_input[CONF_NAME], data=user_input
|
||||||
)
|
)
|
||||||
|
|
||||||
self._errors[CONF_NAME] = "name_exists"
|
self._errors[CONF_NAME] = "name_exists"
|
||||||
|
|
||||||
return await self._show_config_form(
|
return await self._show_config_form(
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"error": {
|
"error": {
|
||||||
"name_exists": "Name already exists"
|
"name_exists": "Location already exists"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -337,8 +337,16 @@ class SonosEntity(MediaPlayerDevice):
|
|||||||
async def async_added_to_hass(self):
|
async def async_added_to_hass(self):
|
||||||
"""Subscribe sonos events."""
|
"""Subscribe sonos events."""
|
||||||
await self.async_seen()
|
await self.async_seen()
|
||||||
|
|
||||||
self.hass.data[DATA_SONOS].entities.append(self)
|
self.hass.data[DATA_SONOS].entities.append(self)
|
||||||
|
|
||||||
|
def _rebuild_groups():
|
||||||
|
"""Build the current group topology."""
|
||||||
|
for entity in self.hass.data[DATA_SONOS].entities:
|
||||||
|
entity.update_groups()
|
||||||
|
|
||||||
|
self.hass.async_add_executor_job(_rebuild_groups)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def unique_id(self):
|
def unique_id(self):
|
||||||
"""Return a unique ID."""
|
"""Return a unique ID."""
|
||||||
@ -469,10 +477,6 @@ class SonosEntity(MediaPlayerDevice):
|
|||||||
self.update_volume()
|
self.update_volume()
|
||||||
self._set_favorites()
|
self._set_favorites()
|
||||||
|
|
||||||
# New player available, build the current group topology
|
|
||||||
for entity in self.hass.data[DATA_SONOS].entities:
|
|
||||||
entity.update_groups()
|
|
||||||
|
|
||||||
player = self.soco
|
player = self.soco
|
||||||
|
|
||||||
def subscribe(service, action):
|
def subscribe(service, action):
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"name": "Version",
|
"name": "Version",
|
||||||
"documentation": "https://www.home-assistant.io/components/version",
|
"documentation": "https://www.home-assistant.io/components/version",
|
||||||
"requirements": [
|
"requirements": [
|
||||||
"pyhaversion==3.0.2"
|
"pyhaversion==3.1.0"
|
||||||
],
|
],
|
||||||
"dependencies": [],
|
"dependencies": [],
|
||||||
"codeowners": [
|
"codeowners": [
|
||||||
|
@ -28,7 +28,7 @@ ALL_IMAGES = [
|
|||||||
"odroid-c2",
|
"odroid-c2",
|
||||||
"odroid-xu",
|
"odroid-xu",
|
||||||
]
|
]
|
||||||
ALL_SOURCES = ["local", "pypi", "hassio", "docker"]
|
ALL_SOURCES = ["local", "pypi", "hassio", "docker", "haio"]
|
||||||
|
|
||||||
CONF_BETA = "beta"
|
CONF_BETA = "beta"
|
||||||
CONF_IMAGE = "image"
|
CONF_IMAGE = "image"
|
||||||
@ -54,7 +54,13 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
|||||||
|
|
||||||
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
|
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
|
||||||
"""Set up the Version sensor platform."""
|
"""Set up the Version sensor platform."""
|
||||||
from pyhaversion import LocalVersion, DockerVersion, HassioVersion, PyPiVersion
|
from pyhaversion import (
|
||||||
|
LocalVersion,
|
||||||
|
DockerVersion,
|
||||||
|
HassioVersion,
|
||||||
|
PyPiVersion,
|
||||||
|
HaIoVersion,
|
||||||
|
)
|
||||||
|
|
||||||
beta = config.get(CONF_BETA)
|
beta = config.get(CONF_BETA)
|
||||||
image = config.get(CONF_IMAGE)
|
image = config.get(CONF_IMAGE)
|
||||||
@ -74,6 +80,8 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||||||
haversion = VersionData(HassioVersion(hass.loop, session, branch, image))
|
haversion = VersionData(HassioVersion(hass.loop, session, branch, image))
|
||||||
elif source == "docker":
|
elif source == "docker":
|
||||||
haversion = VersionData(DockerVersion(hass.loop, session, branch, image))
|
haversion = VersionData(DockerVersion(hass.loop, session, branch, image))
|
||||||
|
elif source == "haio":
|
||||||
|
haversion = VersionData(HaIoVersion(hass.loop, session))
|
||||||
else:
|
else:
|
||||||
haversion = VersionData(LocalVersion(hass.loop, session))
|
haversion = VersionData(LocalVersion(hass.loop, session))
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ from homeassistant.const import (
|
|||||||
EVENT_SERVICE_REMOVED,
|
EVENT_SERVICE_REMOVED,
|
||||||
EVENT_STATE_CHANGED,
|
EVENT_STATE_CHANGED,
|
||||||
EVENT_THEMES_UPDATED,
|
EVENT_THEMES_UPDATED,
|
||||||
|
EVENT_CORE_CONFIG_UPDATE,
|
||||||
)
|
)
|
||||||
from homeassistant.components.persistent_notification import (
|
from homeassistant.components.persistent_notification import (
|
||||||
EVENT_PERSISTENT_NOTIFICATIONS_UPDATED,
|
EVENT_PERSISTENT_NOTIFICATIONS_UPDATED,
|
||||||
@ -22,6 +23,7 @@ from homeassistant.components.frontend import EVENT_PANELS_UPDATED
|
|||||||
# Except for state_changed, which is handled accordingly.
|
# Except for state_changed, which is handled accordingly.
|
||||||
SUBSCRIBE_WHITELIST = {
|
SUBSCRIBE_WHITELIST = {
|
||||||
EVENT_COMPONENT_LOADED,
|
EVENT_COMPONENT_LOADED,
|
||||||
|
EVENT_CORE_CONFIG_UPDATE,
|
||||||
EVENT_PANELS_UPDATED,
|
EVENT_PANELS_UPDATED,
|
||||||
EVENT_PERSISTENT_NOTIFICATIONS_UPDATED,
|
EVENT_PERSISTENT_NOTIFICATIONS_UPDATED,
|
||||||
EVENT_SERVICE_REGISTERED,
|
EVENT_SERVICE_REGISTERED,
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"""Constants used by Home Assistant components."""
|
"""Constants used by Home Assistant components."""
|
||||||
MAJOR_VERSION = 0
|
MAJOR_VERSION = 0
|
||||||
MINOR_VERSION = 98
|
MINOR_VERSION = 98
|
||||||
PATCH_VERSION = "2"
|
PATCH_VERSION = "3"
|
||||||
__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, 0)
|
REQUIRED_PYTHON_VER = (3, 6, 0)
|
||||||
|
@ -50,7 +50,7 @@ PyEssent==0.13
|
|||||||
PyGithub==1.43.5
|
PyGithub==1.43.5
|
||||||
|
|
||||||
# homeassistant.components.isy994
|
# homeassistant.components.isy994
|
||||||
PyISY==1.1.1
|
PyISY==1.1.2
|
||||||
|
|
||||||
# homeassistant.components.mvglive
|
# homeassistant.components.mvglive
|
||||||
PyMVGLive==1.1.4
|
PyMVGLive==1.1.4
|
||||||
@ -142,7 +142,7 @@ aiofreepybox==0.0.8
|
|||||||
aioftp==0.12.0
|
aioftp==0.12.0
|
||||||
|
|
||||||
# homeassistant.components.harmony
|
# homeassistant.components.harmony
|
||||||
aioharmony==0.1.11
|
aioharmony==0.1.13
|
||||||
|
|
||||||
# homeassistant.components.emulated_hue
|
# homeassistant.components.emulated_hue
|
||||||
# homeassistant.components.http
|
# homeassistant.components.http
|
||||||
@ -1186,7 +1186,7 @@ pygtfs==0.1.5
|
|||||||
pygtt==1.1.2
|
pygtt==1.1.2
|
||||||
|
|
||||||
# homeassistant.components.version
|
# homeassistant.components.version
|
||||||
pyhaversion==3.0.2
|
pyhaversion==3.1.0
|
||||||
|
|
||||||
# homeassistant.components.heos
|
# homeassistant.components.heos
|
||||||
pyheos==0.6.0
|
pyheos==0.6.0
|
||||||
|
@ -5,7 +5,7 @@ from . import TEST_URL, DEFAULT_CONFIG
|
|||||||
|
|
||||||
async def test_report_state(hass, aioclient_mock):
|
async def test_report_state(hass, aioclient_mock):
|
||||||
"""Test proactive state reports."""
|
"""Test proactive state reports."""
|
||||||
aioclient_mock.post(TEST_URL, json={"data": "is irrelevant"}, status=202)
|
aioclient_mock.post(TEST_URL, text="", status=202)
|
||||||
|
|
||||||
hass.states.async_set(
|
hass.states.async_set(
|
||||||
"binary_sensor.test_contact",
|
"binary_sensor.test_contact",
|
||||||
@ -39,7 +39,7 @@ async def test_report_state(hass, aioclient_mock):
|
|||||||
|
|
||||||
async def test_send_add_or_update_message(hass, aioclient_mock):
|
async def test_send_add_or_update_message(hass, aioclient_mock):
|
||||||
"""Test sending an AddOrUpdateReport message."""
|
"""Test sending an AddOrUpdateReport message."""
|
||||||
aioclient_mock.post(TEST_URL, json={"data": "is irrelevant"})
|
aioclient_mock.post(TEST_URL, text="")
|
||||||
|
|
||||||
hass.states.async_set(
|
hass.states.async_set(
|
||||||
"binary_sensor.test_contact",
|
"binary_sensor.test_contact",
|
||||||
|
@ -102,7 +102,7 @@ async def test_flow_entry_created_from_user_input():
|
|||||||
async def test_flow_entry_config_entry_already_exists():
|
async def test_flow_entry_config_entry_already_exists():
|
||||||
"""Test that create data from user input and config_entry already exists.
|
"""Test that create data from user input and config_entry already exists.
|
||||||
|
|
||||||
Test when the form should show when user puts existing name
|
Test when the form should show when user puts existing location
|
||||||
in the config gui. Then the form should show with error
|
in the config gui. Then the form should show with error
|
||||||
"""
|
"""
|
||||||
hass = Mock()
|
hass = Mock()
|
||||||
@ -112,6 +112,8 @@ async def test_flow_entry_config_entry_already_exists():
|
|||||||
|
|
||||||
first_entry = MockConfigEntry(domain="met")
|
first_entry = MockConfigEntry(domain="met")
|
||||||
first_entry.data["name"] = "home"
|
first_entry.data["name"] = "home"
|
||||||
|
first_entry.data[CONF_LONGITUDE] = "0"
|
||||||
|
first_entry.data[CONF_LATITUDE] = "0"
|
||||||
first_entry.add_to_hass(hass)
|
first_entry.add_to_hass(hass)
|
||||||
|
|
||||||
test_data = {
|
test_data = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user