8000 2021.12.1 by balloob · Pull Request #61625 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

2021.12.1 #61625

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

Merged
merged 12 commits into from
Dec 12, 2021
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
10 changes: 7 additions & 3 deletions homeassistant/components/frontend/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
"domain": "frontend",
"name": "Home Assistant Frontend",
"documentation": "https://www.home-assistant.io/integrations/frontend",
"requirements": ["home-assistant-frontend==20211211.0"],
"requirements": [
"home-assistant-frontend==20211212.0"
],
"dependencies": [
"api",
"auth",
Expand All @@ -15,6 +17,8 @@
"system_log",
"websocket_api"
],
"codeowners": ["@home-assistant/frontend"],
"codeowners": [
"@home-assistant/frontend"
],
"quality_scale": "internal"
}
}
17 changes: 10 additions & 7 deletions homeassistant/components/homekit/type_covers.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,14 +249,17 @@ def set_tilt(self, value):
def async_update_state(self, new_state):
"""Update cover position and tilt after state changed."""
# update tilt
if not self._supports_tilt:
return
current_tilt = new_state.attributes.get(ATTR_CURRENT_TILT_POSITION)
if isinstance(current_tilt, (float, int)):
# HomeKit sends values between -90 and 90.
# We'll have to normalize to [0,100]
current_tilt = (current_tilt / 100.0 * 180.0) - 90.0
current_tilt = int(current_tilt)
self.char_current_tilt.set_value(current_tilt)
self.char_target_tilt.set_value(current_tilt)
if not isinstance(current_tilt, (float, int)):
return
# HomeKit sends values between -90 and 90.
# We'll have to normalize to [0,100]
current_tilt = (current_tilt / 100.0 * 180.0) - 90.0
current_tilt = int(current_tilt)
self.char_current_tilt.set_value(current_tilt)
self.char_target_tilt.set_value(current_tilt)


