Skip to content

Commit

Permalink
Merge pull request #8 from EtxeanNet/timeout-bump
Browse files Browse the repository at this point in the history
Timeout bump
  • Loading branch information
ArdKuijpers authored Oct 10, 2024
2 parents fdfb933 + e66f67d commit 758e836
Show file tree
Hide file tree
Showing 6 changed files with 758 additions and 752 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.11-slim as build
FROM python:3.11-slim AS build
WORKDIR /app
ENV POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=1 \
Expand All @@ -14,11 +14,11 @@ RUN if [ $(dpkg --print-architecture) = "armhf" ]; then \
RUN pip install poetry
RUN --mount=type=cache,target=$POETRY_CACHE_DIR poetry install --without dev --no-root

FROM python:3.11-slim as final
FROM python:3.11-slim AS final
WORKDIR /app
ENV VIRTUAL_ENV=/app/.venv \
PATH="/app/.venv/bin:$PATH" \
PYTHONDONTWRITEBYTECODE=1
PYTHONDONTWRITEBYTECODE=1

RUN apt update && apt install -y bluez

Expand Down
2 changes: 1 addition & 1 deletion atagmqtt/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""atagmqtt module."""
__version__ = "0.3.1"
__version__ = "0.5.1"
NAME = "atagmqtt"
7 changes: 6 additions & 1 deletion atagmqtt/__main__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Interaction with ATAG ONE."""
import asyncio
import logging
import time
import aiohttp

from pyatag import AtagException, AtagOne
Expand Down Expand Up @@ -65,4 +66,8 @@ def handle_exception(loop, context):
logger.info("AtagOne2mqtt bridge has stopped")

if __name__ == "__main__":
asyncio.run(main(_settings))
try:
asyncio.run(main(_settings))
except:
logger.error(f'Unrecoverable error caught. Waiting {_settings.restart_timeout} s')
time.sleep(_settings.restart_timeout)
1 change: 1 addition & 0 deletions atagmqtt/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class Settings(BaseSettings):
loglevel: str = Field('INFO', env='LOGLEVEL')

atag_setup_timeout: int = Field(30, env='ATAG_SETUP_TIMEOUT')
restart_timeout: int = Field(60, env='RESTART_TIMEOUT')

atag_update_interval: int = Field(30, env='ATAG_UPDATE_INTERVAL')
atag_host: Optional[str] = Field(None, env='ATAG_HOST')
Expand Down
Loading

0 comments on commit 758e836

Please sign in to comment.