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

Initial script condition support (#1910)

This commit is contained in:
Paulus Schoutsen
2016-04-28 12:03:57 +02:00
parent 953223b81b
commit 6354399d55
19 changed files with 656 additions and 427 deletions

View File

@@ -146,12 +146,12 @@ class TestAutomation(unittest.TestCase):
],
'condition': [
{
'platform': 'state',
'condition': 'state',
'entity_id': entity_id,
'state': '100'
},
{
'platform': 'numeric_state',
'condition': 'numeric_state',
'entity_id': entity_id,
'below': 150
}
@@ -231,6 +231,7 @@ class TestAutomation(unittest.TestCase):
{
'platform': 'state',
'entity_id': entity_id,
'from': '120',
'state': '100'
},
{
@@ -248,10 +249,14 @@ class TestAutomation(unittest.TestCase):
self.hass.states.set(entity_id, 100)
self.hass.pool.block_till_done()
self.assertEqual(2, len(self.calls))
self.assertEqual(1, len(self.calls))
self.hass.states.set(entity_id, 120)
self.hass.pool.block_till_done()
self.assertEqual(1, len(self.calls))
self.hass.states.set(entity_id, 100)
self.hass.pool.block_till_done()
self.assertEqual(2, len(self.calls))
self.hass.states.set(entity_id, 151)