Skip to content

Commit 8ccdf42

Browse files
authored
Merge pull request #33 from rlippmann/1.1.2
1.1.2
2 parents ceeef20 + e3fa1d5 commit 8ccdf42

File tree

8 files changed

+51
-19
lines changed

8 files changed

+51
-19
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
## 1.1.2 (2023-10-06)
2+
3+
* change default poll interval to 2 seconds
4+
* update pyproject.toml
5+
* change source location to github/rlippmann from github/rsnodgrass
6+
* fix gateway attributes not updating
7+
* remove dependency on python_dateutils
8+
* add timestamp to example-client logging
9+
110
## 1.1.1 (2023-10-02)
211

312
* pylint fixes

example-client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def setup_logger(level: int):
6060
handler = logging.StreamHandler(sys.stdout)
6161
handler.setLevel(level)
6262

63-
formatter = logging.Formatter("%(name)s - %(levelname)s - %(message)s")
63+
formatter = logging.Formatter("%(asctime)s %(name)s - %(levelname)s - %(message)s")
6464
handler.setFormatter(formatter)
6565
logger.addHandler(handler)
6666

pyadtpulse/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ async def _keepalive_task(self) -> None:
414414
response = await self._pulse_connection.async_query(
415415
ADT_TIMEOUT_URI, "POST"
416416
)
417-
if handle_response(
417+
if not handle_response(
418418
response, logging.INFO, "Failed resetting ADT Pulse cloud timeout"
419419
):
420420
retry_after = self._check_retry_after(response, "Keepalive task")

pyadtpulse/const.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""Constants for pyadtpulse."""
2-
__version__ = "1.1.1"
2+
__version__ = "1.1.2"
33
DEFAULT_API_HOST = "https://portal.adtpulse.com"
44
API_HOST_CA = "https://portal-ca.adtpulse.com" # Canada
55

@@ -25,7 +25,7 @@
2525

2626
# ADT sets their keepalive to 1 second, so poll a little more often
2727
# than that
28-
ADT_DEFAULT_POLL_INTERVAL = 0.75
28+
ADT_DEFAULT_POLL_INTERVAL = 2.0
2929
ADT_GATEWAY_OFFLINE_POLL_INTERVAL = 90.0
3030
ADT_DEFAULT_HTTP_HEADERS = {
3131
"User-Agent": (

pyadtpulse/util.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
from aiohttp import ClientResponse
1313
from bs4 import BeautifulSoup
14-
from dateutil import relativedelta
1514

1615
LOG = logging.getLogger(__name__)
1716

@@ -234,14 +233,13 @@ def parse_pulse_datetime(datestring: str) -> datetime:
234233
t = datetime.today()
235234
if split_string[0].lstrip() == "Today":
236235
last_update = t
236+
elif split_string[0].lstrip() == "Yesterday":
237+
last_update = t - timedelta(days=1)
237238
else:
238-
if split_string[0].lstrip() == "Yesterday":
239-
last_update = t - timedelta(days=1)
240-
else:
241-
tempdate = ("/".join((split_string[0], str(t.year)))).lstrip()
242-
last_update = datetime.strptime(tempdate, "%m/%d/%Y")
243-
if last_update > t:
244-
last_update = last_update - relativedelta.relativedelta(years=1)
239+
tempdate = f"{split_string[0]}/{t.year}"
240+
last_update = datetime.strptime(tempdate, "%m/%d/%Y")
241+
if last_update > t:
242+
last_update = last_update.replace(year=t.year)
245243
update_time = datetime.time(
246244
datetime.strptime(split_string[1] + split_string[2], "%I:%M%p")
247245
)

pyproject.toml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,31 @@
1+
[build-system]
2+
requires = ["setuptools>=61.0"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "pyadtpulse"
7+
dynamic = ["version"]
8+
description="Python interface for ADT Pulse security systems"
9+
readme = "README.md"
10+
authors = [{name = "Ryan Snodgrass"}]
11+
maintainers = [{name = "Robert Lippmann"}]
12+
license = {file = "LICENSE.md"}
13+
dependencies = ["aiohttp>=3.8.1", "uvloop>=0.17.0", "beautifulsoup4>=4.11.1"]
14+
keywords = ["security system", "adt", "home automation", "security alarm"]
15+
classifiers = [
16+
"Programming Language :: Python :: 3",
17+
"License :: OSI Approved :: Apache Software License",
18+
"Operating System :: OS Independent",
19+
]
20+
21+
[project.urls]
22+
"Changelog" = "https://github.com/rlippmann/pyadtpulse/blob/master/CHANGELOG.md"
23+
"Source" = "https://github.com/rlippmann/pyadtpulse"
24+
"Issues" = "https://github.com/rlippmann/pyadtpulse/issues"
25+
26+
[tool.setuptools.dynamic]
27+
version = {attr = "pyadtpulse.const.__version__"}
28+
129
[tool.isort]
230
profile = "black"
331
force_to_top = [ "logging" ]

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
beautifulsoup4>=4.11.1
22
aiohttp>=3.8.1
3-
python_dateutil>=2.8.2
43
uvloop>=0.17.0

setup.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
#!/usr/bin/env python
22

3-
import os
43
import sys
4+
from os import path, system
55
from pathlib import Path
66

77
import setuptools
88

99
from pyadtpulse.const import __version__
1010

1111
if sys.argv[-1] == "publish":
12-
os.system("python setup.py sdist upload")
12+
system("python setup.py sdist upload")
1313
sys.exit()
1414

15-
# read the contents of your README file
16-
from os import path
1715

1816
this_directory = path.abspath(path.dirname(__file__))
1917
long_description = Path(
@@ -27,11 +25,11 @@
2725
description="Python interface for ADT Pulse security systems",
2826
long_description=long_description,
2927
long_description_content_type="text/markdown",
30-
url="https://github.com/rsnodgrass/pyadtpulse",
28+
url="https://github.com/rlippmann/pyadtpulse",
3129
author="",
3230
author_email="",
3331
license="Apache Software License",
34-
install_requires=["aiohttp>=3.8.1", "uvloop>=0.17.0"],
32+
install_requires=["aiohttp>=3.8.1", "uvloop>=0.17.0", "beautifulsoup4>=4.11.1"],
3533
keywords=["security system", "adt", "home automation", "security alarm"],
3634
zip_safe=True,
3735
classifiers=[

0 commit comments

Comments
 (0)