Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mirrored_repos
HomeAssistant
Core
Commits
4a16d806
Commit
4a16d806
authored
8 years ago
by
Fabian Affolter
Committed by
Paulus Schoutsen
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Enable certificate verification and allow non-encrypted communication (#1763)
parent
9d848731
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
homeassistant/components/notify/xmpp.py
+15
-9
15 additions, 9 deletions
homeassistant/components/notify/xmpp.py
requirements_all.txt
+6
-0
6 additions, 0 deletions
requirements_all.txt
with
21 additions
and
9 deletions
homeassistant/components/notify/xmpp.py
+
15
−
9
View file @
4a16d806
...
...
@@ -10,7 +10,10 @@ from homeassistant.components.notify import (
ATTR_TITLE
,
DOMAIN
,
BaseNotificationService
)
from
homeassistant.helpers
import
validate_config
REQUIREMENTS
=
[
'
sleekxmpp==1.3.1
'
,
'
dnspython3==1.12.0
'
]
REQUIREMENTS
=
[
'
sleekxmpp==1.3.1
'
,
'
dnspython3==1.12.0
'
,
'
pyasn1==0.1.9
'
,
'
pyasn1-modules==0.0.8
'
]
_LOGGER
=
logging
.
getLogger
(
__name__
)
...
...
@@ -22,20 +25,23 @@ def get_service(hass, config):
_LOGGER
):
return
None
return
XmppNotificationService
(
config
[
'
sender
'
],
config
[
'
password
'
],
config
[
'
recipient
'
])
return
XmppNotificationService
(
config
.
get
(
'
sender
'
),
config
.
get
(
'
password
'
),
config
.
get
(
'
recipient
'
),
config
.
get
(
'
tls
'
,
True
))
# pylint: disable=too-few-public-methods
class
XmppNotificationService
(
BaseNotificationService
):
"""
Implement the notification service for Jabber (XMPP).
"""
def
__init__
(
self
,
sender
,
password
,
recipient
):
def
__init__
(
self
,
sender
,
password
,
recipient
,
tls
):
"""
Initialize the service.
"""
self
.
_sender
=
sender
self
.
_password
=
password
self
.
_recipient
=
recipient
self
.
_tls
=
tls
def
send_message
(
self
,
message
=
""
,
**
kwargs
):
"""
Send a message to a user.
"""
...
...
@@ -43,10 +49,10 @@ class XmppNotificationService(BaseNotificationService):
data
=
"
{}: {}
"
.
format
(
title
,
message
)
if
title
else
message
send_message
(
self
.
_sender
+
'
/home-assistant
'
,
self
.
_password
,
self
.
_recipient
,
data
)
self
.
_recipient
,
self
.
_tls
,
data
)
def
send_message
(
sender
,
password
,
recipient
,
message
):
def
send_message
(
sender
,
password
,
recipient
,
use_tls
,
message
):
"""
Send a message over XMPP.
"""
import
sleekxmpp
...
...
@@ -59,11 +65,11 @@ def send_message(sender, password, recipient, message):
logging
.
basicConfig
(
level
=
logging
.
ERROR
)
self
.
use_tls
=
True
self
.
use_tls
=
use_tls
self
.
use_ipv6
=
False
self
.
add_event_handler
(
'
failed_auth
'
,
self
.
check_credentials
)
self
.
add_event_handler
(
'
session_start
'
,
self
.
start
)
self
.
connect
()
self
.
connect
(
use_tls
=
self
.
use_tls
,
use_ssl
=
False
)
self
.
process
()
def
start
(
self
,
event
):
...
...
This diff is collapsed.
Click to expand it.
requirements_all.txt
+
6
−
0
View file @
4a16d806
...
...
@@ -177,6 +177,12 @@ py-cpuinfo==0.2.3
# homeassistant.components.rfxtrx
pyRFXtrx==0.6.5
# homeassistant.components.notify.xmpp
pyasn1-modules==0.0.8
# homeassistant.components.notify.xmpp
pyasn1==0.1.9
# homeassistant.components.media_player.cast
pychromecast==0.7.2
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment