-
-
Notifications
You must be signed in to change notification settings - Fork 442
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Home Assistant Notification Support #354
Conversation
721a249
to
f860da4
Compare
if isinstance(self.port, int): | ||
url += ':%d' % self.port | ||
|
||
url += '/' + self.fullpath.strip('/') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@caronc you have the url
method below. it looks like you are constructing the url
manually here. why don't you use the url
method instead?
I seem to have run into an issue here. when the self.fullpath
is empty, the url becomes like //api/services/persistent_notification/create
, which causes the error
Socket Exception: HTTPConnectionPool(host='localhost', port=8123): Max retries exceeded with url: //api/services/persistent_notification/create (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0xffff8b9d0730>, 'Connection to localhost timed out. (connect timeout=4.0)'))
My example URLs are:
hassio://localhost/{access_token}
hassio://localhost:8123/{access_token}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good find; I'll get this fixed.
Description:
Related issue (if applicable): #350
Added Home Assistant Notification Support to Apprise
Details:
Syntax:
hassio://{host}/{long-lived-access-token}
hassio://{user}:{pass}:{host}/{long-lived-access-token}
hassio://{user}:{pass}:{host}:{port}/{long-lived-access-token}
hassio://{host}/optional/path/{long-lived-access-token}
hassio://{user}:{pass}:{host}/optional/path/{long-lived-access-token}
hassio://{user}:{pass}:{host}:{port}/optional/path/{long-lived-access-token}
By default
hassio://
will use port8123
(unless you otherwise specify). If you usehassios://
(adding ans
) to the end, then you use thehttps
protocol on port443
(unless otherwise specified).So the same URL's above could be written using a secure connection/port as:
hassios://{host}/{long-lived-access-token}
hassios://{user}:{pass}:{host}/{long-lived-access-token}
hassios://{user}:{pass}:{host}:{port}/{long-lived-access-token}
hassios://{host}/optional/path/{long-lived-access-token}
hassios://{user}:{pass}:{host}/optional/path/{long-lived-access-token}
hassios://{user}:{pass}:{host}:{port}/optional/path/{long-lived-access-token}
The other thing to note is that Home Assistant requires a
notification_id
associated with each message sent. If the ID is the same as the previous, then the previous message is over-written with the new. This may or may not be what your goal is.So by default Apprise will generate a unique ID (thus a separate message) on every call. If this isn't the effect you're going for, then define your own Notification ID like so:
hassio://{host}/{long-lived-access-token}?nid=myid
New Service Completion Status
keywords
section of thesetup()
declaration%global common_description
Checklist
flake8
)