Skip to content

Commit ceeef20

Browse files
authored
Merge pull request #32 from rlippmann:master
pyadtpulse 1.1.1
2 parents 0714410 + 0263637 commit ceeef20

File tree

12 files changed

+225
-161
lines changed

12 files changed

+225
-161
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ repos:
55
- id: trailing-whitespace
66
- id: end-of-file-fixer
77
- repo: https://github.com/psf/black
8-
rev: 23.3.0
8+
rev: 23.9.1
99
hooks:
1010
- id: black
1111
args: [--config=pyproject.toml]
1212
- repo: https://github.com/hadialqattan/pycln
13-
rev: v2.1.3
13+
rev: v2.2.2
1414
hooks:
1515
- id: pycln
1616
args: [--config=pyproject.toml]
@@ -21,10 +21,10 @@ repos:
2121
files: "\\.(py)$"
2222
args: [--settings-path=pyproject.toml]
2323
- repo: https://github.com/dosisod/refurb
24-
rev: v1.15.0
24+
rev: v1.21.0
2525
hooks:
2626
- id: refurb
2727
- repo: https://github.com/asottile/pyupgrade
28-
rev: v3.3.1
28+
rev: v3.13.0
2929
hooks:
3030
- id: pyupgrade

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## 1.1.1 (2023-10-02)
2+
3+
* pylint fixes
4+
* set min relogin interval
5+
* set max keepalive interval
6+
* remove poll_interval from pyADTPulse constructor
7+
* expose public methods in ADTPulseConnection object
8+
19
## 1.1 (2023-09-20)
210

311
* bug fixes

example-client.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ def load_parameters_from_json(json_file: str) -> Optional[Dict]:
200200
or None if there was an error.
201201
"""
202202
try:
203-
with open(json_file) as file:
203+
with open(json_file, encoding="utf-8") as file:
204204
parameters = json.load(file)
205205
invalid_keys = []
206206
for key, value in parameters.items():
@@ -253,7 +253,7 @@ def print_site(site: ADTPulseSite) -> None:
253253
pprint(site.gateway, compact=True)
254254

255255

256-
def check_updates(site: ADTPulseSite, adt: PyADTPulse, test_alarm: bool) -> bool:
256+
def check_updates(site: ADTPulseSite, adt: PyADTPulse, run_alarm_test: bool) -> bool:
257257
"""Check a site for updates and print details.
258258
259259
We don't really need to do this anymore, as the data will be
@@ -266,7 +266,7 @@ def check_updates(site: ADTPulseSite, adt: PyADTPulse, test_alarm: bool) -> bool
266266
267267
Returns: bool: True if update successful
268268
"""
269-
if test_alarm:
269+
if run_alarm_test:
270270
while (
271271
site.alarm_control_panel.is_arming or site.alarm_control_panel.is_disarming
272272
):
@@ -283,7 +283,7 @@ def check_updates(site: ADTPulseSite, adt: PyADTPulse, test_alarm: bool) -> bool
283283
return False
284284

285285

286-
def test_alarm(site: ADTPulseSite, adt: PyADTPulse, sleep_interval: int) -> None:
286+
def test_alarm(site: ADTPulseSite, adt: PyADTPulse) -> None:
287287
"""Test alarm functions.
288288
289289
Args:
@@ -363,7 +363,6 @@ def sync_example(
363363
run_alarm_test (bool): True if alarm test to be run
364364
sleep_interval (int): how long in seconds to sleep between update checks
365365
debug_locks: bool: True to enable thread lock debugging
366-
poll_interval (float): polling interval in seconds
367366
keepalive_interval (int): keepalive interval in minutes
368367
relogin_interval (int): relogin interval in minutes
369368
"""
@@ -373,7 +372,6 @@ def sync_example(
373372
password,
374373
fingerprint,
375374
debug_locks=debug_locks,
376-
poll_interval=poll_interval,
377375
keepalive_interval=keepalive_interval,
378376
relogin_interval=relogin_interval,
379377
)
@@ -401,11 +399,11 @@ def sync_example(
401399
adt.site.site_lock.release()
402400
adt.logout()
403401
return
404-
402+
adt.site.gateway.poll_interval = poll_interval
405403
pprint(adt.site.zones, compact=True)
406404
adt.site.site_lock.release()
407405
if run_alarm_test:
408-
test_alarm(adt.site, adt, sleep_interval)
406+
test_alarm(adt.site, adt)
409407

410408
done = False
411409
while not done:
@@ -526,7 +524,6 @@ async def async_example(
526524
fingerprint,
527525
do_login=False,
528526
debug_locks=debug_locks,
529-
poll_interval=poll_interval,
530527
keepalive_interval=keepalive_interval,
531528
relogin_interval=relogin_interval,
532529
)
@@ -549,7 +546,7 @@ async def async_example(
549546
print("Error: no zones exist")
550547
await adt.async_logout()
551548
return
552-
549+
adt.site.gateway.poll_interval = poll_interval
553550
pprint(adt.site.zones, compact=True)
554551
if run_alarm_test:
555552
await async_test_alarm(adt)

0 commit comments

Comments
 (0)