Libelium is offering new technical support channels, to contact with de Technical Support team to solve any issue our doubt please contact with your sales agent or visit our contact site



Post a new topicPost a reply Page 2 of 2   [ 18 posts ]
Go to page Previous  1, 2
Author Message
 Post subject: Re: Servidor web para Opengarden
PostPosted: Thu Mar 23, 2017 3:14 pm 

Joined: Tue Feb 07, 2017 1:37 pm
Posts: 37
Eso es, la base de datos no aceptaba la conexión. He insertado los comandos desde la terminal del servidor y me salía el error:
ERROR 2003 (HY000): Can't connect to MySQL server on 'IPservidor' (111)
He editado el fichero: /etc/mysql/mysql.conf.d/mysqld.conf y cambiado la línea "bind-address = 0.0.0.0" para enlazar a todas las direcciones en el sistema.

Ahora entro en la app, y veo el estado de los actuadores y puedo modificarlos. el valor se registra tanto en la BBDD cómo en el terminal serie de Arduino.
Sin embargo, no puedo ver el estado de los nodos ni los valores de los sensores; y los datos sí se están registrando en la base de datos.

Ya me decís. Muchas gracias por vuestra ayuda, me está resultando valiosísima.


Top
 Profile  
 
 Post subject: Re: Servidor web para Opengarden
PostPosted: Fri Mar 24, 2017 11:21 am 

Joined: Mon Sep 28, 2009 12:06 pm
Posts: 11366
Hola Maria43,

con esa información no podemos saber exactamente cual es el problema para ayudarte. Por favor visualiza el fichero de errores de Apache cuando hagas la consulta.

Un saludo


Top
 Profile  
 
 Post subject: Re: Servidor web para Opengarden
PostPosted: Fri Mar 24, 2017 2:10 pm 

Joined: Tue Feb 07, 2017 1:37 pm
Posts: 37
Aquí os lo adjunto, pero lo que no entiendo es cómo funciona perfectamente con Actuators y no con los Sensores existiendo valores de los mismos registrados en la base de datos; y pudiendo acceder a mysql desde consola con el mismo usuario; cómo me indicásteis anteriormente.


*************************error.log.1***************************************

[Thu Mar 23 06:25:01.423131 2017] [mpm_prefork:notice] [pid 16388] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Thu Mar 23 06:25:01.423151 2017] [core:notice] [pid 16388] AH00094: Command line: '/usr/sbin/apache2'
[Thu Mar 23 10:27:48.240828 2017] [:error] [pid 29979] [client IPPúbicaMiPC:53608] PHP Warning: mysqli::__construct(): (HY000/2002): Connection refused in /var/www/html/meekrodb.2.2.class.php on line 163, referer: http://IPServidorRemoto/opengarden-app/nodes
[Thu Mar 23 10:27:55.124366 2017] [:error] [pid 31219] [client IPPúbicaMiPC:53613] PHP Warning: mysqli::__construct(): (HY000/2002): Connection refused in /var/www/html/meekrodb.2.2.class.php on line 163, referer: http://IPServidorRemoto/opengarden-app/actuators
[Thu Mar 23 10:27:57.595201 2017] [:error] [pid 31219] [client IPPúbicaMiPC:53613] PHP Warning: mysqli::__construct(): (HY000/2002): Connection refused in /var/www/html/meekrodb.2.2.class.php on line 163, referer: http://IPServidorRemoto/opengarden-app/nodes
[Thu Mar 23 10:28:03.077029 2017] [:error] [pid 31220] [client IPPúbicaMiPC:53615] PHP Warning: mysqli::__construct(): (HY000/2002): Connection refused in /var/www/html/meekrodb.2.2.class.php on line 163, referer: http://IPServidorRemoto/opengarden-app/actuators
[Thu Mar 23 11:40:05.136253 2017] [mpm_prefork:notice] [pid 16388] AH00169: caught SIGTERM, shutting down
[Thu Mar 23 11:40:06.184246 2017] [mpm_prefork:notice] [pid 31844] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Thu Mar 23 11:40:06.184298 2017] [core:notice] [pid 31844] AH00094: Command line: '/usr/sbin/apache2'
[Fri Mar 24 06:25:01.610830 2017] [mpm_prefork:notice] [pid 31844] AH00171: Graceful restart requested, doing restart
[Fri Mar 24 06:25:01.688730 2017] [mpm_prefork:notice] [pid 31844] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Fri Mar 24 06:25:01.688746 2017] [core:notice] [pid 31844] AH00094: Command line: '/usr/sbin/apache2'
[Fri Mar 24 13:26:52.920262 2017] [mpm_prefork:notice] [pid 31844] AH00169: caught SIGTERM, shutting down
[Fri Mar 24 13:27:40.571917 2017] [mpm_prefork:notice] [pid 1269] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Fri Mar 24 13:27:40.572333 2017] [core:notice] [pid 1269] AH00094: Command line: '/usr/sbin/apache2'
[Sat Mar 25 04:37:40.705816 2017] [:error] [pid 1404] [client 88.181.103.36:57509] script '/var/www/html/xmlrpc.php' not found or unable to stat
[Sat Mar 25 06:25:01.490580 2017] [mpm_prefork:notice] [pid 1269] AH00171: Graceful restart requested, doing restart
[Sat Mar 25 06:25:01.554747 2017] [mpm_prefork:notice] [pid 1269] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Sat Mar 25 06:25:01.554762 2017] [core:notice] [pid 1269] AH00094: Command line: '/usr/sbin/apache2'
[Sat Mar 25 22:29:41.829075 2017] [:error] [pid 3900] [client 94.102.49.218:52016] script '/var/www/html/xmlrpc.php' not found or unable to stat
[Sun Mar 26 06:25:01.698660 2017] [mpm_prefork:notice] [pid 1269] AH00171: Graceful restart requested, doing restart

