marek 1 месяц назад
Родитель
Сommit
ca136f926b
2 измененных файлов с 12 добавлено и 8 удалено
  1. 8 8
      apps/getData.py
  2. 4 0
      apps/postData.js

+ 8 - 8
apps/getData.py

@@ -93,16 +93,16 @@ cursor.execute(
     """CREATE TABLE IF NOT EXISTS data (
         timestamp datetime default current_timestamp primary key,
         
-        indoorTemp integer not null,
-        indoorPressure integer not null,
-        indoorHumidity integer not null,
-        indoorAltitude integer not null,
+        indoorTemp text not null,
+        indoorPressure text not null,
+        indoorHumidity text not null,
+        indoorAltitude text not null,
 
         outdoorConnected integer not null,
-        outdoorTemp integer not null,
-        outdoorPressure integer not null,
-        outdoorHumidity integer not null,
-        outdoorAltitude integer not null
+        outdoorTemp text not null,
+        outdoorPressure text not null,
+        outdoorHumidity text not null,
+        outdoorAltitude text not null
     );"""
 )
 

+ 4 - 0
apps/postData.js

@@ -2,6 +2,10 @@ import Meteostanica from "../utils/meteostanica";
 
 const socket = new WebSocket(`${process.env.BACKEND_URL}/ws/sendData/${process.env.BACKEND_WEBSOCKET_KEY}`);
 
+socket.addEventListener("message", (e) => {
+    console.log(e.data)
+})
+
 setInterval(() => {
     const data = Meteostanica.getData()[0]
     socket.send(JSON.stringify(data))