-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
-- Retorna todos los eventos y muestra dispositivo, ambiente, hora y valor | ||
SELECT | ||
d.di_tipo AS tipo_dispositivo, | ||
a.am_nombre AS ambiente, | ||
e.ev_timestamp AS hora, | ||
e.ev_valor AS valor | ||
FROM | ||
eventos e | ||
JOIN | ||
dispositivos d ON e.ev_di_id = d.di_id | ||
JOIN | ||
ambientes a ON e.ev_am_id = a.am_id; | ||
|
||
-- Retorna todos los eventos de sensores y muestra dispositivo, ambiente, hora y valor | ||
SELECT | ||
d.di_tipo AS tipo_dispositivo, | ||
a.am_nombre AS ambiente, | ||
e.ev_timestamp AS hora, | ||
e.ev_valor AS valor | ||
FROM | ||
eventos e | ||
JOIN | ||
dispositivos d ON e.ev_di_id = d.di_id | ||
JOIN | ||
ambientes a ON e.ev_am_id = a.am_id | ||
WHERE | ||
d.di_tipo = 'sensor'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Trabajar con Node-Red y SQLite | ||
|
||
En una Raspberry Pi con Node-RED, puedes almacenar el archivo SQLite en cualquier directorio al que Node-RED tenga acceso. Una ubicación común y recomendada es dentro de la carpeta de usuario de Node-RED. | ||
|
||
## Ubicación de la carpeta de usuario | ||
|
||
La carpeta de usuario de Node-RED suele estar en `~/.node-red` en la Raspberry Pi. Acceder a la carpeta de usuario: | ||
|
||
```bash | ||
cd ~/.node-red | ||
``` | ||
|
||
Crear una carpeta para archivos de dase de datos: | ||
|
||
```bash | ||
mkdir databases | ||
``` | ||
|
||
Mover el archivo SQLite: | ||
|
||
```bash | ||
mv /ruta/al/archivo/tu_base_de_datos.sqlite ~/.node-red/databases/ | ||
``` | ||
|
||
Por último, para acceder al archivo desde Node-RED, hay que configurar los nodos proporcionando la ruta correcta al archivo. Por ejemplo `/home/pi/.node-red/databases/tu_base_de_datos.sqlite`. |