El jueves 23, después de poder acceder a la base de datos, y el sábado 25 tuve los sensores encendidos y grabando en la misma. Tengo 280 registros.
Ya me decís. Muchas gracias.


Top
 Profile  
 
 Post subject: Re: Servidor web para Opengarden
PostPosted: Mon Mar 27, 2017 8:56 am 

Joined: Mon Sep 28, 2009 12:06 pm
Posts: 11366
Hola Maria43,

hemos vuelto a instalar y replicar la base de datos y nos funciona correctamente. El log no dice nada que nos pueda ayudar a saber que pasa exactamente.

Prueba a ejecutar estas URLs por favor:
1. http://<<servidor>>/opengarden.php, listará todos los nodos. /// Se corresponde con la opción "Nodes" del menú de la app.

2. http://<<servidor>>/opengarden.php?node=1, siendo 1 el número de nodo que tienes guardado en la base de datos (tabla measurements, campo node_id) para consultar los datos de ese nodo. /// Se corresponde con la opción "Sensors" del menú de la app.

Pásanos tanto las cabeceras como los resultados de ambas peticiones. Esto es lo que ejectuta la app para obtener los datos.

Un saludo.


Top
 Profile  
 
 Post subject: Re: Servidor web para Opengarden
PostPosted: Mon Mar 27, 2017 9:12 am 

Joined: Tue Feb 07, 2017 1:37 pm
Posts: 37
Hola, las respuestas son las siguientes:

1. http://<<servidor>>/opengarden.php: ERR_LOGIN. Si abro primero la app y entro con admin y 12345 en otra pestaña, ya sale;

QUERY: SELECT node_id, node_type, max(date) as date, max(date) > (NOW() - INTERVAL 1 HOUR) as online FROM measurements GROUP BY node_id
ERROR: Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'opengarden.measurements.node_type' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

No se si será relevante, pero para las pruebas estoy recogiendo medidas cada minuto.


2. http://<<servidor>>/opengarden.php?node=1: ERR_LOGIN. Ídem

[{"node_id":"1","sensor_type":"Battery level","value":"3952","date":"2017-03-27 18:52:27","unit":"mV"},{"node_id":"1","sensor_type":"Soil Moisture","value":"0","date":"2017-03-27 18:54:03","unit":"%"},{"node_id":"1","sensor_type":"Air Humidity","value":"0.0","date":"2017-03-27 18:54:03","unit":"%RH"},{"node_id":"1","sensor_type":"Air Temperature ","value":"0.0","date":"2017-03-27 18:54:03","unit":"\u00baC"},{"node_id":"1","sensor_type":"Light level","value":"0","date":"2017-03-27 18:54:03","unit":"%"}]

* http://<<servidor>>/opengarden.php?node=2: ERR_LOGIN. Ídem

