Skip to content

Commit

Permalink
2023.7.1 (#96006)
Browse files Browse the repository at this point in the history
  • Loading branch information
balloob committed Jul 6, 2023
2 parents 91ea14d + d18716e commit 816adce
Show file tree
Hide file tree
Showing 25 changed files with 263 additions and 73 deletions.
1 change: 1 addition & 0 deletions homeassistant/components/flick_electric/sensor.py
Expand Up @@ -34,6 +34,7 @@ class FlickPricingSensor(SensorEntity):

_attr_attribution = "Data provided by Flick Electric"
_attr_native_unit_of_measurement = f"{CURRENCY_CENT}/{UnitOfEnergy.KILO_WATT_HOUR}"
_attr_has_entity_name = True
_attr_translation_key = "power_price"
_attributes: dict[str, Any] = {}

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/frontend/manifest.json
Expand Up @@ -20,5 +20,5 @@
"documentation": "https://www.home-assistant.io/integrations/frontend",
"integration_type": "system",
"quality_scale": "internal",
"requirements": ["home-assistant-frontend==20230705.0"]
"requirements": ["home-assistant-frontend==20230705.1"]
}
4 changes: 2 additions & 2 deletions homeassistant/components/matter/light.py
Expand Up @@ -128,7 +128,7 @@ async def _set_brightness(self, brightness: int) -> None:
renormalize(
brightness,
(0, 255),
(level_control.minLevel, level_control.maxLevel),
(level_control.minLevel or 1, level_control.maxLevel or 254),
)
)

Expand Down Expand Up @@ -220,7 +220,7 @@ def _get_brightness(self) -> int:
return round(
renormalize(
level_control.currentLevel,
(level_control.minLevel or 0, level_control.maxLevel or 254),
(level_control.minLevel or 1, level_control.maxLevel or 254),
(0, 255),
)
)
Expand Down
1 change: 1 addition & 0 deletions homeassistant/components/nuki/lock.py
Expand Up @@ -72,6 +72,7 @@ class NukiDeviceEntity(NukiEntity[_NukiDeviceT], LockEntity):
_attr_has_entity_name = True
_attr_supported_features = LockEntityFeature.OPEN
_attr_translation_key = "nuki_lock"
_attr_name = None

@property
def unique_id(self) -> str | None:
Expand Down
6 changes: 6 additions & 0 deletions homeassistant/components/qnap/strings.json
Expand Up @@ -19,5 +19,11 @@
"invalid_auth": "Bad authentication",
"unknown": "Unknown error"
}
},
"issues": {
"deprecated_yaml": {
"title": "The QNAP YAML configuration is being removed",
"description": "Configuring QNAP using YAML is being removed.\n\nYour existing YAML configuration has been imported into the UI automatically.\n\nRemove the QNAP YAML configuration from your configuration.yaml file and restart Home Assistant to fix this issue."
}
}
}
2 changes: 1 addition & 1 deletion homeassistant/components/rainbird/manifest.json
Expand Up @@ -6,5 +6,5 @@
"documentation": "https://www.home-assistant.io/integrations/rainbird",
"iot_class": "local_polling",
"loggers": ["pyrainbird"],
"requirements": ["pyrainbird==2.0.0"]
"requirements": ["pyrainbird==2.1.0"]
}
2 changes: 1 addition & 1 deletion homeassistant/components/script/__init__.py
Expand Up @@ -608,7 +608,7 @@ async def _service_handler(self, service: ServiceCall) -> ServiceResponse:
variables=service.data, context=service.context, wait=True
)
if service.return_response:
return response
return response or {}
return None

async def async_added_to_hass(self) -> None:
Expand Down
4 changes: 3 additions & 1 deletion homeassistant/components/slimproto/media_player.py
Expand Up @@ -27,8 +27,10 @@
from .const import DEFAULT_NAME, DOMAIN, PLAYER_EVENT

