Skip to content

Commit

Permalink
DocPruebas
Browse files Browse the repository at this point in the history
  • Loading branch information
VanessaHuertas committed May 9, 2018
1 parent be77de3 commit ca4303c
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 5 deletions.
Binary file added Docs/PruebasMensajesSS.docx
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions EntidadVirtual/ServidorMensajeria&Correo/MandaCorreosPruebas.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env python3
import time
import paho.mqtt.client as mqtt_connect

user = mqtt_connect.Client("C2")

user.connect('localhost', port=8083)
error = 0
alarmas = 300000
tiempoinicial = time.time()

for i in range(0, alarmas):
user.publish("conjunto1/residencia1/alerta", payload='Alerta, Intruso!!!')

tiempofinal = time.time() - tiempoinicial
print('Tiempo de envío en segundos:', int(tiempofinal))
print('Porcentaje de error: ' + str(error) + '%')


14 changes: 9 additions & 5 deletions EntidadVirtual/ServidorMensajeria&Correo/Notificador.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,20 @@

user = mqtt_connect.Client("C1")

user.connect("157.253.227.89", port=8083)
user.connect('localhost', port=8083)
user.subscribe("conjunto1/residencia1/alerta")

address = '[email protected]'
sender = '[email protected]'
smtp.login(sender, 'vanessa98')
sender = '[email protected]'


def on_message(user, data, message):
tiempoinicial = time.time()
send_msg(message.payload.decode('utf-8'), message.topic)
print('Calidad del mensaje: ', str(message.qos))
tiempofinal = time.time() - tiempoinicial
print('Tiempo de respuesta en segundos', int(tiempofinal))
print(' ')


def send_msg(mensaje, asunto):
Expand All @@ -31,8 +34,10 @@ def send_msg(mensaje, asunto):
mime_message["Subject"] = asunto

try:
smtp = smtplib.SMTP('smtp.office365.com')
smtp = smtplib.SMTP('smtp.gmail.com:587')
smtp.ehlo()
smtp.starttls()
smtp.login(sender, 'tatiana vanessa98')
smtp.send_message(mime_message)
print('Correo enviado')
smtp.quit()
Expand All @@ -41,7 +46,6 @@ def send_msg(mensaje, asunto):


user.on_message = on_message

user.loop_start()
time.sleep(1000)
user.loop_stop()
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
contador = 0
salida = True


def on_subscribe(client, userdata,mid,granted_qos):
print("subscribed: "+str(mid)+" "+str(granted_qos))

Expand Down

0 comments on commit ca4303c

Please sign in to comment.