@@ -36,7 +36,6 def potenciaDefault(AnalogRaw): | |||
|
36 | 36 | potencia[i]=m*AnalogRaw[i]+b |
|
37 | 37 | return potencia |
|
38 | 38 | |
|
39 | ||
|
40 | 39 | def leer_datos_desde_txt(archivo): |
|
41 | 40 | try: |
|
42 | 41 | with open(archivo, 'r') as file: |
@@ -53,7 +52,7 def leer_datos_desde_txt(archivo): | |||
|
53 | 52 | |
|
54 | 53 | def procesamiento_data(analogRawMatriz): |
|
55 | 54 | if analogRawMatriz[0]: |
|
56 |
average_raw=[0,0,0,0,0,0,0,0 |
|
|
55 | average_raw=[0,0,0,0,0,0,0,0] | |
|
57 | 56 | for i in range(8): |
|
58 | 57 | average_raw[i] = sum(analogRawMatriz[i]) / len(analogRawMatriz[i]) |
|
59 | 58 | if(ancho<15): |
@@ -66,12 +65,12 def procesamiento_data(analogRawMatriz): | |||
|
66 | 65 | fecha_utc_menos_5 = fecha_utc.replace(tzinfo=timezone.utc).astimezone(zona_horaria_utc_menos_5) |
|
67 | 66 | fecha_legible=fecha_utc_menos_5.strftime('%d-%m-%Y %H:%M:%S') |
|
68 | 67 | estado=[1 if x > 0 else 0 for x in potenciaNominal] |
|
69 |
processed_data = {"Ancho_us":IPP," |
|
|
68 | processed_data = {"Ancho_us":IPP,"pow": potencia, "time": fecha_legible,"potenciaNominal":potenciaNominal,"status":estado} | |
|
70 | 69 | client.publish(publish_topic, json.dumps(processed_data)) |
|
71 | 70 | print("---------------------------------------") |
|
72 | 71 | print(average_raw) |
|
73 | 72 | print(processed_data) |
|
74 |
print(type(processed_data[" |
|
|
73 | print(type(processed_data["pow"])) | |
|
75 | 74 | |
|
76 | 75 | def on_connect(client, userdata, flags, rc): |
|
77 | 76 | if rc == 0: |
General Comments 0
You need to be logged in to leave comments.
Login now