Skip to content

Commit

Permalink
Updated server.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Mayank Narula committed Nov 13, 2017
1 parent 162dda3 commit dcf52e7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ typings/

# All json files
*.json
!serviceAccountKey.json
!package*
!service*

# All rules
*.rules
21 changes: 19 additions & 2 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ,
Expand Down

0 comments on commit dcf52e7

Please sign in to comment.