Skip to content

Commit

Permalink
Merge pull request #68001 from home-assistant/rc
Browse files Browse the repository at this point in the history
  • Loading branch information
balloob committed Mar 12, 2022
2 parents 737c502 + 3de3410 commit 898af3e
Show file tree
Hide file tree
Showing 16 changed files with 50 additions and 28 deletions.
12 changes: 11 additions & 1 deletion homeassistant/components/discord/notify.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@

ATTR_EMBED = "embed"
ATTR_EMBED_AUTHOR = "author"
ATTR_EMBED_COLOR = "color"
ATTR_EMBED_DESCRIPTION = "description"
ATTR_EMBED_FIELDS = "fields"
ATTR_EMBED_FOOTER = "footer"
ATTR_EMBED_TITLE = "title"
ATTR_EMBED_THUMBNAIL = "thumbnail"
ATTR_EMBED_URL = "url"
ATTR_IMAGES = "images"

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({vol.Required(CONF_TOKEN): cv.string})
Expand Down Expand Up @@ -64,10 +68,16 @@ async def async_send_message(self, message, **kwargs):
embeds: list[nextcord.Embed] = []
if ATTR_EMBED in data:
embedding = data[ATTR_EMBED]
title = embedding.get(ATTR_EMBED_TITLE) or nextcord.Embed.Empty
description = embedding.get(ATTR_EMBED_DESCRIPTION) or nextcord.Embed.Empty
color = embedding.get(ATTR_EMBED_COLOR) or nextcord.Embed.Empty
url = embedding.get(ATTR_EMBED_URL) or nextcord.Embed.Empty
fields = embedding.get(ATTR_EMBED_FIELDS) or []

