Skip to content

Commit

Permalink
Merge pull request #66624 from home-assistant/rc
Browse files Browse the repository at this point in the history
  • Loading branch information
balloob authored Feb 16, 2022
2 parents fc2d30c + 7d2e42d commit e33671d
Show file tree
Hide file tree
Showing 48 changed files with 241 additions and 179 deletions.
4 changes: 2 additions & 2 deletions homeassistant/components/advantage_air/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"@Bre77"
],
"requirements": [
"advantage_air==0.2.5"
"advantage_air==0.3.0"
],
"quality_scale": "platinum",
"iot_class": "local_polling"
}
}
2 changes: 1 addition & 1 deletion homeassistant/components/flux_led/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"config_flow": true,
"dependencies": ["network"],
"documentation": "https://www.home-assistant.io/integrations/flux_led",
"requirements": ["flux_led==0.28.22"],
"requirements": ["flux_led==0.28.26"],
"quality_scale": "platinum",
"codeowners": ["@icemanch", "@bdraco"],
"iot_class": "local_push",
Expand Down
11 changes: 5 additions & 6 deletions homeassistant/components/fritz/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@
ButtonEntityDescription,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ENTITY_CATEGORY_CONFIG
from homeassistant.core import HomeAssistant
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC
from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.entity import DeviceInfo, EntityCategory
from homeassistant.helpers.entity_platform import AddEntitiesCallback

from .common import AvmWrapper
Expand All @@ -41,28 +40,28 @@ class FritzButtonDescription(ButtonEntityDescription, FritzButtonDescriptionMixi
key="firmware_update",
name="Firmware Update",
device_class=ButtonDeviceClass.UPDATE,
entity_category=ENTITY_CATEGORY_CONFIG,
entity_category=EntityCategory.CONFIG,
press_action=lambda avm_wrapper: avm_wrapper.async_trigger_firmware_update(),
),
FritzButtonDescription(
key="reboot",
name="Reboot",
device_class=ButtonDeviceClass.RESTART,
entity_category=ENTITY_CATEGORY_CONFIG,
entity_category=EntityCategory.CONFIG,
press_action=lambda avm_wrapper: avm_wrapper.async_trigger_reboot(),
),
FritzButtonDescription(
key="reconnect",
name="Reconnect",
device_class=ButtonDeviceClass.RESTART,
entity_category=ENTITY_CATEGORY_CONFIG,
entity_category=EntityCategory.CONFIG,
press_action=lambda avm_wrapper: avm_wrapper.async_trigger_reconnect(),
),
FritzButtonDescription(
key="cleanup",
name="Cleanup",
icon="mdi:broom",
entity_category=ENTITY_CATEGORY_CONFIG,
entity_category=EntityCategory.CONFIG,
press_action=lambda avm_wrapper: avm_wrapper.async_trigger_cleanup(),
),
]
Expand Down
18 changes: 13 additions & 5 deletions homeassistant/components/fritz/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,11 +327,19 @@ def scan_devices(self, now: datetime | None = None) -> None:
_LOGGER.debug("Checking host info for FRITZ!Box device %s", self.host)
self._update_available, self._latest_firmware = self._update_device_info()

try:
topology = self.fritz_hosts.get_mesh_topology()
except FritzActionError:
self.mesh_role = MeshRoles.SLAVE
return
if (
"Hosts1" not in self.connection.services
or "X_AVM-DE_GetMeshListPath"
not in self.connection.services["Hosts1"].actions
):
self.mesh_role = MeshRoles.NONE
else:
try:
topology = self.fritz_hosts.get_mesh_topology()
except FritzActionError:
self.mesh_role = MeshRoles.SLAVE
# Avoid duplicating device trackers
return

_LOGGER.debug("Checking devices for FRITZ!Box device %s", self.host)
_default_consider_home = DEFAULT_CONSIDER_HOME.total_seconds()
Expand Down
6 changes: 3 additions & 3 deletions homeassistant/components/fritzbox/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
BinarySensorEntityDescription,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ENTITY_CATEGORY_CONFIG
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import EntityCategory
from homeassistant.helpers.entity_platform import AddEntitiesCallback

from . import FritzBoxEntity
Expand Down Expand Up @@ -49,15 +49,15 @@ class FritzBinarySensorEntityDescription(
key="lock",
name="Button Lock on Device",
device_class=BinarySensorDeviceClass.LOCK,
entity_category=ENTITY_CATEGORY_CONFIG,
entity_category=EntityCategory.CONFIG,
suitable=lambda device: device.lock is not None,
is_on=lambda device: not device.lock,
),
FritzBinarySensorEntityDescription(
key="device_lock",
name="Button Lock via UI",
device_class=BinarySensorDeviceClass.LOCK,
entity_category=ENTITY_CATEGORY_CONFIG,
entity_category=EntityCategory.CONFIG,
suitable=lambda device: device.device_lock is not None,
is_on=lambda device: not device.device_lock,
),
Expand Down
8 changes: 4 additions & 4 deletions homeassistant/components/goodwe/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

