Skip to content
Merged

0.109.1 #34922

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: 5 additions & 5 deletions build.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"image": "homeassistant/{arch}-homeassistant",
"build_from": {
"aarch64": "homeassistant/aarch64-homeassistant-base:7.1.0",
"armhf": "homeassistant/armhf-homeassistant-base:7.1.0",
"armv7": "homeassistant/armv7-homeassistant-base:7.1.0",
"amd64": "homeassistant/amd64-homeassistant-base:7.1.0",
"i386": "homeassistant/i386-homeassistant-base:7.1.0"
"aarch64": "homeassistant/aarch64-homeassistant-base:7.2.0",
"armhf": "homeassistant/armhf-homeassistant-base:7.2.0",
"armv7": "homeassistant/armv7-homeassistant-base:7.2.0",
"amd64": "homeassistant/amd64-homeassistant-base:7.2.0",
"i386": "homeassistant/i386-homeassistant-base:7.2.0"
},
"labels": {
"io.hass.type": "core"
Expand Down
17 changes: 15 additions & 2 deletions homeassistant/components/braviatv/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from homeassistant.const import CONF_HOST, CONF_MAC

from .const import DOMAIN
from .const import BRAVIARC, DOMAIN, UNDO_UPDATE_LISTENER

PLATFORMS = ["media_player"]

Expand All @@ -20,8 +20,13 @@ async def async_setup_entry(hass, config_entry):
host = config_entry.data[CONF_HOST]
mac = config_entry.data[CONF_MAC]

undo_listener = config_entry.add_update_listener(update_listener)

hass.data.setdefault(DOMAIN, {})
hass.data[DOMAIN][config_entry.entry_id] = BraviaRC(host, mac)
hass.data[DOMAIN][config_entry.entry_id] = {
BRAVIARC: BraviaRC(host, mac),
UNDO_UPDATE_LISTENER: undo_listener,
}

for component in PLATFORMS:
hass.async_create_task(
Expand All @@ -41,7 +46,15 @@ async def async_unload_entry(hass, config_entry):
]
)
)

hass.data[DOMAIN][config_entry.entry_id][UNDO_UPDATE_LISTENER]()

if unload_ok:
hass.data[DOMAIN].pop(config_entry.entry_id)

return unload_ok


async def update_listener(hass, config_entry):
"""Handle options update."""
await hass.config_entries.async_reload(config_entry.entry_id)
3 changes: 2 additions & 1 deletion homeassistant/components/braviatv/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
ATTR_CID,
ATTR_MAC,
ATTR_MODEL,
BRAVIARC,
CLIENTID_PREFIX,
CONF_IGNORED_SOURCES,
DOMAIN,
Expand Down Expand Up @@ -152,7 +153,7 @@ def __init__(self, config_entry):

