Skip to content

Commit 867d7be

Browse files
authored
Add support for the 2022 entity model in HA (#14)
* Add an async function to know when the library is done with its initialization. The new HA needs this information at creation time to properly represent an enrity. PS: Requires Python >= 3.12 * Update the python versions to 3.12 in the various resource tiles. * Delete .vs directory
1 parent 9c9c79f commit 867d7be

File tree

5 files changed

+17
-4
lines changed

5 files changed

+17
-4
lines changed

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#-------------------------------------------------------------------------------------------------------------
55

66
# Update the VARIANT arg in devcontainer.json to pick a Python version: 3, 3.8, 3.7, 3.6
7-
ARG VARIANT=3
7+
ARG VARIANT=3.12
88
FROM mcr.microsoft.com/vscode/devcontainers/python:${VARIANT}
99

1010
# [Optional] If your requirements rarely change, uncomment this section to add them to the image.

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"dockerfile": "Dockerfile",
55
"context": "..",
66
"args": {
7-
"VARIANT": "3.8"
7+
"VARIANT": "3.12"
88
}
99
},
1010
"settings": {

.github/workflows/pulls.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on: pull_request
55
jobs:
66
pytest:
77
runs-on: ubuntu-latest
8-
container: python:3.8
8+
container: python:3.12
99
steps:
1010
- name: Checkout repo
1111
uses: actions/checkout@v2

.github/workflows/pypi-upload.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
jobs:
88
build-and-publish:
99
runs-on: ubuntu-20.04
10-
container: python:3.8
10+
container: python:3.12
1111
steps:
1212
- uses: actions/checkout@v2
1313
with:

adext/adext.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
Extends the AlarmDecoder class to include helper methods for HomeAssistant
33
"""
44

5+
import asyncio
6+
57
from alarmdecoder.decoder import AlarmDecoder
68
from alarmdecoder.panels import DSC, ADEMCO as HONEYWELL
79

@@ -15,6 +17,17 @@ class AdExt(AlarmDecoder):
1517
Extended AlarmDecoder class
1618
"""
1719

20+
def __init__(self, device, ignore_message_states=False, ignore_lrr_states=True):
21+
super().__init__(device, ignore_message_states, ignore_lrr_states)
22+
self._event = asyncio.Event()
23+
24+
def _handle_version(self, data):
25+
super()._handle_version(data)
26+
self._event.set()
27+
28+
async def is_init(self):
29+
return (await self._event.wait())
30+
1831
def _get_arm_sequence(
1932
self, arm_mode, code, code_arm_required, auto_bypass, alt_night_mode=False,
2033
):

0 commit comments

Comments
 (0)