diff --git a/homeassistant/components/notify/__init__.py b/homeassistant/components/notify/__init__.py index c779c78d15e..b30777a0cf2 100644 --- a/homeassistant/components/notify/__init__.py +++ b/homeassistant/components/notify/__init__.py @@ -101,7 +101,7 @@ def setup(hass, config): if targets.get(call.service) is not None: kwargs[ATTR_TARGET] = [targets[call.service]] - else: + elif call.data.get(ATTR_TARGET) is not None: kwargs[ATTR_TARGET] = call.data.get(ATTR_TARGET) message.hass = hass diff --git a/tests/components/notify/test_demo.py b/tests/components/notify/test_demo.py index 0d41f0606e5..a0d9f28fe1a 100644 --- a/tests/components/notify/test_demo.py +++ b/tests/components/notify/test_demo.py @@ -64,7 +64,6 @@ class TestNotifyDemo(unittest.TestCase): data = self.events[0].data assert { 'message': 'my message', - 'target': None, 'title': 'my title', 'data': {'hello': 'world'} } == data @@ -92,7 +91,6 @@ data_template: self.assertTrue(len(self.events) == 1) assert { 'message': 'Test 123 4', - 'target': None, 'data': { 'push': { 'sound': @@ -124,7 +122,6 @@ data_template: assert { 'message': 'Test 123 4', 'title': 'Test', - 'target': None, 'data': { 'push': { 'sound':