mirror of
https://github.com/esphome/esphome.git
synced 2026-10-19 12:42:50 +00:00
Reject an unknown publish= value
This commit is contained in:
@@ -559,6 +559,8 @@ class SubEntities:
|
||||
raise ValueError(f"{entity_id}: apply= needs a parent")
|
||||
if publish is not None and (apply is None or self.apply_entity.publish is None):
|
||||
raise ValueError(f"{entity_id}: publish= needs apply= on a stateful domain")
|
||||
if publish not in (None, "before", "after"):
|
||||
raise ValueError(f'{entity_id}: publish= must be "before" or "after"')
|
||||
|
||||
if apply is None:
|
||||
var = await self.new_entity(conf, *args, **kwargs)
|
||||
|
||||
@@ -1458,6 +1458,12 @@ async def test_sub_entities_apply_parent_id(
|
||||
{"publish": "before"},
|
||||
"publish= needs",
|
||||
),
|
||||
(
|
||||
_SWITCH_APPLY,
|
||||
_apply_conf("k_id"),
|
||||
{"apply": "x()", "publish": "Before"},
|
||||
"must be",
|
||||
),
|
||||
],
|
||||
)
|
||||
async def test_sub_entities_apply_errors(
|
||||
|
||||
Reference in New Issue
Block a user