mirror of
https://github.com/home-assistant/core.git
synced 2026-08-24 10:13:52 -05:00
Name the JVC Projector delay between a power command and the refresh (#179791)
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude
parent
b9c9e7aa88
commit
b2e7fea022
@@ -15,6 +15,8 @@ from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||
from .coordinator import JVCConfigEntry
|
||||
from .entity import JvcProjectorEntity
|
||||
|
||||
POWER_SLEEP = 1
|
||||
|
||||
COMMANDS: list[str] = [
|
||||
cmd.Remote.MENU,
|
||||
cmd.Remote.UP,
|
||||
@@ -92,14 +94,14 @@ class JvcProjectorRemote(JvcProjectorEntity, RemoteEntity):
|
||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||
"""Turn the device on."""
|
||||
await self.device.set(cmd.Power, cmd.Power.ON)
|
||||
await asyncio.sleep(1)
|
||||
await asyncio.sleep(POWER_SLEEP)
|
||||
await self.coordinator.async_refresh()
|
||||
|
||||
@override
|
||||
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||
"""Turn the device off."""
|
||||
await self.device.set(cmd.Power, cmd.Power.OFF)
|
||||
await asyncio.sleep(1)
|
||||
await asyncio.sleep(POWER_SLEEP)
|
||||
await self.coordinator.async_refresh()
|
||||
|
||||
@override
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""Tests for JVC Projector remote platform."""
|
||||
|
||||
from unittest.mock import MagicMock
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -31,6 +31,7 @@ async def test_entity_state(
|
||||
assert entity_registry.async_get(entity.entity_id)
|
||||
|
||||
|
||||
@patch("homeassistant.components.jvc_projector.remote.POWER_SLEEP", 0)
|
||||
async def test_commands(
|
||||
hass: HomeAssistant,
|
||||
mock_device: MagicMock,
|
||||
|
||||
Reference in New Issue
Block a user