Centralize august activity updates (#32197)
* Reduce August doorbell detail updates * Doorbell images now get updates from the activity feed * Tests for activity updates * py-august now provides bridge_is_online for available state * py-august now provides is_standby for available state * py-august now provides get_doorbell_image (eliminate requests) * remove debug * black after merge conflict * Centralize august activity updates * Updates appear significantly more responsive * Should address the community complaints about "lag" * Reduce detail updates (device end points) to one hour interval * Signal entities to update via dispatcher when new activity arrives * Resolves out of sync state (skipped test is now unskipped) * pylint * fix merge conflict * review comments * Remove stray * Address review items that can be done without refactor
This commit is contained in:
1 parent
d207c37c33
commit
4c5e364d90
9 files changed
+352
-117
No files matched your search
@@ -1,7 +1,5 @@
|
||||
"""The binary_sensor tests for the august platform."""
|
||||
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.lock import DOMAIN as LOCK_DOMAIN
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
@@ -20,11 +18,6 @@ from tests.components.august.mocks import (
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.skip(
|
||||
reason="The lock and doorsense can get out of sync due to update intervals, "
|
||||
+ "this is an existing bug which will be fixed with dispatcher events to tell "
|
||||
+ "all linked devices to update."
|
||||
)
|
||||
async def test_doorsense(hass):
|
||||
"""Test creation of a lock with doorsense and bridge."""
|
||||
lock_one = await _mock_lock_from_fixture(
|
||||
@@ -33,24 +26,32 @@ async def test_doorsense(hass):
|
||||
lock_details = [lock_one]
|
||||
await _create_august_with_devices(hass, lock_details)
|
||||
|
||||
binary_sensor_abc_name = hass.states.get("binary_sensor.abc_name_open")
|
||||
assert binary_sensor_abc_name.state == STATE_ON
|
||||
binary_sensor_online_with_doorsense_name = hass.states.get(
|
||||
"binary_sensor.online_with_doorsense_name_open"
|
||||
)
|
||||
assert binary_sensor_online_with_doorsense_name.state == STATE_ON
|
||||
|
||||
data = {}
|
||||
data[ATTR_ENTITY_ID] = "lock.abc_name"
|
||||
data[ATTR_ENTITY_ID] = "lock.online_with_doorsense_name"
|
||||
assert await hass.services.async_call(
|
||||
LOCK_DOMAIN, SERVICE_UNLOCK, data, blocking=True
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
binary_sensor_abc_name = hass.states.get("binary_sensor.abc_name_open")
|
||||
assert binary_sensor_abc_name.state == STATE_ON
|
||||
binary_sensor_online_with_doorsense_name = hass.states.get(
|
||||
"binary_sensor.online_with_doorsense_name_open"
|
||||
)
|
||||
assert binary_sensor_online_with_doorsense_name.state == STATE_ON
|
||||
|
||||
assert await hass.services.async_call(
|
||||
LOCK_DOMAIN, SERVICE_LOCK, data, blocking=True
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
binary_sensor_abc_name = hass.states.get("binary_sensor.abc_name_open")
|
||||
assert binary_sensor_abc_name.state == STATE_OFF
|
||||
binary_sensor_online_with_doorsense_name = hass.states.get(
|
||||
"binary_sensor.online_with_doorsense_name_open"
|
||||
)
|
||||
assert binary_sensor_online_with_doorsense_name.state == STATE_OFF
|
||||
|
||||
|
||||
async def test_create_doorbell(hass):
|
||||
|
||||
@@ -28,8 +28,8 @@ async def test_lock_device_registry(hass):
|
||||
reg_device = device_registry.async_get_device(
|
||||
identifiers={("august", "online_with_doorsense")}, connections=set()
|
||||
)
|
||||
assert "AUG-MD01" == reg_device.model
|
||||
assert "undefined-4.3.0-1.8.14" == reg_device.sw_version
|
||||
assert reg_device.model == "AUG-MD01"
|
||||
assert reg_device.sw_version == "undefined-4.3.0-1.8.14"
|
||||
|
||||
|
||||
async def test_one_lock_operation(hass):
|
||||
|
||||
Reference in new issue
Block a user