mirror of
https://github.com/home-assistant/core.git
synced 2026-02-15 07:36:16 +00:00
Update esphome
This commit is contained in:
@@ -29,7 +29,7 @@ from aioesphomeapi import (
|
||||
Event,
|
||||
EventInfo,
|
||||
FanInfo,
|
||||
InfraredProxyInfo,
|
||||
InfraredInfo,
|
||||
LightInfo,
|
||||
LockInfo,
|
||||
MediaPlayerInfo,
|
||||
@@ -85,7 +85,7 @@ INFO_TYPE_TO_PLATFORM: dict[type[EntityInfo], Platform] = {
|
||||
DateTimeInfo: Platform.DATETIME,
|
||||
EventInfo: Platform.EVENT,
|
||||
FanInfo: Platform.FAN,
|
||||
InfraredProxyInfo: Platform.INFRARED,
|
||||
InfraredInfo: Platform.INFRARED,
|
||||
LightInfo: Platform.LIGHT,
|
||||
LockInfo: Platform.LOCK,
|
||||
MediaPlayerInfo: Platform.MEDIA_PLAYER,
|
||||
|
||||
@@ -5,12 +5,7 @@ from __future__ import annotations
|
||||
from functools import partial
|
||||
import logging
|
||||
|
||||
from aioesphomeapi import (
|
||||
EntityInfo,
|
||||
EntityState,
|
||||
InfraredProxyCapability,
|
||||
InfraredProxyInfo,
|
||||
)
|
||||
from aioesphomeapi import EntityInfo, EntityState, InfraredCapability, InfraredInfo
|
||||
|
||||
from homeassistant.components.infrared import (
|
||||
InfraredCommand,
|
||||
@@ -28,9 +23,7 @@ _LOGGER = logging.getLogger(__name__)
|
||||
PARALLEL_UPDATES = 0
|
||||
|
||||
|
||||
class EsphomeInfraredEntity(
|
||||
EsphomeEntity[InfraredProxyInfo, EntityState], InfraredEntity
|
||||
):
|
||||
class EsphomeInfraredEntity(EsphomeEntity[InfraredInfo, EntityState], InfraredEntity):
|
||||
"""ESPHome infrared entity using native API."""
|
||||
|
||||
_attr_has_entity_name = True
|
||||
@@ -43,9 +36,9 @@ class EsphomeInfraredEntity(
|
||||
capabilities = static_info.capabilities
|
||||
|
||||
features = InfraredEntityFeature(0)
|
||||
if capabilities & InfraredProxyCapability.TRANSMITTER:
|
||||
if capabilities & InfraredCapability.TRANSMITTER:
|
||||
features |= InfraredEntityFeature.TRANSMIT
|
||||
if capabilities & InfraredProxyCapability.RECEIVER:
|
||||
if capabilities & InfraredCapability.RECEIVER:
|
||||
features |= InfraredEntityFeature.RECEIVE
|
||||
self._attr_supported_features = features
|
||||
|
||||
@@ -76,7 +69,7 @@ class EsphomeInfraredEntity(
|
||||
Raises:
|
||||
HomeAssistantError: If transmission fails or not supported.
|
||||
"""
|
||||
if not self._static_info.capabilities & InfraredProxyCapability.TRANSMITTER:
|
||||
if not self._static_info.capabilities & InfraredCapability.TRANSMITTER:
|
||||
raise HomeAssistantError(
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="infrared_proxy_transmitter_not_supported",
|
||||
@@ -90,7 +83,7 @@ class EsphomeInfraredEntity(
|
||||
_LOGGER.debug("Sending command: %s", timings)
|
||||
|
||||
try:
|
||||
self._client.infrared_proxy_transmit_raw_timings(
|
||||
self._client.infrared_rf_transmit_raw_timings(
|
||||
self._static_info.key, carrier_frequency=38000, timings=timings
|
||||
)
|
||||
except Exception as err:
|
||||
@@ -106,7 +99,7 @@ class EsphomeInfraredEntity(
|
||||
|
||||
async_setup_entry = partial(
|
||||
platform_async_setup_entry,
|
||||
info_type=InfraredProxyInfo,
|
||||
info_type=InfraredInfo,
|
||||
entity_type=EsphomeInfraredEntity,
|
||||
state_type=EntityState,
|
||||
)
|
||||
|
||||
@@ -17,6 +17,8 @@ from aioesphomeapi import (
|
||||
EncryptionPlaintextAPIError,
|
||||
ExecuteServiceResponse,
|
||||
HomeassistantServiceCall,
|
||||
InfraredCapability,
|
||||
InfraredInfo,
|
||||
InvalidAuthAPIError,
|
||||
InvalidEncryptionKeyAPIError,
|
||||
LogLevel,
|
||||
@@ -692,9 +694,13 @@ class ESPHomeManager:
|
||||
cli.subscribe_zwave_proxy_request(self._async_zwave_proxy_request)
|
||||
)
|
||||
|
||||
if device_info.infrared_proxy_feature_flags:
|
||||
if any(
|
||||
isinstance(info, InfraredInfo)
|
||||
and info.capabilities & InfraredCapability.RECEIVER
|
||||
for info in entity_infos
|
||||
):
|
||||
entry_data.disconnect_callbacks.add(
|
||||
cli.subscribe_infrared_proxy_receive(self._async_infrared_proxy_receive)
|
||||
cli.subscribe_infrared_rf_receive(self._async_infrared_proxy_receive)
|
||||
)
|
||||
|
||||
cli.subscribe_home_assistant_states_and_services(
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
"mqtt": ["esphome/discover/#"],
|
||||
"quality_scale": "platinum",
|
||||
"requirements": [
|
||||
"aioesphomeapi==43.10.1",
|
||||
"aioesphomeapi==43.13.0",
|
||||
"esphome-dashboard-api==1.3.0",
|
||||
"bleak-esphome==3.4.0"
|
||||
],
|
||||
|
||||
2
requirements_all.txt
generated
2
requirements_all.txt
generated
@@ -252,7 +252,7 @@ aioelectricitymaps==1.1.1
|
||||
aioemonitor==1.0.5
|
||||
|
||||
# homeassistant.components.esphome
|
||||
aioesphomeapi==43.10.1
|
||||
aioesphomeapi==43.13.0
|
||||
|
||||
# homeassistant.components.matrix
|
||||
# homeassistant.components.slack
|
||||
|
||||
2
requirements_test_all.txt
generated
2
requirements_test_all.txt
generated
@@ -243,7 +243,7 @@ aioelectricitymaps==1.1.1
|
||||
aioemonitor==1.0.5
|
||||
|
||||
# homeassistant.components.esphome
|
||||
aioesphomeapi==43.10.1
|
||||
aioesphomeapi==43.13.0
|
||||
|
||||
# homeassistant.components.matrix
|
||||
# homeassistant.components.slack
|
||||
|
||||
Reference in New Issue
Block a user