Skip to content

Commit

Permalink
Merge branch 'dev' into AddDanfossEntities
Browse files Browse the repository at this point in the history
  • Loading branch information
Caius-Bonus authored Oct 26, 2023
2 parents 250e4d9 + cf03f83 commit 44e2691
Show file tree
Hide file tree
Showing 354 changed files with 17,834 additions and 2,705 deletions.
2 changes: 1 addition & 1 deletion .core_files.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ components: &components
- homeassistant/components/persistent_notification/**
- homeassistant/components/person/**
- homeassistant/components/recorder/**
- homeassistant/components/recovery_mode/**
- homeassistant/components/repairs/**
- homeassistant/components/safe_mode/**
- homeassistant/components/script/**
- homeassistant/components/shopping_list/**
- homeassistant/components/ssdp/**
Expand Down
5 changes: 2 additions & 3 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,6 @@ omit =
homeassistant/components/edl21/__init__.py
homeassistant/components/edl21/sensor.py
homeassistant/components/egardia/*
homeassistant/components/eight_sleep/__init__.py
homeassistant/components/eight_sleep/binary_sensor.py
homeassistant/components/eight_sleep/sensor.py
homeassistant/components/electric_kiwi/__init__.py
homeassistant/components/electric_kiwi/api.py
homeassistant/components/electric_kiwi/oauth2.py
Expand Down Expand Up @@ -992,6 +989,7 @@ omit =
homeassistant/components/pushsafer/notify.py
homeassistant/components/pyload/sensor.py
homeassistant/components/qbittorrent/__init__.py
homeassistant/components/qbittorrent/coordinator.py
homeassistant/components/qbittorrent/sensor.py
homeassistant/components/qnap/__init__.py
homeassistant/components/qnap/coordinator.py
Expand Down Expand Up @@ -1267,6 +1265,7 @@ omit =
homeassistant/components/switchbot/sensor.py
homeassistant/components/switchbot/switch.py
homeassistant/components/switchbot/lock.py
homeassistant/components/switchbot_cloud/climate.py
homeassistant/components/switchbot_cloud/coordinator.py
homeassistant/components/switchbot_cloud/entity.py
homeassistant/components/switchbot_cloud/switch.py
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ env:
PIP_CACHE_VERSION: 4
MYPY_CACHE_VERSION: 5
BLACK_CACHE_VERSION: 1
HA_SHORT_VERSION: "2023.11"
HA_SHORT_VERSION: "2023.12"
DEFAULT_PYTHON: "3.11"
ALL_PYTHON_VERSIONS: "['3.11', '3.12']"
# 10.3 is the oldest supported version
Expand Down
1 change: 1 addition & 0 deletions .strict-typing
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ homeassistant.components.light.*
homeassistant.components.litejet.*
homeassistant.components.litterrobot.*
homeassistant.components.local_ip.*
homeassistant.components.local_todo.*
homeassistant.components.lock.*
homeassistant.components.logbook.*
homeassistant.components.logger.*
Expand Down
26 changes: 16 additions & 10 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -311,16 +311,14 @@ build.json @home-assistant/supervisor
/tests/components/ecobee/ @marthoc @marcolivierarsenault
/homeassistant/components/ecoforest/ @pjanuario
/tests/components/ecoforest/ @pjanuario
/homeassistant/components/econet/ @vangorra @w1ll1am23
/tests/components/econet/ @vangorra @w1ll1am23
/homeassistant/components/econet/ @w1ll1am23
/tests/components/econet/ @w1ll1am23
/homeassistant/components/ecovacs/ @OverloadUT @mib1185
/homeassistant/components/ecowitt/ @pvizeli
/tests/components/ecowitt/ @pvizeli
/homeassistant/components/efergy/ @tkdrob
/tests/components/efergy/ @tkdrob
/homeassistant/components/egardia/ @jeroenterheerdt
/homeassistant/components/eight_sleep/ @mezz64 @raman325
/tests/components/eight_sleep/ @mezz64 @raman325
/homeassistant/components/electrasmart/ @jafar-atili
/tests/components/electrasmart/ @jafar-atili
/homeassistant/components/electric_kiwi/ @mikey0000
Expand Down Expand Up @@ -423,8 +421,8 @@ build.json @home-assistant/supervisor
/tests/components/fritzbox/ @mib1185 @flabbamann
/homeassistant/components/fritzbox_callmonitor/ @cdce8p
/tests/components/fritzbox_callmonitor/ @cdce8p
/homeassistant/components/fronius/ @nielstron @farmio
/tests/components/fronius/ @nielstron @farmio
/homeassistant/components/fronius/ @farmio
/tests/components/fronius/ @farmio
/homeassistant/components/frontend/ @home-assistant/frontend
/tests/components/frontend/ @home-assistant/frontend
/homeassistant/components/frontier_silicon/ @wlcrs
Expand Down Expand Up @@ -479,6 +477,8 @@ build.json @home-assistant/supervisor
/tests/components/google_mail/ @tkdrob
/homeassistant/components/google_sheets/ @tkdrob
/tests/components/google_sheets/ @tkdrob
/homeassistant/components/google_tasks/ @allenporter
/tests/components/google_tasks/ @allenporter
/homeassistant/components/google_travel_time/ @eifinger
/tests/components/google_travel_time/ @eifinger
/homeassistant/components/govee_ble/ @bdraco @PierreAronnax
Expand Down Expand Up @@ -586,6 +586,8 @@ build.json @home-assistant/supervisor
/tests/components/image_upload/ @home-assistant/core
/homeassistant/components/imap/ @jbouwh
/tests/components/imap/ @jbouwh
/homeassistant/components/improv_ble/ @emontnemery
/tests/components/improv_ble/ @emontnemery
/homeassistant/components/incomfort/ @zxdavb
/homeassistant/components/influxdb/ @mdegat01
/tests/components/influxdb/ @mdegat01
Expand Down Expand Up @@ -708,6 +710,8 @@ build.json @home-assistant/supervisor
/tests/components/local_calendar/ @allenporter
/homeassistant/components/local_ip/ @issacg
/tests/components/local_ip/ @issacg
/homeassistant/components/local_todo/ @allenporter
/tests/components/local_todo/ @allenporter
/homeassistant/components/lock/ @home-assistant/core
/tests/components/lock/ @home-assistant/core
/homeassistant/components/logbook/ @home-assistant/core
Expand Down Expand Up @@ -1035,6 +1039,8 @@ build.json @home-assistant/supervisor
/tests/components/recollect_waste/ @bachya
/homeassistant/components/recorder/ @home-assistant/core
/tests/components/recorder/ @home-assistant/core
/homeassistant/components/recovery_mode/ @home-assistant/core
/tests/components/recovery_mode/ @home-assistant/core
/homeassistant/components/rejseplanen/ @DarkFox
/homeassistant/components/remote/ @home-assistant/core
/tests/components/remote/ @home-assistant/core
Expand Down Expand Up @@ -1085,8 +1091,6 @@ build.json @home-assistant/supervisor
/tests/components/rympro/ @OnFreund @elad-bar @maorcc
/homeassistant/components/sabnzbd/ @shaiu
/tests/components/sabnzbd/ @shaiu
/homeassistant/components/safe_mode/ @home-assistant/core
/tests/components/safe_mode/ @home-assistant/core
/homeassistant/components/saj/ @fredericvl
/homeassistant/components/samsungtv/ @chemelli74 @epenet
/tests/components/samsungtv/ @chemelli74 @epenet
Expand Down Expand Up @@ -1303,6 +1307,8 @@ build.json @home-assistant/supervisor
/homeassistant/components/time_date/ @fabaff
/tests/components/time_date/ @fabaff
/homeassistant/components/tmb/ @alemuro
/homeassistant/components/todo/ @home-assistant/core
/tests/components/todo/ @home-assistant/core
/homeassistant/components/todoist/ @boralyl
/tests/components/todoist/ @boralyl
/homeassistant/components/tolo/ @MatthiasLohr
Expand Down Expand Up @@ -1495,8 +1501,8 @@ build.json @home-assistant/supervisor
/tests/components/zerproc/ @emlove
/homeassistant/components/zeversolar/ @kvanzuijlen
/tests/components/zeversolar/ @kvanzuijlen
/homeassistant/components/zha/ @dmulcahey @adminiuga @puddly
/tests/components/zha/ @dmulcahey @adminiuga @puddly
/homeassistant/components/zha/ @dmulcahey @adminiuga @puddly @TheJulianJES
/tests/components/zha/ @dmulcahey @adminiuga @puddly @TheJulianJES
/homeassistant/components/zodiac/ @JulienTant
/tests/components/zodiac/ @JulienTant
/homeassistant/components/zone/ @home-assistant/core
Expand Down
11 changes: 8 additions & 3 deletions homeassistant/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ def get_arguments() -> argparse.Namespace:
help="Directory that contains the Home Assistant configuration",
)
parser.add_argument(
"--safe-mode", action="store_true", help="Start Home Assistant in safe mode"
"--recovery-mode",
action="store_true",
help="Start Home Assistant in recovery mode",
)
parser.add_argument(
"--debug", action="store_true", help="Start Home Assistant in debug mode"
Expand Down Expand Up @@ -183,7 +185,9 @@ def main() -> int:
ensure_config_path(config_dir)

# pylint: disable-next=import-outside-toplevel
from . import runner
from . import config, runner

safe_mode = config.safe_mode_enabled(config_dir)

runtime_conf = runner.RuntimeConfig(
config_dir=config_dir,
Expand All @@ -193,9 +197,10 @@ def main() -> int:
log_no_color=args.log_no_color,
skip_pip=args.skip_pip,
skip_pip_packages=args.skip_pip_packages,
safe_mode=args.safe_mode,
recovery_mode=args.recovery_mode,
debug=args.debug,
open_ui=args.open_ui,
safe_mode=safe_mode,
)

fault_file_name = os.path.join(config_dir, FAULT_LOG_FILENAME)
Expand Down
27 changes: 15 additions & 12 deletions homeassistant/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ async def async_setup_hass(
runtime_config.log_no_color,
)

hass.config.safe_mode = runtime_config.safe_mode
hass.config.skip_pip = runtime_config.skip_pip
hass.config.skip_pip_packages = runtime_config.skip_pip_packages
if runtime_config.skip_pip or runtime_config.skip_pip_packages:
Expand All @@ -137,14 +138,14 @@ async def async_setup_hass(
config_dict = None
basic_setup_success = False

if not (safe_mode := runtime_config.safe_mode):
if not (recovery_mode := runtime_config.recovery_mode):
await hass.async_add_executor_job(conf_util.process_ha_config_upgrade, hass)

try:
config_dict = await conf_util.async_hass_config_yaml(hass)
except HomeAssistantError as err:
_LOGGER.error(
"Failed to parse configuration.yaml: %s. Activating safe mode",
"Failed to parse configuration.yaml: %s. Activating recovery mode",
err,
)
else:
Expand All @@ -156,24 +157,24 @@ async def async_setup_hass(
)

if config_dict is None:
safe_mode = True
recovery_mode = True

elif not basic_setup_success:
_LOGGER.warning("Unable to set up core integrations. Activating safe mode")
safe_mode = True
_LOGGER.warning("Unable to set up core integrations. Activating recovery mode")
recovery_mode = True

elif (
"frontend" in hass.data.get(DATA_SETUP, {})
and "frontend" not in hass.config.components
):
_LOGGER.warning("Detected that frontend did not load. Activating safe mode")
_LOGGER.warning("Detected that frontend did not load. Activating recovery mode")
# Ask integrations to shut down. It's messy but we can't
# do a clean stop without knowing what is broken
with contextlib.suppress(asyncio.TimeoutError):
async with hass.timeout.async_timeout(10):
await hass.async_stop()

safe_mode = True
recovery_mode = True
old_config = hass.config
old_logging = hass.data.get(DATA_LOGGING)

Expand All @@ -187,16 +188,18 @@ async def async_setup_hass(
# Setup loader cache after the config dir has been set
loader.async_setup(hass)

if safe_mode:
_LOGGER.info("Starting in safe mode")
hass.config.safe_mode = True
if recovery_mode:
_LOGGER.info("Starting in recovery mode")
hass.config.recovery_mode = True

http_conf = (await http.async_get_last_config(hass)) or {}

await async_from_config_dict(
{"safe_mode": {}, "http": http_conf},
{"recovery_mode": {}, "http": http_conf},
hass,
)
elif hass.config.safe_mode:
_LOGGER.info("Starting in safe mode")

if runtime_config.open_ui:
hass.add_job(open_hass_ui, hass)
Expand Down Expand Up @@ -471,7 +474,7 @@ def _get_domains(hass: core.HomeAssistant, config: dict[str, Any]) -> set[str]:
domains = {key.partition(" ")[0] for key in config if key != core.DOMAIN}

# Add config entry domains
if not hass.config.safe_mode:
if not hass.config.recovery_mode:
domains.update(hass.config_entries.async_domains())

# Make sure the Hass.io component is loaded
Expand Down
1 change: 1 addition & 0 deletions homeassistant/brands/google.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"google_maps",
"google_pubsub",
"google_sheets",
"google_tasks",
"google_translate",
"google_travel_time",
"google_wifi",
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/accuweather/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
"iot_class": "cloud_polling",
"loggers": ["accuweather"],
"quality_scale": "platinum",
"requirements": ["accuweather==1.0.0"]
"requirements": ["accuweather==2.0.0"]
}
12 changes: 8 additions & 4 deletions homeassistant/components/alexa/capabilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,12 +630,16 @@ def get_property(self, name: str) -> Any:
if name != "color":
raise UnsupportedProperty(name)

hue, saturation = self.entity.attributes.get(light.ATTR_HS_COLOR, (0, 0))
hue_saturation: tuple[float, float] | None
if (hue_saturation := self.entity.attributes.get(light.ATTR_HS_COLOR)) is None:
hue_saturation = (0, 0)
if (brightness := self.entity.attributes.get(light.ATTR_BRIGHTNESS)) is None:
brightness = 0

return {
"hue": hue,
"saturation": saturation / 100.0,
"brightness": self.entity.attributes.get(light.ATTR_BRIGHTNESS, 0) / 255.0,
"hue": hue_saturation[0],
"saturation": hue_saturation[1] / 100.0,
"brightness": brightness / 255.0,
}


Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/apple_tv/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"documentation": "https://www.home-assistant.io/integrations/apple_tv",
"iot_class": "local_push",
"loggers": ["pyatv", "srptools"],
"requirements": ["pyatv==0.13.4"],
"requirements": ["pyatv==0.14.3"],
"zeroconf": [
"_mediaremotetv._tcp.local.",
"_companion-link._tcp.local.",
Expand Down
8 changes: 6 additions & 2 deletions homeassistant/components/apple_tv/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,11 +371,15 @@ def media_episode(self) -> str | None:
@property
def repeat(self) -> RepeatMode | None:
"""Return current repeat mode."""
if self._playing and self._is_feature_available(FeatureName.Repeat):
if (
self._playing
and self._is_feature_available(FeatureName.Repeat)
and (repeat := self._playing.repeat)
):
return {
RepeatState.Track: RepeatMode.ONE,
RepeatState.All: RepeatMode.ALL,
}.get(self._playing.repeat, RepeatMode.OFF)
}.get(repeat, RepeatMode.OFF)
return None

@property
Expand Down
17 changes: 16 additions & 1 deletion homeassistant/components/apple_tv/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@
_LOGGER = logging.getLogger(__name__)

PARALLEL_UPDATES = 0
COMMAND_TO_ATTRIBUTE = {
"wakeup": ("power", "turn_on"),
"suspend": ("power", "turn_off"),
"turn_on": ("power", "turn_on"),
"turn_off": ("power", "turn_off"),
"volume_up": ("audio", "volume_up"),
"volume_down": ("audio", "volume_down"),
"home_hold": ("remote_control", "home"),
}


async def async_setup_entry(
Expand Down Expand Up @@ -61,7 +70,13 @@ async def async_send_command(self, command: Iterable[str], **kwargs: Any) -> Non

for _ in range(num_repeats):
for single_command in command:
attr_value = getattr(self.atv.remote_control, single_command, None)
attr_value = None
if attributes := COMMAND_TO_ATTRIBUTE.get(single_command):
attr_value = self.atv
for attr_name in attributes:
attr_value = getattr(attr_value, attr_name, None)
if not attr_value:
attr_value = getattr(self.atv.remote_control, single_command, None)
if not attr_value:
raise ValueError("Command not found. Exiting sequence")

Expand Down
5 changes: 4 additions & 1 deletion homeassistant/components/assist_pipeline/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from homeassistant.core import Context, HomeAssistant
from homeassistant.helpers.typing import ConfigType

from .const import CONF_DEBUG_RECORDING_DIR, DATA_CONFIG, DOMAIN
from .const import CONF_DEBUG_RECORDING_DIR, DATA_CONFIG, DATA_LAST_WAKE_UP, DOMAIN
from .error import PipelineNotFound
from .pipeline import (
AudioSettings,
Expand Down Expand Up @@ -58,6 +58,9 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the Assist pipeline integration."""
hass.data[DATA_CONFIG] = config.get(DOMAIN, {})

# wake_word_id -> timestamp of last detection (monotonic_ns)
hass.data[DATA_LAST_WAKE_UP] = {}

await async_setup_pipeline_store(hass)
async_register_websocket_api(hass)

Expand Down
Loading

0 comments on commit 44e2691

Please sign in to comment.