Add inactivity setting for the motion module (#453)

* Add inactivity setting for the motion module

* Fix set_cold_time payload

Co-authored-by: Matt Whitlock <whitslack@users.noreply.github.com>

* Add mention about "smart control"

---------

Co-authored-by: Matt Whitlock <whitslack@users.noreply.github.com>
This commit is contained in:
Teemu R 2023-05-17 20:08:05 +02:00 committed by GitHub
parent ce5821a35f
commit 18ce40b6bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -59,3 +59,16 @@ class Motion(Module):
) )
return await self.call("set_trigger_sens", payload) return await self.call("set_trigger_sens", payload)
@property
def inactivity_timeout(self) -> int:
"""Return inactivity timeout in milliseconds."""
return self.data["cold_time"]
async def set_inactivity_timeout(self, timeout: int):
"""Set inactivity timeout in milliseconds.
Note, that you need to delete the default "Smart Control" rule in the app
to avoid reverting this back to 60 seconds after a period of time.
"""
return await self.call("set_cold_time", {"cold_time": timeout})