Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2023.5.2 #92610

Merged
merged 20 commits into from
May 5, 2023
Merged

2023.5.2 #92610

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
affece8
Fix transmission error handling (#91548)
DDanii May 5, 2023
d96b37a
Fix power sensor state_class in Netatmo integration (#92468)
hex7c0 May 4, 2023
b2fcbbe
Fix for SIA Code not being handled well (#92469)
eavanvalkenburg May 5, 2023
b973825
Fix scene service examples (#92501)
karwosts May 4, 2023
e376272
Fix blocking I/O in the event loop when starting ONVIF (#92518)
bdraco May 4, 2023
8a11ee8
Improve cloud migration (#92520)
emontnemery May 5, 2023
241cacd
Bump aioesphomeapi to 13.7.3 to fix disconnecting while handshake is …
bdraco May 5, 2023
2dd1ce2
Handle invalid ZHA cluster handlers (#92543)
puddly May 5, 2023
163823d
Allow duplicate state updates when force_update is set on an esphome …
bdraco May 5, 2023
82c0967
Bump elkm1-lib to 2.2.2 (#92560)
bdraco May 5, 2023
e8808b5
Re-run expose entities migration if first time failed (#92564)
balloob May 5, 2023
f8c3586
Fix hassio get_os_info retry (#92569)
epenet May 5, 2023
fb29e1a
Bump hatasmota to 0.6.5 (#92585)
emontnemery May 5, 2023
15ef53c
Bumped version to 2023.5.2
balloob May 5, 2023
35c48d3
Improve reliability of ONVIF subscription renewals (#92551)
bdraco May 5, 2023
cf243fb
Lower scan interval for OpenSky (#92593)
joostlek May 5, 2023
f1bccef
Update frontend to 20230503.3 (#92617)
bramkragten May 5, 2023
73d4c73
Fix missing ONVIF events when switching from PullPoint to webhooks (#…
bdraco May 5, 2023
fe57901
Add support for visitor detections to onvif (#92350)
bdraco May 2, 2023
ddebfb3
Fix duplicate ONVIF sensors (#92629)
bdraco May 5, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions homeassistant/components/alexa/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import asyncio
import logging

from homeassistant.core import CALLBACK_TYPE, callback
from homeassistant.core import CALLBACK_TYPE, HomeAssistant, callback
from homeassistant.helpers.storage import Store

from .const import DOMAIN
Expand All @@ -19,7 +19,7 @@ class AbstractConfig(ABC):

_unsub_proactive_report: asyncio.Task[CALLBACK_TYPE] | None = None

def __init__(self, hass):
def __init__(self, hass: HomeAssistant) -> None:
"""Initialize abstract config."""
self.hass = hass
self._store = None
Expand Down
24 changes: 15 additions & 9 deletions homeassistant/components/cloud/alexa_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,14 +199,10 @@ def _migrate_alexa_entity_settings_v1(self):
# Don't migrate if there's a YAML config
return

for state in self.hass.states.async_all():
async_expose_entity(
self.hass,
CLOUD_ALEXA,
state.entity_id,
self._should_expose_legacy(state.entity_id),
)
for entity_id in self._prefs.alexa_entity_configs:
for entity_id in {
*self.hass.states.async_entity_ids(),
*self._prefs.alexa_entity_configs,
}:
async_expose_entity(
self.hass,
CLOUD_ALEXA,
Expand All @@ -220,8 +216,18 @@ async def async_initialize(self):

async def on_hass_started(hass):
if self._prefs.alexa_settings_version != ALEXA_SETTINGS_VERSION:
if self._prefs.alexa_settings_version < 2:
if self._prefs.alexa_settings_version < 2 or (
# Recover from a bug we had in 2023.5.0 where entities didn't get exposed
self._prefs.alexa_settings_version < 3
and not any(
settings.get("should_expose", False)
for settings in async_get_assistant_settings(
hass, CLOUD_ALEXA
).values()
)
):
self._migrate_alexa_entity_settings_v1()

await self._prefs.async_update(
alexa_settings_version=ALEXA_SETTINGS_VERSION
)
Expand Down
34 changes: 16 additions & 18 deletions homeassistant/components/cloud/google_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from homeassistant.components.google_assistant.helpers import AbstractConfig
from homeassistant.components.homeassistant.exposed_entities import (
async_expose_entity,
async_get_assistant_settings,
async_get_entity_settings,
async_listen_entity_updates,
async_set_assistant_option,
Expand Down Expand Up @@ -175,23 +176,10 @@ def _migrate_google_entity_settings_v1(self):
# Don't migrate if there's a YAML config
return

for state in self.hass.states.async_all():
entity_id = state.entity_id
async_expose_entity(
self.hass,
CLOUD_GOOGLE,
entity_id,
self._should_expose_legacy(entity_id),
)
if _2fa_disabled := (self._2fa_disabled_legacy(entity_id) is not None):
async_set_assistant_option(
self.hass,
CLOUD_GOOGLE,
entity_id,
PREF_DISABLE_2FA,
_2fa_disabled,
)
for entity_id in self._prefs.google_entity_configs:
for entity_id in {
*self.hass.states.async_entity_ids(),
*self._prefs.google_entity_configs,
}:
async_expose_entity(
self.hass,
CLOUD_GOOGLE,
Expand All @@ -213,8 +201,18 @@ async def async_initialize(self):

async def on_hass_started(hass: HomeAssistant) -> None:
if self._prefs.google_settings_version != GOOGLE_SETTINGS_VERSION:
if self._prefs.google_settings_version < 2:
if self._prefs.google_settings_version < 2 or (
# Recover from a bug we had in 2023.5.0 where entities didn't get exposed
self._prefs.google_settings_version < 3
and not any(
settings.get("should_expose", False)
for settings in async_get_assistant_settings(
hass, CLOUD_GOOGLE
).values()
)
):
self._migrate_google_entity_settings_v1()

await self._prefs.async_update(
google_settings_version=GOOGLE_SETTINGS_VERSION
)
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/cloud/prefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
STORAGE_VERSION = 1
STORAGE_VERSION_MINOR = 2

ALEXA_SETTINGS_VERSION = 2
GOOGLE_SETTINGS_VERSION = 2
ALEXA_SETTINGS_VERSION = 3
GOOGLE_SETTINGS_VERSION = 3


class CloudPreferencesStore(Store):
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/elkm1/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
"documentation": "https://www.home-assistant.io/integrations/elkm1",
"iot_class": "local_push",
"loggers": ["elkm1_lib"],
"requirements": ["elkm1-lib==2.2.1"]
"requirements": ["elkm1-lib==2.2.2"]
}
14 changes: 12 additions & 2 deletions homeassistant/components/esphome/entry_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
NumberInfo,
SelectInfo,
SensorInfo,
SensorState,
SwitchInfo,
TextSensorInfo,
UserService,
Expand Down Expand Up @@ -240,9 +241,18 @@ def async_update_state(self, state: EntityState) -> None:
current_state_by_type = self.state[state_type]
current_state = current_state_by_type.get(key, _SENTINEL)
subscription_key = (state_type, key)
if current_state == state and subscription_key not in stale_state:
if (
current_state == state
and subscription_key not in stale_state
and not (
type(state) is SensorState # pylint: disable=unidiomatic-typecheck
and (platform_info := self.info.get(Platform.SENSOR))
and (entity_info := platform_info.get(state.key))
and (cast(SensorInfo, entity_info)).force_update
)
):
_LOGGER.debug(
"%s: ignoring duplicate update with and key %s: %s",
"%s: ignoring duplicate update with key %s: %s",
self.name,
key,
state,
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/esphome/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"iot_class": "local_push",
"loggers": ["aioesphomeapi", "noiseprotocol"],
"requirements": [
"aioesphomeapi==13.7.2",
"aioesphomeapi==13.7.3",
"bluetooth-data-tools==0.4.0",
"esphome-dashboard-api==1.2.3"
],
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/frontend/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
"documentation": "https://www.home-assistant.io/integrations/frontend",
"integration_type": "system",
"quality_scale": "internal",
"requirements": ["home-assistant-frontend==20230503.2"]
"requirements": ["home-assistant-frontend==20230503.3"]
}
4 changes: 2 additions & 2 deletions homeassistant/components/hassio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ async def async_handle_core_service(call: ServiceCall) -> None:
await async_setup_addon_panel(hass, hassio)

# Setup hardware integration for the detected board type
async def _async_setup_hardware_integration(hass):
async def _async_setup_hardware_integration(_: datetime) -> None:
"""Set up hardaware integration for the detected board type."""
if (os_info := get_os_info(hass)) is None:
# os info not yet fetched from supervisor, retry later
Expand All @@ -610,7 +610,7 @@ async def _async_setup_hardware_integration(hass):
)
)

await _async_setup_hardware_integration(hass)
await _async_setup_hardware_integration(datetime.now())

hass.async_create_task(
hass.config_entries.flow.async_init(DOMAIN, context={"source": "system"})
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/netatmo/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ class NetatmoSensorEntityDescription(SensorEntityDescription, NetatmoRequiredKey
netatmo_name="power",
entity_registry_enabled_default=True,
native_unit_of_measurement=UnitOfPower.WATT,
state_class=SensorStateClass.TOTAL,
state_class=SensorStateClass.MEASUREMENT,
device_class=SensorDeviceClass.POWER,
),
)
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/onvif/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def __init__(self, device: ONVIFDevice) -> None:

async def async_press(self) -> None:
"""Send out a SystemReboot command."""
device_mgmt = self.device.device.create_devicemgmt_service()
device_mgmt = await self.device.device.create_devicemgmt_service()
await device_mgmt.SystemReboot()


Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/onvif/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ async def async_setup_profiles(

try:
await device.update_xaddrs()
device_mgmt = device.create_devicemgmt_service()
device_mgmt = await device.create_devicemgmt_service()
# Get the MAC address to use as the unique ID for the config flow
if not self.device_id:
try:
Expand Down Expand Up @@ -314,7 +314,7 @@ async def async_setup_profiles(
}
)
# Verify there is an H264 profile
media_service = device.create_media_service()
media_service = await device.create_media_service()
profiles = await media_service.GetProfiles()
except AttributeError: # Likely an empty document or 404 from the wrong port
LOGGER.debug(
Expand Down
24 changes: 12 additions & 12 deletions homeassistant/components/onvif/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ async def async_setup(self) -> None:

if self.capabilities.ptz:
LOGGER.debug("%s: creating PTZ service", self.name)
self.device.create_ptz_service()
await self.device.create_ptz_service()

# Determine max resolution from profiles
self.max_resolution = max(
Expand All @@ -159,7 +159,7 @@ async def async_stop(self, event=None):

async def async_manually_set_date_and_time(self) -> None:
"""Set Date and Time Manually using SetSystemDateAndTime command."""
device_mgmt = self.device.create_devicemgmt_service()
device_mgmt = await self.device.create_devicemgmt_service()

# Retrieve DateTime object from camera to use as template for Set operation
device_time = await device_mgmt.GetSystemDateAndTime()
Expand Down Expand Up @@ -202,7 +202,7 @@ async def async_manually_set_date_and_time(self) -> None:
async def async_check_date_and_time(self) -> None:
"""Warns if device and system date not synced."""
LOGGER.debug("%s: Setting up the ONVIF device management service", self.name)
device_mgmt = self.device.create_devicemgmt_service()
device_mgmt = await self.device.create_devicemgmt_service()
system_date = dt_util.utcnow()

LOGGER.debug("%s: Retrieving current device date/time", self.name)
Expand Down Expand Up @@ -285,7 +285,7 @@ async def async_check_date_and_time(self) -> None:

async def async_get_device_info(self) -> DeviceInfo:
"""Obtain information about this device."""
device_mgmt = self.device.create_devicemgmt_service()
device_mgmt = await self.device.create_devicemgmt_service()
manufacturer = None
model = None
firmware_version = None
Expand Down Expand Up @@ -331,7 +331,7 @@ async def async_get_capabilities(self):
"""Obtain information about the available services on the device."""
snapshot = False
with suppress(*GET_CAPABILITIES_EXCEPTIONS):
media_service = self.device.create_media_service()
media_service = await self.device.create_media_service()
media_capabilities = await media_service.GetServiceCapabilities()
snapshot = media_capabilities and media_capabilities.SnapshotUri

Expand All @@ -342,7 +342,7 @@ async def async_get_capabilities(self):

imaging = False
with suppress(*GET_CAPABILITIES_EXCEPTIONS):
self.device.create_imaging_service()
await self.device.create_imaging_service()
imaging = True

return Capabilities(snapshot=snapshot, ptz=ptz, imaging=imaging)
Expand All @@ -361,7 +361,7 @@ async def async_start_events(self):

async def async_get_profiles(self) -> list[Profile]:
"""Obtain media profiles for this device."""
media_service = self.device.create_media_service()
media_service = await self.device.create_media_service()
LOGGER.debug("%s: xaddr for media_service: %s", self.name, media_service.xaddr)
try:
result = await media_service.GetProfiles()
Expand Down Expand Up @@ -408,7 +408,7 @@ async def async_get_profiles(self) -> list[Profile]:
)

try:
ptz_service = self.device.create_ptz_service()
ptz_service = await self.device.create_ptz_service()
presets = await ptz_service.GetPresets(profile.token)
profile.ptz.presets = [preset.token for preset in presets if preset]
except GET_CAPABILITIES_EXCEPTIONS:
Expand All @@ -427,7 +427,7 @@ async def async_get_profiles(self) -> list[Profile]:

async def async_get_stream_uri(self, profile: Profile) -> str:
"""Get the stream URI for a specified profile."""
media_service = self.device.create_media_service()
media_service = await self.device.create_media_service()
req = media_service.create_type("GetStreamUri")
req.ProfileToken = profile.token
req.StreamSetup = {
Expand All @@ -454,7 +454,7 @@ async def async_perform_ptz(
LOGGER.warning("PTZ actions are not supported on device '%s'", self.name)
return

ptz_service = self.device.create_ptz_service()
ptz_service = await self.device.create_ptz_service()

pan_val = distance * PAN_FACTOR.get(pan, 0)
tilt_val = distance * TILT_FACTOR.get(tilt, 0)
Expand Down Expand Up @@ -576,7 +576,7 @@ async def async_run_aux_command(
LOGGER.warning("PTZ actions are not supported on device '%s'", self.name)
return

ptz_service = self.device.create_ptz_service()
ptz_service = await self.device.create_ptz_service()

LOGGER.debug(
"Running Aux Command | Cmd = %s",
Expand Down Expand Up @@ -607,7 +607,7 @@ async def async_set_imaging_settings(
)
return

imaging_service = self.device.create_imaging_service()
imaging_service = await self.device.create_imaging_service()

LOGGER.debug("Setting Imaging Setting | Settings = %s", settings)
try:
Expand Down
Loading