Improve handling of template platforms when entity extraction fails (#37831)
Most of the the template platforms would check for extract_entities failing to extract entities and avoid setting up a state change listner for MATCH_ALL after extract_entities had warned that it could not extract the entities and updates would need to be done manually. This protection has been extended to all template platforms. Alter the behavior of extract_entities to return the successfully extracted entities if one or more templates fail extraction instead of returning MATCH_ALL
This commit is contained in:
1 parent
e938dcfbda
commit
44fefb3216
12 files changed
+63
-44
No files matched your search
@@ -618,10 +618,11 @@ async def test_no_template_match_all(hass, caplog):
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert hass.states.get("sensor.invalid_state").state == "2"
|
||||
assert hass.states.get("sensor.invalid_icon").state == "startup"
|
||||
assert hass.states.get("sensor.invalid_entity_picture").state == "startup"
|
||||
assert hass.states.get("sensor.invalid_friendly_name").state == "startup"
|
||||
assert hass.states.get("sensor.invalid_attribute").state == "startup"
|
||||
# Will now process because we have at least one valid template
|
||||
assert hass.states.get("sensor.invalid_icon").state == "hello"
|
||||
assert hass.states.get("sensor.invalid_entity_picture").state == "hello"
|
||||
assert hass.states.get("sensor.invalid_friendly_name").state == "hello"
|
||||
assert hass.states.get("sensor.invalid_attribute").state == "hello"
|
||||
|
||||
await hass.helpers.entity_component.async_update_entity("sensor.invalid_state")
|
||||
await hass.helpers.entity_component.async_update_entity("sensor.invalid_icon")
|
||||
|
||||
Reference in new issue
Block a user