Просмотр исходного кода

Smart plugs: temperature auto-off can wait for the bed (#3464) (#3539)

Keybored 1 неделя назад
Родитель
Сommit
c835566649
30 измененных файлов с 609 добавлено и 73 удалено
  1. 1 0
      CHANGELOG.md
  2. 9 0
      backend/app/core/database.py
  3. 7 0
      backend/app/models/smart_plug.py
  4. 6 0
      backend/app/schemas/smart_plug.py
  5. 46 27
      backend/app/services/smart_plug_manager.py
  6. 48 0
      backend/tests/integration/test_smart_plugs_api.py
  7. 129 1
      backend/tests/unit/services/test_smart_plug_manager.py
  8. 106 0
      backend/tests/unit/test_smart_plug_temp_source_migration_3464.py
  9. 2 0
      frontend/src/__tests__/components/SmartPlugCard.test.tsx
  10. 51 0
      frontend/src/__tests__/components/SmartPlugCardWiring.test.tsx
  11. 2 0
      frontend/src/__tests__/components/spoolbuddy/SpoolBuddyQuickMenu.test.tsx
  12. 2 0
      frontend/src/__tests__/mocks/handlers.ts
  13. 11 0
      frontend/src/api/client.ts
  14. 61 13
      frontend/src/components/SmartPlugCard.tsx
  15. 8 2
      frontend/src/i18n/locales/de.ts
  16. 8 2
      frontend/src/i18n/locales/en.ts
  17. 8 2
      frontend/src/i18n/locales/es.ts
  18. 8 2
      frontend/src/i18n/locales/fr.ts
  19. 8 2
      frontend/src/i18n/locales/it.ts
  20. 8 2
      frontend/src/i18n/locales/ja.ts
  21. 8 2
      frontend/src/i18n/locales/ko.ts
  22. 8 2
      frontend/src/i18n/locales/nl.ts
  23. 8 2
      frontend/src/i18n/locales/pl.ts
  24. 8 2
      frontend/src/i18n/locales/pt-BR.ts
  25. 8 2
      frontend/src/i18n/locales/ru.ts
  26. 8 2
      frontend/src/i18n/locales/sv.ts
  27. 8 2
      frontend/src/i18n/locales/tr.ts
  28. 8 2
      frontend/src/i18n/locales/uk.ts
  29. 8 2
      frontend/src/i18n/locales/zh-CN.ts
  30. 8 2
      frontend/src/i18n/locales/zh-TW.ts

+ 1 - 0
CHANGELOG.md

@@ -13,6 +13,7 @@ All notable changes to Bambuddy will be documented in this file.
 - **Cam Wall tiles show temperatures and finish time, and can pause, stop and switch the light (#3479, sponsor vote Q4 2026)** — With the **Full** status overlay, every connected tile shows its nozzle (both on a dual-nozzle printer), bed and chamber temperatures, and a printing tile adds its finish time beside the time left. Hovering over a tile shows **Pause/Resume** and **Stop**, with the same confirmations as the printer card, and a **chamber light** switch; **Tile controls: Always** in the wall settings keeps them on screen, and a touch screen always shows them. The controls need the `printers:control` permission; a user without it, an offline printer and a Cam Wall token (kiosk) wall get none.
 - **The H2C shows how long each nozzle has printed (#1908, contributed by @Keybored02 in #3507)** — Recent H2C firmware counts the print time of every nozzle, which says more about a nozzle's use than the wear estimate. Hovering over a nozzle on the printer card, in the nozzle rack or on the left and right hotend, now shows its **Print time** next to **Wear**. Firmware that does not report it, and other printers, show no print time. Wiki updated.
 - **A virtual printer can be an H3C (#3442, requested by @mgera-git)** — Settings > Virtual Printer now offers the H3C as a model. Bambu Studio recognises a printer by its serial, so a virtual H3C gets one like a real H3C (32X...). A proxy virtual printer for an H3C takes the model from its target.
+- **A smart plug's temperature auto-off can wait for the bed (#3464, requested by @EmcetPL, contributed by @Keybored02 in #3539)** — With **Turn Off Delay Mode** set to **Temp**, a plug turned off once the nozzle cooled, which takes a few minutes, while the bed stays hot much longer: a plug that powers the printer cut it before the print could be taken off a cool bed, and before the Bed Cooled notification was sent. Temp mode now has **Wait for: Nozzle / Bed**, and the bed has its own threshold (35 °C by default, the Bed Cooled notification's default). Existing plugs keep waiting for the nozzle.
 
 ### Changed
 - **A slice sent again from the slicer adds a print to its archive (#1634, requested by @d3nn3s08, contributed by @Keybored02 in #3508)** — A print from the File Manager or the queue already joined the archive of its file, but a print sent from Bambu Studio or OrcaSlicer, or started on the printer, always got a new archive: the slicer writes a new 3MF each time it sends, so the file never matched, and the archive's print count stayed at one. Bambuddy now also keeps the hash of each archive's G-code, and a print whose G-code matches an archive nobody owns, in no project and not from a File Manager file adds a run to that archive. The archive takes the new 3MF in place of its old one and keeps its photos, timelapses, notes, tags and earlier runs; a name set by hand stays, and a name taken from the file follows the new file. While another print of it is running, the archive keeps its file and only gets the run. A model sliced again with other settings gets an archive of its own. OrcaSlicer writes the slicing time into the G-code, so with it only the same slice sent again matches. Archives made before are read once in the background after the update. Wiki updated.

+ 9 - 0
backend/app/core/database.py

@@ -6161,6 +6161,15 @@ async def _run_migrations(conn):
         "ALTER TABLE spool_assignment ADD COLUMN assigned_by_user_id INTEGER REFERENCES users(id) ON DELETE SET NULL",
     )
 
+    # Migration: what a smart plug's temperature-based auto-off waits for
+    # (#3464), and the bed's own threshold. NOT NULL with the model's server
+    # defaults, identical DDL on SQLite and Postgres; existing plugs keep
+    # waiting for the nozzle only, as they did.
+    await _safe_execute(
+        conn, "ALTER TABLE smart_plugs ADD COLUMN off_temp_source VARCHAR(20) NOT NULL DEFAULT 'nozzle'"
+    )
+    await _safe_execute(conn, "ALTER TABLE smart_plugs ADD COLUMN off_bed_temp_threshold INTEGER NOT NULL DEFAULT 35")
+
     await _backfill_archive_run_photos(conn)
     await _migrate_h3c_queue_tray_ids(conn)
 

+ 7 - 0
backend/app/models/smart_plug.py

@@ -103,6 +103,13 @@ class SmartPlug(Base):
     off_delay_mode: Mapped[str] = mapped_column(String(20), default="time")
     off_delay_minutes: Mapped[int] = mapped_column(Integer, default=5)  # For time mode
     off_temp_threshold: Mapped[int] = mapped_column(Integer, default=70)  # For temp mode (°C)
+    # What temp mode waits for (#3464): "nozzle" or "bed". The bed
+    # holds its heat long after the nozzle has cooled, so a plug that cuts
+    # power on the nozzle alone drops the printer before the bed is cool
+    # enough to take the print off, and before the bed-cooled notification.
+    # The bed has its own threshold: nozzle and bed values are far apart.
+    off_temp_source: Mapped[str] = mapped_column(String(20), default="nozzle", server_default="nozzle")
+    off_bed_temp_threshold: Mapped[int] = mapped_column(Integer, default=35, server_default="35")
 
     # Auto-off after AMS drying completes (#1349). Independent of `auto_off`
     # (which only fires after a print finishes). Uses its own delay because

+ 6 - 0
backend/app/schemas/smart_plug.py

@@ -91,6 +91,9 @@ class SmartPlugBase(BaseModel):
     off_delay_mode: Literal["time", "temperature"] = "time"
     off_delay_minutes: int = Field(default=5, ge=0, le=60)
     off_temp_threshold: int = Field(default=70, ge=30, le=150)
+    # #3464: what temperature mode waits for, and the bed's own threshold.
+    off_temp_source: Literal["nozzle", "bed"] = "nozzle"
+    off_bed_temp_threshold: int = Field(default=35, ge=20, le=100)
     # #1349: auto-off after AMS drying completes. Independent of `auto_off`
     # (print-finish). Fires whenever any AMS on the linked printer finishes
     # a dry cycle.
@@ -188,6 +191,9 @@ class SmartPlugUpdate(IgnoresNullForRequiredColumns):
     off_delay_mode: Literal["time", "temperature"] | None = None
     off_delay_minutes: int | None = Field(default=None, ge=0, le=60)
     off_temp_threshold: int | None = Field(default=None, ge=30, le=150)
+    # #3464: see SmartPlugBase.off_temp_source.
+    off_temp_source: Literal["nozzle", "bed"] | None = None
+    off_bed_temp_threshold: int | None = Field(default=None, ge=20, le=100)
     # #1349: per-plug drying auto-off.
     auto_off_after_drying: bool | None = None
     off_delay_after_drying_minutes: int | None = Field(default=None, ge=0, le=120)

+ 46 - 27
backend/app/services/smart_plug_manager.py

@@ -61,6 +61,28 @@ async def publish_plug_state(
         logger.debug("MQTT relay: failed to publish the state of plug %s: %s", plug_id, e)
 
 
+def _cooled_down(temps: dict, temp_source: str, nozzle_threshold: int, bed_threshold: int) -> tuple[bool, str]:
+    """Whether a temperature-based auto-off may switch off, and what was read.
+
+    ``temp_source`` picks what must be below its threshold (#3464): the
+    hottest nozzle (the H2 series has two) or the bed. A reading the
+    printer hasn't reported counts as hot, so it keeps the plug on. Any other
+    value waits for the nozzle, as temperature mode did before #3464.
+    """
+    if temp_source == "bed":
+        bed_temp = temps.get("bed", 999)
+        return bed_temp < bed_threshold, f"bed={bed_temp}°C (threshold {bed_threshold}°C)"
+
+    nozzle_temp = temps.get("nozzle", 999)
+    nozzle_2_temp = temps.get("nozzle_2")
+    if nozzle_2_temp is not None:
+        reading = f"nozzle1={nozzle_temp}°C, nozzle2={nozzle_2_temp}°C"
+        nozzle_temp = max(nozzle_temp, nozzle_2_temp)
+    else:
+        reading = f"nozzle={nozzle_temp}°C"
+    return nozzle_temp < nozzle_threshold, f"{reading} (threshold {nozzle_threshold}°C)"
+
+
 def _is_script_plug(plug) -> bool:
     """A Home Assistant script entity: it can be run, not switched."""
     return (
@@ -506,7 +528,8 @@ class SmartPlugManager:
 
         Honours the per-plug ``off_delay_mode`` — ``time`` waits
         ``off_delay_minutes``; ``temperature`` waits until the nozzle drops
-        below ``off_temp_threshold`` (#1890 — the queue/scheduler auto-off
+        below ``off_temp_threshold``, or the bed below ``off_bed_temp_threshold``
+        (``off_temp_source``, #3464) (#1890 — the queue/scheduler auto-off
         paths used to hardcode 50°C / 600s and ignore these settings). Both
         branches register a cancellable task in ``_pending_off``, so a re-print
         cancels the pending off via :meth:`on_print_start`.
@@ -694,7 +717,14 @@ class SmartPlugManager:
         # Cancel any existing task for this plug
         self._cancel_pending_off(plug.id)
 
-        logger.info("Scheduling temperature-based turn-off for plug '%s' (threshold: %s°C)", plug.name, temp_threshold)
+        logger.info(
+            "Scheduling temperature-based turn-off for plug '%s' (waits for: %s, nozzle threshold: %s°C, "
+            "bed threshold: %s°C)",
+            plug.name,
+            plug.off_temp_source,
+            temp_threshold,
+            plug.off_bed_temp_threshold,
+        )
 
         # Mark as pending in database (survives restarts)
         spawn_background_task(self._mark_auto_off_pending(plug.id, True), name=f"plug-auto-off-pending-{plug.id}")
@@ -709,6 +739,8 @@ class SmartPlugManager:
                 plug.password,
                 printer_id,
                 temp_threshold,
+                temp_source=plug.off_temp_source,
+                bed_temp_threshold=plug.off_bed_temp_threshold,
                 controls_printer_power=plug.controls_printer_power,
                 plug_name=plug.name,
                 rest_off_url=plug.rest_off_url if plug.plug_type == "rest" else None,
@@ -730,6 +762,8 @@ class SmartPlugManager:
         printer_id: int,
         temp_threshold: int,
         *,
+        temp_source: str = "nozzle",
+        bed_temp_threshold: int = 35,
         controls_printer_power: bool = True,
         plug_name: str = "",
         rest_off_url: str | None = None,
@@ -739,7 +773,9 @@ class SmartPlugManager:
     ):
         """Poll temperature until below threshold, then turn off.
 
-        For dual-extruder printers (H2 series), checks both nozzles.
+        ``temp_source`` is what has to cool (#3464): the nozzle (both nozzles
+        on dual-extruder H2 printers) below ``temp_threshold``, or the bed
+        below ``bed_temp_threshold``.
         """
         try:
             check_interval = 10  # seconds
@@ -750,26 +786,12 @@ class SmartPlugManager:
                 status = printer_manager.get_status(printer_id)
 
                 if status:
-                    temps = status.temperatures or {}
-                    nozzle_temp = temps.get("nozzle", 999)
-                    # Check second nozzle for dual-extruder printers (H2 series)
-                    nozzle_2_temp = temps.get("nozzle_2")
-
-                    # Get the maximum temperature across all nozzles
-                    max_nozzle_temp = nozzle_temp
-                    if nozzle_2_temp is not None:
-                        max_nozzle_temp = max(nozzle_temp, nozzle_2_temp)
-                        logger.info(
-                            f"Temp check plug {plug_id}: nozzle1={nozzle_temp}°C, "
-                            f"nozzle2={nozzle_2_temp}°C, max={max_nozzle_temp}°C, "
-                            f"threshold={temp_threshold}°C"
-                        )
-                    else:
-                        logger.info(
-                            "Temp check plug %s: nozzle=%s°C, threshold=%s°C", plug_id, nozzle_temp, temp_threshold
-                        )
+                    cooled, reading = _cooled_down(
+                        status.temperatures or {}, temp_source, temp_threshold, bed_temp_threshold
+                    )
+                    logger.info("Temp check plug %s: %s", plug_id, reading)
 
-                    if max_nozzle_temp < temp_threshold:
+                    if cooled:
                         # #1890: the nozzle can dip below the threshold between
                         # a finished print and a fresh one starting (e.g. a
                         # touchscreen reprint during the PREPARE/heating phase).
@@ -786,7 +808,7 @@ class SmartPlugManager:
                             elapsed += check_interval
                             continue
 
-                        # All nozzles are below threshold, turn off
+                        # Cool enough, turn off
                         class PlugInfo:
                             def __init__(self):
                                 self.plug_type = plug_type
@@ -805,10 +827,7 @@ class SmartPlugManager:
                         plug_info = PlugInfo()
                         service = await self.get_service_for_plug(plug_info)
                         success = await service.turn_off(plug_info)
-                        logger.info(
-                            f"Turned off plug {plug_id} after nozzle temp dropped to "
-                            f"{max_nozzle_temp}°C (threshold: {temp_threshold}°C)"
-                        )
+                        logger.info("Turned off plug %s after cooling down: %s", plug_id, reading)
 
                         # Mark auto_off_executed in database and update printer status
                         if success:

+ 48 - 0
backend/tests/integration/test_smart_plugs_api.py

@@ -189,6 +189,54 @@ class TestSmartPlugsAPI:
         assert result["off_delay_mode"] == "temperature"
         assert result["off_temp_threshold"] == 50
 
+    @pytest.mark.asyncio
+    @pytest.mark.integration
+    async def test_temp_mode_waits_for_the_nozzle_by_default(self, async_client: AsyncClient, smart_plug_factory):
+        """#3464: plugs that never chose a source keep the nozzle-only behaviour."""
+        plug = await smart_plug_factory()
+
+        response = await async_client.get(f"/api/v1/smart-plugs/{plug.id}")
+
+        assert response.status_code == 200
+        assert response.json()["off_temp_source"] == "nozzle"
+        assert response.json()["off_bed_temp_threshold"] == 35
+
+    @pytest.mark.asyncio
+    @pytest.mark.integration
+    async def test_update_off_temp_source(self, async_client: AsyncClient, smart_plug_factory):
+        """#3464: temperature mode can wait for the bed, with its own threshold."""
+        plug = await smart_plug_factory(off_delay_mode="temperature")
+
+        response = await async_client.patch(
+            f"/api/v1/smart-plugs/{plug.id}", json={"off_temp_source": "bed", "off_bed_temp_threshold": 40}
+        )
+
+        assert response.status_code == 200
+        result = response.json()
+        assert result["off_temp_source"] == "bed"
+        assert result["off_bed_temp_threshold"] == 40
+        assert result["off_temp_threshold"] == 70  # the nozzle's own threshold is untouched
+
+    @pytest.mark.asyncio
+    @pytest.mark.integration
+    @pytest.mark.parametrize(
+        "payload",
+        [
+            {"off_temp_source": "chamber"},
+            {"off_temp_source": "both"},
+            {"off_bed_temp_threshold": 10},
+            {"off_bed_temp_threshold": 130},
+        ],
+    )
+    async def test_update_rejects_invalid_temp_source_settings(
+        self, async_client: AsyncClient, smart_plug_factory, payload
+    ):
+        plug = await smart_plug_factory()
+
+        response = await async_client.patch(f"/api/v1/smart-plugs/{plug.id}", json=payload)
+
+        assert response.status_code == 422
+
     @pytest.mark.asyncio
     @pytest.mark.integration
     async def test_update_schedule_settings(self, async_client: AsyncClient, smart_plug_factory, db_session):

+ 129 - 1
backend/tests/unit/services/test_smart_plug_manager.py

@@ -10,7 +10,7 @@ from unittest.mock import AsyncMock, MagicMock, patch
 
 import pytest
 
-from backend.app.services.smart_plug_manager import SmartPlugManager
+from backend.app.services.smart_plug_manager import SmartPlugManager, _cooled_down
 
 
 class TestSmartPlugManager:
@@ -1223,3 +1223,131 @@ class TestAccessoryPlugDoesNotMarkPrinterOffline:
             await manager._check_schedules()
 
             mock_pm.mark_printer_offline.assert_called_once_with(1)
+
+
+class TestTemperatureSource:
+    """#3464 — temperature mode can wait for the bed, not only the nozzle.
+
+    The nozzle cools in minutes while the bed stays hot, so a plug that only
+    watched the nozzle cut power before the bed was cool enough to take the
+    print off (and before the bed-cooled notification could fire).
+    """
+
+    @pytest.fixture
+    def manager(self):
+        return SmartPlugManager()
+
+    # ---- _cooled_down ------------------------------------------------------
+
+    @pytest.mark.parametrize(
+        ("source", "temps", "expected"),
+        [
+            # nozzle: the bed is ignored, as before #3464
+            ("nozzle", {"nozzle": 40, "bed": 90}, True),
+            ("nozzle", {"nozzle": 80, "bed": 20}, False),
+            # bed: the nozzle is ignored
+            ("bed", {"nozzle": 40, "bed": 50}, False),
+            ("bed", {"nozzle": 200, "bed": 30}, True),
+        ],
+    )
+    def test_each_source_waits_for_its_own_readings(self, source, temps, expected):
+        cooled, _ = _cooled_down(temps, source, nozzle_threshold=70, bed_threshold=35)
+        assert cooled is expected
+
+    def test_dual_nozzle_waits_for_the_hotter_one(self):
+        cooled, reading = _cooled_down({"nozzle": 40, "nozzle_2": 90, "bed": 20}, "nozzle", 70, 35)
+        assert cooled is False
+        assert "nozzle2=90" in reading
+
+    def test_missing_bed_reading_counts_as_hot(self):
+        """No reading yet must keep the power on, never switch it off."""
+        cooled, _ = _cooled_down({"nozzle": 30}, "bed", 70, 35)
+        assert cooled is False
+
+    def test_unknown_source_waits_for_the_nozzle(self):
+        assert _cooled_down({"nozzle": 40, "bed": 90}, "chamber", 70, 35)[0] is True
+        assert _cooled_down({"nozzle": 80, "bed": 20}, "chamber", 70, 35)[0] is False
+
+    def test_reading_names_what_is_watched(self):
+        assert "bed" not in _cooled_down({"nozzle": 40, "bed": 90}, "nozzle", 70, 35)[1]
+        assert "nozzle" not in _cooled_down({"nozzle": 40, "bed": 90}, "bed", 70, 35)[1]
+
+    # ---- _temp_based_off ---------------------------------------------------
+
+    @pytest.mark.asyncio
+    async def test_bed_source_keeps_power_on_while_bed_is_hot(self, manager):
+        """The issue's case: the nozzle is cold, the bed still above its threshold."""
+        with (
+            patch("backend.app.services.smart_plug_manager.printer_manager") as mock_pm,
+            patch("backend.app.services.smart_plug_manager.asyncio.sleep", new_callable=AsyncMock) as mock_sleep,
+            patch.object(manager, "get_service_for_plug", new_callable=AsyncMock) as mock_get_svc,
+        ):
+            mock_pm.get_status.return_value = MagicMock(state="FINISH", temperatures={"nozzle": 35, "bed": 55})
+            mock_pm.is_print_active.return_value = False
+            # Stop after the first poll so the test terminates.
+            mock_sleep.side_effect = asyncio.CancelledError()
+
+            await manager._temp_based_off(
+                1, "tasmota", "1.2.3.4", None, None, None, 1, 70, temp_source="bed", bed_temp_threshold=35
+            )
+
+            mock_get_svc.assert_not_called()
+
+    @pytest.mark.asyncio
+    async def test_bed_source_powers_off_once_bed_is_cool(self, manager):
+        mock_service = AsyncMock()
+        mock_service.turn_off = AsyncMock(return_value=True)
+        with (
+            patch("backend.app.services.smart_plug_manager.printer_manager") as mock_pm,
+            patch("backend.app.services.smart_plug_manager.asyncio.sleep", new_callable=AsyncMock),
+            patch.object(manager, "get_service_for_plug", new_callable=AsyncMock, return_value=mock_service),
+            patch.object(manager, "_mark_auto_off_executed", new_callable=AsyncMock),
+        ):
+            mock_pm.get_status.return_value = MagicMock(state="FINISH", temperatures={"nozzle": 35, "bed": 34})
+            mock_pm.is_print_active.return_value = False
+
+            await manager._temp_based_off(
+                1, "tasmota", "1.2.3.4", None, None, None, 1, 70, temp_source="bed", bed_temp_threshold=35
+            )
+
+            mock_service.turn_off.assert_awaited_once()
+
+    @pytest.mark.asyncio
+    async def test_default_source_still_ignores_the_bed(self, manager):
+        """Callers that don't pass a source keep the pre-#3464 nozzle-only behaviour."""
+        mock_service = AsyncMock()
+        mock_service.turn_off = AsyncMock(return_value=True)
+        with (
+            patch("backend.app.services.smart_plug_manager.printer_manager") as mock_pm,
+            patch("backend.app.services.smart_plug_manager.asyncio.sleep", new_callable=AsyncMock),
+            patch.object(manager, "get_service_for_plug", new_callable=AsyncMock, return_value=mock_service),
+            patch.object(manager, "_mark_auto_off_executed", new_callable=AsyncMock),
+        ):
+            mock_pm.get_status.return_value = MagicMock(state="FINISH", temperatures={"nozzle": 40, "bed": 90})
+            mock_pm.is_print_active.return_value = False
+
+            await manager._temp_based_off(1, "tasmota", "1.2.3.4", None, None, None, printer_id=1, temp_threshold=55)
+
+            mock_service.turn_off.assert_awaited_once()
+
+    # ---- _schedule_temp_based_off -----------------------------------------
+
+    @pytest.mark.asyncio
+    async def test_scheduler_forwards_source_and_bed_threshold(self, manager):
+        """The detached task only receives primitives, so the plug's choice must be passed in."""
+        plug = MagicMock()
+        plug.id = 1
+        plug.name = "Printer"
+        plug.plug_type = "tasmota"
+        plug.off_temp_source = "bed"
+        plug.off_bed_temp_threshold = 32
+        with (
+            patch.object(manager, "_mark_auto_off_pending", new_callable=AsyncMock),
+            patch.object(manager, "_temp_based_off", new_callable=AsyncMock) as mock_temp,
+        ):
+            manager._schedule_temp_based_off(plug, 1, 70)
+            await manager._pending_off[plug.id]
+
+            assert mock_temp.call_args.kwargs["temp_source"] == "bed"
+            assert mock_temp.call_args.kwargs["bed_temp_threshold"] == 32
+            assert mock_temp.call_args.args[7] == 70  # nozzle threshold unchanged

+ 106 - 0
backend/tests/unit/test_smart_plug_temp_source_migration_3464.py

@@ -0,0 +1,106 @@
+"""Migration test for #3464 — smart_plugs.off_temp_source / off_bed_temp_threshold.
+
+An existing plug in temperature mode waited for the nozzle only. The upgrade
+must keep it doing so (source "nozzle"), and the added columns must come out
+as a fresh install builds them: NOT NULL, with the model's defaults.
+"""
+
+from __future__ import annotations
+
+import pytest
+from sqlalchemy import text
+from sqlalchemy.ext.asyncio import create_async_engine
+
+from backend.app.core.database import load_all_models, run_migrations
+
+NEW_COLUMNS = ("off_temp_source", "off_bed_temp_threshold")
+
+
+@pytest.fixture(autouse=True)
+def force_sqlite_dialect(monkeypatch):
+    """settings.database_url may point at Postgres in dev configs; the test engine
+    is SQLite, so force the dialect both places run_migrations reads it from."""
+    from backend.app.core import database as database_module, db_dialect
+
+    monkeypatch.setattr(db_dialect, "is_sqlite", lambda: True)
+    monkeypatch.setattr(db_dialect, "is_postgres", lambda: False)
+    monkeypatch.setattr(database_module, "is_sqlite", lambda: True)
+
+
+async def _columns(conn) -> dict[str, tuple]:
+    """name -> (type, notnull, default) for smart_plugs. The default is unquoted:
+    create_all writes an integer server default as '35', the migration as 35."""
+    rows = await conn.execute(text("PRAGMA table_info(smart_plugs)"))
+    return {row[1]: (row[2], row[3], row[4] and row[4].strip("'")) for row in rows}
+
+
+@pytest.fixture
+async def fresh_engine():
+    engine = create_async_engine("sqlite+aiosqlite:///:memory:", echo=False)
+    async with engine.begin() as conn:
+        await conn.run_sync(load_all_models().create_all)
+    yield engine
+    await engine.dispose()
+
+
+@pytest.fixture
+async def legacy_engine():
+    """A current schema whose smart_plugs predates #3464, holding one temp-mode plug."""
+    engine = create_async_engine("sqlite+aiosqlite:///:memory:", echo=False)
+    async with engine.begin() as conn:
+        metadata = load_all_models()
+        await conn.run_sync(metadata.create_all)
+        # Through the table, which fills in the model's Python-side defaults.
+        await conn.execute(
+            metadata.tables["smart_plugs"]
+            .insert()
+            .values(id=1, name="P1S Power", plug_type="tasmota", off_delay_mode="temperature", off_temp_threshold=60)
+        )
+        for column in NEW_COLUMNS:
+            await conn.execute(text(f"ALTER TABLE smart_plugs DROP COLUMN {column}"))
+    yield engine
+    await engine.dispose()
+
+
+async def test_columns_missing_before_migration(legacy_engine):
+    """Sanity check so the assertions below can't pass by accident."""
+    async with legacy_engine.begin() as conn:
+        columns = await _columns(conn)
+    assert not set(NEW_COLUMNS) & set(columns)
+
+
+async def test_existing_plug_keeps_waiting_for_the_nozzle(legacy_engine):
+    async with legacy_engine.begin() as conn:
+        await run_migrations(conn)
+
+    async with legacy_engine.begin() as conn:
+        row = (
+            await conn.execute(
+                text("SELECT off_temp_source, off_bed_temp_threshold, off_temp_threshold FROM smart_plugs WHERE id = 1")
+            )
+        ).one()
+    assert tuple(row) == ("nozzle", 35, 60)
+
+
+async def test_upgraded_columns_match_a_fresh_install(legacy_engine, fresh_engine):
+    async with legacy_engine.begin() as conn:
+        await run_migrations(conn)
+        upgraded = await _columns(conn)
+    async with fresh_engine.begin() as conn:
+        fresh = await _columns(conn)
+
+    for column in NEW_COLUMNS:
+        assert upgraded[column] == fresh[column], column
+        assert upgraded[column][1] == 1, f"{column} must be NOT NULL"
+
+
+async def test_migration_is_idempotent(legacy_engine):
+    """A second boot must not fail on the columns already being there."""
+    async with legacy_engine.begin() as conn:
+        await run_migrations(conn)
+    async with legacy_engine.begin() as conn:
+        await run_migrations(conn)
+
+    async with legacy_engine.begin() as conn:
+        source = (await conn.execute(text("SELECT off_temp_source FROM smart_plugs WHERE id = 1"))).scalar_one()
+    assert source == "nozzle"

+ 2 - 0
frontend/src/__tests__/components/SmartPlugCard.test.tsx

@@ -48,6 +48,8 @@ const createMockPlug = (overrides: Partial<SmartPlug> = {}): SmartPlug => ({
   off_delay_mode: 'time',
   off_delay_minutes: 5,
   off_temp_threshold: 70,
+  off_temp_source: 'nozzle',
+  off_bed_temp_threshold: 35,
   username: null,
   password: null,
   power_alert_enabled: false,

+ 51 - 0
frontend/src/__tests__/components/SmartPlugCardWiring.test.tsx

@@ -30,6 +30,8 @@ function makePlug(overrides: Partial<SmartPlug> = {}): SmartPlug {
     off_delay_mode: 'time',
     off_delay_minutes: 5,
     off_temp_threshold: 70,
+    off_temp_source: 'nozzle',
+    off_bed_temp_threshold: 35,
     username: null,
     password: null,
     power_alert_enabled: false,
@@ -166,3 +168,52 @@ describe('SmartPlugCard wiring', () => {
     expect(writes()[0].body).toEqual(expected);
   });
 });
+
+describe('SmartPlugCard temperature auto-off source (#3464)', () => {
+  async function renderTempMode(overrides: Partial<SmartPlug> = {}) {
+    const user = userEvent.setup();
+    render(
+      <SmartPlugCard
+        plug={makePlug({ auto_off: true, off_delay_mode: 'temperature', ...overrides })}
+        onEdit={() => undefined}
+      />,
+    );
+    await user.click(screen.getByText('Automation Settings'));
+    await screen.findByText('Wait for');
+    return user;
+  }
+
+  it.each([
+    ['nozzle', true, false],
+    ['bed', false, true],
+  ] as const)('"%s" shows the thresholds it waits for', async (source, nozzle, bed) => {
+    await renderTempMode({ off_temp_source: source });
+    expect(screen.queryByText('Nozzle threshold (°C)') !== null).toBe(nozzle);
+    expect(screen.queryByText('Bed threshold (°C)') !== null).toBe(bed);
+  });
+
+  it('an unknown source is shown as nozzle, as the backend treats it', async () => {
+    await renderTempMode({ off_temp_source: 'chamber' as SmartPlug['off_temp_source'] });
+    expect(screen.getByText('Turns off when the nozzle cools below its threshold')).toBeInTheDocument();
+    expect(screen.queryByText('Bed threshold (°C)')).not.toBeInTheDocument();
+  });
+
+  it('picking Bed PATCHes only off_temp_source', async () => {
+    const user = await renderTempMode();
+    await user.click(screen.getByRole('button', { name: 'Bed' }));
+
+    await waitFor(() => expect(writes()).toHaveLength(1));
+    expect(writes()[0]).toMatchObject({ method: 'PATCH', path: '/api/v1/smart-plugs/42' });
+    expect(writes()[0].body).toEqual({ off_temp_source: 'bed' });
+  });
+
+  it('the bed threshold PATCHes off_bed_temp_threshold', async () => {
+    const user = await renderTempMode({ off_temp_source: 'bed' });
+    const input = screen.getByText('Bed threshold (°C)').nextElementSibling as HTMLInputElement;
+    await user.clear(input);
+    await user.type(input, '40');
+
+    await waitFor(() => expect(writes()).toHaveLength(1));
+    expect(writes()[0].body).toEqual({ off_bed_temp_threshold: 40 });
+  });
+});

+ 2 - 0
frontend/src/__tests__/components/spoolbuddy/SpoolBuddyQuickMenu.test.tsx

@@ -79,6 +79,8 @@ const mockSmartPlug = {
   off_delay_mode: 'time' as const,
   off_delay_minutes: 5,
   off_temp_threshold: 50,
+  off_temp_source: 'nozzle',
+  off_bed_temp_threshold: 35,
   username: null,
   password: null,
   power_alert_enabled: false,

+ 2 - 0
frontend/src/__tests__/mocks/handlers.ts

@@ -17,6 +17,8 @@ const mockSmartPlugs = [
     off_delay_mode: 'time',
     off_delay_minutes: 5,
     off_temp_threshold: 70,
+    off_temp_source: 'nozzle',
+    off_bed_temp_threshold: 35,
     username: null,
     password: null,
     power_alert_enabled: false,

+ 11 - 0
frontend/src/api/client.ts

@@ -2418,6 +2418,8 @@ export interface CloudDevice {
 }
 
 // Smart Plug types
+export type SmartPlugTempSource = 'nozzle' | 'bed';
+
 export interface SmartPlug {
   id: number;
   name: string;
@@ -2475,6 +2477,9 @@ export interface SmartPlug {
   off_delay_mode: 'time' | 'temperature';
   off_delay_minutes: number;
   off_temp_threshold: number;
+  // #3464: what temperature mode waits for, and the bed's own threshold.
+  off_temp_source: SmartPlugTempSource;
+  off_bed_temp_threshold: number;
   // #1349: auto-off after AMS drying completes.
   auto_off_after_drying: boolean;
   off_delay_after_drying_minutes: number;
@@ -2553,6 +2558,9 @@ export interface SmartPlugCreate {
   off_delay_mode?: 'time' | 'temperature';
   off_delay_minutes?: number;
   off_temp_threshold?: number;
+  // #3464
+  off_temp_source?: SmartPlugTempSource;
+  off_bed_temp_threshold?: number;
   // #1349
   auto_off_after_drying?: boolean;
   off_delay_after_drying_minutes?: number;
@@ -2623,6 +2631,9 @@ export interface SmartPlugUpdate {
   off_delay_mode?: 'time' | 'temperature';
   off_delay_minutes?: number;
   off_temp_threshold?: number;
+  // #3464
+  off_temp_source?: SmartPlugTempSource;
+  off_bed_temp_threshold?: number;
   // #1349
   auto_off_after_drying?: boolean;
   off_delay_after_drying_minutes?: number;

+ 61 - 13
frontend/src/components/SmartPlugCard.tsx

@@ -3,13 +3,19 @@ import { useMutation, useQueryClient, useQuery } from '@tanstack/react-query';
 import { Plug, Power, PowerOff, Loader2, Trash2, Settings2, Thermometer, Clock, Wifi, WifiOff, Edit2, Bell, Calendar, LayoutGrid, ExternalLink, Home, Radio, Eye, Globe } from 'lucide-react';
 import { useTranslation } from 'react-i18next';
 import { api } from '../api/client';
-import type { SmartPlug, SmartPlugUpdate } from '../api/client';
+import type { SmartPlug, SmartPlugTempSource, SmartPlugUpdate } from '../api/client';
 import { Card, CardContent } from './Card';
 import { Button } from './Button';
 import { ConfirmModal } from './ConfirmModal';
 import { useToast } from '../contexts/ToastContext';
 import { NumberInput } from './NumberInput';
 
+// What temperature-based auto-off can wait for (#3464), in display order.
+const TEMP_SOURCES: { value: SmartPlugTempSource; labelKey: string; descriptionKey: string }[] = [
+  { value: 'nozzle', labelKey: 'smartPlugs.tempSourceNozzle', descriptionKey: 'smartPlugs.tempSourceNozzleDescription' },
+  { value: 'bed', labelKey: 'smartPlugs.tempSourceBed', descriptionKey: 'smartPlugs.tempSourceBedDescription' },
+];
+
 interface SmartPlugCardProps {
   plug: SmartPlug;
   onEdit: (plug: SmartPlug) => void;
@@ -38,6 +44,8 @@ export function SmartPlugCard({ plug, onEdit }: SmartPlugCardProps) {
   });
 
   const linkedPrinter = printers?.find(p => p.id === plug.printer_id);
+  // Anything unknown waits for the nozzle, as the backend does.
+  const tempSource = TEMP_SOURCES.find((s) => s.value === plug.off_temp_source) ?? TEMP_SOURCES[0];
 
   // Control mutation with optimistic updates
   const controlMutation = useMutation({
@@ -458,18 +466,58 @@ export function SmartPlugCard({ plug, onEdit }: SmartPlugCardProps) {
                       />
                     </div>
                   ) : (
-                    <div>
-                      <label className="block text-xs text-bambu-gray mb-1">{t('smartPlugs.tempThreshold')}</label>
-                      <NumberInput
-                        min={30}
-                        max={100}
-                        value={plug.off_temp_threshold}
-                        onChange={(v) => updateMutation.mutate({ off_temp_threshold: v })}
-                        fallback={70}
-                        className="w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:border-bambu-green focus:outline-none"
-                      />
-                      <p className="text-xs text-bambu-gray mt-1">{t('smartPlugs.tempThresholdDescription')}</p>
-                    </div>
+                    <>
+                      {/* What has to cool before the plug turns off (#3464):
+                          the bed stays hot long after the nozzle. */}
+                      <div>
+                        <p className="text-xs text-bambu-gray mb-1">{t('smartPlugs.tempSource')}</p>
+                        <div className="flex gap-2">
+                          {TEMP_SOURCES.map(({ value, labelKey }) => (
+                            <button
+                              key={value}
+                              onClick={() => updateMutation.mutate({ off_temp_source: value })}
+                              className={`flex-1 px-3 py-1.5 rounded-lg text-sm transition-colors ${
+                                tempSource.value === value
+                                  ? 'bg-bambu-green text-white'
+                                  : 'bg-bambu-dark text-bambu-gray hover:text-white'
+                              }`}
+                            >
+                              {t(labelKey)}
+                            </button>
+                          ))}
+                        </div>
+                        <p className="text-xs text-bambu-gray mt-1">
+                          {t(tempSource.descriptionKey)}
+                        </p>
+                      </div>
+                      {tempSource.value === 'nozzle' && (
+                        <div>
+                          <label className="block text-xs text-bambu-gray mb-1">{t('smartPlugs.nozzleTempThreshold')}</label>
+                          <NumberInput
+                            min={30}
+                            max={100}
+                            value={plug.off_temp_threshold}
+                            onChange={(v) => updateMutation.mutate({ off_temp_threshold: v })}
+                            fallback={70}
+                            className="w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:border-bambu-green focus:outline-none"
+                          />
+                        </div>
+                      )}
+                      {tempSource.value === 'bed' && (
+                        <div>
+                          <label className="block text-xs text-bambu-gray mb-1">{t('smartPlugs.bedTempThreshold')}</label>
+                          <NumberInput
+                            min={20}
+                            max={100}
+                            value={plug.off_bed_temp_threshold}
+                            onChange={(v) => updateMutation.mutate({ off_bed_temp_threshold: v })}
+                            fallback={35}
+                            className="w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:border-bambu-green focus:outline-none"
+                          />
+                          <p className="text-xs text-bambu-gray mt-1">{t('smartPlugs.bedTempThresholdDescription')}</p>
+                        </div>
+                      )}
+                    </>
                   )}
                 </div>
               )}

+ 8 - 2
frontend/src/i18n/locales/de.ts

@@ -6737,8 +6737,14 @@ export default {
     time: 'Zeit',
     temp: 'Temp.',
     delayMinutes: 'Verzögerung (Minuten)',
-    tempThreshold: 'Temperaturschwelle (°C)',
-    tempThresholdDescription: 'Schaltet aus wenn die Düse unter diese Temperatur abkühlt',
+    tempSource: 'Warten auf',
+    tempSourceNozzle: 'Düse',
+    tempSourceBed: 'Bett',
+    tempSourceNozzleDescription: 'Schaltet aus, wenn die Düse unter ihren Schwellenwert abkühlt',
+    tempSourceBedDescription: 'Schaltet aus, wenn das Bett unter seinen Schwellenwert abkühlt',
+    nozzleTempThreshold: 'Düsen-Schwellenwert (°C)',
+    bedTempThreshold: 'Bett-Schwellenwert (°C)',
+    bedTempThresholdDescription: 'Höchstens so hoch wie der Schwellenwert der Bett-Abkühlung-Benachrichtigung, damit diese vor dem Abschalten gesendet wird',
     edit: 'Bearbeiten',
     deleteConfirm: 'Möchten Sie "{{name}}" wirklich löschen? Dies kann nicht rückgängig gemacht werden.',
     turnOnConfirm: 'Möchten Sie "{{name}}" wirklich einschalten?',

+ 8 - 2
frontend/src/i18n/locales/en.ts

@@ -6790,8 +6790,14 @@ export default {
     time: 'Time',
     temp: 'Temp',
     delayMinutes: 'Delay (minutes)',
-    tempThreshold: 'Temperature threshold (°C)',
-    tempThresholdDescription: 'Turns off when nozzle cools below this temperature',
+    tempSource: 'Wait for',
+    tempSourceNozzle: 'Nozzle',
+    tempSourceBed: 'Bed',
+    tempSourceNozzleDescription: 'Turns off when the nozzle cools below its threshold',
+    tempSourceBedDescription: 'Turns off when the bed cools below its threshold',
+    nozzleTempThreshold: 'Nozzle threshold (°C)',
+    bedTempThreshold: 'Bed threshold (°C)',
+    bedTempThresholdDescription: 'Keep it at or below the bed-cooled notification threshold so that notification is sent before the power goes off',
     edit: 'Edit',
     deleteConfirm: 'Are you sure you want to delete "{{name}}"? This cannot be undone.',
     turnOnConfirm: 'Are you sure you want to turn on "{{name}}"?',

+ 8 - 2
frontend/src/i18n/locales/es.ts

@@ -6745,8 +6745,14 @@ export default {
     time: 'Tiempo',
     temp: 'Temp.',
     delayMinutes: 'Retardo (minutos)',
-    tempThreshold: 'Umbral de temperatura (°C)',
-    tempThresholdDescription: 'Se apaga cuando la boquilla se enfría por debajo de esta temperatura',
+    tempSource: 'Esperar a',
+    tempSourceNozzle: 'Boquilla',
+    tempSourceBed: 'Cama',
+    tempSourceNozzleDescription: 'Se apaga cuando la boquilla se enfría por debajo de su umbral',
+    tempSourceBedDescription: 'Se apaga cuando la cama se enfría por debajo de su umbral',
+    nozzleTempThreshold: 'Umbral de boquilla (°C)',
+    bedTempThreshold: 'Umbral de cama (°C)',
+    bedTempThresholdDescription: 'Igual o por debajo del umbral de la notificación de cama enfriada, para que esa notificación se envíe antes de cortar la corriente',
     edit: 'Editar',
     deleteConfirm: '¿Está seguro de que desea eliminar "{{name}}"? Esto no se puede deshacer.',
     turnOnConfirm: '¿Está seguro de que desea encender "{{name}}"?',

+ 8 - 2
frontend/src/i18n/locales/fr.ts

@@ -6725,8 +6725,14 @@ export default {
     time: 'Temps',
     temp: 'Temp.',
     delayMinutes: 'Délai (minutes)',
-    tempThreshold: 'Seuil de température (°C)',
-    tempThresholdDescription: 'S\'éteint lorsque la buse refroidit en dessous de cette température',
+    tempSource: 'Attendre',
+    tempSourceNozzle: 'Buse',
+    tempSourceBed: 'Plateau',
+    tempSourceNozzleDescription: 'S\'éteint lorsque la buse refroidit sous son seuil',
+    tempSourceBedDescription: 'S\'éteint lorsque le plateau refroidit sous son seuil',
+    nozzleTempThreshold: 'Seuil de la buse (°C)',
+    bedTempThreshold: 'Seuil du plateau (°C)',
+    bedTempThresholdDescription: 'Égal ou inférieur au seuil de la notification de plateau refroidi, pour que celle-ci parte avant la coupure de courant',
     edit: 'Modifier',
     deleteConfirm: 'Êtes-vous sûr de vouloir supprimer "{{name}}" ? Cette action est irréversible.',
     turnOnConfirm: 'Êtes-vous sûr de vouloir allumer "{{name}}" ?',

+ 8 - 2
frontend/src/i18n/locales/it.ts

@@ -6724,8 +6724,14 @@ export default {
     time: 'Tempo',
     temp: 'Temp.',
     delayMinutes: 'Ritardo (minuti)',
-    tempThreshold: 'Soglia temperatura (°C)',
-    tempThresholdDescription: 'Si spegne quando l\'ugello si raffredda sotto questa temperatura',
+    tempSource: 'Attendi',
+    tempSourceNozzle: 'Ugello',
+    tempSourceBed: 'Piatto',
+    tempSourceNozzleDescription: 'Si spegne quando l\'ugello si raffredda sotto la sua soglia',
+    tempSourceBedDescription: 'Si spegne quando il piatto si raffredda sotto la sua soglia',
+    nozzleTempThreshold: 'Soglia ugello (°C)',
+    bedTempThreshold: 'Soglia piatto (°C)',
+    bedTempThresholdDescription: 'Uguale o inferiore alla soglia della notifica di piatto raffreddato, così la notifica parte prima dello spegnimento',
     edit: 'Modifica',
     deleteConfirm: 'Sei sicuro di voler eliminare "{{name}}"? Questa azione non può essere annullata.',
     turnOnConfirm: 'Sei sicuro di voler accendere "{{name}}"?',

+ 8 - 2
frontend/src/i18n/locales/ja.ts

@@ -6738,8 +6738,14 @@ export default {
     time: '時間',
     temp: '温度',
     delayMinutes: '遅延(分)',
-    tempThreshold: '温度しきい値(°C)',
-    tempThresholdDescription: 'ノズルがこの温度以下に冷却されるとオフになります',
+    tempSource: '待機対象',
+    tempSourceNozzle: 'ノズル',
+    tempSourceBed: 'ベッド',
+    tempSourceNozzleDescription: 'ノズルがしきい値以下に冷却されるとオフになります',
+    tempSourceBedDescription: 'ベッドがしきい値以下に冷却されるとオフになります',
+    nozzleTempThreshold: 'ノズルしきい値(°C)',
+    bedTempThreshold: 'ベッドしきい値(°C)',
+    bedTempThresholdDescription: 'ベッド冷却通知のしきい値以下に設定すると、電源が切れる前に通知が送信されます',
     edit: '編集',
     deleteConfirm: '"{{name}}"を削除してもよろしいですか?この操作は取り消せません。',
     turnOnConfirm: '"{{name}}"をオンにしてもよろしいですか?',

+ 8 - 2
frontend/src/i18n/locales/ko.ts

@@ -6464,8 +6464,14 @@ export default {
     time: '시간',
     temp: '온도',
     delayMinutes: '지연 (분)',
-    tempThreshold: '온도 임계값 (°C)',
-    tempThresholdDescription: '노즐이 이 온도 이하로 냉각될 때 끄기',
+    tempSource: '대기 대상',
+    tempSourceNozzle: '노즐',
+    tempSourceBed: '베드',
+    tempSourceNozzleDescription: '노즐이 임계값 이하로 냉각될 때 끄기',
+    tempSourceBedDescription: '베드가 임계값 이하로 냉각될 때 끄기',
+    nozzleTempThreshold: '노즐 임계값 (°C)',
+    bedTempThreshold: '베드 임계값 (°C)',
+    bedTempThresholdDescription: '베드 냉각 알림 임계값 이하로 설정하면 전원이 꺼지기 전에 알림이 전송됩니다',
     edit: '편집',
     deleteConfirm: '"{{name}}"을(를) 삭제하시겠습니까? 이 작업은 취소할 수 없습니다.',
     turnOnConfirm: '"{{name}}"을(를) 켜시겠습니까?',

+ 8 - 2
frontend/src/i18n/locales/nl.ts

@@ -6788,8 +6788,14 @@ export default {
     time: 'Tijd',
     temp: 'Temp',
     delayMinutes: 'Vertraging (minuten)',
-    tempThreshold: 'Temperatuurdrempel (°C)',
-    tempThresholdDescription: 'Schakelt uit wanneer de nozzle onder deze temperatuur is afgekoeld',
+    tempSource: 'Wachten op',
+    tempSourceNozzle: 'Nozzle',
+    tempSourceBed: 'Printbed',
+    tempSourceNozzleDescription: 'Schakelt uit wanneer de nozzle onder zijn drempel is afgekoeld',
+    tempSourceBedDescription: 'Schakelt uit wanneer het printbed onder zijn drempel is afgekoeld',
+    nozzleTempThreshold: 'Nozzledrempel (°C)',
+    bedTempThreshold: 'Printbeddrempel (°C)',
+    bedTempThresholdDescription: 'Gelijk aan of lager dan de drempel van de melding voor afgekoeld bed, zodat die melding vóór het uitschakelen wordt verstuurd',
     edit: 'Bewerken',
     deleteConfirm: 'Weet je zeker dat je "{{name}}" wilt verwijderen? Dit kan niet ongedaan worden gemaakt.',
     turnOnConfirm: 'Weet je zeker dat je "{{name}}" wilt inschakelen?',

+ 8 - 2
frontend/src/i18n/locales/pl.ts

@@ -6790,8 +6790,14 @@ export default {
     time: 'Czas',
     temp: 'Temp.',
     delayMinutes: 'Opóźnienie (minuty)',
-    tempThreshold: 'Próg temperatury (°C)',
-    tempThresholdDescription: 'Wyłącza, gdy dysza ostygnie poniżej tej temperatury',
+    tempSource: 'Czekaj na',
+    tempSourceNozzle: 'Dysza',
+    tempSourceBed: 'Stół',
+    tempSourceNozzleDescription: 'Wyłącza, gdy dysza ostygnie poniżej swojego progu',
+    tempSourceBedDescription: 'Wyłącza, gdy stół ostygnie poniżej swojego progu',
+    nozzleTempThreshold: 'Próg dyszy (°C)',
+    bedTempThreshold: 'Próg stołu (°C)',
+    bedTempThresholdDescription: 'Ustaw na progu powiadomienia o ostygnięciu stołu lub poniżej, aby to powiadomienie zostało wysłane przed odcięciem zasilania',
     edit: 'Edytuj',
     deleteConfirm: 'Czy na pewno chcesz usunąć „{{name}}”? Tej operacji nie można cofnąć.',
     turnOnConfirm: 'Czy na pewno chcesz włączyć „{{name}}”?',

+ 8 - 2
frontend/src/i18n/locales/pt-BR.ts

@@ -6724,8 +6724,14 @@ export default {
     time: 'Tempo',
     temp: 'Temp.',
     delayMinutes: 'Atraso (minutos)',
-    tempThreshold: 'Limite de temperatura (°C)',
-    tempThresholdDescription: 'Desliga quando o bico esfria abaixo desta temperatura',
+    tempSource: 'Aguardar',
+    tempSourceNozzle: 'Bico',
+    tempSourceBed: 'Cama',
+    tempSourceNozzleDescription: 'Desliga quando o bico esfria abaixo do seu limite',
+    tempSourceBedDescription: 'Desliga quando a cama esfria abaixo do seu limite',
+    nozzleTempThreshold: 'Limite do bico (°C)',
+    bedTempThreshold: 'Limite da cama (°C)',
+    bedTempThresholdDescription: 'Igual ou abaixo do limite da notificação de cama resfriada, para que essa notificação seja enviada antes de desligar a energia',
     edit: 'Editar',
     deleteConfirm: 'Tem certeza que deseja excluir "{{name}}"? Esta ação não pode ser desfeita.',
     turnOnConfirm: 'Tem certeza que deseja ligar "{{name}}"?',

+ 8 - 2
frontend/src/i18n/locales/ru.ts

@@ -6455,8 +6455,14 @@ export default {
     time: "Время",
     temp: "Температура",
     delayMinutes: "Задержка (мин)",
-    tempThreshold: "Порог температуры (°C)",
-    tempThresholdDescription: "Выключать, когда сопло остынет ниже этой температуры",
+    tempSource: "Ждать",
+    tempSourceNozzle: "Сопло",
+    tempSourceBed: "Стол",
+    tempSourceNozzleDescription: "Выключать, когда сопло остынет ниже своего порога",
+    tempSourceBedDescription: "Выключать, когда стол остынет ниже своего порога",
+    nozzleTempThreshold: "Порог сопла (°C)",
+    bedTempThreshold: "Порог стола (°C)",
+    bedTempThresholdDescription: "Не выше порога уведомления об остывании стола, чтобы уведомление ушло до отключения питания",
     edit: "Изменить",
     deleteConfirm: "Удалить «{{name}}»? Это действие нельзя отменить.",
     turnOnConfirm: "Включить «{{name}}»?",

+ 8 - 2
frontend/src/i18n/locales/sv.ts

@@ -6819,8 +6819,14 @@ errors: {
     time: 'Tid',
     temp: 'Temp',
     delayMinutes: 'Fördröjning (minuter)',
-    tempThreshold: 'Temperaturtröskelvärde (°C)',
-    tempThresholdDescription: 'Stäng av när munstycket svalnar under detta tröskelvärde',
+    tempSource: 'Vänta på',
+    tempSourceNozzle: 'Munstycke',
+    tempSourceBed: 'Byggplatta',
+    tempSourceNozzleDescription: 'Stäng av när munstycket svalnar under sitt tröskelvärde',
+    tempSourceBedDescription: 'Stäng av när byggplattan svalnar under sitt tröskelvärde',
+    nozzleTempThreshold: 'Tröskelvärde för munstycke (°C)',
+    bedTempThreshold: 'Tröskelvärde för byggplatta (°C)',
+    bedTempThresholdDescription: 'Högst tröskelvärdet för aviseringen om sval byggplatta, så att aviseringen skickas innan strömmen bryts',
     edit: 'Redigera',
     deleteConfirm: 'Är du säker på att du vill ta bort "{{name}}"? Detta kan inte ångras.',
     turnOnConfirm: 'Är du säker på att du vill sätta på "{{name}}"?',

+ 8 - 2
frontend/src/i18n/locales/tr.ts

@@ -6700,8 +6700,14 @@ export default {
     time: 'Süre',
     temp: 'Sıcaklık',
     delayMinutes: 'Gecikme (dakika)',
-    tempThreshold: 'Sıcaklık eşiği (°C)',
-    tempThresholdDescription: 'Nozul bu sıcaklığın altına soğuduğunda kapanır',
+    tempSource: 'Bekle',
+    tempSourceNozzle: 'Nozul',
+    tempSourceBed: 'Tabla',
+    tempSourceNozzleDescription: 'Nozul eşiğinin altına soğuduğunda kapanır',
+    tempSourceBedDescription: 'Tabla eşiğinin altına soğuduğunda kapanır',
+    nozzleTempThreshold: 'Nozul eşiği (°C)',
+    bedTempThreshold: 'Tabla eşiği (°C)',
+    bedTempThresholdDescription: 'Tabla soğuma bildirimi eşiğine eşit veya altında olursa, bu bildirim güç kesilmeden önce gönderilir',
     edit: 'Düzenle',
     deleteConfirm: '"{{name}}" silmek istediğinizden emin misiniz? Bu geri alınamaz.',
     turnOnConfirm: '"{{name}}" açmak istediğinizden emin misiniz?',

+ 8 - 2
frontend/src/i18n/locales/uk.ts

@@ -6778,8 +6778,14 @@ export default {
     time: "Час",
     temp: "Температура",
     delayMinutes: "Затримка (хвилин)",
-    tempThreshold: "Температурний поріг (°C)",
-    tempThresholdDescription: "Вимикається, коли сопло охолоне нижче цієї температури",
+    tempSource: "Чекати на",
+    tempSourceNozzle: "Сопло",
+    tempSourceBed: "Стіл",
+    tempSourceNozzleDescription: "Вимикається, коли сопло охолоне нижче свого порогу",
+    tempSourceBedDescription: "Вимикається, коли стіл охолоне нижче свого порогу",
+    nozzleTempThreshold: "Поріг сопла (°C)",
+    bedTempThreshold: "Поріг столу (°C)",
+    bedTempThresholdDescription: "Не вище порогу сповіщення про охолодження столу, щоб сповіщення надійшло до вимкнення живлення",
     edit: "Редагувати",
     deleteConfirm: "Ви впевнені, що хочете видалити \"{{name}}\"? Це неможливо скасувати.",
     turnOnConfirm: "Ви впевнені, що бажаєте ввімкнути \"{{name}}\"?",

+ 8 - 2
frontend/src/i18n/locales/zh-CN.ts

@@ -6723,8 +6723,14 @@ export default {
     time: '时间',
     temp: '温度',
     delayMinutes: '延迟(分钟)',
-    tempThreshold: '温度阈值(°C)',
-    tempThresholdDescription: '当喷嘴冷却到此温度以下时关闭',
+    tempSource: '等待',
+    tempSourceNozzle: '喷嘴',
+    tempSourceBed: '热床',
+    tempSourceNozzleDescription: '当喷嘴冷却到其阈值以下时关闭',
+    tempSourceBedDescription: '当热床冷却到其阈值以下时关闭',
+    nozzleTempThreshold: '喷嘴阈值(°C)',
+    bedTempThreshold: '热床阈值(°C)',
+    bedTempThresholdDescription: '设为不高于热床冷却通知的阈值,该通知会在断电前发送',
     edit: '编辑',
     deleteConfirm: '确定要删除"{{name}}"吗?此操作无法撤销。',
     turnOnConfirm: '确定要开启"{{name}}"吗?',

+ 8 - 2
frontend/src/i18n/locales/zh-TW.ts

@@ -6723,8 +6723,14 @@ export default {
     time: '時間',
     temp: '溫度',
     delayMinutes: '延遲(分鐘)',
-    tempThreshold: '溫度閾值(°C)',
-    tempThresholdDescription: '當噴嘴冷卻到此溫度以下時關閉',
+    tempSource: '等待',
+    tempSourceNozzle: '噴嘴',
+    tempSourceBed: '熱床',
+    tempSourceNozzleDescription: '當噴嘴冷卻到其閾值以下時關閉',
+    tempSourceBedDescription: '當熱床冷卻到其閾值以下時關閉',
+    nozzleTempThreshold: '噴嘴閾值(°C)',
+    bedTempThreshold: '熱床閾值(°C)',
+    bedTempThresholdDescription: '設為不高於熱床冷卻通知的閾值,該通知會在斷電前發送',
     edit: '編輯',
     deleteConfirm: '確定要刪除"{{name}}"嗎?此操作無法復原。',
     turnOnConfirm: '確定要開啟"{{name}}"嗎?',