Skip to content

Commit 41b543b

Browse files
committed
updated mqtt_trigger() stub for new encoding arg
1 parent 02ab26e commit 41b543b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

custom_components/pyscript/stubs/pyscript_builtins.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,15 @@ def time_active(*time_spec: str, hold_off: int | float | None = None) -> Callabl
105105
...
106106

107107

108-
def mqtt_trigger(topic: str, str_expr: str | None = None, **kwargs) -> Callable[..., Any]:
108+
def mqtt_trigger(
109+
topic: str, str_expr: str | None = None, encoding: str = "utf-8", **kwargs
110+
) -> Callable[..., Any]:
109111
"""Trigger when a subscribed MQTT message matches the specification.
110112
111113
Args:
112114
topic: MQTT topic to monitor; wildcards ``+`` and ``#`` are supported.
113115
str_expr: Optional expression evaluated against ``payload``, ``payload_obj``, ``retain``, ``topic``, and ``qos``.
116+
encoding: Character encoding for MQTT payload decoding; defaults to ``"utf-8"``.
114117
kwargs: Extra keyword arguments merged into each invocation.
115118
"""
116119
...
@@ -417,6 +420,7 @@ def wait_until(
417420
time_trigger: str | list[str] | None = None,
418421
event_trigger: str | list[str] | None = None,
419422
mqtt_trigger: str | list[str] | None = None,
423+
mqtt_trigger_encoding: str | None = None,
420424
webhook_trigger: str | list[str] | None = None,
421425
webhook_local_only: bool = True,
422426
webhook_methods: list[str] = ("POST", "PUT"),
@@ -432,6 +436,7 @@ def wait_until(
432436
time_trigger: Time specifications matching ``@time_trigger`` semantics.
433437
event_trigger: Event types or filters matching ``@event_trigger`` semantics.
434438
mqtt_trigger: MQTT topics or filters matching ``@mqtt_trigger`` semantics.
439+
mqtt_trigger_encoding: Character encoding for MQTT payload decoding; defaults to ``"utf-8"`` when omitted.
435440
webhook_trigger: Webhook ids matching ``@webhook_trigger`` semantics.
436441
webhook_local_only: Limit webhooks to local network clients when ``True``.
437442
webhook_methods: Allowed HTTP methods for webhook triggers.

0 commit comments

Comments
 (0)