- Neues stündliches Python-Script (restricted/gartenbewaesserung/auto_watering.py): holt Niederschlags- und Sonnenuntergangsdaten von Open-Meteo, wertet je Zone (Hochbeete/Tröge/Garten vorn) individuelle Regen-Schwellenwerte und Mindest-Bewässerungsdauern aus und startet bei Bedarf per MQTT den passenden Automatik-Modus der Ventilsteuerung im Zeitraum vor Sonnenuntergang; veröffentlicht den Regen-Status zusätzlich stündlich als retained MQTT-Nachricht je Zone. - Web-UI: neue Bewässerungs-Steuerung/-Anzeige (ajax/watering.php, js/solar/solarMQTT.js, assets/img/realtime.svg) inkl. Live-Status-Icons (aus/geplant/pausiert/aktiv per Farbe und Symbol). - AutoAction-Regeleditor (ajax/actorDetails.php, sensorDetails.php, fillActorDD.php, fillSensorDD.php, tahoma.php, AutoAction.php) liest Actor-/Sensor-Parameter jetzt live aus der homeMesh-Datenbank statt aus stark vereinfachten Altfeldern, inkl. zugehöriger Anpassungen am Device-Discovery-Tooling (restricted/deviceDiscovery/*, neues logic_module.py). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
75 lines
2.0 KiB
Python
75 lines
2.0 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
WLED Module
|
|
Enthält NUR Logik-spezifische Geräte-Discovery Logik
|
|
KEINE Datenbank-Operationen!
|
|
"""
|
|
|
|
import requests
|
|
import socket
|
|
import concurrent.futures
|
|
import logging
|
|
from typing import List, Dict, Optional, Tuple
|
|
from modules.base_module import BaseModule
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
class LogicModule(BaseModule):
|
|
"""
|
|
Logic Modul - Implementiert BaseModule Interface
|
|
Gibt nur Actors zurück, KEINE DB-Operationen
|
|
"""
|
|
|
|
def is_enabled(self) -> bool:
|
|
"""Prüft ob Logic aktiviert ist"""
|
|
return self.config.logic_enable
|
|
|
|
def discover(self) -> Tuple[List[Dict], List[Dict]]:
|
|
"""
|
|
Erzeugt Einträge für Sensorunabhängige Funktionen (Timer, Sonnenauf/untergang, Uhrzeiten, etc.)
|
|
|
|
Returns:
|
|
Tuple (actors, sensors) - WLED sind immer Actors
|
|
"""
|
|
logger.info("\n" + "=" * 60)
|
|
logger.info("LOGIC-GERÄTE WERDEN ERZEUGT")
|
|
logger.info("=" * 60)
|
|
|
|
actors = []
|
|
sensors = []
|
|
|
|
states = []
|
|
states.append({
|
|
'name': 'Uhrzeit',
|
|
'url': 'time',
|
|
'type': 'time',
|
|
'current_value': '13:45'
|
|
})
|
|
states.append({
|
|
'name': 'Datum',
|
|
'url': 'date',
|
|
'type': 'date',
|
|
'current_value': '20.03.2026'
|
|
})
|
|
states.append({
|
|
'name': 'Sonnenaufgang',
|
|
'url': 'sunrise',
|
|
'type': 'deltatime',
|
|
'current_value': '00:00'
|
|
})
|
|
states.append({
|
|
'name': 'Sonnenuntergang',
|
|
'url': 'sunset',
|
|
'type': 'deltatime',
|
|
'current_value': '00:00'
|
|
})
|
|
|
|
sensors.append({'type': 'LOGIC',
|
|
'name': "Zeitpunkt",
|
|
'url': f"Logic",
|
|
'commands': [],
|
|
'states': states})
|
|
|
|
return actors, sensors
|