[{"node_id":"2","sensor_type":"Battery level","value":"3966","date":"2017-03-27 18:52:27","unit":"mV"},{"node_id":"2","sensor_type":"Soil Moisture","value":"414","date":"2017-03-27 18:54:11","unit":"%"},{"node_id":"2","sensor_type":"Air Humidity","value":"56.5","date":"2017-03-27 18:54:11","unit":"%RH"},{"node_id":"2","sensor_type":"Air Temperature ","value":"22.3","date":"2017-03-27 18:54:11","unit":"\u00baC"},{"node_id":"2","sensor_type":"Light level","value":"0","date":"2017-03-27 18:54:11","unit":"%"}]

* http://<<servidor>>/opengarden.php?node=0: ERR_LOGIN. Ídem

[{"node_id":"0","sensor_type":"Air Humidity","value":"40.9","date":"2017-03-25 12:50:57","unit":"%RH"},{"node_id":"0","sensor_type":"Air Temperature ","value":"21.6","date":"2017-03-25 12:50:57","unit":"\u00baC"},{"node_id":"0","sensor_type":"Light level","value":"17","date":"2017-03-25 12:50:57","unit":"%"},{"node_id":"0","sensor_type":"Soil Moisture","value":"876","date":"2017-03-25 12:50:57","unit":"%"}][{"node_id":"0","sensor_type":"Light level","value":"10","date":"2017-03-27 17:47:52","unit":"%"},{"node_id":"0","sensor_type":"Soil Moisture","value":"0","date":"2017-03-27 18:53:55","unit":"%"},{"node_id":"0","sensor_type":"Soil temperature","value":"-127.0","date":"2017-03-27 18:53:55","unit":"\u00baC"},{"node_id":"0","sensor_type":"Air Humidity","value":"52.6","date":"2017-03-27 18:53:55","unit":"%RH"},{"node_id":"0","sensor_type":"Air Temperature ","value":"23.2","date":"2017-03-27 18:53:55","unit":"\u00baC"}]

Lo datos obtenidos son correctos, ya que el gateway lleva acoplados un sensor de humedad del suelo y uno de temperatura y humedad del aire. El nodo 1 tiene acoplado un sensor de humedad del suelo y el nodo 2 uno de temperatura y humedad del aire.

Ya me decís. Gracias.


Top
 Profile  
 
 Post subject: Re: Servidor web para Opengarden
PostPosted: Tue Mar 28, 2017 9:42 am 

Joined: Mon Sep 28, 2009 12:06 pm
Posts: 11366
Hola Maria43,
Quote:
ERR_LOGIN:

Esto es normal si no se te has logueado en la app.
Quote:
1. http://<<servidor>>/opengarden.php
ERROR: Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'opengarden.measurements.node_type' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

Parece ser que tienes instalado MySQL 5.7, y en esta versión añadieron una ejecución más estricta de algunas consultas.

Edita el fichero opengarden.php, en la línea 96 tienes que modificar la siguiente consulta
Quote:
$results = DB::query("SELECT node_id, node_type, max(date) as date, max(date) > (NOW() - INTERVAL 1 HOUR) as online FROM measurements GROUP BY node_id");

por esta otra:
Code:
    $results = DB::query("SELECT node_id, node_type, max(date) as date, max(date) > (NOW() - INTERVAL 1 HOUR) as online FROM measurements GROUP BY node_id, node_type");


El resto de peticiones funcionan bien.

Un saludo.


Top
 Profile  
 
 Post subject: Re: Servidor web para Opengarden
PostPosted: Tue Mar 28, 2017 6:19 pm 

Joined: Tue Feb 07, 2017 1:37 pm
Posts: 37
Con esto funciona perfectamente.
Muchas gracias por vuestra ayuda. Un saludo.


Top
 Profile  
 
 Post subject: Re: Servidor web para Opengarden
PostPosted: Wed Mar 29, 2017 7:42 am 

Joined: Mon Sep 28, 2009 12:06 pm
Posts: 11366
Hola Maria43,

nos alegramos de que hayas conseguido hacer funcionar la base de datos con Open Garden. No dudes en consultarnos cualquier otra duda.

Un saludo


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 2 of 2   [ 18 posts ]
Go to page Previous  1, 2


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Libelium theme based on 610nm Style by Daniel St. Jules of http://www.gamexe.net


© Libelium Comunicaciones Distribuidas S.L. | Terms of use.