Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 3 additions & 1 deletion homeassistant/components/vultr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import voluptuous as vol
from vultr import Vultr as VultrAPI

from homeassistant.components import persistent_notification
from homeassistant.const import CONF_API_KEY, Platform
from homeassistant.core import HomeAssistant
import homeassistant.helpers.config_validation as cv
Expand Down Expand Up @@ -56,7 +57,8 @@ def setup(hass: HomeAssistant, config: ConfigType) -> bool:
vultr.update()
except RuntimeError as ex:
_LOGGER.error("Failed to make update API request because: %s", ex)
hass.components.persistent_notification.create(
persistent_notification.create(
hass,
"Error: {}" "".format(ex),
title=NOTIFICATION_TITLE,
notification_id=NOTIFICATION_ID,
Expand Down
4 changes: 3 additions & 1 deletion homeassistant/components/waterfurnace/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import voluptuous as vol
from waterfurnace.waterfurnace import WaterFurnace, WFCredentialError, WFException

from homeassistant.components import persistent_notification
from homeassistant.const import (
CONF_PASSWORD,
CONF_USERNAME,
Expand Down Expand Up @@ -92,7 +93,8 @@ def _reconnect(self):
self._fails += 1
if self._fails > MAX_FAILS:
_LOGGER.error("Failed to refresh login credentials. Thread stopped")
self.hass.components.persistent_notification.create(
persistent_notification.create(
self.hass,
"Error:<br/>Connection to waterfurnace website failed "
"the maximum number of times. Thread has stopped",
title=NOTIFICATION_TITLE,
Expand Down
4 changes: 3 additions & 1 deletion homeassistant/components/wirelesstag/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from wirelesstagpy import WirelessTags
from wirelesstagpy.exceptions import WirelessTagsException

from homeassistant.components import persistent_notification
from homeassistant.const import (
ATTR_BATTERY_LEVEL,
ATTR_VOLTAGE,
Expand Down Expand Up @@ -141,7 +142,8 @@ def setup(hass: HomeAssistant, config: ConfigType) -> bool:
hass.data[DOMAIN] = platform
except (ConnectTimeout, HTTPError, WirelessTagsException) as ex:
_LOGGER.error("Unable to connect to wirelesstag.net service: %s", str(ex))
hass.components.persistent_notification.create(
persistent_notification.create(
hass,
f"Error: {ex}<br />Please restart hass after fixing this.",
title=NOTIFICATION_TITLE,
notification_id=NOTIFICATION_ID,
Expand Down
4 changes: 3 additions & 1 deletion homeassistant/components/xiaomi_aqara/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from xiaomi_gateway import XiaomiGateway, XiaomiGatewayDiscovery

from homeassistant import config_entries, core
from homeassistant.components import persistent_notification
from homeassistant.const import (
ATTR_BATTERY_LEVEL,
ATTR_DEVICE_ID,
Expand Down Expand Up @@ -99,7 +100,8 @@ def add_device_service(call: ServiceCall) -> None:
"""Service to add a new sub-device within the next 30 seconds."""
gateway = call.data.get(ATTR_GW_MAC)
gateway.write_to_hub(gateway.sid, join_permission="yes")
hass.components.persistent_notification.async_create(
persistent_notification.async_create(
hass,
"Join permission enabled for 30 seconds! "
"Please press the pairing button of the new device once.",
title="Xiaomi Aqara Gateway",
Expand Down
9 changes: 5 additions & 4 deletions homeassistant/components/xiaomi_miio/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from miio import ChuangmiIr, DeviceException
import voluptuous as vol

from homeassistant.components import persistent_notification
from homeassistant.components.remote import (
ATTR_DELAY_SECS,
ATTR_NUM_REPEATS,
Expand Down Expand Up @@ -138,8 +139,8 @@ async def async_service_learn_handler(entity, service):
if "code" in message and message["code"]:
log_msg = "Received command is: {}".format(message["code"])
_LOGGER.info(log_msg)
hass.components.persistent_notification.async_create(
log_msg, title="Xiaomi Miio Remote"
persistent_notification.async_create(
hass, log_msg, title="Xiaomi Miio Remote"
)
return

Expand All @@ -149,8 +150,8 @@ async def async_service_learn_handler(entity, service):
await asyncio.sleep(1)

_LOGGER.error("Timeout. No infrared command captured")
hass.components.persistent_notification.async_create(
"Timeout. No infrared command captured", title="Xiaomi Miio Remote"
persistent_notification.async_create(
hass, "Timeout. No infrared command captured", title="Xiaomi Miio Remote"
)

platform = entity_platform.async_get_current_platform()
Expand Down
2 changes: 1 addition & 1 deletion tests/components/websocket_api/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
import pytest
import voluptuous as vol

from homeassistant.bootstrap import SIGNAL_BOOTSTRAP_INTEGRATONS
from homeassistant.components.websocket_api import const
from homeassistant.components.websocket_api.auth import (
TYPE_AUTH,
TYPE_AUTH_OK,
TYPE_AUTH_REQUIRED,
)
from homeassistant.components.websocket_api.const import URL
from homeassistant.const import SIGNAL_BOOTSTRAP_INTEGRATONS
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why this change slipped into this PR

Copy link
Copy Markdown
Contributor Author

@emontnemery emontnemery Jan 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The constant was moved in part1 (#63898) to fix a circular import, this just updates the import.

from homeassistant.core import Context, HomeAssistant, callback
from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers import entity
Expand Down