class OpeningDevice(OpeningDeviceBase, HomeAccessory):
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==3.0.2"],
"requirements": ["aiohue==3.0.3"],
"ssdp": [
{
"manufacturer": "Royal Philips Electronics",
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/hue/scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ async def async_activate(self, **kwargs: Any) -> None:
"""Activate Hue scene."""
transition = kwargs.get("transition")
if transition is not None:
# hue transition duration is in steps of 100 ms
transition = int(transition * 100)
# hue transition duration is in milliseconds
transition = int(transition * 1000)
dynamic = kwargs.get("dynamic", self.is_dynamic)
await self.bridge.async_request_call(
self.controller.recall,
Expand Down
3 changes: 3 additions & 0 deletions homeassistant/components/hue/v2/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ def available(self) -> bool:
if self.resource.type == ResourceTypes.ZIGBEE_CONNECTIVITY:
# the zigbee connectivity sensor itself should be always available
return True
if self.device.product_data.manufacturer_name != "Signify Netherlands B.V.":
# availability status for non-philips brand lights is unreliable
return True
if zigbee := self.bridge.api.devices.get_zigbee_connectivity(self.device.id):
# all device-attached entities get availability from the zigbee connectivity
return zigbee.status == ConnectivityServiceStatus.CONNECTED
Expand Down
14 changes: 9 additions & 5 deletions homeassistant/components/hue/v2/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from homeassistant.helpers.entity_platform import AddEntitiesCallback

from ..bridge import HueBridge
from ..const import DOMAIN
from ..const import CONF_ALLOW_HUE_GROUPS, DOMAIN
from .entity import HueBaseEntity

ALLOWED_ERRORS = [
Expand Down Expand Up @@ -76,8 +76,6 @@ def async_add_light(event_type: EventType, resource: Room | Zone) -> None:
class GroupedHueLight(HueBaseEntity, LightEntity):
"""Representation of a Grouped Hue light."""

# Entities for Hue groups are disabled by default
_attr_entity_registry_enabled_default = False
_attr_icon = "mdi:lightbulb-group"

def __init__(
Expand All @@ -92,6 +90,12 @@ def __init__(
self.api: HueBridgeV2 = bridge.api
self._attr_supported_features |= SUPPORT_TRANSITION

# Entities for Hue groups are disabled by default
# unless they were enabled in old version (legacy option)
self._attr_entity_registry_enabled_default = bridge.config_entry.data.get(
CONF_ALLOW_HUE_GROUPS, False
)

self._update_values()

async def async_added_to_hass(self) -> None:
Expand Down Expand Up @@ -146,8 +150,8 @@ async def async_turn_on(self, **kwargs: Any) -> None:
# Hue uses a range of [0, 100] to control brightness.
brightness = float((brightness / 255) * 100)
if transition is not None:
# hue transition duration is in steps of 100 ms
transition = int(transition * 100)
# hue transition duration is in milliseconds
transition = int(transition * 1000)

# NOTE: a grouped_light can only handle turn on/off
# To set other features, you'll have to control the attached lights
Expand Down
8 changes: 4 additions & 4 deletions homeassistant/components/hue/v2/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ async def async_turn_on(self, **kwargs: Any) -> None:
# Hue uses a range of [0, 100] to control brightness.
brightness = float((brightness / 255) * 100)
if transition is not None:
# hue transition duration is in steps of 100 ms
transition = int(transition * 100)
# hue transition duration is in milliseconds
transition = int(transition * 1000)

await self.bridge.async_request_call(
self.controller.set_state,
Expand All @@ -176,8 +176,8 @@ async def async_turn_off(self, **kwargs: Any) -> None:
"""Turn the light off."""
transition = kwargs.get(ATTR_TRANSITION)
if transition is not None:
# hue transition duration is in steps of 100 ms
transition = int(transition * 100)
# hue transition duration is in milliseconds
transition = int(transition * 1000)
await self.bridge.async_request_call(
self.controller.set_state,
id=self.resource.id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"domain": "hunterdouglas_powerview",
"name": "Hunter Douglas PowerView",
"documentation": "https://www.home-assistant.io/integrations/hunterdouglas_powerview",
"requirements": ["aiopvapi==1.6.14"],
"requirements": ["aiopvapi==1.6.19"],
"codeowners": ["@bdraco"],
"config_flow": true,
"homekit": {
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/nest/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"config_flow": true,
"dependencies": ["ffmpeg", "http", "media_source"],
"documentation": "https://www.home-assistant.io/integrations/nest",
"requirements": ["python-nest==4.1.0", "google-nest-sdm==0.4.5"],
"requirements": ["python-nest==4.1.0", "google-nest-sdm==0.4.6"],
"codeowners": ["@allenporter"],
"quality_scale": "platinum",
"dhcp": [
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/nest/media_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

from google_nest_sdm.camera_traits import CameraClipPreviewTrait, CameraEventImageTrait
from google_nest_sdm.device import Device
from google_nest_sdm.event import ImageEventBase
from google_nest_sdm.event import EventImageType, ImageEventBase

from homeassistant.components.media_player.const import (
MEDIA_CLASS_DIRECTORY,
Expand Down Expand Up @@ -253,7 +253,7 @@ def _browse_event(
event_name=MEDIA_SOURCE_EVENT_TITLE_MAP.get(event.event_type, "Event"),
event_time=dt_util.as_local(event.timestamp).strftime(DATE_STR_FORMAT),
),
can_play=True,
can_play=(event.event_image_type == EventImageType.CLIP_PREVIEW),
can_expand=False,
thumbnail=None,
children=[],
Expand Down
63 changes: 29 additions & 34 deletions homeassistant/components/solarlog/const.py
3D11
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,11 @@
from dataclasses import dataclass

from homeassistant.components.sensor import (
STATE_CLASS_MEASUREMENT,
STATE_CLASS_TOTAL,
SensorDeviceClass,
SensorEntityDescription,
SensorStateClass,
)
from homeassistant.const import (
DEVICE_CLASS_ENERGY,
DEVICE_CLASS_POWER,
DEVICE_CLASS_POWER_FACTOR,
DEVICE_CLASS_TIMESTAMP,
DEVICE_CLASS_VOLTAGE,
ELECTRIC_POTENTIAL_VOLT,
ENERGY_KILO_WATT_HOUR,
PERCENTAGE,
Expand All @@ -38,35 +33,35 @@ class SolarLogSensorEntityDescription(SensorEntityDescription):
SolarLogSensorEntityDescription(
key="time",
name="last update",
device_class=DEVICE_CLASS_TIMESTAMP,
device_class=SensorDeviceClass.TIMESTAMP,
),
SolarLogSensorEntityDescription(
key="power_ac",
name="power AC",
icon="mdi:solar-power",
native_unit_of_measurement=POWER_WATT,
state_class=STATE_CLASS_MEASUREMENT,
state_class=SensorStateClass.MEASUREMENT,
),
SolarLogSensorEntityDescription(
key="power_dc",
name="power DC",
icon="mdi:solar-power",
native_unit_of_measurement=POWER_WATT,
state_class=STATE_CLASS_MEASUREMENT,
state_class=SensorStateClass.MEASUREMENT,
),
SolarLogSensorEntityDescription(
key="voltage_ac",
name="voltage AC",
native_unit_of_measurement=ELECTRIC_POTENTIAL_VOLT,
device_class=DEVICE_CLASS_VOLTAGE,
state_class=STATE_CLASS_MEASUREMENT,
device_class=SensorDeviceClass.VOLTAGE,
state_class=SensorStateClass.MEASUREMENT,
),
SolarLogSensorEntityDescription(
key="voltage_dc",
name="voltage DC",
native_unit_of_measurement=ELECTRIC_POTENTIAL_VOLT,
device_class=DEVICE_CLASS_VOLTAGE,
state_class=STATE_CLASS_MEASUREMENT,
device_class=SensorDeviceClass.VOLTAGE,
state_class=SensorStateClass.MEASUREMENT,
),
SolarLogSensorEntityDescription(
key="yield_day",
Expand Down Expand Up @@ -101,98 +96,98 @@ class SolarLogSensorEntityDescription(SensorEntityDescription):
name="yield total",
icon="mdi:solar-power",
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
state_class=STATE_CLASS_TOTAL,
state_class=SensorStateClass.TOTAL,
factor=0.001,
),
SolarLogSensorEntityDescription(
key="consumption_ac",
name="consumption AC",
native_unit_of_measurement=POWER_WATT,
device_class=DEVICE_CLASS_POWER,
state_class=STATE_CLASS_MEASUREMENT,
device_class=SensorDeviceClass.POWER,
state_class=SensorStateClass.MEASUREMENT,
),
SolarLogSensorEntityDescription(
key="consumption_day",
name="consumption day",
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
device_class=DEVICE_CLASS_ENERGY,
device_class=SensorDeviceClass.ENERGY,
factor=0.001,
),
SolarLogSensorEntityDescription(
key="consumption_yesterday",
name="consumption yesterday",
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
device_class=DEVICE_CLASS_ENERGY,
device_class=SensorDeviceClass.ENERGY,
factor=0.001,
),
SolarLogSensorEntityDescription(
key="consumption_month",
name="consumption month",
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
device_class=DEVICE_CLASS_ENERGY,
device_class=SensorDeviceClass.ENERGY,
factor=0.001,
),
SolarLogSensorEntityDescription(
key="consumption_year",
name="consumption year",
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
device_class=DEVICE_CLASS_ENERGY,
device_class=SensorDeviceClass.ENERGY,
factor=0.001,
),
SolarLogSensorEntityDescription(
key="consumption_total",
name="consumption total",
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
device_class=DEVICE_CLASS_ENERGY,
state_class=STATE_CLASS_TOTAL,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL,
factor=0.001,
),
SolarLogSensorEntityDescription(
key="total_power",
name="installed peak power",
icon="mdi:solar-power",
native_unit_of_measurement=POWER_WATT,
device_class=DEVICE_CLASS_POWER,
device_class=SensorDeviceClass.POWER,
),
SolarLogSensorEntityDescription(
key="alternator_loss",
name="alternator loss",
icon="mdi:solar-power",
native_unit_of_measurement=POWER_WATT,
device_class=DEVICE_CLASS_POWER,
state_class=STATE_CLASS_MEASUREMENT,
device_class=SensorDeviceClass.POWER,
state_class=SensorStateClass.MEASUREMENT,
),
SolarLogSensorEntityDescription(
key="capacity",
name="capacity",
icon="mdi:solar-power",
native_unit_of_measurement=PERCENTAGE,
device_class=DEVICE_CLASS_POWER_FACTOR,
state_class=STATE_CLASS_MEASUREMENT,
device_class=SensorDeviceClass.POWER_FACTOR,
state_class=SensorStateClass.MEASUREMENT,
factor=100,
),
SolarLogSensorEntityDescription(
key="efficiency",
name="efficiency",
native_unit_of_measurement=PERCENTAGE,
device_class=DEVICE_CLASS_POWER_FACTOR,
state_class=STATE_CLASS_MEASUREMENT,
device_class=SensorDeviceClass.POWER_FACTOR,
state_class=SensorStateClass.MEASUREMENT,
factor=100,
),
SolarLogSensorEntityDescription(
key="power_available",
name="power available",
icon="mdi:solar-power",
native_unit_of_measurement=POWER_WATT,
device_class=DEVICE_CLASS_POWER,
state_class=STATE_CLASS_MEASUREMENT,
device_class=SensorDeviceClass.POWER,
state_class=SensorStateClass.MEASUREMENT,
),
SolarLogSensorEntityDescription(
key="usage",
name="usage",
native_unit_of_measurement=PERCENTAGE,
device_class=DEVICE_CLASS_POWER_FACTOR,
state_class=STATE_CLASS_MEASUREMENT,
device_class=SensorDeviceClass.POWER_FACTOR,
state_class=SensorStateClass.MEASUREMENT,
factor=100,
),
)
18 changes: 12 additions & 6 deletions homeassistant/components/solarlog/sensor.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
"""Platform for solarlog sensors."""
from homeassistant.components.sensor import SensorEntity
from homeassistant.helpers import update_coordinator
from homeassistant.helpers.entity import DeviceInfo, StateType
from homeassistant.helpers.entity import DeviceInfo
from homeassistant.util.dt import as_local

from . import SolarlogData
from .const import DOMAIN, SENSOR_TYPES, SolarLogSensorEntityDescription
Expand Down Expand Up @@ -38,11 +39,16 @@ def __init__(
)

@property
def native_value(self) -> StateType:
def native_value(self):
"""Return the native sensor value."""
result = getattr(self.coordinator.data, self.entity_description.key)
if self.entity_description.factor:
state = round(result * self.entity_description.factor, 3)
if self.entity_description.key == "time":
state = as_local(
getattr(self.coordinator.data, self.entity_description.key)
)
else:
state = result
result = getattr(self.coordinator.data, self.entity_description.key)
if self.entity_description.factor:
state = round(result * self.entity_description.factor, 3)
else:
state = result
return state
Loading
0