mirror of
https://github.com/home-assistant/core.git
synced 2026-04-02 00:20:30 +01:00
Fix Abode retrofit lock discovery (#166433)
This commit is contained in:
@@ -9,6 +9,6 @@
|
||||
},
|
||||
"iot_class": "cloud_push",
|
||||
"loggers": ["jaraco.abode", "lomond"],
|
||||
"requirements": ["jaraco.abode==6.2.1"],
|
||||
"requirements": ["jaraco.abode==6.4.0"],
|
||||
"single_config_entry": true
|
||||
}
|
||||
|
||||
2
requirements_all.txt
generated
2
requirements_all.txt
generated
@@ -1355,7 +1355,7 @@ ismartgate==5.0.2
|
||||
israel-rail-api==0.1.4
|
||||
|
||||
# homeassistant.components.abode
|
||||
jaraco.abode==6.2.1
|
||||
jaraco.abode==6.4.0
|
||||
|
||||
# homeassistant.components.jellyfin
|
||||
jellyfin-apiclient-python==1.11.0
|
||||
|
||||
2
requirements_test_all.txt
generated
2
requirements_test_all.txt
generated
@@ -1201,7 +1201,7 @@ ismartgate==5.0.2
|
||||
israel-rail-api==0.1.4
|
||||
|
||||
# homeassistant.components.abode
|
||||
jaraco.abode==6.2.1
|
||||
jaraco.abode==6.4.0
|
||||
|
||||
# homeassistant.components.jellyfin
|
||||
jellyfin-apiclient-python==1.11.0
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
"""Tests for the Abode lock device."""
|
||||
|
||||
import json
|
||||
from unittest.mock import patch
|
||||
|
||||
from jaraco.abode.helpers import urls as URL
|
||||
from requests_mock import Mocker
|
||||
|
||||
from homeassistant.components.abode import ATTR_DEVICE_ID
|
||||
from homeassistant.components.lock import DOMAIN as LOCK_DOMAIN, LockState
|
||||
from homeassistant.const import (
|
||||
@@ -15,6 +19,8 @@ from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from .common import setup_platform
|
||||
|
||||
from tests.common import async_load_fixture
|
||||
|
||||
DEVICE_ID = "lock.test_lock"
|
||||
|
||||
|
||||
@@ -63,3 +69,23 @@ async def test_unlock(hass: HomeAssistant) -> None:
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
mock_unlock.assert_called_once()
|
||||
|
||||
|
||||
async def test_retrofit_lock_discovered(
|
||||
hass: HomeAssistant, requests_mock: Mocker
|
||||
) -> None:
|
||||
"""Test retrofit locks are discovered as lock entities."""
|
||||
devices = json.loads(await async_load_fixture(hass, "devices.json", "abode"))
|
||||
for device in devices:
|
||||
if device["type_tag"] == "device_type.door_lock":
|
||||
device["type_tag"] = "device_type.retrofit_lock"
|
||||
device["type"] = "Retrofit Lock"
|
||||
break
|
||||
|
||||
requests_mock.get(URL.DEVICES, text=json.dumps(devices))
|
||||
|
||||
await setup_platform(hass, LOCK_DOMAIN)
|
||||
|
||||
state = hass.states.get(DEVICE_ID)
|
||||
assert state is not None
|
||||
assert state.state == LockState.LOCKED
|
||||
|
||||
Reference in New Issue
Block a user