Skip to content

Commit

Permalink
Await for Peripheral.trigger_port_update()
Browse files Browse the repository at this point in the history
  • Loading branch information
ccrisan committed May 2, 2020
1 parent dc22c86 commit 72e6b79
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions qtoggleserver/paradox/paradoxalarm.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class ParadoxAlarm(Peripheral):
def __init__(
self,
*,
name: Optional[str] = None,
areas: List[int] = None,
zones: List[int] = None,
outputs: List[int] = None,
Expand All @@ -31,6 +30,7 @@ def __init__(
ip_host: Optional[str] = None,
ip_port: int = constants.DEFAULT_IP_PORT,
ip_password: str = constants.DEFAULT_IP_PASSWORD,
**kwargs
) -> None:

self.setup_config()
Expand All @@ -54,7 +54,7 @@ def __init__(

self._properties = {}

super().__init__(name)
super().__init__(**kwargs)

@staticmethod
def setup_config() -> None:
Expand Down Expand Up @@ -113,7 +113,7 @@ async def connect(self) -> None:
raise exceptions.ParadoxConnectError()

self.debug('connected to panel')
asyncio.create_task(self.handle_connected())
await self.handle_connected()

def make_port_args(self) -> List[Dict[str, Any]]:
from .area import AreaAlarmPort, AreaArmedPort
Expand All @@ -138,7 +138,7 @@ async def handle_connected(self) -> None:
self._panel_task = asyncio.create_task(self._paradox.loop())

self.parse_labels()
self.trigger_port_update()
await self.trigger_port_update()

async def disconnect(self) -> None:
if self._panel_task is None:
Expand All @@ -154,7 +154,7 @@ async def disconnect(self) -> None:

self._paradox = None

self.trigger_port_update()
await self.trigger_port_update()

try:
await asyncio.wait_for(self._panel_task, timeout=10)
Expand Down

0 comments on commit 72e6b79

Please sign in to comment.