mirror of
https://github.com/home-assistant/core.git
synced 2025-07-08 13:57:10 +00:00
Disallow automation.trigger without entity_id (#14724)
This commit is contained in:
parent
f6eb9e79d5
commit
fcbc399809
@ -98,7 +98,7 @@ SERVICE_SCHEMA = vol.Schema({
|
|||||||
})
|
})
|
||||||
|
|
||||||
TRIGGER_SERVICE_SCHEMA = vol.Schema({
|
TRIGGER_SERVICE_SCHEMA = vol.Schema({
|
||||||
vol.Optional(ATTR_ENTITY_ID): cv.entity_ids,
|
vol.Required(ATTR_ENTITY_ID): cv.entity_ids,
|
||||||
vol.Optional(ATTR_VARIABLES, default={}): dict,
|
vol.Optional(ATTR_VARIABLES, default={}): dict,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -207,6 +207,7 @@ class TestAutomation(unittest.TestCase):
|
|||||||
"""Test triggers."""
|
"""Test triggers."""
|
||||||
assert setup_component(self.hass, automation.DOMAIN, {
|
assert setup_component(self.hass, automation.DOMAIN, {
|
||||||
automation.DOMAIN: {
|
automation.DOMAIN: {
|
||||||
|
'alias': 'test',
|
||||||
'trigger': [
|
'trigger': [
|
||||||
{
|
{
|
||||||
'platform': 'event',
|
'platform': 'event',
|
||||||
@ -228,7 +229,9 @@ class TestAutomation(unittest.TestCase):
|
|||||||
self.hass.block_till_done()
|
self.hass.block_till_done()
|
||||||
assert len(self.calls) == 0
|
assert len(self.calls) == 0
|
||||||
|
|
||||||
self.hass.services.call('automation', 'trigger', blocking=True)
|
self.hass.services.call('automation', 'trigger',
|
||||||
|
{'entity_id': 'automation.test'},
|
||||||
|
blocking=True)
|
||||||
self.hass.block_till_done()
|
self.hass.block_till_done()
|
||||||
assert len(self.calls) == 1
|
assert len(self.calls) == 1
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user