mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Increase time before scene and script HomeKit entities are reset (#54105)
This commit is contained in:
parent
46ad55455b
commit
adc9f75493
@ -57,6 +57,8 @@ VALVE_TYPE = {
|
|||||||
|
|
||||||
ACTIVATE_ONLY_SWITCH_DOMAINS = {"scene", "script"}
|
ACTIVATE_ONLY_SWITCH_DOMAINS = {"scene", "script"}
|
||||||
|
|
||||||
|
ACTIVATE_ONLY_RESET_SECONDS = 10
|
||||||
|
|
||||||
|
|
||||||
@TYPES.register("Outlet")
|
@TYPES.register("Outlet")
|
||||||
class Outlet(HomeAccessory):
|
class Outlet(HomeAccessory):
|
||||||
@ -141,7 +143,7 @@ class Switch(HomeAccessory):
|
|||||||
self.async_call_service(self._domain, service, params)
|
self.async_call_service(self._domain, service, params)
|
||||||
|
|
||||||
if self.activate_only:
|
if self.activate_only:
|
||||||
async_call_later(self.hass, 1, self.reset_switch)
|
async_call_later(self.hass, ACTIVATE_ONLY_RESET_SECONDS, self.reset_switch)
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def async_update_state(self, new_state):
|
def async_update_state(self, new_state):
|
||||||
|
@ -329,7 +329,13 @@ async def test_reset_switch(hass, hk_driver, events):
|
|||||||
future = dt_util.utcnow() + timedelta(seconds=1)
|
future = dt_util.utcnow() + timedelta(seconds=1)
|
||||||
async_fire_time_changed(hass, future)
|
async_fire_time_changed(hass, future)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
assert acc.char_on.value is True
|
||||||
|
|
||||||
|
future = dt_util.utcnow() + timedelta(seconds=10)
|
||||||
|
async_fire_time_changed(hass, future)
|
||||||
|
await hass.async_block_till_done()
|
||||||
assert acc.char_on.value is False
|
assert acc.char_on.value is False
|
||||||
|
|
||||||
assert len(events) == 1
|
assert len(events) == 1
|
||||||
assert not call_turn_off
|
assert not call_turn_off
|
||||||
|
|
||||||
@ -367,7 +373,13 @@ async def test_script_switch(hass, hk_driver, events):
|
|||||||
future = dt_util.utcnow() + timedelta(seconds=1)
|
future = dt_util.utcnow() + timedelta(seconds=1)
|
||||||
async_fire_time_changed(hass, future)
|
async_fire_time_changed(hass, future)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
assert acc.char_on.value is True
|
||||||
|
|
||||||
|
future = dt_util.utcnow() + timedelta(seconds=10)
|
||||||
|
async_fire_time_changed(hass, future)
|
||||||
|
await hass.async_block_till_done()
|
||||||
assert acc.char_on.value is False
|
assert acc.char_on.value is False
|
||||||
|
|
||||||
assert len(events) == 1
|
assert len(events) == 1
|
||||||
assert not call_turn_off
|
assert not call_turn_off
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user