mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-17 19:36:28 +02:00
[Feature]: Bind Home Assistant sensors to storage locations (dryboxes/bins) (#2827)
This commit is contained in:
@@ -47,6 +47,9 @@ export function AddNotificationModal({ provider, onClose }: AddNotificationModal
|
||||
const [onPlateClearRequired, setOnPlateClearRequired] = useState(provider?.on_plate_clear_required ?? false);
|
||||
const [onBedCooled, setOnBedCooled] = useState(provider?.on_bed_cooled ?? false);
|
||||
const [onHaSensorAlert, setOnHaSensorAlert] = useState(provider?.on_ha_sensor_alert ?? false);
|
||||
const [onLocationHaSensorAlert, setOnLocationHaSensorAlert] = useState(
|
||||
provider?.on_location_ha_sensor_alert ?? false
|
||||
);
|
||||
const [onFirstLayerComplete, setOnFirstLayerComplete] = useState(provider?.on_first_layer_complete ?? false);
|
||||
|
||||
// Provider-specific config (scalar fields only — event_priorities is split out
|
||||
@@ -204,6 +207,7 @@ export function AddNotificationModal({ provider, onClose }: AddNotificationModal
|
||||
on_plate_clear_required: onPlateClearRequired,
|
||||
on_bed_cooled: onBedCooled,
|
||||
on_ha_sensor_alert: onHaSensorAlert,
|
||||
on_location_ha_sensor_alert: onLocationHaSensorAlert,
|
||||
on_first_layer_complete: onFirstLayerComplete,
|
||||
};
|
||||
|
||||
@@ -653,6 +657,13 @@ export function AddNotificationModal({ provider, onClose }: AddNotificationModal
|
||||
</div>
|
||||
<Toggle checked={onHaSensorAlert} onChange={setOnHaSensorAlert} />
|
||||
</div>
|
||||
<div className="flex items-center justify-between col-span-2">
|
||||
<div>
|
||||
<span className="text-sm text-white">{t('notifications.locationHaSensorAlert')}</span>
|
||||
<span className="text-xs text-bambu-gray ml-1">{t('notifications.locationHaSensorAlertDescription')}</span>
|
||||
</div>
|
||||
<Toggle checked={onLocationHaSensorAlert} onChange={setOnLocationHaSensorAlert} />
|
||||
</div>
|
||||
<div className="flex items-center justify-between">
|
||||
<span className="text-sm text-white">{t('notifications.error')}</span>
|
||||
<Toggle checked={onPrinterError} onChange={setOnPrinterError} />
|
||||
@@ -708,6 +719,7 @@ export function AddNotificationModal({ provider, onClose }: AddNotificationModal
|
||||
if (onPrinterOffline) enabledEvents.push({ key: 'on_printer_offline', label: t('notifications.offline') });
|
||||
if (onPrinterError) enabledEvents.push({ key: 'on_printer_error', label: t('notifications.error') });
|
||||
if (onHaSensorAlert) enabledEvents.push({ key: 'on_ha_sensor_alert', label: t('notifications.haSensorAlert') });
|
||||
if (onLocationHaSensorAlert) enabledEvents.push({ key: 'on_location_ha_sensor_alert', label: t('notifications.locationHaSensorAlert') });
|
||||
if (onAiFailureDetection) enabledEvents.push({ key: 'on_ai_failure_detection', label: t('notifications.aiFailureDetection') });
|
||||
if (onFilamentLow) enabledEvents.push({ key: 'on_filament_low', label: t('notifications.lowFilament') });
|
||||
if (onMaintenanceDue) enabledEvents.push({ key: 'on_maintenance_due', label: t('notifications.maintenance') });
|
||||
|
||||
Reference in New Issue
Block a user