Add auto_reset_time_remaining attribute (#558)

* Add auto_reset_time_remaining attribute

* fix attr

* Add test
This commit is contained in:
Bas Nijholt 2023-04-08 03:39:08 -07:00 • committed by GitHub
commit fe7bdd3940
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 0 deletions

View file

@ -692,9 +692,15 @@ async def test_auto_reset_manual_control(hass):
await turn_light(True, brightness=1)
await turn_light(True, brightness=10)
assert manual_control[light.entity_id]
assert (
switch.extra_state_attributes["autoreset_time_remaining"][light.entity_id] > 0
)
await asyncio.sleep(0.3) # Should be enough time for auto reset
await update()
assert not manual_control[light.entity_id], (light, manual_control)
assert (
light.entity_id not in switch.extra_state_attributes["autoreset_time_remaining"]
)
# Do a couple of quick changes and check that light is not reset
for i in range(3):