DE & EN – Deutsch zuerst, English version below.
- Überblick
- Hauptvorteile gegenüber pnbruckner
- Funktionsprinzip
- Installation
- Einrichtung & Optionen
- Entität & Attribute
- Dienste
- Best Practices & Tuning
- Beispiele (Automationen, UI-kompatibel)
- Kompatibilität & Versionierung
- Troubleshooting & FAQ
- Credits & Lizenz
- Overview
- Key advantages over pnbruckner
- How it works
- Installation
- Setup & Options
- Entity & Attributes
- Services
- Best practices & tuning
- Examples (Automations, UI-compatible)
- Compatibility & versioning
- Troubleshooting & FAQ
- Credits & License
Illuminance Plus modelliert die Außenhelligkeit (Lux) mit einer Clear-Sky-Kurve (nach pnbruckner) und dämpft diese mit Wetterfaktoren (Bewölkung, Niederschlag, Sichtweite). Ergebnis: stabile, automationsfreundliche Werte für die Innenraum-Lichtsteuerung – ohne echte Außen-Lichtsensoren.
- Robuste Glättung (EMA) + Hysterese gegen Flattern bei Wolken.
- Dayparts (Tagesabschnitte) aus Sonnenstand, lokalisiert (DE/EN).
- UI-Setup & Re-Konfiguration (Options-Flow).
- Entity-Dienst:
illuminance_plus.refreshfür Sofort-Neuberechnung.
- UI-Optionen jederzeit änderbar (kein Neu-Anlegen nötig).
- Mehr Wetterquellen: Cloud-%, Rain (mm/h), Visibility (km) – inkl. Einheiten-Normalisierung.
- State vs. Steuergröße getrennt:
State =raw_lux(ungeglättet, schön für Charts)
Attributcontrol_lux(geglättet) +is_dark(Hysterese) für Automationen. - Dayparts (DE/EN), genaue Abschnitte über Sonnengeometrie.
- Refresh-Dienst pro Entität.
- Clear-Sky-Lux (pnbruckner) aus Sonnenhöhe.
- Wetter-Dämpfung: Cloud-Deckung, Niederschlag, Sichtweite → Faktoren/Divisoren.
- Rohwert
raw_lux= gedämpfte Clear-Sky-Helligkeit (Entitätszustand). - Glättung (EMA) →
control_lux(Attribut): für Schaltschwellen &is_dark. - Hysterese:
on_threshold/off_thresholdaufcontrol_lux.
- HACS → Integrationen → ⋮ → Custom repositories → Repo-URL eintragen → Integration wählen.
- Integration installieren → HA neu starten.
- Einstellungen → Geräte & Dienste → Integration hinzufügen → „Illuminance Plus“.
- Ordner
custom_components/illuminance_plus/in dein HAconfig/kopieren. - HA neu starten → Integration hinzufügen.
- Weather entity: allgemeiner Wetterzustand (
sunny,cloudy,rainy,fog, …) – optional, dient als Fallback für Dämpfung. - Cloud coverage: 0–100 % (idealerweise vom Wetterdienst) – wird in Divisor umgerechnet.
- Precipitation: mm/h (US-Einheiten werden automatisch in mm/h konvertiert).
- Visibility: km (US-Meilen werden automatisch nach km umgerechnet).
Fehlende Quellen sind optional – die Integration fällt auf sinnvolle Defaults zurück.
- Update (Sekunden): Berechnungsintervall. 120–300 s praxisgerecht.
- Glättung (Sek.): Zeitkonstante der EMA. 180–240 s = ruhig, aber reaktionsfähig.
- Hysterese: On-/Off-Schwellen für
control_lux. Typisch: on 1000–1300, off 3000–3500. - Max. Wolken-Dämpfung (÷): Obergrenze der Cloud-Abdunkelung. Typisch 10–15.
- Zustand (
state):raw_lux(ungeglättet, gerundet). - Attribute (Auszug):
control_lux(geglättet, für Schaltlogik)is_dark(bool, basierend auf Hysterese)on_threshold,off_thresholddaypart,daypart_label(EN/DE)- Diagnose:
clear_sky_lux,cloud_divisor,rain_gain,visibility_gain,low_sun_gain
illuminance_plus.refresh(pro Entität): Sofort neu berechnen (unabhängig vom Updateintervall).
Optional: Ein globalerrefresh_allkann in der Integration ergänzt werden.
Pro Raum eigener „Helligkeits-Charakter“ via Faktor k (nur im Automations-Template).
Vergleich jeweils gegen effektive Schwellen:
- EIN:
control_lux <= on_threshold * k - AUS:
control_lux >= off_threshold * k
Typische Werte:
- dunkle Nische: 1.3–1.6
- normal: 1.0–1.2
- sehr hell: 0.8–0.9
k herleiten (ohne Helfer):
- In dem Moment, wo du „jetzt an“ willst:
k_on = control_lux / on_threshold - In dem Moment, wo du „jetzt aus“ willst:
k_off = control_lux / off_threshold - k ≈ (k_on + k_off) / 2
- Baseline-Raum wählen (z. B. normal hell).
- Bei „jetzt an“:
on_threshold ≈ L_on / k_baseline - Bei „jetzt aus“:
off_threshold ≈ L_off / k_baseline - Global stabil lassen, pro Raum nur k feinjustieren (±0.1).
- Update: 120–300 s
- Glättung: 180–240 s
- Hysterese: on 1000–1300, off 3000–3500
- Cloud ÷: 10–15
Passe nur Entitäts-IDs &
kan. Die Hysterese bleibt global in der Integration definiert.
alias: Licht WC-Ecke (Illuminance Plus)
mode: restart
triggers:
- platform: state
entity_id: binary_sensor.bad_wc_presence_sensor
to: "on"
- platform: state
entity_id: binary_sensor.bad_wc_presence_sensor
to: "off"
- platform: state
entity_id: sensor.illuminance_plus
conditions: []
actions:
- choose:
- conditions:
- condition: state
entity_id: binary_sensor.bad_wc_presence_sensor
state: "on"
- condition: state
entity_id: light.wc_ecke
state: "off"
- condition: template
value_template: >
{% set lux = state_attr('sensor.illuminance_plus','control_lux')|float(0) %}
{% set onb = state_attr('sensor.illuminance_plus','on_threshold')|float(1200) %}
{% set k = 1.4 %}
{{ lux <= onb * k }}
sequence:
- service: light.turn_on
target: { entity_id: light.wc_ecke }
- conditions:
- condition: state
entity_id: binary_sensor.bad_wc_presence_sensor
state: "on"
- condition: state
entity_id: light.wc_ecke
state: "on"
- condition: template
value_template: >
{% set lux = state_attr('sensor.illuminance_plus','control_lux')|float(0) %}
{% set offb = state_attr('sensor.illuminance_plus','off_threshold')|float(3200) %}
{% set k = 1.4 %}
{{ lux >= offb * k }}
sequence:
- service: light.turn_off
target: { entity_id: light.wc_ecke }# identisch, nur k = 1.3 und Entity-IDs für Bad anpassen# identisch, nur k = 1.2 und Entity-IDs für Küche anpassen- Getestet mit Home Assistant ≥ 2024.6.
- Nutzt stabile öffentliche APIs (SensorEntity, entity services, sun.sun).
- Lux-Einheit versionssicher (Fallback auf ältere Konstanten).
- Dienst fehlt? →
services.yamluntercustom_components/illuminance_plus/vorhanden? Insensor.pyentity_platform.async_register_entity_service(...)aufgerufen? HA neu starten. - Quellen fehlen? → Optional; die Integration hat Fallbacks. Bessere Daten = realistischere Lux.
- Flattert bei Wolken? → Glättung erhöhen (z. B. 240 s) und genügend Abstand zwischen on/off lassen.
- Re-Setup? → In der Integrationskachel ⋮ → Optionen.
- Clear-Sky-Modell: pnbruckner (ha-illuminance).
- Entwicklung & Erweiterung: Martin Kluger.
- Lizenz: MIT.
Illuminance Plus models outdoor illuminance (Lux) with a clear-sky curve (by pnbruckner), attenuated by weather inputs (cloud cover, precipitation, visibility). It yields stable, automation-ready values for indoor lighting – without physical outdoor sensors.
- UI options can be adjusted anytime (no delete/re-add).
- More weather inputs: cloud %, rain (mm/h), visibility (km) – with unit normalization.
- State vs control value separated (charts vs switching).
- Dayparts with EN/DE labels.
- Per-entity refresh service.
- Clear-sky lux from solar elevation.
- Weather attenuation via cloud/rain/visibility.
raw_lux(entity state).- EMA smoothing →
control_lux(attribute). - Hysteresis (
on_threshold/off_threshold) oncontrol_lux.
- HACS → Integrations → ⋮ → Custom repositories → add this repo as Integration.
- Install → restart HA.
- Settings → Devices & Services → Add Integration → “Illuminance Plus”.
- Copy
custom_components/illuminance_plus/into your HAconfig/. - Restart HA → add the integration.
- Weather entity (state string): general weather (
sunny,cloudy,rainy,fog, …). - Cloud coverage: 0–100 %.
- Precipitation: mm/h (US units converted to mm/h).
- Visibility: km (miles converted to km).
- Update (seconds): recompute interval (120–300 s recommended).
- Smoothing (seconds): EMA time constant (180–240 s recommended).
- Hysteresis: on/off thresholds for
control_lux(1000–1300 / 3000–3500 typical). - Max cloud attenuation (÷): upper bound for cloud attenuation (10–15 typical).
- State:
raw_lux(unsmoothed). - Attributes:
control_lux,is_dark,on_threshold,off_threshold,daypart,daypart_label, diagnostics (clear_sky_lux,cloud_divisor, etc.).
illuminance_plus.refresh(per entity): trigger instant recalculation.
Optional:refresh_allif you added a global service.
- ON:
control_lux <= on_threshold * k - OFF:
control_lux >= off_threshold * k
Typical k: dark 1.3–1.6, normal 1.0–1.2, very bright 0.8–0.9.
Derive k: measure control_lux at your subjective ON/OFF moments →
k_on = control_lux / on_threshold, k_off = control_lux / off_threshold, k ≈ (k_on + k_off)/2.
Choose a baseline room, measure L_on/L_off, compute:
on_threshold ≈ L_on / k_baseline, off_threshold ≈ L_off / k_baseline.
Then fine-tune per-room k (±0.1).
- Update 120–300 s, Smoothing 180–240 s, Hysteresis on 1000–1300 / off 3000–3500, Cloud ÷ 10–15.
Same as German examples; only change entity IDs and
kper room. (See above.)
- Tested with Home Assistant ≥ 2024.6.
- Uses stable public APIs only.
- Lux unit is backwards-compatible (fallbacks).
- Service missing? Check
services.yamland registration insensor.py; restart HA. - Missing sources? They’re optional; better data → better lux.
- Flicker under clouds? Increase smoothing and keep a healthy gap between on/off.
- Re-setup? Use the integration’s Options menu.
- Clear-sky model: pnbruckner (ha-illuminance).
- Development & extensions: Martin Kluger.
- License: MIT.