Skip to content

Commit bcbcef0

Browse files
authored
v0.2.3
1 parent 2b9b783 commit bcbcef0

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

CHANGES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
v0.2.3, 2022-04-06 Fixed CLI asyncio error for Windows systems.
12
v0.2.2, 2022-04-05 [BREAKING] Moved action functions from controller to individual devices.
23
Added support for lights.
34
Fixed OTP login workflow in CLI.

pyalarmdotcomajax/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
from .errors import UnexpectedDataStructure
3939
from .errors import UnsupportedDevice
4040

41-
__version__ = "0.2.2"
41+
__version__ = "0.2.3"
4242

4343

4444
log = logging.getLogger(__name__)

pyalarmdotcomajax/cli.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@
44
Based on https://github.com/uvjustin/pyalarmdotcomajax/pull/16 by Kevin David (@kevin-david)
55
"""
66
from __future__ import annotations
7+
import platform
78

89
import argparse
910
import asyncio
1011
import logging
1112
import sys
1213

1314
import aiohttp
15+
from attr import has
1416
import pyalarmdotcomajax
1517
from pyalarmdotcomajax.errors import AuthenticationFailed
1618
from pyalarmdotcomajax.errors import DataFetchFailed
@@ -322,4 +324,11 @@ def _print_element_tearsheet(
322324

323325
def main() -> None:
324326
"""Run primary CLI function via asyncio. Main entrypoint for command line tool."""
327+
328+
# Below is necessary to prevent asyncio "Event loop is closed" error in Windows.
329+
if platform.system() == "Windows" and hasattr(
330+
asyncio, "WindowsSelectorEventLoopPolicy"
331+
):
332+
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) # type: ignore
333+
325334
asyncio.run(cli())

0 commit comments

Comments
 (0)