if embedding:
embed = nextcord.Embed(**embedding)
embed = nextcord.Embed(
title=title, description=description, color=color, url=url
)
for field in fields:
embed.add_field(**field)
if ATTR_EMBED_FOOTER in embedding:
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/insteon/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Insteon",
"documentation": "https://www.home-assistant.io/integrations/insteon",
"requirements": [
"pyinsteon==1.0.16"
"pyinsteon==1.0.13"
],
"codeowners": [
"@teharris1"
Expand Down
2 changes: 2 additions & 0 deletions homeassistant/components/kodi/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,8 @@ async def async_play_media(
await self._kodi.play_channel(int(media_id))
elif media_type_lower == MEDIA_TYPE_PLAYLIST:
await self._kodi.play_playlist(int(media_id))
elif media_type_lower == "file":
await self._kodi.play_file(media_id)
elif media_type_lower == "directory":
await self._kodi.play_directory(media_id)
elif media_type_lower in [
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/mediaroom/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"domain": "mediaroom",
"name": "Mediaroom",
"documentation": "https://www.home-assistant.io/integrations/mediaroom",
"requirements": ["pymediaroom==0.6.4.1"],
"requirements": ["pymediaroom==0.6.5.4"],
"codeowners": ["@dgomes"],
"iot_class": "local_polling",
"loggers": ["pymediaroom"]
Expand Down
23 changes: 14 additions & 9 deletions homeassistant/components/mqtt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from operator import attrgetter
import ssl
import time
from typing import Any, Union, cast
from typing import TYPE_CHECKING, Any, Union, cast
import uuid

import attr
Expand Down Expand Up @@ -113,6 +113,11 @@
)
from .util import _VALID_QOS_SCHEMA, valid_publish_topic, valid_subscribe_topic

if TYPE_CHECKING:
# Only import for paho-mqtt type checking here, imports are done locally
# because integrations should be able to optionally rely on MQTT.
import paho.mqtt.client as mqtt # pylint: disable=import-outside-toplevel

_LOGGER = logging.getLogger(__name__)

_SENTINEL = object()
Expand Down Expand Up @@ -759,23 +764,23 @@ class Subscription:
class MqttClientSetup:
"""Helper class to setup the paho mqtt client from config."""

# We don't import on the top because some integrations
# should be able to optionally rely on MQTT.
import paho.mqtt.client as mqtt # pylint: disable=import-outside-toplevel

def __init__(self, config: ConfigType) -> None:
"""Initialize the MQTT client setup helper."""

# We don't import on the top because some integrations
# should be able to optionally rely on MQTT.
import paho.mqtt.client as mqtt # pylint: disable=import-outside-toplevel

if config[CONF_PROTOCOL] == PROTOCOL_31:
proto = self.mqtt.MQTTv31
proto = mqtt.MQTTv31
else:
proto = self.mqtt.MQTTv311
proto = mqtt.MQTTv311

if (client_id := config.get(CONF_CLIENT_ID)) is None:
# PAHO MQTT relies on the MQTT server to generate random client IDs.
# However, that feature is not mandatory so we generate our own.
client_id = self.mqtt.base62(uuid.uuid4().int, padding=22)
self._client = self.mqtt.Client(client_id, protocol=proto)
client_id = mqtt.base62(uuid.uuid4().int, padding=22)
self._client = mqtt.Client(client_id, protocol=proto)

# Enable logging
self._client.enable_logger()
Expand Down
6 changes: 5 additions & 1 deletion homeassistant/components/mqtt/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,10 @@ async def async_step_options(self, user_input=None):

def try_connection(hass, broker, port, username, password, protocol="3.1"):
"""Test if we can connect to an MQTT broker."""
# We don't import on the top because some integrations
# should be able to optionally rely on MQTT.
import paho.mqtt.client as mqtt # pylint: disable=import-outside-toplevel

# Get the config from configuration.yaml
yaml_config = hass.data.get(DATA_MQTT_CONFIG, {})
entry_config = {
Expand All @@ -334,7 +338,7 @@ def try_connection(hass, broker, port, username, password, protocol="3.1"):

def on_connect(client_, userdata, flags, result_code):
"""Handle connection result."""
result.put(result_code == MqttClientSetup.mqtt.CONNACK_ACCEPTED)
result.put(result_code == mqtt.CONNACK_ACCEPTED)

client.on_connect = on_connect

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/radio_browser/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Radio Browser",
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/radio",
"requirements": ["radios==0.1.0"],
"requirements": ["radios==0.1.1"],
"codeowners": ["@frenck"],
"iot_class": "cloud_polling"
}
2 changes: 1 addition & 1 deletion homeassistant/components/sabnzbd/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"domain": "sabnzbd",
"name": "SABnzbd",
"documentation": "https://www.home-assistant.io/integrations/sabnzbd",
"requirements": ["pysabnzbd==1.1.0"],
"requirements": ["pysabnzbd==1.1.1"],
"dependencies": ["configurator"],
"after_dependencies": ["discovery"],
"codeowners": [],
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/script/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ async def reload_service(service: ServiceCall) -> None:
"""Call a service to reload scripts."""
if (conf := await component.async_prepare_reload()) is None:
return

async_get_blueprints(hass).async_reset_cache()
await _async_process_config(hass, conf, component)

async def turn_on_service(service: ServiceCall) -> None:
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/shelly/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ async def async_turn_on(self, **kwargs: Any) -> None:
ATTR_RGBW_COLOR
]

if ATTR_EFFECT in kwargs:
if ATTR_EFFECT in kwargs and ATTR_COLOR_TEMP not in kwargs:
# Color effect change - used only in color mode, switch device mode to color
set_mode = "color"
if self.wrapper.model == "SHBLB-1":
Expand Down
1 change: 1 addition & 0 deletions homeassistant/components/sun/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ def __init__(self, hass):
self.rising = self.phase = None
self._next_change = None

@callback
def update_location(_event):
location, elevation = get_astral_location(self.hass)
if location == self.location:
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/zwave_js/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Z-Wave JS",
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/zwave_js",
"requirements": ["zwave-js-server-python==0.35.1"],
"requirements": ["zwave-js-server-python==0.35.2"],
"codeowners": ["@home-assistant/z-wave"],
"dependencies": ["usb", "http", "websocket_api"],
"iot_class": "local_push",
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

MAJOR_VERSION: Final = 2022
MINOR_VERSION: Final = 3
PATCH_VERSION: Final = "3"
PATCH_VERSION: Final = "4"
__short_version__: Final = f"{MAJOR_VERSION}.{MINOR_VERSION}"
__version__: Final = f"{__short_version__}.{PATCH_VERSION}"
REQUIRED_PYTHON_VER: Final[tuple[int, int, int]] = (3, 9, 0)
Expand Down
10 changes: 5 additions & 5 deletions requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1589,7 +1589,7 @@ pyialarm==1.9.0
pyicloud==1.0.0

# homeassistant.components.insteon
pyinsteon==1.0.16
pyinsteon==1.0.13

# homeassistant.components.intesishome
pyintesishome==1.7.6
Expand Down Expand Up @@ -1670,7 +1670,7 @@ pymata-express==1.19
pymazda==0.3.2

# homeassistant.components.mediaroom
pymediaroom==0.6.4.1
pymediaroom==0.6.5.4

# homeassistant.components.melcloud
pymelcloud==2.5.6
Expand Down Expand Up @@ -1813,7 +1813,7 @@ pyrituals==0.0.6
pyruckus==0.12

# homeassistant.components.sabnzbd
pysabnzbd==1.1.0
pysabnzbd==1.1.1

# homeassistant.components.saj
pysaj==0.0.16
Expand Down Expand Up @@ -2079,7 +2079,7 @@ quantum-gateway==0.0.6
rachiopy==1.0.3

# homeassistant.components.radio_browser
radios==0.1.0
radios==0.1.1

# homeassistant.components.radiotherm
radiotherm==2.1.0
Expand Down Expand Up @@ -2566,7 +2566,7 @@ zigpy==0.43.0
zm-py==0.5.2

# homeassistant.components.zwave_js
zwave-js-server-python==0.35.1
zwave-js-server-python==0.35.2

# homeassistant.components.zwave_me
zwave_me_ws==0.2.1
6 changes: 3 additions & 3 deletions requirements_test_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1000,7 +1000,7 @@ pyialarm==1.9.0
pyicloud==1.0.0

# homeassistant.components.insteon
pyinsteon==1.0.16
pyinsteon==1.0.13

# homeassistant.components.ipma
pyipma==2.0.5
Expand Down Expand Up @@ -1295,7 +1295,7 @@ pyzerproc==0.4.8
rachiopy==1.0.3

# homeassistant.components.radio_browser
radios==0.1.0
radios==0.1.1

# homeassistant.components.rainmachine
regenmaschine==2022.01.0
Expand Down Expand Up @@ -1588,7 +1588,7 @@ zigpy-znp==0.7.0
zigpy==0.43.0

# homeassistant.components.zwave_js
zwave-js-server-python==0.35.1
zwave-js-server-python==0.35.2

# homeassistant.components.zwave_me
zwave_me_ws==0.2.1
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = homeassistant
version = 2022.3.3
version = 2022.3.4
author = The Home Assistant Authors
author_email = hello@home-assistant.io
license = Apache-2.0
Expand Down

0 comments on commit 898af3e

Please sign in to comment.