This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from . import HA_req | |
| # Globale Variablen | |
| acttime = 0 | |
| movement_list = [] | |
| move_act = "off" | |
| def get_timetable(): | |
| """Hier soll der HTTP-Request zur Stundenplan-API gemacht werden.""" | |
| try: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| HOME_ASSISTANT_URL = "http://homeassistant.local:8123" | |
| HEADERS = { | |
| "Authorization": f"Bearer {TOKEN}", | |
| "Content-Type": "application/json" | |
| } | |
| def change_temperature(entity_id, value=17): | |
| """Ändert die Temperatur eines Home Assistant Entities.""" | |
| url = f"{HOME_ASSISTANT_URL}/api/services/input_number/set_value" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def get_current_time(): | |
| """Gibt die aktuelle Uhrzeit zurück.""" | |
| now = t.localtime() | |
| return time(now.tm_hour, now.tm_min) | |
| def get_current_lesson(): | |
| """Gibt die aktuelle Unterrichtsstunde zurück.""" | |
| current = get_current_time() | |
| for stunde in LESSON_HOURS: | |
| if stunde["start"] <= current < stunde["ende"]: |