Skip to content

Commit

Permalink
Merge branch 'dev' into refactor
Browse files Browse the repository at this point in the history
* dev: (31 commits)
  Use identity checks for ESPHome Enums (home-assistant#124334)
  Bump yalexs to 8.1.4 (home-assistant#124425)
  Refactor targets for zwave_js services (home-assistant#115734)
  Check minimum amount of integrations for a brand (home-assistant#124310)
  Reduce ESPHome entity state write overhead (home-assistant#124329)
  Cleanup redundant fixtures and move all other hassio addon fixtures to be shared (home-assistant#124437)
  Bump ruff to 0.6.2 (home-assistant#124433)
  Fix Import ReceivePayloadType (home-assistant#124431)
  Allow to set options for an MQTT enum sensor (home-assistant#123248)
  Add LawnMowerActivity.RETURNING to Lawn Mower (home-assistant#124261)
  Add zip to template engine (home-assistant#122460)
  Shutdown database engine before waiting for executor shutdown (home-assistant#117339)
  Add Bang & Olufsen websocket testing (home-assistant#123075)
  Wrap OSError in loader.load_yaml (home-assistant#124406)
  Improve Bang olufsen test typing and parameter order (home-assistant#124419)
  Add supported features for iZone (home-assistant#124416)
  Automatically generate Amazon Polly list of voices and regions (home-assistant#119198)
  Fix shelly available check when device is not initialized (home-assistant#124182)
  Drop ignore-missing-annotations from pylint tests (home-assistant#120302)
  Improve type hints in lcn tests (home-assistant#124415)
  ...
  • Loading branch information
raman325 committed Aug 22, 2024
2 parents 5797c23 + 61ac4c7 commit 687aab9
Show file tree
Hide file tree
Showing 81 changed files with 2,189 additions and 854 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build base image
uses: home-assistant/builder@2024.08.1
uses: home-assistant/builder@2024.08.2
with:
args: |
$BUILD_ARGS \
Expand Down Expand Up @@ -263,7 +263,7 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build base image
uses: home-assistant/builder@2024.08.1
uses: home-assistant/builder@2024.08.2
with:
args: |
$BUILD_ARGS \
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -716,14 +716,14 @@ jobs:
run: |
. venv/bin/activate
python --version
pylint --ignore-missing-annotations=y tests
pylint tests
- name: Run pylint (partially)
if: needs.info.outputs.test_full_suite == 'false'
shell: bash
run: |
. venv/bin/activate
python --version
pylint --ignore-missing-annotations=y tests/components/${{ needs.info.outputs.tests_glob }}
pylint tests/components/${{ needs.info.outputs.tests_glob }}
mypy:
name: Check mypy
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ jobs:
uses: actions/checkout@v4.1.7

- name: Initialize CodeQL
uses: github/codeql-action/init@v3.26.2
uses: github/codeql-action/init@v3.26.4
with:
languages: python

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3.26.2
uses: github/codeql-action/analyze@v3.26.4
with:
category: "/language:python"
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.1
rev: v0.6.2
hooks:
- id: ruff
args:
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/alexa/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ class AlexaPresetResource(AlexaCapabilityResource):
"""Implements Alexa PresetResources.
Use presetResources with RangeController to provide a set of
friendlyNamesfor each RangeController preset.
friendlyNames for each RangeController preset.
https://developer.amazon.com/docs/device-apis/resources-and-assets.html#presetresources
"""
Expand Down
121 changes: 9 additions & 112 deletions homeassistant/components/amazon_polly/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,135 +8,32 @@
CONF_ACCESS_KEY_ID: Final = "aws_access_key_id"
CONF_SECRET_ACCESS_KEY: Final = "aws_secret_access_key"

DEFAULT_REGION: Final = "us-east-1"
SUPPORTED_REGIONS: Final[list[str]] = [
"us-east-1",
"us-east-2",
"us-west-1",
"us-west-2",
"ca-central-1",
"eu-west-1",
"eu-central-1",
"eu-west-2",
"eu-west-3",
"ap-southeast-1",
"ap-southeast-2",
"ap-northeast-2",
"ap-northeast-1",
"ap-south-1",
"sa-east-1",
]

CONF_ENGINE: Final = "engine"
CONF_VOICE: Final = "voice"
CONF_OUTPUT_FORMAT: Final = "output_format"
CONF_SAMPLE_RATE: Final = "sample_rate"
CONF_TEXT_TYPE: Final = "text_type"

SUPPORTED_VOICES: Final[list[str]] = [
"Aditi", # Hindi
"Amy", # English (British)
"Aria", # English (New Zealand), Neural
"Arlet", # Catalan, Neural
"Arthur", # English, Neural
"Astrid", # Swedish
"Ayanda", # English (South African), Neural
"Bianca", # Italian
"Brian", # English (British)
"Camila", # Portuguese, Brazilian
"Carla", # Italian
"Carmen", # Romanian
"Celine", # French
"Chantal", # French Canadian
"Conchita", # Spanish (European)
"Cristiano", # Portuguese (European)
"Daniel", # German, Neural
"Dora", # Icelandic
"Elin", # Swedish, Neural
"Emma", # English
"Enrique", # Spanish (European)
"Ewa", # Polish
"Filiz", # Turkish
"Gabrielle", # French (Canadian)
"Geraint", # English Welsh
"Giorgio", # Italian
"Gwyneth", # Welsh
"Hala", # Arabic (Gulf), Neural
"Hannah", # German (Austrian), Neural
"Hans", # German
"Hiujin", # Chinese (Cantonese), Neural
"Ida", # Norwegian, Neural
"Ines", # Portuguese, European # codespell:ignore ines
"Ivy", # English
"Jacek", # Polish
"Jan", # Polish
"Joanna", # English
"Joey", # English
"Justin", # English
"Kajal", # English (Indian)/Hindi (Bilingual ), Neural
"Karl", # Icelandic
"Kendra", # English
"Kevin", # English, Neural
"Kimberly", # English
"Laura", # Dutch, Neural
"Lea", # French
"Liam", # Canadian French, Neural
"Liv", # Norwegian
"Lotte", # Dutch
"Lucia", # Spanish European
"Lupe", # Spanish US
"Mads", # Danish
"Maja", # Polish
"Marlene", # German
"Mathieu", # French
"Matthew", # English
"Maxim", # Russian
"Mia", # Spanish Mexican
"Miguel", # Spanish US
"Mizuki", # Japanese
"Naja", # Danish
"Nicole", # English Australian
"Ola", # Polish, Neural
"Olivia", # Female, Australian, Neural
"Penelope", # Spanish US
"Pedro", # Spanish US, Neural
"Raveena", # English, Indian
"Ricardo", # Portuguese (Brazilian)
"Ruben", # Dutch
"Russell", # English (Australian)
"Ruth", # English, Neural
"Salli", # English
"Seoyeon", # Korean
"Stephen", # English, Neural
"Suvi", # Finnish
"Takumi", # Japanese
"Tatyana", # Russian
"Vicki", # German
"Vitoria", # Portuguese, Brazilian
"Zeina", # Arabic
"Zhiyu", # Chinese
]

SUPPORTED_OUTPUT_FORMATS: Final[list[str]] = ["mp3", "ogg_vorbis", "pcm"]
SUPPORTED_OUTPUT_FORMATS: Final[set[str]] = {"mp3", "ogg_vorbis", "pcm"}

SUPPORTED_ENGINES: Final[list[str]] = ["neural", "standard"]
SUPPORTED_SAMPLE_RATES: Final[set[str]] = {"8000", "16000", "22050", "24000"}

SUPPORTED_SAMPLE_RATES: Final[list[str]] = ["8000", "16000", "22050", "24000"]

SUPPORTED_SAMPLE_RATES_MAP: Final[dict[str, list[str]]] = {
"mp3": ["8000", "16000", "22050", "24000"],
"ogg_vorbis": ["8000", "16000", "22050"],
"pcm": ["8000", "16000"],
SUPPORTED_SAMPLE_RATES_MAP: Final[dict[str, set[str]]] = {
"mp3": {"8000", "16000", "22050", "24000"},
"ogg_vorbis": {"8000", "16000", "22050"},
"pcm": {"8000", "16000"},
}

SUPPORTED_TEXT_TYPES: Final[list[str]] = ["text", "ssml"]
SUPPORTED_TEXT_TYPES: Final[set[str]] = {"text", "ssml"}

CONTENT_TYPE_EXTENSIONS: Final[dict[str, str]] = {
"audio/mpeg": "mp3",
"audio/ogg": "ogg",
"audio/pcm": "pcm",
}

DEFAULT_REGION: Final = "us-east-1"

DEFAULT_ENGINE: Final = "standard"
DEFAULT_VOICE: Final = "Joanna"
DEFAULT_OUTPUT_FORMAT: Final = "mp3"
Expand Down
8 changes: 5 additions & 3 deletions homeassistant/components/amazon_polly/tts.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
)
from homeassistant.const import ATTR_CREDENTIALS, CONF_PROFILE_NAME
from homeassistant.core import HomeAssistant
from homeassistant.generated.amazon_polly import (
SUPPORTED_ENGINES,
SUPPORTED_REGIONS,
SUPPORTED_VOICES,
)
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType

Expand All @@ -38,13 +43,10 @@
DEFAULT_SAMPLE_RATES,
DEFAULT_TEXT_TYPE,
DEFAULT_VOICE,
SUPPORTED_ENGINES,
SUPPORTED_OUTPUT_FORMATS,
SUPPORTED_REGIONS,
SUPPORTED_SAMPLE_RATES,
SUPPORTED_SAMPLE_RATES_MAP,
SUPPORTED_TEXT_TYPES,
SUPPORTED_VOICES,
)

_LOGGER: Final = logging.getLogger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/august/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@
"documentation": "https://www.home-assistant.io/integrations/august",
"iot_class": "cloud_push",
"loggers": ["pubnub", "yalexs"],
"requirements": ["yalexs==8.1.2", "yalexs-ble==2.4.3"]
"requirements": ["yalexs==8.1.4", "yalexs-ble==2.4.3"]
}
2 changes: 1 addition & 1 deletion homeassistant/components/bluetooth/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"bluetooth-adapters==0.19.4",
"bluetooth-auto-recovery==1.4.2",
"bluetooth-data-tools==1.19.4",
"dbus-fast==2.22.1",
"dbus-fast==2.23.0",
"habluetooth==3.3.2"
]
}
4 changes: 2 additions & 2 deletions homeassistant/components/esphome/cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ def is_closed(self) -> bool | None:
@esphome_state_property
def is_opening(self) -> bool:
"""Return if the cover is opening or not."""
return self._state.current_operation == CoverOperation.IS_OPENING
return self._state.current_operation is CoverOperation.IS_OPENING

@property
@esphome_state_property
def is_closing(self) -> bool:
"""Return if the cover is closing or not."""
return self._state.current_operation == CoverOperation.IS_CLOSING
return self._state.current_operation is CoverOperation.IS_CLOSING

@property
@esphome_state_property
Expand Down
8 changes: 3 additions & 5 deletions homeassistant/components/esphome/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ async def platform_async_setup_entry(
"""
entry_data = entry.runtime_data
entry_data.info[info_type] = {}
entry_data.state.setdefault(state_type, {})
platform = entity_platform.async_get_current_platform()
on_static_info_update = functools.partial(
async_static_info_updated,
Expand Down Expand Up @@ -188,6 +187,7 @@ def __init__(
) -> None:
"""Initialize."""
self._entry_data = entry_data
self._states = cast(dict[int, _StateT], entry_data.state[state_type])
assert entry_data.device_info is not None
device_info = entry_data.device_info
self._device_info = device_info
Expand Down Expand Up @@ -265,11 +265,9 @@ def _on_static_info_update(self, static_info: EntityInfo) -> None:
@callback
def _update_state_from_entry_data(self) -> None:
"""Update state from entry data."""
state = self._entry_data.state
key = self._key
state_type = self._state_type
if has_state := key in state[state_type]:
self._state = cast(_StateT, state[state_type][key])
if has_state := key in self._states:
self._state = self._states[key]
self._has_state = has_state

@callback
Expand Down
5 changes: 4 additions & 1 deletion homeassistant/components/esphome/entry_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from __future__ import annotations

import asyncio
from collections import defaultdict
from collections.abc import Callable, Iterable
from dataclasses import dataclass, field
from functools import partial
Expand Down Expand Up @@ -111,7 +112,9 @@ class RuntimeEntryData:
title: str
client: APIClient
store: ESPHomeStorage
state: dict[type[EntityState], dict[int, EntityState]] = field(default_factory=dict)
state: defaultdict[type[EntityState], dict[int, EntityState]] = field(
default_factory=lambda: defaultdict(dict)
)
# When the disconnect callback is called, we mark all states
# as stale so we will always dispatch a state update when the
# device reconnects. This is the same format as state_subscriptions.
Expand Down
8 changes: 4 additions & 4 deletions homeassistant/components/esphome/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,25 @@ def _on_static_info_update(self, static_info: EntityInfo) -> None:
@esphome_state_property
def is_locked(self) -> bool | None:
"""Return true if the lock is locked."""
return self._state.state == LockState.LOCKED
return self._state.state is LockState.LOCKED

@property
@esphome_state_property
def is_locking(self) -> bool | None:
"""Return true if the lock is locking."""
return self._state.state == LockState.LOCKING
return self._state.state is LockState.LOCKING

@property
@esphome_state_property
def is_unlocking(self) -> bool | None:
"""Return true if the lock is unlocking."""
return self._state.state == LockState.UNLOCKING
return self._state.state is LockState.UNLOCKING

@property
@esphome_state_property
def is_jammed(self) -> bool | None:
"""Return true if the lock is jammed (incomplete locking)."""
return self._state.state == LockState.JAMMED
return self._state.state is LockState.JAMMED

@convert_api_error_ha_error
async def async_lock(self, **kwargs: Any) -> None:
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/holiday/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/holiday",
"iot_class": "local_polling",
"requirements": ["holidays==0.54", "babel==2.15.0"]
"requirements": ["holidays==0.55", "babel==2.15.0"]
}
1 change: 1 addition & 0 deletions homeassistant/components/iotawatt/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import httpx

DOMAIN = "iotawatt"
VOLT_AMPERE_REACTIVE = "VAR"
VOLT_AMPERE_REACTIVE_HOURS = "VARh"

CONNECTION_ERRORS = (KeyError, json.JSONDecodeError, httpx.HTTPError)
5 changes: 2 additions & 3 deletions homeassistant/components/iotawatt/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
UnitOfEnergy,
UnitOfFrequency,
UnitOfPower,
UnitOfReactivePower,
)
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import device_registry as dr, entity_registry as er
Expand All @@ -32,7 +31,7 @@
from homeassistant.helpers.update_coordinator import CoordinatorEntity
from homeassistant.util import dt as dt_util

from .const import DOMAIN, VOLT_AMPERE_REACTIVE_HOURS
from .const import DOMAIN, VOLT_AMPERE_REACTIVE, VOLT_AMPERE_REACTIVE_HOURS
from .coordinator import IotawattUpdater

_LOGGER = logging.getLogger(__name__)
Expand Down Expand Up @@ -90,7 +89,7 @@ class IotaWattSensorEntityDescription(SensorEntityDescription):
),
"VAR": IotaWattSensorEntityDescription(
key="VAR",
native_unit_of_measurement=UnitOfReactivePower.VOLT_AMPERE_REACTIVE,
native_unit_of_measurement=VOLT_AMPERE_REACTIVE,
state_class=SensorStateClass.MEASUREMENT,
icon="mdi:flash",
entity_registry_enabled_default=False,
Expand Down
3 changes: 3 additions & 0 deletions homeassistant/components/izone/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,9 @@ class ZoneDevice(ClimateEntity):
_attr_name = None
_attr_temperature_unit = UnitOfTemperature.CELSIUS
_attr_target_temperature_step = 0.5
_attr_supported_features = (
ClimateEntityFeature.TURN_OFF | ClimateEntityFeature.TURN_ON
)

def __init__(self, controller: ControllerDevice, zone: Zone) -> None:
"""Initialise ZoneDevice."""
Expand Down
Loading

0 comments on commit 687aab9

Please sign in to comment.