1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Raise ConditionError for numeric_state errors (#45923)

This commit is contained in:
Anders Melchiorsen
2021-02-08 10:47:57 +01:00
committed by GitHub
parent 9e07910ab0
commit b9b1caf4d7
10 changed files with 352 additions and 63 deletions

View File

@@ -162,18 +162,20 @@ async def test_trigger_service_ignoring_condition(hass, calls):
"alias": "test",
"trigger": [{"platform": "event", "event_type": "test_event"}],
"condition": {
"condition": "state",
"condition": "numeric_state",
"entity_id": "non.existing",
"state": "beer",
"above": "1",
},
"action": {"service": "test.automation"},
}
},
)
hass.bus.async_fire("test_event")
await hass.async_block_till_done()
assert len(calls) == 0
with patch("homeassistant.components.automation.LOGGER.warning") as logwarn:
hass.bus.async_fire("test_event")
await hass.async_block_till_done()
assert len(calls) == 0
assert len(logwarn.mock_calls) == 1
await hass.services.async_call(
"automation", "trigger", {"entity_id": "automation.test"}, blocking=True