mirror of
https://github.com/esphome/esphome.git
synced 2024-11-26 00:48:19 +01:00
Fix restoring globals (#2442)
This commit is contained in:
parent
87358e8843
commit
871d3b66fb
1 changed files with 5 additions and 2 deletions
|
@ -638,7 +638,7 @@ async def process_lambda(
|
||||||
:param return_type: The return type of the lambda.
|
:param return_type: The return type of the lambda.
|
||||||
:return: The generated lambda expression.
|
:return: The generated lambda expression.
|
||||||
"""
|
"""
|
||||||
from esphome.components.globals import GlobalsComponent
|
from esphome.components.globals import GlobalsComponent, RestoringGlobalsComponent
|
||||||
|
|
||||||
if value is None:
|
if value is None:
|
||||||
return
|
return
|
||||||
|
@ -648,7 +648,10 @@ async def process_lambda(
|
||||||
if (
|
if (
|
||||||
full_id is not None
|
full_id is not None
|
||||||
and isinstance(full_id.type, MockObjClass)
|
and isinstance(full_id.type, MockObjClass)
|
||||||
and full_id.type.inherits_from(GlobalsComponent)
|
and (
|
||||||
|
full_id.type.inherits_from(GlobalsComponent)
|
||||||
|
or full_id.type.inherits_from(RestoringGlobalsComponent)
|
||||||
|
)
|
||||||
):
|
):
|
||||||
parts[i * 3 + 1] = var.value()
|
parts[i * 3 + 1] = var.value()
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in a new issue