diff --git a/apprise/plugins/NotifyJoin.py b/apprise/plugins/NotifyJoin.py index 76011d98..278ddaef 100644 --- a/apprise/plugins/NotifyJoin.py +++ b/apprise/plugins/NotifyJoin.py @@ -130,6 +130,11 @@ class NotifyJoin(NotifyBase): 'regex': (r'^[a-z0-9]{32}$', 'i'), 'map_to': 'targets', }, + 'device_name': { + 'name': _('Device Name'), + 'type': 'string', + 'map_to': 'targets', + }, 'group': { 'name': _('Group'), 'type': 'choice:string', @@ -210,18 +215,7 @@ class NotifyJoin(NotifyBase): 'group.{}'.format(group_re.group('name').lower())) continue - elif IS_DEVICE_RE.match(target): - self.targets.append(target) - continue - - self.logger.warning( - 'Ignoring invalid Join device/group "{}"'.format(target) - ) - - if not self.targets: - msg = 'No Join targets to notify.' - self.logger.warning(msg) - raise TypeError(msg) + self.targets.append(target) return @@ -247,12 +241,18 @@ class NotifyJoin(NotifyBase): url_args = { 'apikey': self.apikey, - 'deviceId': target, 'priority': str(self.priority), 'title': title, 'text': body, } + if IS_GROUP_RE.match(target) or IS_DEVICE_RE.match(target): + url_args['deviceId'] = target + + else: + # Support Device Names + url_args['deviceNames'] = target + # prepare our image for display if configured to do so image_url = None if not self.include_image \ else self.image_url(notify_type) diff --git a/test/test_rest_plugins.py b/test/test_rest_plugins.py index af3518c6..cabaac26 100644 --- a/test/test_rest_plugins.py +++ b/test/test_rest_plugins.py @@ -921,9 +921,9 @@ TEST_URLS = ( ('join://%s@%s?image=False' % ('a' * 32, 'd' * 32), { 'instance': plugins.NotifyJoin, }), - # API Key + invalid device - ('join://%s/%s' % ('a' * 32, 'k' * 12), { - 'instance': TypeError, + # API Key + Device Name + ('join://%s/%s' % ('a' * 32, 'My Device'), { + 'instance': plugins.NotifyJoin, }), # API Key + device ('join://%s/%s' % ('a' * 32, 'd' * 32), {