Automation: Add trigger context and expose to action
This commit is contained in:
parent
c4913a87e4
commit
4e568f8b99
20 changed files with 232 additions and 69 deletions
|
@ -51,7 +51,10 @@ class TestAutomation(unittest.TestCase):
|
|||
},
|
||||
'action': {
|
||||
'service': 'test.automation',
|
||||
'data': {'some': 'data'}
|
||||
'data_template': {
|
||||
'some': '{{ trigger.platform }} - '
|
||||
'{{ trigger.event.event_type }}'
|
||||
},
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -59,7 +62,7 @@ class TestAutomation(unittest.TestCase):
|
|||
self.hass.bus.fire('test_event')
|
||||
self.hass.pool.block_till_done()
|
||||
self.assertEqual(1, len(self.calls))
|
||||
self.assertEqual('data', self.calls[0].data['some'])
|
||||
self.assertEqual('event - test_event', self.calls[0].data['some'])
|
||||
|
||||
def test_service_specify_entity_id(self):
|
||||
"""Test service data."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue