diff --git a/.gitignore b/.gitignore index 65aa544..7987d4e 100644 --- a/.gitignore +++ b/.gitignore @@ -60,8 +60,8 @@ typings/ # All json files *.json +!serviceAccountKey.json !package* -!service* # All rules *.rules diff --git a/server.js b/server.js index 27d0b53..e60e6e1 100644 --- a/server.js +++ b/server.js @@ -331,12 +331,29 @@ function pushSensorData(t,h,l,im,om,gx,gy,gz){ var Now = Date.now(); + if( im == null || im == undefined){ + im = false; + } else if( im == "true"){ + im = true; + } else { + im = false; + } + + + if( om == null || om == undefined ){ + om = false; + } else if( om == "true"){ + om = true; + } else { + om = false; + } + var state = { light : parseFloat(l) || null, temp : parseFloat(t) || null, humidity : parseFloat(h) || null, - inDoorMotion : (im=="true"), - outDoorMotion : (om=="true"), + inDoorMotion : im, + outDoorMotion : om, ax : parseFloat(gx) || null , ay : parseFloat(gy) || null, az : parseFloat(gz) || null ,