Skip to content
Merged

2021.5.1 #50243

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
66c9658
Fix mysensors default persistence file on import (#48410)
MartinHjelmare May 7, 2021
ca9a685
Only initialize Nuki configurations (#49747)
May 7, 2021
2aafc88
Denonavr bugfixes (#49984)
scarface-4711 May 7, 2021
74b958d
Fix group selector (#50088)
tkdrob May 6, 2021
c75d99c
Fix RM pro temperature sensor (#50098)
felipediel May 7, 2021
a7ef642
Ignore empty output from MQTT fan's value template (#50122)
jbouwh May 7, 2021
70a7339
Bump python-miio dependency (#50129)
rytilahti May 6, 2021
d1a75b2
Bump sqlalchemy to 1.4.13 (#50138)
bdraco May 6, 2021
bb3ebad
Fix zwave_js websocket api KeyError on unloaded entry (#50154)
MartinHjelmare May 6, 2021
1e604fe
Fix unique_id issue on onewire config entries (#50161)
epenet May 7, 2021
27e0c0b
Add color_mode support to group light (#50165)
emontnemery May 7, 2021
df740a7
Move not loaded websocket constant to zwave_js (#50188)
MartinHjelmare May 7, 2021
5c6b9c7
Add value map for Climacell V3 pollen sensors (#50200)
raman325 May 7, 2021
cf7f277
Ensure tesla setup is retried on timeout (#50202)
bdraco May 7, 2021
b144550
Allow SimpliSafe startup to retry on failure (#50211)
bachya May 7, 2021
ead7a90
Bump aiohue to 2.3.0 (#50217)
balloob May 7, 2021
193a0df
support more alarm panels (#50235)
dmulcahey May 7, 2021
a9bb905
Fix Netatmo climate (#50238)
cgtobi May 7, 2021
dfc5d22
Bumped version to 2021.5.1
frenck May 7, 2021
1e072b7
Fix light turn_on color conversion (#50251)
emontnemery May 7, 2021
dabd398
Add color_mode to demo light (#49694)
emontnemery Apr 29, 2021
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
2 changes: 1 addition & 1 deletion homeassistant/components/broadlink/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
sensors = [
BroadlinkSensor(device, monitored_condition)
for monitored_condition in sensor_data
if sensor_data[monitored_condition] or device.api.type == "A1"
if sensor_data[monitored_condition] != 0 or device.api.type == "A1"
]
async_add_entities(sensors)

Expand Down
16 changes: 15 additions & 1 deletion homeassistant/components/broadlink/updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,25 @@ async def async_fetch_data(self):
device = self.device

if hasattr(device.api, "check_sensors"):
return await device.async_request(device.api.check_sensors)
data = await device.async_request(device.api.check_sensors)
return self.normalize(data, self.coordinator.data)

await device.async_request(device.api.update)
return {}

@staticmethod
def normalize(data, previous_data):
"""Fix firmware issue.

See https://github.com/home-assistant/core/issues/42100.
"""
if data["temperature"] == -7:
if previous_data is None or previous_data["temperature"] is None:
data["temperature"] = None
elif abs(previous_data["temperature"] - data["temperature"]) > 3:
data["temperature"] = previous_data["temperature"]
return data


class BroadlinkSP1UpdateManager(BroadlinkUpdateManager):
"""Manages updates for Broadlink SP1 devices."""
Expand Down
19 changes: 16 additions & 3 deletions homeassistant/components/climacell/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
HealthConcernType,
PollenIndex,
PrimaryPollutantType,
V3PollenIndex,
WeatherCode,
)

Expand Down Expand Up @@ -307,8 +308,20 @@
ATTR_FIELD: CC_V3_ATTR_CHINA_HEALTH_CONCERN,
ATTR_NAME: "China MEP Health Concern",
},
{ATTR_FIELD: CC_V3_ATTR_POLLEN_TREE, ATTR_NAME: "Tree Pollen Index"},
{ATTR_FIELD: CC_V3_ATTR_POLLEN_WEED, ATTR_NAME: "Weed Pollen Index"},
{ATTR_FIELD: CC_V3_ATTR_POLLEN_GRASS, ATTR_NAME: "Grass Pollen Index"},
{
ATTR_FIELD: CC_V3_ATTR_POLLEN_TREE,
ATTR_NAME: "Tree Pollen Index",
ATTR_VALUE_MAP: V3PollenIndex,
},
{
ATTR_FIELD: CC_V3_ATTR_POLLEN_WEED,
ATTR_NAME: "Weed Pollen Index",
ATTR_VALUE_MAP: V3PollenIndex,
},
{
ATTR_FIELD: CC_V3_ATTR_POLLEN_GRASS,
ATTR_NAME: "Grass Pollen Index",
ATTR_VALUE_MAP: V3PollenIndex,
},
{ATTR_FIELD: CC_V3_ATTR_FIRE_INDEX, ATTR_NAME: "Fire Index"},
]
2 changes: 1 addition & 1 deletion homeassistant/components/climacell/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "ClimaCell",
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/climacell",
"requirements": ["pyclimacell==0.18.0"],
"requirements": ["pyclimacell==0.18.2"],
"codeowners": ["@raman325"],
"iot_class": "cloud_polling"
}
2 changes: 1 addition & 1 deletion homeassistant/components/climacell/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def state(self) -> str | int | float | None:
):
return round(self._state * self.sensor_type[ATTR_METRIC_CONVERSION], 4)

if ATTR_VALUE_MAP in self.sensor_type:
if ATTR_VALUE_MAP in self.sensor_type and self._state is not None:
return self.sensor_type[ATTR_VALUE_MAP](self._state).name.lower()
return self._state

Expand Down
138 changes: 92 additions & 46 deletions homeassistant/components/demo/light.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
"""Demo light platform that implements lights."""
from __future__ import annotations

import random

from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_COLOR_TEMP,
ATTR_EFFECT,
ATTR_HS_COLOR,
ATTR_WHITE_VALUE,
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
SUPPORT_COLOR_TEMP,
ATTR_RGBW_COLOR,
ATTR_RGBWW_COLOR,
COLOR_MODE_COLOR_TEMP,
COLOR_MODE_HS,
COLOR_MODE_RGBW,
COLOR_MODE_RGBWW,
SUPPORT_EFFECT,
SUPPORT_WHITE_VALUE,
LightEntity,
)

Expand All @@ -23,37 +26,51 @@

LIGHT_TEMPS = [240, 380]

SUPPORT_DEMO = (
SUPPORT_BRIGHTNESS | SUPPORT_COLOR_TEMP | SUPPORT_COLOR | SUPPORT_WHITE_VALUE
)
SUPPORT_DEMO = {COLOR_MODE_HS, COLOR_MODE_COLOR_TEMP}


async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the demo light platform."""
async_add_entities(
[
DemoLight(
unique_id="light_1",
name="Bed Light",
state=False,
available=True,
effect_list=LIGHT_EFFECT_LIST,
effect=LIGHT_EFFECT_LIST[0],
name="Bed Light",
state=False,
unique_id="light_1",
),
DemoLight(
unique_id="light_2",
name="Ceiling Lights",
state=True,
available=True,
ct=LIGHT_TEMPS[1],
name="Ceiling Lights",
state=True,
unique_id="light_2",
),
DemoLight(
unique_id="light_3",
available=True,
hs_color=LIGHT_COLORS[1],
name="Kitchen Lights",
state=True,
unique_id="light_3",
),
DemoLight(
available=True,
hs_color=LIGHT_COLORS[1],
ct=LIGHT_TEMPS[0],
ct=LIGHT_TEMPS[1],
name="Office RGBW Lights",
rgbw_color=(255, 0, 0, 255),
state=True,
supported_color_modes={COLOR_MODE_RGBW},
unique_id="light_4",
),
DemoLight(
available=True,
name="Living Room RGBWW Lights",
rgbww_color=(255, 0, 0, 255, 0),
state=True,
supported_color_modes={COLOR_MODE_RGBWW},
unique_id="light_5",
),
]
)
Expand All @@ -73,26 +90,39 @@ def __init__(
name,
state,
available=False,
hs_color=None,
ct=None,
brightness=180,
white=200,
ct=None,
effect_list=None,
effect=None,
hs_color=None,
rgbw_color=None,
rgbww_color=None,
supported_color_modes=None,
):
"""Initialize the light."""
self._unique_id = unique_id
self._name = name
self._state = state
self._hs_color = hs_color
self._ct = ct or random.choice(LIGHT_TEMPS)
self._available = True
self._brightness = brightness
self._white = white
self._features = SUPPORT_DEMO
self._effect_list = effect_list
self._ct = ct or random.choice(LIGHT_TEMPS)
self._effect = effect
self._available = True
self._color_mode = "ct" if ct is not None and hs_color is None else "hs"
self._effect_list = effect_list
self._features = 0
self._hs_color = hs_color
self._name = name
self._rgbw_color = rgbw_color
self._rgbww_color = rgbww_color
self._state = state
self._unique_id = unique_id
if hs_color:
self._color_mode = COLOR_MODE_HS
elif rgbw_color:
self._color_mode = COLOR_MODE_RGBW
elif rgbww_color:
self._color_mode = COLOR_MODE_RGBWW
else:
self._color_mode = COLOR_MODE_COLOR_TEMP
if not supported_color_modes:
supported_color_modes = SUPPORT_DEMO
self._color_modes = supported_color_modes
if self._effect_list is not None:
self._features |= SUPPORT_EFFECT

Expand Down Expand Up @@ -134,24 +164,30 @@ def brightness(self) -> int:
"""Return the brightness of this light between 0..255."""
return self._brightness

@property
def color_mode(self) -> str | None:
"""Return the color mode of the light."""
return self._color_mode

@property
def hs_color(self) -> tuple:
"""Return the hs color value."""
if self._color_mode == "hs":
return self._hs_color
return None
return self._hs_color

@property
def color_temp(self) -> int:
"""Return the CT color temperature."""
if self._color_mode == "ct":
return self._ct
return None
def rgbw_color(self) -> tuple:
"""Return the rgbw color value."""
return self._rgbw_color

@property
def rgbww_color(self) -> tuple:
"""Return the rgbww color value."""
return self._rgbww_color

@property
def white_value(self) -> int:
"""Return the white value of this light between 0..255."""
return self._white
def color_temp(self) -> int:
"""Return the CT color temperature."""
return self._ct

@property
def effect_list(self) -> list:
Expand All @@ -173,24 +209,34 @@ def supported_features(self) -> int:
"""Flag supported features."""
return self._features

@property
def supported_color_modes(self) -> set | None:
"""Flag supported color modes."""
return self._color_modes

async def async_turn_on(self, **kwargs) -> None:
"""Turn the light on."""
self._state = True

if ATTR_RGBW_COLOR in kwargs:
self._color_mode = COLOR_MODE_RGBW
self._rgbw_color = kwargs[ATTR_RGBW_COLOR]

if ATTR_RGBWW_COLOR in kwargs:
self._color_mode = COLOR_MODE_RGBWW
self._rgbww_color = kwargs[ATTR_RGBWW_COLOR]

if ATTR_HS_COLOR in kwargs:
self._color_mode = "hs"
self._color_mode = COLOR_MODE_HS
self._hs_color = kwargs[ATTR_HS_COLOR]

if ATTR_COLOR_TEMP in kwargs:
self._color_mode = "ct"
self._color_mode = COLOR_MODE_COLOR_TEMP
self._ct = kwargs[ATTR_COLOR_TEMP]

if ATTR_BRIGHTNESS in kwargs:
self._brightness = kwargs[ATTR_BRIGHTNESS]

if ATTR_WHITE_VALUE in kwargs:
self._white = kwargs[ATTR_WHITE_VALUE]

if ATTR_EFFECT in kwargs:
self._effect = kwargs[ATTR_EFFECT]

Expand Down
1 change: 0 additions & 1 deletion homeassistant/components/denonavr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ async def async_setup_entry(
entry.options.get(CONF_ZONE2, DEFAULT_ZONE2),
entry.options.get(CONF_ZONE3, DEFAULT_ZONE3),
lambda: get_async_client(hass),
entry.state,
)
try:
await connect_denonavr.async_connect_receiver()
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/denonavr/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Denon AVR Network Receivers",
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/denonavr",
"requirements": ["denonavr==0.10.5"],
"requirements": ["denonavr==0.10.6"],
"codeowners": ["@scarface-4711", "@starkillerOG"],
"ssdp": [
{
Expand Down
1 change: 0 additions & 1 deletion homeassistant/components/denonavr/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ def device_info(self):
"manufacturer": self._config_entry.data[CONF_MANUFACTURER],
"name": self._config_entry.title,
"model": f"{self._config_entry.data[CONF_MODEL]}-{self._config_entry.data[CONF_TYPE]}",
"serial_number": self._config_entry.data[CONF_SERIAL_NUMBER],
}

return device_info
Expand Down
2 changes: 0 additions & 2 deletions homeassistant/components/denonavr/receiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,13 @@ def __init__(
zone2: bool,
zone3: bool,
async_client_getter: Callable,
entry_state: str | None = None,
):
"""Initialize the class."""
self._async_client_getter = async_client_getter
self._receiver = None
self._host = host
self._show_all_inputs = show_all_inputs
self._timeout = timeout
self._entry_state = entry_state

self._zones = {}
if zone2:
Expand Down
Loading