Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove redundant code for home presence #303

Merged
merged 1 commit into from
Nov 8, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions ZgatewayBT.ino
Original file line number Diff line number Diff line change
Expand Up @@ -117,28 +117,6 @@ Thanks to wolass https://github.com/wolass for suggesting me HM 10 and dinosd ht
boolean result = process_data(pos - 26,service_data,mac);
}
}
#ifdef roomPresence
StaticJsonBuffer<200> jsonBuffer;
JsonObject& HomePresence = jsonBuffer.createObject();
trc("BLE id :");
String id = advertisedDevice.getAddress().toString().c_str();
trc(id);
HomePresence["id"] = id;
trc("BLE Name :");
String name = advertisedDevice.getName().c_str();
trc(name);
HomePresence["name"] = name;
trc("BLE DISTANCE :");
double BLErssi = advertisedDevice.getRSSI();
double ratio = BLErssi/-59;
double distance = (0.89)* pow(ratio,7.7095) + 0.11;
HomePresence["distance"] = distance;
HomePresence["rssi"] = BLErssi;
trc(distance);
char JSONmessageBuffer[100];
HomePresence.printTo(JSONmessageBuffer, sizeof(JSONmessageBuffer));
client.publish(subjectHomePresence,JSONmessageBuffer);
#endif
}
}
};
Expand Down