Skip to content
Merged
3 changes: 1 addition & 2 deletions homeassistant/components/broadlink/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"domain": "broadlink",
"name": "Broadlink",
"documentation": "https://www.home-assistant.io/integrations/broadlink",
"requirements": ["broadlink==0.13.0"],
"dependencies": [],
"requirements": ["broadlink==0.13.1"],
"codeowners": ["@danielhiversen", "@felipediel"]
}
15 changes: 13 additions & 2 deletions homeassistant/components/elkm1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
CONF_PASSWORD,
CONF_TEMPERATURE_UNIT,
CONF_USERNAME,
TEMP_CELSIUS,
TEMP_FAHRENHEIT,
)
from homeassistant.core import HomeAssistant, callback
from homeassistant.exceptions import ConfigEntryNotReady
Expand All @@ -23,6 +25,8 @@
from homeassistant.helpers.typing import ConfigType

from .const import (
BARE_TEMP_CELSIUS,
BARE_TEMP_FAHRENHEIT,
CONF_AREA,
CONF_AUTO_CONFIGURE,
CONF_COUNTER,
Expand Down Expand Up @@ -119,7 +123,10 @@ def _has_all_unique_prefixes(value):
vol.Optional(CONF_USERNAME, default=""): cv.string,
vol.Optional(CONF_PASSWORD, default=""): cv.string,
vol.Optional(CONF_AUTO_CONFIGURE, default=False): cv.boolean,
vol.Optional(CONF_TEMPERATURE_UNIT, default="F"): cv.temperature_unit,
# cv.temperature_unit will mutate 'C' -> '°C' and 'F' -> '°F'
vol.Optional(
CONF_TEMPERATURE_UNIT, default=BARE_TEMP_FAHRENHEIT
): cv.temperature_unit,
vol.Optional(CONF_AREA, default={}): DEVICE_SCHEMA_SUBDOMAIN,
vol.Optional(CONF_COUNTER, default={}): DEVICE_SCHEMA_SUBDOMAIN,
vol.Optional(CONF_KEYPAD, default={}): DEVICE_SCHEMA_SUBDOMAIN,
Expand Down Expand Up @@ -187,7 +194,11 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):

_LOGGER.debug("Setting up elkm1 %s", conf["host"])

config = {"temperature_unit": conf[CONF_TEMPERATURE_UNIT]}
temperature_unit = TEMP_FAHRENHEIT
if conf[CONF_TEMPERATURE_UNIT] in (BARE_TEMP_CELSIUS, TEMP_CELSIUS):
temperature_unit = TEMP_CELSIUS

config = {"temperature_unit": temperature_unit}

if not conf[CONF_AUTO_CONFIGURE]:
# With elkm1-lib==0.7.16 and later auto configure is available
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/elkm1/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
SUPPORT_FAN_MODE,
SUPPORT_TARGET_TEMPERATURE_RANGE,
)
from homeassistant.const import PRECISION_WHOLE, STATE_ON, TEMP_CELSIUS, TEMP_FAHRENHEIT
from homeassistant.const import PRECISION_WHOLE, STATE_ON

from . import ElkEntity, create_elk_entities
from .const import DOMAIN
Expand Down Expand Up @@ -55,7 +55,7 @@ def supported_features(self):
@property
def temperature_unit(self):
"""Return the temperature unit."""
return TEMP_FAHRENHEIT if self._temperature_unit == "F" else TEMP_CELSIUS
return self._temperature_unit

@property
def current_temperature(self):
Expand Down
6 changes: 5 additions & 1 deletion homeassistant/components/elkm1/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
CONF_PROTOCOL,
CONF_TEMPERATURE_UNIT,
CONF_USERNAME,
TEMP_CELSIUS,
TEMP_FAHRENHEIT,
)
from homeassistant.util import slugify

Expand All @@ -33,7 +35,9 @@
vol.Optional(CONF_USERNAME, default=""): str,
vol.Optional(CONF_PASSWORD, default=""): str,
vol.Optional(CONF_PREFIX, default=""): str,
vol.Optional(CONF_TEMPERATURE_UNIT, default="F"): vol.In(["F", "C"]),
vol.Optional(CONF_TEMPERATURE_UNIT, default=TEMP_FAHRENHEIT): vol.In(
[TEMP_FAHRENHEIT, TEMP_CELSIUS]
),
}
)

Expand Down
3 changes: 3 additions & 0 deletions homeassistant/components/elkm1/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
CONF_PREFIX = "prefix"


BARE_TEMP_FAHRENHEIT = "F"
BARE_TEMP_CELSIUS = "C"

