Skip to content
Merged

0.109.2 #35001

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
1 change: 1 addition & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ homeassistant/components/ipp/* @ctalkington
homeassistant/components/iqvia/* @bachya
homeassistant/components/irish_rail_transport/* @ttroy50
homeassistant/components/islamic_prayer_times/* @engrbm87
homeassistant/components/isy994/* @bdraco
homeassistant/components/izone/* @Swamp-Ig
homeassistant/components/jewish_calendar/* @tsvi
homeassistant/components/juicenet/* @jesserockz
Expand Down
3 changes: 3 additions & 0 deletions azure-pipelines-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,9 @@ stages:
pip install -U pip setuptools wheel
pip install -r requirements_all.txt -c homeassistant/package_constraints.txt
pip install -r requirements_test.txt -c homeassistant/package_constraints.txt
# This is a TEMP. Eventually we should make sure our 4 dependencies drop typing.
# Find offending deps with `pipdeptree -r -p typing`
pip uninstall -y typing
- script: |
. venv/bin/activate
pip install -e .
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/brother/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Brother Printer",
"documentation": "https://www.home-assistant.io/integrations/brother",
"codeowners": ["@bieniu"],
"requirements": ["brother==0.1.13"],
"requirements": ["brother==0.1.14"],
"zeroconf": ["_printer._tcp.local."],
"config_flow": true,
"quality_scale": "platinum"
Expand Down
23 changes: 13 additions & 10 deletions homeassistant/components/directv/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from directv import DIRECTV, DIRECTVError

from homeassistant.components.remote import RemoteDevice
from homeassistant.components.remote import ATTR_NUM_REPEATS, RemoteDevice
from homeassistant.config_entries import ConfigEntry
from homeassistant.helpers.typing import HomeAssistantType

Expand Down Expand Up @@ -95,12 +95,15 @@ async def async_send_command(self, command: Iterable[str], **kwargs: Any) -> Non
blue, chanup, chandown, prev, 0, 1, 2, 3, 4, 5,
6, 7, 8, 9, dash, enter
"""
for single_command in command:
try:
await self.dtv.remote(single_command, self._address)
except DIRECTVError:
_LOGGER.exception(
"Sending command %s to device %s failed",
single_command,
self._device_id,
)
num_repeats = kwargs[ATTR_NUM_REPEATS]

for _ in range(num_repeats):
for single_command in command:
try:
await self.dtv.remote(single_command, self._address)
except DIRECTVError:
_LOGGER.exception(
"Sending command %s to device %s failed",
single_command,
self._device_id,
)
4 changes: 3 additions & 1 deletion homeassistant/components/homekit/type_fans.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,9 @@ def update_state(self, new_state):
self.char_direction.set_value(hk_direction)

# Handle Speed
if self.char_speed is not None:
if self.char_speed is not None and state != STATE_OFF:
# We do not change the homekit speed when turning off
# as it will clear the restore state
speed = new_state.attributes.get(ATTR_SPEED)
hk_speed_value = self.speed_mapping.speed_to_homekit(speed)
if hk_speed_value is not None and self.char_speed.value != hk_speed_value:
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/homekit/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def speed_to_homekit(self, speed):
if speed is None:
return None
speed_range = self.speed_ranges[speed]
return speed_range.target
return round(speed_range.target)

def speed_to_states(self, speed):
"""Map HomeKit speed to Home Assistant speed state."""
Expand Down
29 changes: 26 additions & 3 deletions homeassistant/components/isy994/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
from typing import Callable

from homeassistant.components.light import DOMAIN, SUPPORT_BRIGHTNESS, Light
from homeassistant.helpers.restore_state import RestoreEntity
from homeassistant.helpers.typing import ConfigType

from . import ISY994_NODES, ISYDevice

_LOGGER = logging.getLogger(__name__)

ATTR_LAST_BRIGHTNESS = "last_brightness"


def setup_platform(
hass, config: ConfigType, add_entities: Callable[[list], None], discovery_info=None
Expand All @@ -21,13 +24,13 @@ def setup_platform(
add_entities(devices)


class ISYLightDevice(ISYDevice, Light):
class ISYLightDevice(ISYDevice, Light, RestoreEntity):
"""Representation of an ISY994 light device."""

def __init__(self, node) -> None:
"""Initialize the ISY994 light device."""
super().__init__(node)
self._last_brightness = self.brightness
self._last_brightness = None

@property
def is_on(self) -> bool:
Expand Down Expand Up @@ -56,7 +59,7 @@ def on_update(self, event: object) -> None:
# pylint: disable=arguments-differ
def turn_on(self, brightness=None, **kwargs) -> None:
"""Send the turn on command to the ISY994 light device."""
if brightness is None and self._last_brightness is not None:
if brightness is None and self._last_brightness:
brightness = self._last_brightness
if not self._node.on(val=brightness):
_LOGGER.debug("Unable to turn on light")
Expand All @@ -65,3 +68,23 @@ def turn_on(self, brightness=None, **kwargs) -> None:
def supported_features(self):
"""Flag supported features."""
return SUPPORT_BRIGHTNESS

@property
def device_state_attributes(self):
"""Return the light attributes."""
return {ATTR_LAST_BRIGHTNESS: self._last_brightness}

async def async_added_to_hass(self) -> None:
"""Restore last_brightness on restart."""
await super().async_added_to_hass()

self._last_brightness = self.brightness or 255
last_state = await self.async_get_last_state()
if not last_state:
return

if (
ATTR_LAST_BRIGHTNESS in last_state.attributes
and last_state.attributes[ATTR_LAST_BRIGHTNESS]
):
self._last_brightness = last_state.attributes[ATTR_LAST_BRIGHTNESS]
2 changes: 1 addition & 1 deletion homeassistant/components/isy994/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"name": "Universal Devices ISY994",
"documentation": "https://www.home-assistant.io/integrations/isy994",
"requirements": ["PyISY==1.1.2"],
"codeowners": []
"codeowners": ["@bdraco"]
}
25 changes: 18 additions & 7 deletions homeassistant/components/mqtt/debug_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def _log_message(msg):
debug_info = hass.data[DATA_MQTT_DEBUG_INFO]
messages = debug_info["entities"][entity_id]["subscriptions"][
msg.subscribed_topic
]
]["messages"]
if msg not in messages:
messages.append(msg)

Expand All @@ -50,16 +50,27 @@ def add_subscription(hass, message_callback, subscription):
entity_info = debug_info["entities"].setdefault(
entity_id, {"subscriptions": {}, "discovery_data": {}}
)
entity_info["subscriptions"][subscription] = deque([], STORED_MESSAGES)
if subscription not in entity_info["subscriptions"]:
entity_info["subscriptions"][subscription] = {
"count": 0,
"messages": deque([], STORED_MESSAGES),
}
entity_info["subscriptions"][subscription]["count"] += 1


def remove_subscription(hass, message_callback, subscription):
"""Remove debug data for subscription."""
"""Remove debug data for subscription if it exists."""
entity_id = getattr(message_callback, "__entity_id", None)
if entity_id and entity_id in hass.data[DATA_MQTT_DEBUG_INFO]["entities"]:
hass.data[DATA_MQTT_DEBUG_INFO]["entities"][entity_id]["subscriptions"].pop(
hass.data[DATA_MQTT_DEBUG_INFO]["entities"][entity_id]["subscriptions"][
subscription
)
]["count"] -= 1
if not hass.data[DATA_MQTT_DEBUG_INFO]["entities"][entity_id]["subscriptions"][
subscription
]["count"]:
hass.data[DATA_MQTT_DEBUG_INFO]["entities"][entity_id]["subscriptions"].pop(
subscription
)


def add_entity_discovery_data(hass, discovery_data, entity_id):
Expand Down Expand Up @@ -127,10 +138,10 @@ async def info_for_device(hass, device_id):
"topic": topic,
"messages": [
{"payload": msg.payload, "time": msg.timestamp, "topic": msg.topic}
for msg in list(messages)
for msg in list(subscription["messages"])
],
}
for topic, messages in entity_info["subscriptions"].items()
for topic, subscription in entity_info["subscriptions"].items()
]
discovery_data = {
"topic": entity_info["discovery_data"].get(ATTR_DISCOVERY_TOPIC, ""),
Expand Down
6 changes: 5 additions & 1 deletion homeassistant/components/rachio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,11 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
if not person.controllers:
_LOGGER.error("No Rachio devices found in account %s", person.username)
return False
_LOGGER.info("%d Rachio device(s) found", len(person.controllers))
_LOGGER.info(
"%d Rachio device(s) found; The url %s must be accessible from the internet in order to receive updates",
len(person.controllers),
webhook_url,
)

# Enable component
hass.data[DOMAIN][entry.entry_id] = person
Expand Down
13 changes: 8 additions & 5 deletions homeassistant/components/roku/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
)
from roku import RokuException

from homeassistant.components.remote import RemoteDevice
from homeassistant.components.remote import ATTR_NUM_REPEATS, RemoteDevice
from homeassistant.config_entries import ConfigEntry
from homeassistant.helpers.typing import HomeAssistantType

Expand Down Expand Up @@ -84,8 +84,11 @@ def should_poll(self):

def send_command(self, command, **kwargs):
"""Send a command to one device."""
for single_command in command:
if not hasattr(self.roku, single_command):
continue
num_repeats = kwargs[ATTR_NUM_REPEATS]

getattr(self.roku, single_command)()
for _ in range(num_repeats):
for single_command in command:
if not hasattr(self.roku, single_command):
continue

getattr(self.roku, single_command)()
8 changes: 7 additions & 1 deletion homeassistant/components/roomba/irobot_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import logging

from homeassistant.components.vacuum import (
ATTR_STATUS,
STATE_CLEANING,
STATE_DOCKED,
STATE_ERROR,
Expand All @@ -16,6 +17,7 @@
SUPPORT_SEND_COMMAND,
SUPPORT_START,
SUPPORT_STATE,
SUPPORT_STATUS,
SUPPORT_STOP,
StateVacuumDevice,
)
Expand All @@ -40,6 +42,7 @@
| SUPPORT_SEND_COMMAND
| SUPPORT_START
| SUPPORT_STATE
| SUPPORT_STATUS
| SUPPORT_STOP
| SUPPORT_LOCATE
)
Expand Down Expand Up @@ -143,7 +146,7 @@ def state(self):
state = STATE_MAP[phase]
except KeyError:
return STATE_ERROR
if cycle != "none" and state != STATE_CLEANING and state != STATE_RETURNING:
if cycle != "none" and state in (STATE_IDLE, STATE_DOCKED):
state = STATE_PAUSED
return state

Expand Down Expand Up @@ -173,6 +176,9 @@ def device_state_attributes(self):
# Set properties that are to appear in the GUI
state_attrs = {ATTR_SOFTWARE_VERSION: software_version}

# Set legacy status to avoid break changes
state_attrs[ATTR_STATUS] = self.vacuum.current_state

# Only add cleaning time and cleaned area attrs when the vacuum is
# currently on
if self.state == STATE_CLEANING:
Expand Down
3 changes: 2 additions & 1 deletion homeassistant/components/totalconnect/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
vol.Required(CONF_PASSWORD): cv.string,
}
)
}
},
extra=vol.ALLOW_EXTRA,
)


Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/unifi/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def add_entities(controller, async_add_entities):

if tracker_class is UniFiClientTracker:

if item.is_wired:
if mac not in controller.wireless_clients:
if not controller.option_track_wired_clients:
continue
else:
Expand Down
15 changes: 9 additions & 6 deletions homeassistant/components/vizio/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def __init__(
self._state = None
self._volume_level = None
self._volume_step = config_entry.options[CONF_VOLUME_STEP]
self._is_muted = None
self._is_volume_muted = None
self._current_input = None
self._current_app = None
self._current_app_config = None
Expand Down Expand Up @@ -190,7 +190,7 @@ async def async_update(self) -> None:
if not is_on:
self._state = STATE_OFF
self._volume_level = None
self._is_muted = None
self._is_volume_muted = None
self._current_input = None
self._available_inputs = None
self._current_app = None
Expand All @@ -207,7 +207,10 @@ async def async_update(self) -> None:
)
if audio_settings is not None:
self._volume_level = float(audio_settings["volume"]) / self._max_volume
self._is_muted = audio_settings["mute"].lower() == "on"
if "mute" in audio_settings:
self._is_volume_muted = audio_settings["mute"].lower() == "on"
else:
self._is_volume_muted = None

if VIZIO_SOUND_MODE in audio_settings:
self._supported_commands |= SUPPORT_SELECT_SOUND_MODE
Expand Down Expand Up @@ -324,7 +327,7 @@ def volume_level(self) -> float:
@property
def is_volume_muted(self):
"""Boolean if volume is currently muted."""
return self._is_muted
return self._is_volume_muted

@property
def source(self) -> str:
Expand Down Expand Up @@ -428,10 +431,10 @@ async def async_mute_volume(self, mute: bool) -> None:
"""Mute the volume."""
if mute:
await self._device.mute_on()
self._is_muted = True
self._is_volume_muted = True
else:
await self._device.mute_off()
self._is_muted = False
self._is_volume_muted = False

async def async_media_previous_track(self) -> None:
"""Send previous channel command."""
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 = 109
PATCH_VERSION = "1"
PATCH_VERSION = "2"
__short_version__ = f"{MAJOR_VERSION}.{MINOR_VERSION}"
__version__ = f"{__short_version__}.{PATCH_VERSION}"
REQUIRED_PYTHON_VER = (3, 7, 0)
Expand Down
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ bravia-tv==1.0.2
broadlink==0.13.2

# homeassistant.components.brother
brother==0.1.13
brother==0.1.14

# homeassistant.components.brottsplatskartan
brottsplatskartan==0.0.1
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ bravia-tv==1.0.2
broadlink==0.13.2

# homeassistant.components.brother
brother==0.1.13
brother==0.1.14

# homeassistant.components.buienradar
buienradar==1.0.4
Expand Down
Loading