{% extends 'base.html.twig' %} {% import 'components/datalogger_tabs.html.twig' as tabs %} {% block title %}Gruppierte HAT Sensoren - Dashboard{% endblock %} {% block content %} {# API-Warnung wird als Toast angezeigt wenn nötig #} {% if apiAvailable is defined and not apiAvailable %} {% endif %} {% if datalogger is defined %} {{ tabs.renderTabs(datalogger, app.request.attributes.get('_route')) }} {% endif %}
{# Chart-Modus Toggle #}
Chart-Modus:
Historisch-Modus aktiv
{# Chart-Einstellungen in einer Karte #}

Chart-Einstellungen

{# Sektionenauswahl #}
{% if allGroups is defined %} {% for group in allGroups %} {% endfor %} {% else %}
Keine Gruppen verfügbar
{% endif %}
Mehrfachauswahl möglich
{# Einstellungen in Grid #}
{# Zeitraum #}
bis
Falls ausgefüllt: Chart „laden“, CSV- und PDF-Export verwenden genau diesen Zeitraum (sonst die Presets 1h/6h/24h/7d/30d).
{# Aggregation #}
{# Prognose #}
{# Aktions-Buttons #}
Auto-Refresh:
{% if datalogger is defined %} {% endif %}
{# Chart-Container #}

Gruppierte Sensoren

{# Filter #}
{# Gesamtwerte-Card direkt nach dem Suchfeld #} {% if sensorGroups.totals is defined %} {% set totals = sensorGroups.totals %}

Gesamtwerte

{# Temperatur #} {% if totals.temperature is not null %}
Durchschnittstemperatur
{{ totals.temperature|number_format(2) }}°C
{% endif %} {% if totals.pressure is not null %}
Durchschnittsdruck
{{ totals.pressure|number_format(2) }} bar(g)
{% endif %} {% if totals.massKg is not null %}
Aktuelle Gesamtmasse
{{ totals.massKg|number_format(2) }} kg {% if totals.maxMassAt0C is defined and totals.maxMassAt0C is not null %}
{{ totals.maxMassAt0C|number_format(2) }} kg bei 0°C
{% endif %}
{% if totals.usableMassKg is not null %}
Nutzbar: {{ totals.usableMassKg|number_format(2) }} kg
{% endif %}
{% endif %} {% if totals.fillLevelPercent is not null %}
Füllstand
{{ totals.fillLevelPercent|number_format(1) }}%
{% endif %}
{% endif %} {% if sensorGroups is defined and sensorGroups.groups is defined %} {% if sensorGroups.groups is not empty %}
{% for group in sensorGroups.groups %} {% set sensorNames = [] %} {% if group.temperatureSensors is defined %} {% for sensor in group.temperatureSensors %} {% set sensorNames = sensorNames|merge([(sensor.hatName ?? '')|lower, ('ch' ~ (sensor.channel ?? ''))|lower]) %} {% endfor %} {% endif %} {% if group.pressureSensors is defined %} {% for sensor in group.pressureSensors %} {% set sensorNames = sensorNames|merge([(sensor.hatName ?? '')|lower, ('ch' ~ (sensor.channel ?? ''))|lower]) %} {% endfor %} {% endif %}

{{ group.name }}

{% if group.description %}

{{ group.description }}

{% endif %}
{# Alarm-Status #} {% if group.alarmsEnabled and group.alarmThresholds %} {% set hasAlarm = false %} {% if group.temperatureAverage is not null %} {% if group.alarmThresholds.temperature.min is defined and group.temperatureAverage < group.alarmThresholds.temperature.min %} {% set hasAlarm = true %} {% elseif group.alarmThresholds.temperature.max is defined and group.temperatureAverage > group.alarmThresholds.temperature.max %} {% set hasAlarm = true %} {% endif %} {% endif %} {% if group.pressureAverage is not null %} {% if group.alarmThresholds.pressure.min is defined and group.pressureAverage < group.alarmThresholds.pressure.min %} {% set hasAlarm = true %} {% elseif group.alarmThresholds.pressure.max is defined and group.pressureAverage > group.alarmThresholds.pressure.max %} {% set hasAlarm = true %} {% endif %} {% endif %}
{{ hasAlarm ? 'Alarm' : 'OK' }}
{% endif %}
{# Alarm-Warnungen #} {% if group.alarms is defined and group.alarms is not empty %}
Alarm!
    {% for alarm in group.alarms %}
  • {{ alarm.message }}
  • {% endfor %}
{% endif %} {# Keine API-Sensordaten (Gruppe konfiguriert, aber API liefert nichts) #} {% if (group.temperatureSensors is not defined or group.temperatureSensors is empty) and (group.pressureSensors is not defined or group.pressureSensors is empty) %}
Keine Sensordaten von der API (API offline oder HAT-Namen/Channels passen nicht zur Konfiguration).
{% endif %} {# Temperatur-Sensoren #} {% if group.temperatureSensors is defined and group.temperatureSensors is not empty %}

Temperatursensoren {% if group.alarmThresholds and group.alarmThresholds.temperature %} {% if group.alarmThresholds.temperature.min is defined %}Min: {{ group.alarmThresholds.temperature.min }}°C{% endif %} {% if group.alarmThresholds.temperature.min is defined and group.alarmThresholds.temperature.max is defined %} / {% endif %} {% if group.alarmThresholds.temperature.max is defined %}Max: {{ group.alarmThresholds.temperature.max }}°C{% endif %} {% endif %}

{% if group.showAverage and group.temperatureAverage is not null and group.temperatureSensors|length > 1 %}
Durchschnitt: {{ group.temperatureAverage|number_format(2) }}°C
{% endif %} {# Zeige immer die aktuellen Werte an, auch wenn showIndividual false ist #}
{% for sensor in group.temperatureSensors %}
{% if sensor.channel is not null %}Ch{{ sensor.channel }}{% endif %} {% if sensor.value is defined and sensor.value is not null %} {{ sensor.value|number_format(2) }}{% if sensor.unit %}{{ sensor.unit }}{% else %}°C{% endif %} {% else %} -- {% endif %}
{% endfor %}
{% endif %} {# Druck-Sensoren #} {% if group.pressureSensors is defined and group.pressureSensors is not empty %}

Drucksensoren {% if group.alarmThresholds and group.alarmThresholds.pressure %} {% if group.alarmThresholds.pressure.min is defined %}Min: {{ group.alarmThresholds.pressure.min }} bar{% endif %} {% if group.alarmThresholds.pressure.min is defined and group.alarmThresholds.pressure.max is defined %} / {% endif %} {% if group.alarmThresholds.pressure.max is defined %}Max: {{ group.alarmThresholds.pressure.max }} bar{% endif %} {% endif %}

{% if group.showAverage and group.pressureAverage is not null and group.pressureSensors|length > 1 %}
Durchschnitt: {{ group.pressureAverage|number_format(2) }} bar
{% endif %} {# Zeige immer die aktuellen Werte an, auch wenn showIndividual false ist #}
{% for sensor in group.pressureSensors %}
{% if sensor.channel is not null %}Ch{{ sensor.channel }}{% endif %} {% if sensor.value is defined and sensor.value is not null %} {% set displayUnit = sensor.unit ? (sensor.unit|lower == 'bar' ? 'bar (g)' : sensor.unit) : ' bar' %} {{ sensor.value|number_format(2) }}{{ displayUnit }} {% else %} -- {% endif %}
{% endfor %}
{% endif %} {# H₂-Masse Sektion #} {% if group.massKg is defined and group.massKg is not null %}

H₂-Masse

Gesamt:
{{ group.massKg|number_format(2) }} kg
Nutzbar:
{{ (group.usableMassKg ?? (group.massKg - 60.0))|number_format(2) }} kg
Füllstand:
{{ (group.fillLevelPercent ?? ((group.massKg / 1246.0) * 100))|number_format(1) }}%
{% if group.tankCount is defined and group.tankCount is not null %}
Behälteranzahl:
{{ group.tankCount }}
{% endif %}
{% endif %}
{% endfor %}
{% else %}

Sensor-Sektionen

Keine Sensor-Sektionen verfügbar

Es wurden keine Sensor-Sektionen für diesen Datalogger konfiguriert oder keine Daten sind verfügbar.

{% if is_granted('ROLE_ADMIN') %} Sektionen konfigurieren {% endif %}
{# Debug: Zeige Informationen über die Gruppen in der DB #} {% if allGroups is defined and allGroups is not empty %}
Debug: Sektionen in DB gefunden, aber nicht verarbeitet:
    {% for group in allGroups %}
  • {{ group.name }} (ID: {{ group.id }}, Type: {{ group.type ?? 'null' }}, Active: {{ group.active ? 'Ja' : 'Nein' }})
    Sensoren in Config: {{ group.sensors|length }}, Show Average: {{ group.showAverage ? 'Ja' : 'Nein' }}, Show Individual: {{ group.showIndividual ? 'Ja' : 'Nein' }}
  • {% endfor %}
{% endif %}
{% endif %} {% else %} {% endif %}
{# .hats-groups-modern #} {# Modal für Berechnungsdetails #} {% endblock %} {% block javascripts %} {% endblock %}