Skip to content

Commit

Permalink
Merge branch 'dev' into mqtt-device-based-discovery
Browse files Browse the repository at this point in the history
  • Loading branch information
jbouwh authored Aug 20, 2024
2 parents d23973b + b74aced commit fbc9829
Show file tree
Hide file tree
Showing 461 changed files with 12,539 additions and 3,557 deletions.
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.5.7
rev: v0.6.1
hooks:
- id: ruff
args:
Expand Down
3 changes: 3 additions & 0 deletions .strict-typing
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,9 @@ homeassistant.components.fritzbox.*
homeassistant.components.fritzbox_callmonitor.*
homeassistant.components.fronius.*
homeassistant.components.frontend.*
homeassistant.components.fujitsu_fglair.*
homeassistant.components.fully_kiosk.*
homeassistant.components.fyta.*
homeassistant.components.generic_hygrostat.*
homeassistant.components.generic_thermostat.*
homeassistant.components.geo_location.*
Expand Down Expand Up @@ -293,6 +295,7 @@ homeassistant.components.lookin.*
homeassistant.components.luftdaten.*
homeassistant.components.madvr.*
homeassistant.components.mailbox.*
homeassistant.components.manual.*
homeassistant.components.map.*
homeassistant.components.mastodon.*
homeassistant.components.matrix.*
Expand Down
4 changes: 4 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,8 @@ build.json @home-assistant/supervisor
/tests/components/frontend/ @home-assistant/frontend
/homeassistant/components/frontier_silicon/ @wlcrs
/tests/components/frontier_silicon/ @wlcrs
/homeassistant/components/fujitsu_fglair/ @crevetor
/tests/components/fujitsu_fglair/ @crevetor
/homeassistant/components/fully_kiosk/ @cgarwood
/tests/components/fully_kiosk/ @cgarwood
/homeassistant/components/fyta/ @dontinelli
Expand Down Expand Up @@ -1327,6 +1329,8 @@ build.json @home-assistant/supervisor
/homeassistant/components/smarty/ @z0mbieprocess
/homeassistant/components/smhi/ @gjohansson-ST
/tests/components/smhi/ @gjohansson-ST
/homeassistant/components/smlight/ @tl-sl
/tests/components/smlight/ @tl-sl
/homeassistant/components/sms/ @ocalvo
/tests/components/sms/ @ocalvo
/homeassistant/components/snapcast/ @luar123
Expand Down
55 changes: 55 additions & 0 deletions homeassistant/block_async_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from http.client import HTTPConnection
import importlib
import os
from pathlib import Path
from ssl import SSLContext
import sys
import threading
Expand Down Expand Up @@ -162,6 +163,60 @@ class BlockingCall:
strict_core=False,
skip_for_tests=True,
),
BlockingCall(
original_func=SSLContext.load_cert_chain,
object=SSLContext,
function="load_cert_chain",
check_allowed=None,
strict=False,
strict_core=False,
skip_for_tests=True,
),
BlockingCall(
original_func=Path.open,
object=Path,
function="open",
check_allowed=_check_file_allowed,
strict=False,
strict_core=False,
skip_for_tests=True,
),
BlockingCall(
original_func=Path.read_text,
object=Path,
function="read_text",
check_allowed=_check_file_allowed,
strict=False,
strict_core=False,
skip_for_tests=True,
),
BlockingCall(
original_func=Path.read_bytes,
object=Path,
function="read_bytes",
check_allowed=_check_file_allowed,
strict=False,
strict_core=False,
skip_for_tests=True,
),
BlockingCall(
original_func=Path.write_text,
object=Path,
function="write_text",
check_allowed=_check_file_allowed,
strict=False,
strict_core=False,
skip_for_tests=True,
),
BlockingCall(
original_func=Path.write_bytes,
object=Path,
function="write_bytes",
check_allowed=_check_file_allowed,
strict=False,
strict_core=False,
skip_for_tests=True,
),
)


Expand Down
5 changes: 5 additions & 0 deletions homeassistant/brands/fujitsu.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"domain": "fujitsu",
"name": "Fujitsu",
"integrations": ["fujitsu_anywair", "fujitsu_fglair"]
}
8 changes: 4 additions & 4 deletions homeassistant/components/apsystems/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,28 @@ class ApsystemsLocalApiBinarySensorDescription(BinarySensorEntityDescription):
translation_key="off_grid_status",
device_class=BinarySensorDeviceClass.PROBLEM,
entity_category=EntityCategory.DIAGNOSTIC,
is_on=lambda c: bool(c.og),
is_on=lambda c: c.offgrid,
),
ApsystemsLocalApiBinarySensorDescription(
key="dc_1_short_circuit_error_status",
translation_key="dc_1_short_circuit_error_status",
device_class=BinarySensorDeviceClass.PROBLEM,
entity_category=EntityCategory.DIAGNOSTIC,
is_on=lambda c: bool(c.isce1),
is_on=lambda c: c.shortcircuit_1,
),
ApsystemsLocalApiBinarySensorDescription(
key="dc_2_short_circuit_error_status",
translation_key="dc_2_short_circuit_error_status",
device_class=BinarySensorDeviceClass.PROBLEM,
entity_category=EntityCategory.DIAGNOSTIC,
is_on=lambda c: bool(c.isce2),
is_on=lambda c: c.shortcircuit_2,
),
ApsystemsLocalApiBinarySensorDescription(
key="output_fault_status",
translation_key="output_fault_status",
device_class=BinarySensorDeviceClass.PROBLEM,
entity_category=EntityCategory.DIAGNOSTIC,
is_on=lambda c: bool(c.oe),
is_on=lambda c: not c.operating,
),
)

