Skip to content

Commit e2c626c

Browse files
committed
more reverts
1 parent 19684b2 commit e2c626c

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

appdaemon/plugins/hass/hassapi.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,8 @@ def get_tracker_state(self, *args, **kwargs) -> str:
260260
"""
261261
return self.get_state(*args, **kwargs)
262262

263-
def anyone_home(self, person: bool = True, namespace: str | None = None) -> bool:
263+
@utils.sync_decorator
264+
async def anyone_home(self, person: bool = True, namespace: str | None = None) -> bool:
264265
"""Determines if the house/apartment is occupied.
265266
266267
A convenience function to determine if one or more person is home. Use
@@ -285,10 +286,11 @@ def anyone_home(self, person: bool = True, namespace: str | None = None) -> bool
285286
>>> do something
286287
287288
"""
288-
details = self.get_tracker_details(person, namespace, copy=False)
289+
details = await self.get_tracker_details(person, namespace, copy=False)
289290
return any(state['state'] == 'home' for state in details.values())
290291

291-
def everyone_home(self, person: bool = True, namespace: str | None = None) -> bool:
292+
@utils.sync_decorator
293+
async def everyone_home(self, person: bool = True, namespace: str | None = None) -> bool:
292294
"""Determine if all family's members at home.
293295
294296
A convenience function to determine if everyone is home. Use this in
@@ -312,10 +314,11 @@ def everyone_home(self, person: bool = True, namespace: str | None = None) -> bo
312314
>>> do something
313315
314316
"""
315-
details = self.get_tracker_details(person, namespace, copy=False)
317+
details = await self.get_tracker_details(person, namespace, copy=False)
316318
return all(state['state'] == 'home' for state in details.values())
317319

318-
def noone_home(self, person: bool = True, namespace: str | None = None) -> bool:
320+
@utils.sync_decorator
321+
async def noone_home(self, person: bool = True, namespace: str | None = None) -> bool:
319322
"""Determines if the house/apartment is empty.
320323
321324
A convenience function to determine if no people are at home. Use this
@@ -340,7 +343,7 @@ def noone_home(self, person: bool = True, namespace: str | None = None) -> bool:
340343
>>> do something
341344
342345
"""
343-
return not self.anyone_home(person, namespace)
346+
return not await self.anyone_home(person, namespace)
344347

345348
#
346349
# Built-in constraints

0 commit comments

Comments
 (0)