Compare commits

...

10 Commits

Author SHA1 Message Date
Franck Nijhof
2063dbf00d Bumped version to 2023.3.0b3 2023-02-25 12:07:47 +01:00
Joakim Sørensen
91a03ab83d Remove homeassistant_hardware after dependency from zha (#88751) 2023-02-25 12:07:25 +01:00
J. Nick Koston
ed8f538890 Prevent new discovery flows from being created when stopping (#88743) 2023-02-25 12:07:22 +01:00
J. Nick Koston
6196607c5d Make hass.async_stop an untracked task (#88738) 2023-02-25 12:07:19 +01:00
J. Nick Koston
833ccafb76 Log futures that are blocking shutdown stages (#88736) 2023-02-25 12:07:15 +01:00
mkmer
ca539d0a09 Add missing reauth strings to Honeywell (#88733)
Add missing reauth strings
2023-02-25 12:07:12 +01:00
Austin Mroczek
0e3e954000 Bump total_connect_client to v2023.2 (#88729)
* bump total_connect_client to v2023.2

* Trigger Build
2023-02-25 12:07:09 +01:00
avee87
4ef96c76e4 Fix log message in recorder on total_increasing reset (#88710) 2023-02-25 12:07:05 +01:00
Álvaro Fernández Rojas
d5b0c1faa0 Update aioqsw v0.3.2 (#88695)
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-02-25 12:07:02 +01:00
Arturo
2405908cdd Fix matter light color capabilities bit map (#88693)
* Adds matter light color capabilities bit map

* Fixed matter light hue and saturation test
2023-02-25 12:06:58 +01:00
16 changed files with 88 additions and 44 deletions

View File

@@ -7,6 +7,13 @@
"username": "[%key:common::config_flow::data::username%]",
"password": "[%key:common::config_flow::data::password%]"
}
},
"reauth_confirm": {
"title": "[%key:common::config_flow::title::reauth%]",
"description": "The Honeywell integration needs to re-authenticate your account",
"data": {
"password": "[%key:common::config_flow::data::password%]"
}
}
},
"error": {

View File

@@ -1,6 +1,7 @@
"""Matter light."""
from __future__ import annotations
from enum import IntFlag
from typing import Any
from chip.clusters import Objects as clusters
@@ -260,12 +261,16 @@ class MatterLight(MatterEntity, LightEntity):
color_temp = kwargs.get(ATTR_COLOR_TEMP)
brightness = kwargs.get(ATTR_BRIGHTNESS)
if hs_color is not None and self.supports_color:
await self._set_hs_color(hs_color)
elif xy_color is not None:
await self._set_xy_color(xy_color)
elif color_temp is not None and self.supports_color_temperature:
await self._set_color_temp(color_temp)
if self.supported_color_modes is not None:
if hs_color is not None and ColorMode.HS in self.supported_color_modes:
await self._set_hs_color(hs_color)
elif xy_color is not None and ColorMode.XY in self.supported_color_modes:
await self._set_xy_color(xy_color)
elif (
color_temp is not None
and ColorMode.COLOR_TEMP in self.supported_color_modes
):
await self._set_color_temp(color_temp)
if brightness is not None and self.supports_brightness:
await self._set_brightness(brightness)
@@ -284,7 +289,6 @@ class MatterLight(MatterEntity, LightEntity):
@callback
def _update_from_device(self) -> None:
"""Update from device."""
if self._attr_supported_color_modes is None:
# work out what (color)features are supported
supported_color_modes: set[ColorMode] = set()
@@ -297,30 +301,19 @@ class MatterLight(MatterEntity, LightEntity):
if self._entity_info.endpoint.has_attribute(
None, clusters.ColorControl.Attributes.ColorMode
):
# device has some color support, check which color modes
# are supported with the featuremap on the ColorControl cluster
color_feature_map = self.get_matter_attribute_value(
clusters.ColorControl.Attributes.FeatureMap,
capabilities = self.get_matter_attribute_value(
clusters.ColorControl.Attributes.ColorCapabilities
)
if (
color_feature_map
& clusters.ColorControl.Attributes.CurrentHue.attribute_id
):
assert capabilities is not None
if capabilities & ColorCapabilities.kHueSaturationSupported:
supported_color_modes.add(ColorMode.HS)
if (
color_feature_map
& clusters.ColorControl.Attributes.CurrentX.attribute_id
):
if capabilities & ColorCapabilities.kXYAttributesSupported:
supported_color_modes.add(ColorMode.XY)
# color temperature support detection using the featuremap is not reliable
# (temporary?) fallback to checking the value
if (
self.get_matter_attribute_value(
clusters.ColorControl.Attributes.ColorTemperatureMireds
)
is not None
):
if capabilities & ColorCapabilities.kColorTemperatureSupported:
supported_color_modes.add(ColorMode.COLOR_TEMP)
self._attr_supported_color_modes = supported_color_modes
@@ -351,11 +344,23 @@ class MatterLight(MatterEntity, LightEntity):
self._attr_brightness = self._get_brightness()
# This enum should be removed once the ColorControlCapabilities enum is added to the CHIP (Matter) library
# clusters.ColorControl.Bitmap.ColorCapabilities
class ColorCapabilities(IntFlag):
"""Color control capabilities bitmap."""
kHueSaturationSupported = 0x1
kEnhancedHueSupported = 0x2
kColorLoopSupported = 0x4
kXYAttributesSupported = 0x8
kColorTemperatureSupported = 0x10
# Discovery schema(s) to map Matter Attributes to HA entities
DISCOVERY_SCHEMAS = [
MatterDiscoverySchema(
platform=Platform.LIGHT,
entity_description=LightEntityDescription(key="ExtendedMatterLight"),
entity_description=LightEntityDescription(key="MatterLight"),
entity_class=MatterLight,
required_attributes=(clusters.OnOff.Attributes.OnOff,),
optional_attributes=(

View File

@@ -11,5 +11,5 @@
"documentation": "https://www.home-assistant.io/integrations/qnap_qsw",
"iot_class": "local_polling",
"loggers": ["aioqsw"],
"requirements": ["aioqsw==0.3.1"]
"requirements": ["aioqsw==0.3.2"]
}

View File

@@ -588,8 +588,8 @@ def _compile_statistics( # noqa: C901
),
entity_id,
new_state,
state.last_updated.isoformat(),
fstate,
state.last_updated.isoformat(),
)
except HomeAssistantError:
continue

View File

@@ -7,5 +7,5 @@
"documentation": "https://www.home-assistant.io/integrations/totalconnect",
"iot_class": "cloud_polling",
"loggers": ["total_connect_client"],
"requirements": ["total_connect_client==2023.1"]
"requirements": ["total_connect_client==2023.2"]
}

View File

@@ -5,7 +5,6 @@
"onboarding",
"usb",
"zeroconf",
"homeassistant_hardware",
"homeassistant_yellow"
],
"codeowners": ["@dmulcahey", "@adminiuga", "@puddly"],

View File

@@ -8,7 +8,7 @@ from .backports.enum import StrEnum
APPLICATION_NAME: Final = "HomeAssistant"
MAJOR_VERSION: Final = 2023
MINOR_VERSION: Final = 3
PATCH_VERSION: Final = "0b2"
PATCH_VERSION: Final = "0b3"
__short_version__: Final = f"{MAJOR_VERSION}.{MINOR_VERSION}"
__version__: Final = f"{__short_version__}.{PATCH_VERSION}"
REQUIRED_PYTHON_VER: Final[tuple[int, int, int]] = (3, 10, 0)

View File

@@ -730,6 +730,7 @@ class HomeAssistant:
"Timed out waiting for shutdown stage 1 to complete, the shutdown will"
" continue"
)
self._async_log_running_tasks(1)
# stage 2
self.state = CoreState.final_write
@@ -742,6 +743,7 @@ class HomeAssistant:
"Timed out waiting for shutdown stage 2 to complete, the shutdown will"
" continue"
)
self._async_log_running_tasks(2)
# stage 3
self.state = CoreState.not_running
@@ -762,11 +764,18 @@ class HomeAssistant:
"Timed out waiting for shutdown stage 3 to complete, the shutdown will"
" continue"
)
self._async_log_running_tasks(3)
self.state = CoreState.stopped
if self._stopped is not None:
self._stopped.set()
def _async_log_running_tasks(self, stage: int) -> None:
"""Log all running tasks."""
for task in self._tasks:
_LOGGER.warning("Shutdown stage %s: still running: %s", stage, task)
class Context:
"""The context that triggered something."""

View File

@@ -44,7 +44,9 @@ def _async_init_flow(
# as ones in progress as it may cause additional device probing
# which can overload devices since zeroconf/ssdp updates can happen
# multiple times in the same minute
if hass.config_entries.flow.async_has_matching_flow(domain, context, data):
if hass.is_stopping or hass.config_entries.flow.async_has_matching_flow(
domain, context, data
):
return None
return hass.config_entries.flow.async_init(domain, context=context, data=data)

View File

@@ -1,4 +1,5 @@
"""Signal handling related helpers."""
import asyncio
import logging
import signal
@@ -23,7 +24,9 @@ def async_register_signal_handling(hass: HomeAssistant) -> None:
"""
hass.loop.remove_signal_handler(signal.SIGTERM)
hass.loop.remove_signal_handler(signal.SIGINT)
hass.async_create_task(hass.async_stop(exit_code))
hass.data["homeassistant_stop"] = asyncio.create_task(
hass.async_stop(exit_code)
)
try:
hass.loop.add_signal_handler(signal.SIGTERM, async_signal_handle, 0)

View File

@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "homeassistant"
version = "2023.3.0b2"
version = "2023.3.0b3"
license = {text = "Apache-2.0"}
description = "Open-source home automation platform running on Python 3."
readme = "README.rst"

View File

@@ -249,7 +249,7 @@ aiopvpc==4.0.1
aiopyarr==22.11.0
# homeassistant.components.qnap_qsw
aioqsw==0.3.1
aioqsw==0.3.2
# homeassistant.components.recollect_waste
aiorecollect==1.0.8
@@ -2518,7 +2518,7 @@ tololib==0.1.0b4
toonapi==0.2.1
# homeassistant.components.totalconnect
total_connect_client==2023.1
total_connect_client==2023.2
# homeassistant.components.tplink_lte
tp-connected==0.0.4

View File

@@ -227,7 +227,7 @@ aiopvpc==4.0.1
aiopyarr==22.11.0
# homeassistant.components.qnap_qsw
aioqsw==0.3.1
aioqsw==0.3.2
# homeassistant.components.recollect_waste
aiorecollect==1.0.8
@@ -1773,7 +1773,7 @@ tololib==0.1.0b4
toonapi==0.2.1
# homeassistant.components.totalconnect
total_connect_client==2023.1
total_connect_client==2023.2
# homeassistant.components.tplink_omada
tplink-omada-client==1.1.0

View File

@@ -146,6 +146,8 @@ IGNORE_VIOLATIONS = {
("demo", "openalpr_local"),
# This would be a circular dep
("http", "network"),
# This would be a circular dep
("zha", "homeassistant_hardware"),
# This should become a helper method that integrations can submit data to
("websocket_api", "lovelace"),
("websocket_api", "shopping_list"),

View File

@@ -288,7 +288,7 @@ async def test_extended_color_light(
"turn_on",
{
"entity_id": entity_id,
"hs_color": (0, 0),
"hs_color": (236.69291338582678, 100.0),
},
blocking=True,
)
@@ -299,9 +299,9 @@ async def test_extended_color_light(
call(
node_id=1,
endpoint_id=1,
command=clusters.ColorControl.Commands.MoveToColor(
colorX=21168,
colorY=21561,
command=clusters.ColorControl.Commands.MoveToHueAndSaturation(
hue=167,
saturation=254,
transitionTime=0,
optionsMask=0,
optionsOverride=0,

View File

@@ -96,3 +96,20 @@ async def test_async_create_flow_checks_existing_flows_before_startup(
data={"properties": {"id": "aa:bb:cc:dd:ee:ff"}},
)
]
async def test_async_create_flow_does_nothing_after_stop(
hass: HomeAssistant, mock_flow_init
) -> None:
"""Test we no longer create flows when hass is stopping."""
hass.bus.async_fire(EVENT_HOMEASSISTANT_STARTED)
await hass.async_block_till_done()
hass.state = CoreState.stopping
mock_flow_init.reset_mock()
discovery_flow.async_create_flow(
hass,
"hue",
{"source": config_entries.SOURCE_HOMEKIT},
{"properties": {"id": "aa:bb:cc:dd:ee:ff"}},
)
assert len(mock_flow_init.mock_calls) == 0