Skip to content

Commit

Permalink
add env variable for better working with docker
Browse files Browse the repository at this point in the history
  • Loading branch information
BenniWi committed May 27, 2024
1 parent 7df2759 commit 44e8001
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@

# airodor-wifi

This repository provides two [poetry](https://python-poetry.org/) packages
1. airodor_wifi_api: this package provides a simple python api to communicate with the limodor/limot airodor wifi module
2. airodor_web_app: this packages provides a simple flas web app as frontend to the airodor_wifi_api. :warning: This module holds a poetry tool dependency to the airodor_wifi_api. This is currently a workaround to have both packages in one repository and will be resolved in the future.

## use the docker container

you can easily use the docker container provided at dockerhub [benniwi/airodor-wifi](https://hub.docker.com/r/benniwi/airodor-wifi)

Start the container with the environment variable **VENTILATION_ADDRESS** to connect it to your airodor wifi module


## install poetry

```bash
Expand Down
10 changes: 9 additions & 1 deletion airodor_web_app/airodor_web_app/app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import ipaddress
import os
import threading
import time
from datetime import datetime, timedelta
Expand All @@ -8,8 +9,15 @@
from airodor_wifi_api import airodor
from flask import Flask, redirect, render_template, request, url_for

env_variable_venilation_address = "VENTILATION_ADDRESS"
default_IP = ipaddress.ip_address("192.168.2.122")
current_ip = default_IP

# check if ipadress is given as environment variable
if env_variable_venilation_address in os.environ:
current_ip = ipaddress.ip_address(os.environ[env_variable_venilation_address])
else:
current_ip = default_IP

lock_timer_dict = threading.Lock()
timer_dict = {"A": airodor.VentilationTimerList(), "B": airodor.VentilationTimerList()}
timezone = pytz.timezone('Europe/Berlin')
Expand Down

0 comments on commit 44e8001

Please sign in to comment.