from homeassistant.components.number import NumberEntity, NumberEntityDescription
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ENTITY_CATEGORY_CONFIG, PERCENTAGE, POWER_WATT
from homeassistant.const import PERCENTAGE, POWER_WATT
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.entity import DeviceInfo, EntityCategory
from homeassistant.helpers.entity_platform import AddEntitiesCallback

from .const import DOMAIN, KEY_DEVICE_INFO, KEY_INVERTER
Expand Down Expand Up @@ -39,7 +39,7 @@ class GoodweNumberEntityDescription(
key="grid_export_limit",
name="Grid export limit",
icon="mdi:transmission-tower",
entity_category=ENTITY_CATEGORY_CONFIG,
entity_category=EntityCategory.CONFIG,
unit_of_measurement=POWER_WATT,
getter=lambda inv: inv.get_grid_export_limit(),
setter=lambda inv, val: inv.set_grid_export_limit(val),
Expand All @@ -51,7 +51,7 @@ class GoodweNumberEntityDescription(
key="battery_discharge_depth",
name="Depth of discharge (on-grid)",
icon="mdi:battery-arrow-down",
entity_category=ENTITY_CATEGORY_CONFIG,
entity_category=EntityCategory.CONFIG,
unit_of_measurement=PERCENTAGE,
getter=lambda inv: inv.get_ongrid_battery_dod(),
setter=lambda inv, val: inv.set_ongrid_battery_dod(val),
Expand Down
5 changes: 2 additions & 3 deletions homeassistant/components/goodwe/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@

from homeassistant.components.select import SelectEntity, SelectEntityDescription
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ENTITY_CATEGORY_CONFIG
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.entity import DeviceInfo, EntityCategory
from homeassistant.helpers.entity_platform import AddEntitiesCallback

from .const import DOMAIN, KEY_DEVICE_INFO, KEY_INVERTER
Expand All @@ -26,7 +25,7 @@
key="operation_mode",
name="Inverter operation mode",
icon="mdi:solar-power",
entity_category=ENTITY_CATEGORY_CONFIG,
entity_category=EntityCategory.CONFIG,
)


Expand Down
8 changes: 4 additions & 4 deletions homeassistant/components/hdmi_cec/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

from homeassistant.components.media_player import MediaPlayerEntity
from homeassistant.components.media_player.const import (
DOMAIN,
DOMAIN as MP_DOMAIN,
SUPPORT_NEXT_TRACK,
SUPPORT_PAUSE,
SUPPORT_PLAY_MEDIA,
Expand All @@ -48,11 +48,11 @@
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType

from . import ATTR_NEW, CecEntity
from . import ATTR_NEW, DOMAIN, CecEntity

_LOGGER = logging.getLogger(__name__)

ENTITY_ID_FORMAT = DOMAIN + ".{}"
ENTITY_ID_FORMAT = MP_DOMAIN + ".{}"


def setup_platform(
Expand All @@ -77,7 +77,7 @@ class CecPlayerEntity(CecEntity, MediaPlayerEntity):
def __init__(self, device, logical) -> None:
"""Initialize the HDMI device."""
CecEntity.__init__(self, device, logical)
self.entity_id = f"{DOMAIN}.hdmi_{hex(self._logical_address)[2:]}"
self.entity_id = f"{MP_DOMAIN}.hdmi_{hex(self._logical_address)[2:]}"

def send_keypress(self, key):
"""Send keypress to CEC adapter."""
Expand Down
8 changes: 4 additions & 4 deletions homeassistant/components/hdmi_cec/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@

import logging

from homeassistant.components.switch import DOMAIN, SwitchEntity
from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN, SwitchEntity
from homeassistant.const import STATE_OFF, STATE_ON
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType

from . import ATTR_NEW, CecEntity
from . import ATTR_NEW, DOMAIN, CecEntity

_LOGGER = logging.getLogger(__name__)

ENTITY_ID_FORMAT = DOMAIN + ".{}"
ENTITY_ID_FORMAT = SWITCH_DOMAIN + ".{}"


def setup_platform(
Expand All @@ -38,7 +38,7 @@ class CecSwitchEntity(CecEntity, SwitchEntity):
def __init__(self, device, logical) -> None:
"""Initialize the HDMI device."""
CecEntity.__init__(self, device, logical)
self.entity_id = f"{DOMAIN}.hdmi_{hex(self._logical_address)[2:]}"
self.entity_id = f"{SWITCH_DOMAIN}.hdmi_{hex(self._logical_address)[2:]}"

def turn_on(self, **kwargs) -> None:
"""Turn device on."""
Expand Down
11 changes: 5 additions & 6 deletions homeassistant/components/homewizard/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@
DEVICE_CLASS_GAS,
DEVICE_CLASS_POWER,
ENERGY_KILO_WATT_HOUR,
ENTITY_CATEGORY_DIAGNOSTIC,
PERCENTAGE,
POWER_WATT,
VOLUME_CUBIC_METERS,
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.entity import DeviceInfo, EntityCategory
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import StateType
from homeassistant.helpers.update_coordinator import CoordinatorEntity
Expand All @@ -37,27 +36,27 @@
key="smr_version",
name="DSMR Version",
icon="mdi:counter",
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
entity_category=EntityCategory.DIAGNOSTIC,
),
SensorEntityDescription(
key="meter_model",
name="Smart Meter Model",
icon="mdi:gauge",
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
entity_category=EntityCategory.DIAGNOSTIC,
),
SensorEntityDescription(
key="wifi_ssid",
name="Wifi SSID",
icon="mdi:wifi",
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
entity_category=EntityCategory.DIAGNOSTIC,
),
SensorEntityDescription(
key="wifi_strength",
name="Wifi Strength",
icon="mdi:wifi",
native_unit_of_measurement=PERCENTAGE,
state_class=STATE_CLASS_MEASUREMENT,
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
entity_category=EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default=False,
),
SensorEntityDescription(
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/hue/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Philips Hue",
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/hue",
"requirements": ["aiohue==4.0.1"],
"requirements": ["aiohue==4.1.2"],
"ssdp": [
{
"manufacturer": "Royal Philips Electronics",
Expand Down
8 changes: 6 additions & 2 deletions homeassistant/components/hue/scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@

from aiohue.v2 import HueBridgeV2
from aiohue.v2.controllers.events import EventType
from aiohue.v2.controllers.scenes import Scene as HueScene, ScenesController
from aiohue.v2.controllers.scenes import (
Scene as HueScene,
ScenePut as HueScenePut,
ScenesController,
)
import voluptuous as vol

from homeassistant.components.scene import ATTR_TRANSITION, Scene as SceneEntity
Expand Down Expand Up @@ -131,7 +135,7 @@ async def async_activate(self, **kwargs: Any) -> None:
await self.bridge.async_request_call(
self.controller.update,
self.resource.id,
HueScene(self.resource.id, speed=speed / 100),
HueScenePut(speed=speed / 100),
)

await self.bridge.async_request_call(
Expand Down
10 changes: 8 additions & 2 deletions homeassistant/components/hue/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@

from aiohue.v2 import HueBridgeV2
from aiohue.v2.controllers.events import EventType
from aiohue.v2.controllers.sensors import LightLevelController, MotionController
from aiohue.v2.models.resource import SensingService
from aiohue.v2.controllers.sensors import (
LightLevel,
LightLevelController,
Motion,
MotionController,
)

from homeassistant.components.switch import SwitchDeviceClass, SwitchEntity
from homeassistant.config_entries import ConfigEntry
Expand All @@ -20,6 +24,8 @@

ControllerType = Union[LightLevelController, MotionController]

SensingService = Union[LightLevel, Motion]


async def async_setup_entry(
hass: HomeAssistant,
Expand Down
12 changes: 6 additions & 6 deletions homeassistant/components/hue/v2/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
from typing import Any, Union

from aiohue.v2 import HueBridgeV2
from aiohue.v2.controllers.config import EntertainmentConfigurationController
from aiohue.v2.controllers.events import EventType
from aiohue.v2.controllers.sensors import MotionController
from aiohue.v2.models.entertainment import (
from aiohue.v2.controllers.config import (
EntertainmentConfiguration,
EntertainmentStatus,
EntertainmentConfigurationController,
)
from aiohue.v2.controllers.events import EventType
from aiohue.v2.controllers.sensors import MotionController
from aiohue.v2.models.entertainment_configuration import EntertainmentStatus
from aiohue.v2.models.motion import Motion

from homeassistant.components.binary_sensor import (
Expand Down Expand Up @@ -109,4 +109,4 @@ def is_on(self) -> bool | None:
def name(self) -> str:
"""Return sensor name."""
type_title = self.resource.type.value.replace("_", " ").title()
return f"{self.resource.name}: {type_title}"
return f"{self.resource.metadata.name}: {type_title}"
Loading

0 comments on commit e33671d

Please sign in to comment.