STATE_MAPPING = {
PlayerState.IDLE: MediaPlayerState.IDLE,
PlayerState.STOPPED: MediaPlayerState.IDLE,
PlayerState.PLAYING: MediaPlayerState.PLAYING,
PlayerState.BUFFER_READY: MediaPlayerState.PLAYING,
PlayerState.BUFFERING: MediaPlayerState.PLAYING,
PlayerState.PAUSED: MediaPlayerState.PAUSED,
}

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/switchbot/strings.json
Expand Up @@ -44,7 +44,7 @@
},
"abort": {
"already_configured_device": "[%key:common::config_flow::abort::already_configured_device%]",
"no_devices_found": "[%key:common::config_flow::abort::no_devices_found%]",
"no_devices_found": "No supported SwitchBot devices found in range; If the device is in range, ensure the scanner has active scanning enabled, as SwitchBot devices cannot be discovered with passive scans. Active scans can be disabled once the device is configured. If you need clarification on whether the device is in-range, download the diagnostics for the integration that provides your Bluetooth adapter or proxy and check if the MAC address of the SwitchBot device is present.",
"unknown": "[%key:common::config_flow::error::unknown%]",
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
"switchbot_unsupported_type": "Unsupported Switchbot Type."
Expand Down
2 changes: 2 additions & 0 deletions homeassistant/components/tuya/sensor.py
Expand Up @@ -511,6 +511,7 @@ class TuyaSensorEntityDescription(SensorEntityDescription):
"rqbj": (
TuyaSensorEntityDescription(
key=DPCode.GAS_SENSOR_VALUE,
name=None,
icon="mdi:gas-cylinder",
state_class=SensorStateClass.MEASUREMENT,
),
Expand Down Expand Up @@ -633,6 +634,7 @@ class TuyaSensorEntityDescription(SensorEntityDescription):
"ylcg": (
TuyaSensorEntityDescription(
key=DPCode.PRESSURE_VALUE,
name=None,
device_class=SensorDeviceClass.PRESSURE,
state_class=SensorStateClass.MEASUREMENT,
),
Expand Down
2 changes: 2 additions & 0 deletions homeassistant/components/xiaomi_miio/fan.py
Expand Up @@ -292,6 +292,8 @@ async def async_service_handler(service: ServiceCall) -> None:
class XiaomiGenericDevice(XiaomiCoordinatedMiioEntity, FanEntity):
"""Representation of a generic Xiaomi device."""

_attr_name = None

def __init__(self, device, entry, unique_id, coordinator):
"""Initialize the generic Xiaomi device."""
super().__init__(device, entry, unique_id, coordinator)
Expand Down
1 change: 1 addition & 0 deletions homeassistant/components/xiaomi_miio/humidifier.py
Expand Up @@ -118,6 +118,7 @@ class XiaomiGenericHumidifier(XiaomiCoordinatedMiioEntity, HumidifierEntity):

_attr_device_class = HumidifierDeviceClass.HUMIDIFIER
_attr_supported_features = HumidifierEntityFeature.MODES
_attr_name = None

def __init__(self, device, entry, unique_id, coordinator):
"""Initialize the generic Xiaomi device."""
Expand Down
30 changes: 18 additions & 12 deletions homeassistant/components/yamaha_musiccast/media_player.py
Expand Up @@ -130,14 +130,11 @@ def zone_id(self):

@property
def _is_netusb(self):
return (
self.coordinator.data.netusb_input
== self.coordinator.data.zones[self._zone_id].input
)
return self.coordinator.data.netusb_input == self.source_id

@property
def _is_tuner(self):
return self.coordinator.data.zones[self._zone_id].input == "tuner"
return self.source_id == "tuner"

@property
def media_content_id(self):
Expand Down Expand Up @@ -516,10 +513,15 @@ async def async_select_source(self, source: str) -> None:
self._zone_id, self.reverse_source_mapping.get(source, source)
)

@property
def source_id(self):
"""ID of the current input source."""
return self.coordinator.data.zones[self._zone_id].input

@property
def source(self):
"""Name of the current input source."""
return self.source_mapping.get(self.coordinator.data.zones[self._zone_id].input)
return self.source_mapping.get(self.source_id)

@property
def source_list(self):
Expand Down Expand Up @@ -597,7 +599,7 @@ def is_network_client(self) -> bool:
return (
self.coordinator.data.group_role == "client"
and self.coordinator.data.group_id != NULL_GROUP
and self.source == ATTR_MC_LINK
and self.source_id == ATTR_MC_LINK
)

@property
Expand All @@ -606,7 +608,7 @@ def is_client(self) -> bool:
If the media player is not part of a group, False is returned.
"""
return self.is_network_client or self.source == ATTR_MAIN_SYNC
return self.is_network_client or self.source_id == ATTR_MAIN_SYNC

def get_all_mc_entities(self) -> list[MusicCastMediaPlayer]:
"""Return all media player entities of the musiccast system."""
Expand Down Expand Up @@ -639,11 +641,11 @@ def is_part_of_group(self, group_server) -> bool:
and self.coordinator.data.group_id
== group_server.coordinator.data.group_id
and self.ip_address != group_server.ip_address
and self.source == ATTR_MC_LINK
and self.source_id == ATTR_MC_LINK
)
or (
self.ip_address == group_server.ip_address
and self.source == ATTR_MAIN_SYNC
and self.source_id == ATTR_MAIN_SYNC
)
)

Expand Down Expand Up @@ -859,8 +861,12 @@ async def async_client_leave_group(self, force=False):
"""
_LOGGER.debug("%s client leave called", self.entity_id)
if not force and (
self.source == ATTR_MAIN_SYNC
or [entity for entity in self.other_zones if entity.source == ATTR_MC_LINK]
self.source_id == ATTR_MAIN_SYNC
or [
entity
for entity in self.other_zones
if entity.source_id == ATTR_MC_LINK
]
):
await self.coordinator.musiccast.zone_unjoin(self._zone_id)
else:
Expand Down
24 changes: 20 additions & 4 deletions homeassistant/components/zha/__init__.py
Expand Up @@ -3,6 +3,7 @@
import copy
import logging
import os
import re

import voluptuous as vol
from zhaquirks import setup as setup_quirks
Expand Down Expand Up @@ -85,19 +86,34 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
return True


def _clean_serial_port_path(path: str) -> str:
"""Clean the serial port path, applying corrections where necessary."""

if path.startswith("socket://"):
path = path.strip()

# Removes extraneous brackets from IP addresses (they don't parse in CPython 3.11.4)
if re.match(r"^socket://\[\d+\.\d+\.\d+\.\d+\]:\d+$", path):
path = path.replace("[", "").replace("]", "")

return path


async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool:
"""Set up ZHA.
Will automatically load components to support devices found on the network.
"""

# Strip whitespace around `socket://` URIs, this is no longer accepted by zigpy
# This will be removed in 2023.7.0
# Remove brackets around IP addresses, this no longer works in CPython 3.11.4
# This will be removed in 2023.11.0
path = config_entry.data[CONF_DEVICE][CONF_DEVICE_PATH]
cleaned_path = _clean_serial_port_path(path)
data = copy.deepcopy(dict(config_entry.data))

if path.startswith("socket://") and path != path.strip():
data[CONF_DEVICE][CONF_DEVICE_PATH] = path.strip()
if path != cleaned_path:
_LOGGER.debug("Cleaned serial port path %r -> %r", path, cleaned_path)
data[CONF_DEVICE][CONF_DEVICE_PATH] = cleaned_path
hass.config_entries.async_update_entry(config_entry, data=data)

zha_data = hass.data.setdefault(DATA_ZHA, {})
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/const.py
Expand Up @@ -8,7 +8,7 @@
APPLICATION_NAME: Final = "HomeAssistant"
MAJOR_VERSION: Final = 2023
MINOR_VERSION: Final = 7
PATCH_VERSION: Final = "0"
PATCH_VERSION: Final = "1"
__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)
Expand Down
5 changes: 3 additions & 2 deletions homeassistant/helpers/entity.py
Expand Up @@ -772,9 +772,10 @@ def _friendly_name_internal(self) -> str | None:
):
return name

device_name = device_entry.name_by_user or device_entry.name
if self.use_device_name:
return device_entry.name_by_user or device_entry.name
return f"{device_entry.name_by_user or device_entry.name} {name}"
return device_name
return f"{device_name} {name}" if device_name else name

@callback
def _async_write_ha_state(self) -> None:
Expand Down

0 comments on commit 816adce

Please sign in to comment.