Expand Down
9 changes: 8 additions & 1 deletion homeassistant/components/apsystems/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from APsystemsEZ1 import APsystemsEZ1M, ReturnAlarmInfo, ReturnOutputData

from homeassistant.core import HomeAssistant
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed

from .const import LOGGER

Expand All @@ -34,6 +34,13 @@ def __init__(self, hass: HomeAssistant, api: APsystemsEZ1M) -> None:
)
self.api = api

async def _async_setup(self) -> None:
try:
max_power = (await self.api.get_device_info()).maxPower
except (ConnectionError, TimeoutError):
raise UpdateFailed from None
self.api.max_power = max_power

async def _async_update_data(self) -> ApSystemsSensorData:
output_data = await self.api.get_output_data()
alarm_info = await self.api.get_alarm_info()
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/apsystems/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"documentation": "https://www.home-assistant.io/integrations/apsystems",
"integration_type": "device",
"iot_class": "local_polling",
"requirements": ["apsystems-ez1==1.3.3"]
"requirements": ["apsystems-ez1==2.2.1"]
}
2 changes: 1 addition & 1 deletion homeassistant/components/apsystems/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ async def async_setup_entry(
class ApSystemsMaxOutputNumber(ApSystemsEntity, NumberEntity):
"""Base sensor to be used with description."""

_attr_native_max_value = 800
_attr_native_min_value = 30
_attr_native_step = 1
_attr_device_class = NumberDeviceClass.POWER
Expand All @@ -42,6 +41,7 @@ def __init__(
super().__init__(data)
self._api = data.coordinator.api
self._attr_unique_id = f"{data.device_id}_output_limit"
self._attr_native_max_value = data.coordinator.api.max_power

async def async_update(self) -> None:
"""Set the state with the value fetched from the inverter."""
Expand Down
7 changes: 3 additions & 4 deletions homeassistant/components/apsystems/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from typing import Any

from aiohttp.client_exceptions import ClientConnectionError
from APsystemsEZ1 import Status

from homeassistant.components.switch import SwitchDeviceClass, SwitchEntity
from homeassistant.core import HomeAssistant
Expand Down Expand Up @@ -45,12 +44,12 @@ async def async_update(self) -> None:
self._attr_available = False
else:
self._attr_available = True
self._attr_is_on = status == Status.normal
self._attr_is_on = status

async def async_turn_on(self, **kwargs: Any) -> None:
"""Turn the switch on."""
await self._api.set_device_power_status(0)
await self._api.set_device_power_status(True)

async def async_turn_off(self, **kwargs: Any) -> None:
"""Turn the switch off."""
await self._api.set_device_power_status(1)
await self._api.set_device_power_status(False)
6 changes: 5 additions & 1 deletion homeassistant/components/aquacell/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
from __future__ import annotations

from aioaquacell import AquacellApi
from aioaquacell.const import Brand

from homeassistant.config_entries import ConfigEntry
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
from homeassistant.helpers.aiohttp_client import async_get_clientsession

from .const import CONF_BRAND
from .coordinator import AquacellCoordinator

PLATFORMS = [Platform.SENSOR]
Expand All @@ -20,7 +22,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: AquacellConfigEntry) ->
"""Set up Aquacell from a config entry."""
session = async_get_clientsession(hass)

aquacell_api = AquacellApi(session)
brand = entry.data.get(CONF_BRAND, Brand.AQUACELL)

aquacell_api = AquacellApi(session, brand)

coordinator = AquacellCoordinator(hass, aquacell_api)

Expand Down
16 changes: 13 additions & 3 deletions homeassistant/components/aquacell/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,27 @@
from typing import Any

from aioaquacell import ApiException, AquacellApi, AuthenticationFailed
from aioaquacell.const import SUPPORTED_BRANDS, Brand
import voluptuous as vol

from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_EMAIL, CONF_PASSWORD
from homeassistant.helpers.aiohttp_client import async_get_clientsession

from .const import CONF_REFRESH_TOKEN, CONF_REFRESH_TOKEN_CREATION_TIME, DOMAIN
from .const import (
CONF_BRAND,
CONF_REFRESH_TOKEN,
CONF_REFRESH_TOKEN_CREATION_TIME,
DOMAIN,
)

_LOGGER = logging.getLogger(__name__)

DATA_SCHEMA = vol.Schema(
{
vol.Required(CONF_BRAND, default=Brand.AQUACELL): vol.In(
{key: brand.name for key, brand in SUPPORTED_BRANDS.items()}
),
vol.Required(CONF_EMAIL): str,
vol.Required(CONF_PASSWORD): str,
}
Expand All @@ -33,7 +42,7 @@ class AquaCellConfigFlow(ConfigFlow, domain=DOMAIN):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step."""
"""Handle the cloud logon step."""
errors: dict[str, str] = {}
if user_input is not None:
await self.async_set_unique_id(
Expand All @@ -42,7 +51,7 @@ async def async_step_user(
self._abort_if_unique_id_configured()

session = async_get_clientsession(self.hass)
api = AquacellApi(session)
api = AquacellApi(session, user_input[CONF_BRAND])
try:
refresh_token = await api.authenticate(
user_input[CONF_EMAIL], user_input[CONF_PASSWORD]
Expand All @@ -59,6 +68,7 @@ async def async_step_user(
title=user_input[CONF_EMAIL],
data={
**user_input,
CONF_BRAND: user_input[CONF_BRAND],
CONF_REFRESH_TOKEN: refresh_token,
CONF_REFRESH_TOKEN_CREATION_TIME: datetime.now().timestamp(),
},
Expand Down
1 change: 1 addition & 0 deletions homeassistant/components/aquacell/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
DOMAIN = "aquacell"
DATA_AQUACELL = "DATA_AQUACELL"

CONF_BRAND = "brand"
CONF_REFRESH_TOKEN = "refresh_token"
CONF_REFRESH_TOKEN_CREATION_TIME = "refresh_token_creation_time"

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/aquacell/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"domain": "aquacell",
"name": "Aquacell",
"name": "AquaCell",
"codeowners": ["@Jordi1990"],
"config_flow": true,
"dependencies": ["http", "network"],
Expand Down
3 changes: 2 additions & 1 deletion homeassistant/components/aquacell/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
"config": {
"step": {
"user": {
"description": "Fill in your Aquacell mobile app credentials",
"description": "Select the brand of the softener and fill in your softener mobile app credentials",
"data": {
"brand": "Brand",
"email": "[%key:common::config_flow::data::email%]",
"password": "[%key:common::config_flow::data::password%]"
}
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/bluetooth/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"requirements": [
"bleak==0.22.2",
"bleak-retry-connector==3.5.0",
"bluetooth-adapters==0.19.3",
"bluetooth-adapters==0.19.4",
"bluetooth-auto-recovery==1.4.2",
"bluetooth-data-tools==1.19.4",
"dbus-fast==2.22.1",
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/braviatv/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"integration_type": "device",
"iot_class": "local_polling",
"loggers": ["pybravia"],
"requirements": ["pybravia==0.3.3"],
"requirements": ["pybravia==0.3.4"],
"ssdp": [
{
"st": "urn:schemas-sony-com:service:ScalarWebAPI:1",
Expand Down
15 changes: 6 additions & 9 deletions homeassistant/components/bring/todo.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError, ServiceValidationError
from homeassistant.helpers import config_validation as cv, entity_platform
from homeassistant.helpers.config_validation import make_entity_service_schema
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.update_coordinator import CoordinatorEntity

Expand Down Expand Up @@ -62,14 +61,12 @@ async def async_setup_entry(

platform.async_register_entity_service(
SERVICE_PUSH_NOTIFICATION,
make_entity_service_schema(
{
vol.Required(ATTR_NOTIFICATION_TYPE): vol.All(
vol.Upper, cv.enum(BringNotificationType)
),
vol.Optional(ATTR_ITEM_NAME): cv.string,
}
),
{
vol.Required(ATTR_NOTIFICATION_TYPE): vol.All(
vol.Upper, cv.enum(BringNotificationType)
),
vol.Optional(ATTR_ITEM_NAME): cv.string,
},
"async_send_message",
)

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 @@ -9,7 +9,7 @@
"iot_class": "local_polling",
"loggers": ["brother", "pyasn1", "pysmi", "pysnmp"],
"quality_scale": "platinum",
"requirements": ["brother==4.2.0"],
"requirements": ["brother==4.3.0"],
"zeroconf": [
{
"type": "_printer._tcp.local.",
Expand Down
8 changes: 8 additions & 0 deletions homeassistant/components/chacon_dio/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,11 @@ def callback_device_state(self, data: dict[str, Any]) -> None:
_LOGGER.debug("Data received from server %s", data)
self._update_attr(data)
self.async_write_ha_state()

async def async_update(self) -> None:
"""Update the state when the entity is requested to."""

_LOGGER.debug("Update called for %s, %s", self, self.target_id)
data = await self.client.get_status_details([self.target_id])
_LOGGER.debug("Received data from server %s", data)
self._update_attr(data[self.target_id])
Loading

0 comments on commit fbc9829

Please sign in to comment.