Use Platform enum in ZHA (#61016)

This commit is contained in:
David F. Mulcahey 2021-12-11 11:06:39 -05:00 committed by GitHub
parent 5907f6690c
commit a17031630f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 332 additions and 316 deletions

View file

@ -7,8 +7,12 @@ import zigpy.zcl.clusters.closures as closures
import zigpy.zcl.clusters.general as general
import zigpy.zcl.foundation as zcl_f
from homeassistant.components.lock import DOMAIN
from homeassistant.const import STATE_LOCKED, STATE_UNAVAILABLE, STATE_UNLOCKED
from homeassistant.const import (
STATE_LOCKED,
STATE_UNAVAILABLE,
STATE_UNLOCKED,
Platform,
)
from .common import async_enable_traffic, find_entity_id, send_attributes_report
from .conftest import SIG_EP_INPUT, SIG_EP_OUTPUT, SIG_EP_TYPE
@ -44,7 +48,7 @@ async def test_lock(hass, lock):
"""Test zha lock platform."""
zha_device, cluster = lock
entity_id = await find_entity_id(DOMAIN, zha_device, hass)
entity_id = await find_entity_id(Platform.LOCK, zha_device, hass)
assert entity_id is not None
assert hass.states.get(entity_id).state == STATE_UNLOCKED
@ -92,7 +96,7 @@ async def async_lock(hass, cluster, entity_id):
):
# lock via UI
await hass.services.async_call(
DOMAIN, "lock", {"entity_id": entity_id}, blocking=True
Platform.LOCK, "lock", {"entity_id": entity_id}, blocking=True
)
assert cluster.request.call_count == 1
assert cluster.request.call_args[0][0] is False
@ -106,7 +110,7 @@ async def async_unlock(hass, cluster, entity_id):
):
# lock via UI
await hass.services.async_call(
DOMAIN, "unlock", {"entity_id": entity_id}, blocking=True
Platform.LOCK, "unlock", {"entity_id": entity_id}, blocking=True
)
assert cluster.request.call_count == 1
assert cluster.request.call_args[0][0] is False