Skip to content

Commit

Permalink
Notify: Only attach target if in call data (home-assistant#3831)
Browse files Browse the repository at this point in the history
* Only pass through the target if it has a value

* Target will no longer be none
  • Loading branch information
robbiet480 authored and balloob committed Oct 12, 2016
1 parent e135691 commit d302dbe
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
2 changes: 1 addition & 1 deletion homeassistant/components/notify/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def notify_message(notify_service, call):

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
Expand Down
3 changes: 0 additions & 3 deletions tests/components/notify/test_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ def test_method_forwards_correct_data(self):
data = self.events[0].data
assert {
'message': 'my message',
'target': None,
'title': 'my title',
'data': {'hello': 'world'}
} == data
Expand Down Expand Up @@ -92,7 +91,6 @@ def test_calling_notify_from_script_loaded_from_yaml_without_title(self):
self.assertTrue(len(self.events) == 1)
assert {
'message': 'Test 123 4',
'target': None,
'data': {
'push': {
'sound':
Expand Down Expand Up @@ -124,7 +122,6 @@ def test_calling_notify_from_script_loaded_from_yaml_with_title(self):
assert {
'message': 'Test 123 4',
'title': 'Test',
'target': None,
'data': {
'push': {
'sound':
Expand Down

0 comments on commit d302dbe

Please sign in to comment.