257 files
This commit is contained in:
@@ -21,6 +21,7 @@ from ..const import (
|
||||
MAX_TIMESTAMP_LENGTH,
|
||||
)
|
||||
from ..helpers.completion_photos import MAX_COMPLETION_PHOTOS, normalize_photo_doc_ids
|
||||
from ..helpers.parts import MAX_PART_STOCK
|
||||
from ..helpers.ws_errors import send_exception_error, send_translated_error
|
||||
from ..models.maintenance_task import MaintenanceTask
|
||||
from . import (
|
||||
@@ -106,7 +107,7 @@ def _refuse_too_early(connection: websocket_api.ActiveConnection, msg: dict[str,
|
||||
vol.Optional("reading_values"): READING_VALUES_FIELD,
|
||||
# Spare parts: on an auto-created "buy" task, how many units were
|
||||
# actually bought (dialog override of the part's restock_quantity).
|
||||
vol.Optional("restock_quantity"): vol.Any(vol.All(vol.Any(int, float), vol.Coerce(float), vol.Range(min=0.01, max=9999)), None),
|
||||
vol.Optional("restock_quantity"): vol.Any(vol.All(vol.Any(int, float), vol.Coerce(float), vol.Range(min=0.01, max=MAX_PART_STOCK)), None),
|
||||
# #99: the parts actually used on THIS completion. An explicit list
|
||||
# (even an empty one) REPLACES the task's automatic consumes_parts
|
||||
# deduction; omitting the key keeps the automatic behaviour.
|
||||
@@ -459,7 +460,8 @@ async def ws_snooze_task(
|
||||
due-soon/overdue/triggered reminders for ``snooze_duration_hours`` — it does
|
||||
not change the task's schedule or state.
|
||||
"""
|
||||
from ..const import DOMAIN, NOTIFICATION_MANAGER_KEY
|
||||
from ..const import CONF_SNOOZE_DURATION_HOURS, DOMAIN, NOTIFICATION_MANAGER_KEY
|
||||
from ..helpers.global_options import global_option
|
||||
|
||||
if _load_object_task(hass, connection, msg) is None:
|
||||
return
|
||||
@@ -468,8 +470,11 @@ async def ws_snooze_task(
|
||||
if nm is None:
|
||||
send_translated_error(connection, msg["id"], "unavailable", "Notifications not configured", translation_key="notify_not_configured")
|
||||
return
|
||||
nm.snooze_task(msg["entry_id"], msg["task_id"])
|
||||
connection.send_result(msg["id"], {"success": True})
|
||||
until = nm.snooze_task(msg["entry_id"], msg["task_id"])
|
||||
# #193: the panel names the duration — "Snoozed" alone left users
|
||||
# wondering what happened and for how long.
|
||||
hours = global_option(hass, CONF_SNOOZE_DURATION_HOURS)
|
||||
connection.send_result(msg["id"], {"success": True, "hours": hours, "snoozed_until": until.isoformat()})
|
||||
|
||||
|
||||
@websocket_api.websocket_command(
|
||||
|
||||
Reference in New Issue
Block a user