ELK_ELEMENTS = {
CONF_AREA: Max.AREAS.value,
CONF_COUNTER: Max.COUNTERS.value,
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/kef/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ async def async_media_next_track(self):
"""Send next track command."""
await self._speaker.next_track()

async def update_dsp(self) -> None:
async def update_dsp(self, _=None) -> None:
"""Update the DSP settings."""
if self._speaker_type == "LS50" and self._state == STATE_OFF:
# The LSX is able to respond when off the LS50 has to be on.
Expand Down
7 changes: 6 additions & 1 deletion homeassistant/components/nut/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,15 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):

_LOGGER.debug("NUT Sensors Available: %s", status)

unique_id = _unique_id_from_status(status)

if unique_id is None:
unique_id = entry.entry_id

hass.data[DOMAIN][entry.entry_id] = {
PYNUT_DATA: data,
PYNUT_STATUS: status,
PYNUT_UNIQUE_ID: _unique_id_from_status(status),
PYNUT_UNIQUE_ID: unique_id,
PYNUT_MANUFACTURER: _manufacturer_from_status(status),
PYNUT_MODEL: _model_from_status(status),
PYNUT_FIRMWARE: _firmware_from_status(status),
Expand Down
19 changes: 13 additions & 6 deletions homeassistant/components/sonos/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ def state(self):
if self._status in ("PAUSED_PLAYBACK", "STOPPED",):
# Sonos can consider itself "paused" but without having media loaded
# (happens if playing Spotify and via Spotify app you pick another device to play on)
if self._media_title is None:
if self.media_title is None:
return STATE_IDLE
return STATE_PAUSED
if self._status in ("PLAYING", "TRANSITIONING"):
Expand Down Expand Up @@ -614,12 +614,19 @@ def update_media_radio(self, variables, track_info):
except (TypeError, KeyError, AttributeError):
pass

# Radios without tagging can have part of the radio URI as title.
# Non-playing radios will not have a current title. In these cases we
# try to use the radio name instead.
# Non-playing radios will not have a current title. Radios without tagging
# can have part of the radio URI as title. In these cases we try to use the
# radio name instead.
try:
if self._media_title in self._uri or self.state != STATE_PLAYING:
self._media_title = variables["enqueued_transport_uri_meta_data"].title
uri_meta_data = variables["enqueued_transport_uri_meta_data"]
if isinstance(
uri_meta_data, pysonos.data_structures.DidlAudioBroadcast
) and (
self.state != STATE_PLAYING
or self.soco.is_radio_uri(self._media_title)
or self._media_title in self._uri
):
self._media_title = uri_meta_data.title
except (TypeError, KeyError, AttributeError):
pass

Expand Down
21 changes: 20 additions & 1 deletion homeassistant/components/vizio/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@

from homeassistant import config_entries
from homeassistant.components.media_player import DEVICE_CLASS_SPEAKER, DEVICE_CLASS_TV
from homeassistant.config_entries import SOURCE_IMPORT, SOURCE_ZEROCONF, ConfigEntry
from homeassistant.config_entries import (
SOURCE_IGNORE,
SOURCE_IMPORT,
SOURCE_ZEROCONF,
ConfigEntry,
)
from homeassistant.const import (
CONF_ACCESS_TOKEN,
CONF_DEVICE_CLASS,
Expand Down Expand Up @@ -198,8 +203,13 @@ async def async_step_user(

# Check if new config entry matches any existing config entries
for entry in self.hass.config_entries.async_entries(DOMAIN):
# If source is ignore bypass host and name check and continue through loop
if entry.source == SOURCE_IGNORE:
continue

if _host_is_same(entry.data[CONF_HOST], user_input[CONF_HOST]):
errors[CONF_HOST] = "host_exists"

if entry.data[CONF_NAME] == user_input[CONF_NAME]:
errors[CONF_NAME] = "name_exists"

Expand Down Expand Up @@ -270,6 +280,10 @@ async def async_step_import(self, import_config: Dict[str, Any]) -> Dict[str, An
"""Import a config entry from configuration.yaml."""
# Check if new config entry matches any existing config entries
for entry in self.hass.config_entries.async_entries(DOMAIN):
# If source is ignore bypass host check and continue through loop
if entry.source == SOURCE_IGNORE:
continue

if _host_is_same(entry.data[CONF_HOST], import_config[CONF_HOST]):
updated_options = {}
updated_data = {}
Expand Down Expand Up @@ -327,13 +341,18 @@ async def async_step_zeroconf(
await self.async_set_unique_id(
unique_id=discovery_info[CONF_HOST].split(":")[0], raise_on_progress=True
)
self._abort_if_unique_id_configured()

discovery_info[
CONF_HOST
] = f"{discovery_info[CONF_HOST]}:{discovery_info[CONF_PORT]}"

# Check if new config entry matches any existing config entries and abort if so
for entry in self.hass.config_entries.async_entries(DOMAIN):
# If source is ignore bypass host check and continue through loop
if entry.source == SOURCE_IGNORE:
continue

if _host_is_same(entry.data[CONF_HOST], discovery_info[CONF_HOST]):
return self.async_abort(reason="already_setup")

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/const.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Constants used by Home Assistant components."""
MAJOR_VERSION = 0
MINOR_VERSION = 108
PATCH_VERSION = "5"
PATCH_VERSION = "6"
__short_version__ = f"{MAJOR_VERSION}.{MINOR_VERSION}"
__version__ = f"{__short_version__}.{PATCH_VERSION}"
REQUIRED_PYTHON_VER = (3, 7, 0)
Expand Down
3 changes: 2 additions & 1 deletion homeassistant/helpers/update_coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ async def async_refresh(self) -> None:
self.name,
monotonic() - start,
)
self._schedule_refresh()
if self._listeners:
self._schedule_refresh()

for update_callback in self._listeners:
update_callback()
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ boto3==1.9.252
bravia-tv==1.0.1

# homeassistant.components.broadlink
broadlink==0.13.0
broadlink==0.13.1

# homeassistant.components.brother
brother==0.1.11
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ bellows-homeassistant==0.15.2
bomradarloop==0.1.4

# homeassistant.components.broadlink
broadlink==0.13.0
broadlink==0.13.1

# homeassistant.components.brother
brother==0.1.11
Expand Down
16 changes: 8 additions & 8 deletions tests/components/elkm1/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async def test_form_user_with_secure_elk(hass):
"address": "1.2.3.4",
"username": "test-username",
"password": "test-password",
"temperature_unit": "F",
"temperature_unit": "°F",
"prefix": "",
},
)
Expand All @@ -51,7 +51,7 @@ async def test_form_user_with_secure_elk(hass):
"host": "elks://1.2.3.4",
"password": "test-password",
"prefix": "",
"temperature_unit": "F",
"temperature_unit": "°F",
"username": "test-username",
}
await hass.async_block_till_done()
Expand Down Expand Up @@ -82,7 +82,7 @@ async def test_form_user_with_non_secure_elk(hass):
{
"protocol": "non-secure",
"address": "1.2.3.4",
"temperature_unit": "F",
"temperature_unit": "°F",
"prefix": "guest_house",
},
)
Expand All @@ -95,7 +95,7 @@ async def test_form_user_with_non_secure_elk(hass):
"prefix": "guest_house",
"username": "",
"password": "",
"temperature_unit": "F",
"temperature_unit": "°F",
}
await hass.async_block_till_done()
assert len(mock_setup.mock_calls) == 1
Expand Down Expand Up @@ -125,7 +125,7 @@ async def test_form_user_with_serial_elk(hass):
{
"protocol": "serial",
"address": "/dev/ttyS0:115200",
"temperature_unit": "F",
"temperature_unit": "°C",
"prefix": "",
},
)
Expand All @@ -138,7 +138,7 @@ async def test_form_user_with_serial_elk(hass):
"prefix": "",
"username": "",
"password": "",
"temperature_unit": "F",
"temperature_unit": "°C",
}
await hass.async_block_till_done()
assert len(mock_setup.mock_calls) == 1
Expand Down Expand Up @@ -166,7 +166,7 @@ async def test_form_cannot_connect(hass):
"address": "1.2.3.4",
"username": "test-username",
"password": "test-password",
"temperature_unit": "F",
"temperature_unit": "°F",
"prefix": "",
},
)
Expand All @@ -193,7 +193,7 @@ async def test_form_invalid_auth(hass):
"address": "1.2.3.4",
"username": "test-username",
"password": "test-password",
"temperature_unit": "F",
"temperature_unit": "°F",
"prefix": "",
},
)
Expand Down
1 change: 1 addition & 0 deletions tests/components/vizio/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ def __init__(self, auth_token: str) -> None:
CONF_INCLUDE_OR_EXCLUDE: CONF_INCLUDE.title(),
CONF_APPS_TO_INCLUDE_OR_EXCLUDE: [CURRENT_APP],
}

MOCK_INCLUDE_NO_APPS = {
CONF_INCLUDE_OR_EXCLUDE: CONF_INCLUDE.title(),
CONF_APPS_TO_INCLUDE_OR_EXCLUDE: [],
Expand Down
Loading