mirror of
https://github.com/esphome/esphome.git
synced 2026-07-10 17:05:36 +00:00
[mdns] Add comment explaining why manual lambda wrapping is needed
This commit is contained in:
@@ -132,7 +132,8 @@ def mdns_service(
|
||||
Returns:
|
||||
A StructInitializer representing a MDNSService struct
|
||||
"""
|
||||
# Wrap port in a stateless lambda for TemplatableFn storage
|
||||
# Wrap port in a stateless lambda for TemplatableFn storage.
|
||||
# Can't use cg.templatable() here because this is a sync function.
|
||||
if not isinstance(port, LambdaExpression):
|
||||
port = LambdaExpression(
|
||||
f"return {cg.safe_exp(port)};", [], capture="", return_type=cg.uint16
|
||||
|
||||
Reference in New Issue
Block a user