Skip to content

Commit

Permalink
Add support for the 2022 entity model in HA (#14)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
tichris0 authored May 11, 2024
1 parent 9c9c79f commit 867d7be
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#-------------------------------------------------------------------------------------------------------------

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

# [Optional] If your requirements rarely change, uncomment this section to add them to the image.
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"dockerfile": "Dockerfile",
"context": "..",
"args": {
"VARIANT": "3.8"
"VARIANT": "3.12"
}
},
"settings": {
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pulls.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on: pull_request
jobs:
pytest:
runs-on: ubuntu-latest
container: python:3.8
container: python:3.12
steps:
- name: Checkout repo
uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pypi-upload.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
jobs:
build-and-publish:
runs-on: ubuntu-20.04
container: python:3.8
container: python:3.12
steps:
- uses: actions/checkout@v2
with:
Expand Down
13 changes: 13 additions & 0 deletions adext/adext.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
Extends the AlarmDecoder class to include helper methods for HomeAssistant
"""

import asyncio

from alarmdecoder.decoder import AlarmDecoder
from alarmdecoder.panels import DSC, ADEMCO as HONEYWELL

Expand All @@ -15,6 +17,17 @@ class AdExt(AlarmDecoder):
Extended AlarmDecoder class
"""

def __init__(self, device, ignore_message_states=False, ignore_lrr_states=True):
super().__init__(device, ignore_message_states, ignore_lrr_states)
self._event = asyncio.Event()

def _handle_version(self, data):
super()._handle_version(data)
self._event.set()

async def is_init(self):
return (await self._event.wait())

def _get_arm_sequence(
self, arm_mode, code, code_arm_required, auto_bypass, alt_night_mode=False,
):
Expand Down

0 comments on commit 867d7be

Please sign in to comment.