async def async_step_init(self, user_input=None):
"""Manage the options."""
self.braviarc = self.hass.data[DOMAIN][self.config_entry.entry_id]
self.braviarc = self.hass.data[DOMAIN][self.config_entry.entry_id][BRAVIARC]
if not self.braviarc.is_connected():
await self.hass.async_add_executor_job(
self.braviarc.connect, self.pin, CLIENTID_PREFIX, NICKNAME,
Expand Down
2 changes: 2 additions & 0 deletions homeassistant/components/braviatv/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@

CONF_IGNORED_SOURCES = "ignored_sources"

BRAVIARC = "braviarc"
BRAVIA_CONFIG_FILE = "bravia.conf"
CLIENTID_PREFIX = "HomeAssistant"
DEFAULT_NAME = f"{ATTR_MANUFACTURER} Bravia TV"
DOMAIN = "braviatv"
NICKNAME = "Home Assistant"
UNDO_UPDATE_LISTENER = "undo_update_listener"
3 changes: 2 additions & 1 deletion homeassistant/components/braviatv/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from .const import (
ATTR_MANUFACTURER,
BRAVIA_CONFIG_FILE,
BRAVIARC,
CLIENTID_PREFIX,
CONF_IGNORED_SOURCES,
DEFAULT_NAME,
Expand Down Expand Up @@ -103,7 +104,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
"model": config_entry.title,
}

braviarc = hass.data[DOMAIN][config_entry.entry_id]
braviarc = hass.data[DOMAIN][config_entry.entry_id][BRAVIARC]

ignored_sources = config_entry.options.get(CONF_IGNORED_SOURCES, [])

Expand Down
22 changes: 11 additions & 11 deletions homeassistant/components/flunearyou/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,6 @@ def __init__(self, hass, client, latitude, longitude):
self.latitude = latitude
self.longitude = longitude

self._api_coros = {
CATEGORY_CDC_REPORT: self._client.cdc_reports.status_by_coordinates(
latitude, longitude
),
CATEGORY_USER_REPORT: self._client.user_reports.status_by_coordinates(
latitude, longitude
),
}

self._api_category_count = {
CATEGORY_CDC_REPORT: 0,
CATEGORY_USER_REPORT: 0,
Expand All @@ -155,8 +146,17 @@ async def _async_get_data_from_api(self, api_category):
if self._api_category_count[api_category] == 0:
return

if api_category == CATEGORY_CDC_REPORT:
api_coro = self._client.cdc_reports.status_by_coordinates(
self.latitude, self.longitude
)
else:
api_coro = self._client.user_reports.status_by_coordinates(
self.latitude, self.longitude
)

try:
self.data[api_category] = await self._api_coros[api_category]
self.data[api_category] = await api_coro
except FluNearYouError as err:
LOGGER.error("Unable to get %s data: %s", api_category, err)
self.data[api_category] = None
Expand Down Expand Up @@ -200,7 +200,7 @@ async def async_update(self):
"""Update Flu Near You data."""
tasks = [
self._async_get_data_from_api(api_category)
for api_category in self._api_coros
for api_category in self._api_category_count
]

await asyncio.gather(*tasks)
Expand Down
5 changes: 4 additions & 1 deletion homeassistant/components/garmin_connect/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ class GarminConnectData:

def __init__(self, hass, client):
"""Initialize."""
self.hass = hass
self.client = client
self.data = None

Expand All @@ -95,7 +96,9 @@ async def async_update(self):
today = date.today()

try:
self.data = self.client.get_stats_and_body(today.isoformat())
self.data = await self.hass.async_add_executor_job(
self.client.get_stats_and_body, today.isoformat()
)
except (
GarminConnectAuthenticationError,
GarminConnectTooManyRequestsError,
Expand Down
10 changes: 9 additions & 1 deletion homeassistant/components/homekit/accessories.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ def __init__(
self.entity_id = entity_id
self.hass = hass
self.debounce = {}
self._char_battery = None
self._char_charging = None
self._char_low_battery = None
self.linked_battery_sensor = self.config.get(CONF_LINKED_BATTERY_SENSOR)
self.linked_battery_charging_sensor = self.config.get(
CONF_LINKED_BATTERY_CHARGING_SENSOR
Expand Down Expand Up @@ -247,6 +250,10 @@ def update_battery(self, battery_level, battery_charging):

Only call this function if self._support_battery_level is True.
"""
if not self._char_battery:
# Battery appeared after homekit was started
return

battery_level = convert_to_float(battery_level)
if battery_level is not None:
if self._char_battery.value != battery_level:
Expand All @@ -258,7 +265,8 @@ def update_battery(self, battery_level, battery_charging):
"%s: Updated battery level to %d", self.entity_id, battery_level
)

if battery_charging is None:
# Charging state can appear after homekit was started
if battery_charging is None or not self._char_charging:
return

hk_charging = HK_CHARGING if battery_charging else HK_NOT_CHARGING
Expand Down
14 changes: 7 additions & 7 deletions homeassistant/components/homekit/type_fans.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,13 @@ def _set_chars(self, char_values):
_LOGGER.debug("Fan _set_chars: %s", char_values)
if CHAR_ACTIVE in char_values:
if char_values[CHAR_ACTIVE]:
is_on = False
state = self.hass.states.get(self.entity_id)
if state and state.state == STATE_ON:
is_on = True
# Only set the state to active if we
# did not get a rotation speed or its off
if not is_on or CHAR_ROTATION_SPEED not in char_values:
# If the device supports set speed we
# do not want to turn on as it will take
# the fan to 100% than to the desired speed.
#
# Setting the speed will take care of turning
# on the fan if SUPPORT_SET_SPEED is set.
if not self.char_speed or CHAR_ROTATION_SPEED not in char_values:
self.set_state(1)
else:
# Its off, nothing more to do as setting the
Expand Down
Loading