mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
Bump aioesphomeapi to 19.0.0 (#104512)
This commit is contained in:
parent
837f34c40c
commit
fc5ae50e06
@ -27,7 +27,12 @@ import voluptuous as vol
|
|||||||
|
|
||||||
from homeassistant.components import tag, zeroconf
|
from homeassistant.components import tag, zeroconf
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import ATTR_DEVICE_ID, CONF_MODE, EVENT_HOMEASSISTANT_STOP
|
from homeassistant.const import (
|
||||||
|
ATTR_DEVICE_ID,
|
||||||
|
CONF_MODE,
|
||||||
|
EVENT_HOMEASSISTANT_STOP,
|
||||||
|
EVENT_LOGGING_CHANGED,
|
||||||
|
)
|
||||||
from homeassistant.core import (
|
from homeassistant.core import (
|
||||||
CALLBACK_TYPE,
|
CALLBACK_TYPE,
|
||||||
Event,
|
Event,
|
||||||
@ -545,6 +550,11 @@ class ESPHomeManager:
|
|||||||
):
|
):
|
||||||
self.entry.async_start_reauth(self.hass)
|
self.entry.async_start_reauth(self.hass)
|
||||||
|
|
||||||
|
@callback
|
||||||
|
def _async_handle_logging_changed(self, _event: Event) -> None:
|
||||||
|
"""Handle when the logging level changes."""
|
||||||
|
self.cli.set_debug(_LOGGER.isEnabledFor(logging.DEBUG))
|
||||||
|
|
||||||
async def async_start(self) -> None:
|
async def async_start(self) -> None:
|
||||||
"""Start the esphome connection manager."""
|
"""Start the esphome connection manager."""
|
||||||
hass = self.hass
|
hass = self.hass
|
||||||
@ -561,6 +571,11 @@ class ESPHomeManager:
|
|||||||
entry_data.cleanup_callbacks.append(
|
entry_data.cleanup_callbacks.append(
|
||||||
hass.bus.async_listen(EVENT_HOMEASSISTANT_STOP, self.on_stop)
|
hass.bus.async_listen(EVENT_HOMEASSISTANT_STOP, self.on_stop)
|
||||||
)
|
)
|
||||||
|
entry_data.cleanup_callbacks.append(
|
||||||
|
hass.bus.async_listen(
|
||||||
|
EVENT_LOGGING_CHANGED, self._async_handle_logging_changed
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
reconnect_logic = ReconnectLogic(
|
reconnect_logic = ReconnectLogic(
|
||||||
client=self.cli,
|
client=self.cli,
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
"loggers": ["aioesphomeapi", "noiseprotocol"],
|
"loggers": ["aioesphomeapi", "noiseprotocol"],
|
||||||
"requirements": [
|
"requirements": [
|
||||||
"async-interrupt==1.1.1",
|
"async-interrupt==1.1.1",
|
||||||
"aioesphomeapi==18.5.9",
|
"aioesphomeapi==19.0.0",
|
||||||
"bluetooth-data-tools==1.15.0",
|
"bluetooth-data-tools==1.15.0",
|
||||||
"esphome-dashboard-api==1.2.3"
|
"esphome-dashboard-api==1.2.3"
|
||||||
],
|
],
|
||||||
|
@ -236,7 +236,7 @@ aioelectricitymaps==0.1.5
|
|||||||
aioemonitor==1.0.5
|
aioemonitor==1.0.5
|
||||||
|
|
||||||
# homeassistant.components.esphome
|
# homeassistant.components.esphome
|
||||||
aioesphomeapi==18.5.9
|
aioesphomeapi==19.0.0
|
||||||
|
|
||||||
# homeassistant.components.flo
|
# homeassistant.components.flo
|
||||||
aioflo==2021.11.0
|
aioflo==2021.11.0
|
||||||
|
@ -215,7 +215,7 @@ aioelectricitymaps==0.1.5
|
|||||||
aioemonitor==1.0.5
|
aioemonitor==1.0.5
|
||||||
|
|
||||||
# homeassistant.components.esphome
|
# homeassistant.components.esphome
|
||||||
aioesphomeapi==18.5.9
|
aioesphomeapi==19.0.0
|
||||||
|
|
||||||
# homeassistant.components.flo
|
# homeassistant.components.flo
|
||||||
aioflo==2021.11.0
|
aioflo==2021.11.0
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
"""Test ESPHome manager."""
|
"""Test ESPHome manager."""
|
||||||
from collections.abc import Awaitable, Callable
|
from collections.abc import Awaitable, Callable
|
||||||
from unittest.mock import AsyncMock
|
from unittest.mock import AsyncMock, call
|
||||||
|
|
||||||
from aioesphomeapi import APIClient, DeviceInfo, EntityInfo, EntityState, UserService
|
from aioesphomeapi import APIClient, DeviceInfo, EntityInfo, EntityState, UserService
|
||||||
import pytest
|
import pytest
|
||||||
@ -16,6 +16,7 @@ from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PORT
|
|||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.data_entry_flow import FlowResultType
|
from homeassistant.data_entry_flow import FlowResultType
|
||||||
from homeassistant.helpers import issue_registry as ir
|
from homeassistant.helpers import issue_registry as ir
|
||||||
|
from homeassistant.setup import async_setup_component
|
||||||
|
|
||||||
from .conftest import MockESPHomeDevice
|
from .conftest import MockESPHomeDevice
|
||||||
|
|
||||||
@ -332,3 +333,39 @@ async def test_connection_aborted_wrong_device(
|
|||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
assert len(new_info.mock_calls) == 1
|
assert len(new_info.mock_calls) == 1
|
||||||
assert "Unexpected device found at" not in caplog.text
|
assert "Unexpected device found at" not in caplog.text
|
||||||
|
|
||||||
|
|
||||||
|
async def test_debug_logging(
|
||||||
|
mock_client: APIClient,
|
||||||
|
hass: HomeAssistant,
|
||||||
|
mock_generic_device_entry: Callable[
|
||||||
|
[APIClient, list[EntityInfo], list[UserService], list[EntityState]],
|
||||||
|
Awaitable[MockConfigEntry],
|
||||||
|
],
|
||||||
|
) -> None:
|
||||||
|
"""Test enabling and disabling debug logging."""
|
||||||
|
assert await async_setup_component(hass, "logger", {"logger": {}})
|
||||||
|
await mock_generic_device_entry(
|
||||||
|
mock_client=mock_client,
|
||||||
|
entity_info=[],
|
||||||
|
user_service=[],
|
||||||
|
states=[],
|
||||||
|
)
|
||||||
|
await hass.services.async_call(
|
||||||
|
"logger",
|
||||||
|
"set_level",
|
||||||
|
{"homeassistant.components.esphome": "DEBUG"},
|
||||||
|
blocking=True,
|
||||||
|
)
|
||||||
|
await hass.async_block_till_done()
|
||||||
|
mock_client.set_debug.assert_has_calls([call(True)])
|
||||||
|
|
||||||
|
mock_client.reset_mock()
|
||||||
|
await hass.services.async_call(
|
||||||
|
"logger",
|
||||||
|
"set_level",
|
||||||
|
{"homeassistant.components.esphome": "WARNING"},
|
||||||
|
blocking=True,
|
||||||
|
)
|
||||||
|
await hass.async_block_till_done()
|
||||||
|
mock_client.set_debug.assert_has_calls([call(False)])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user