Remove test data send

This commit is contained in:
estevez-dev 2019-09-01 22:31:46 +03:00
parent de762a4878
commit 27e6198d83

View File

@ -90,31 +90,9 @@ class LocationManager {
if (enabled) { if (enabled) {
if (ConnectionManager().webhookId != null && if (ConnectionManager().webhookId != null &&
ConnectionManager().webhookId.isNotEmpty) { ConnectionManager().webhookId.isNotEmpty) {
DateTime currentTime = DateTime.now();
String timeData = "${currentTime.year}-${currentTime
.month}-${currentTime.day} ${currentTime.hour}:${currentTime
.minute}";
print("[Location] Sending test time data home...");
String url = "${ConnectionManager() String url = "${ConnectionManager()
.httpWebHost}/api/webhook/${ConnectionManager().webhookId}"; .httpWebHost}/api/webhook/${ConnectionManager().webhookId}";
Map<String, String> headers = {}; Map<String, String> headers = {};
headers["Content-Type"] = "application/json";
var data = {
"type": "call_service",
"data": {
"domain": "input_datetime",
"service": "set_datetime",
"service_data": {
"entity_id": "input_datetime.app_alarm_service_test",
"datetime": timeData
}
}
};
await http.post(
url,
headers: headers,
body: json.encode(data)
);
Logger.d("[Location] Getting device location..."); Logger.d("[Location] Getting device location...");
Position location = await Geolocator().getCurrentPosition( Position location = await Geolocator().getCurrentPosition(
desiredAccuracy: LocationAccuracy.medium); desiredAccuracy: LocationAccuracy.medium);
@ -123,7 +101,7 @@ class LocationManager {
int battery = DateTime int battery = DateTime
.now() .now()
.hour; .hour;
data = { var data = {
"type": "update_location", "type": "update_location",
"data": { "data": {
"gps": [location.latitude, location.longitude], "gps": [location.latitude, location.longitude],
@ -131,6 +109,7 @@ class LocationManager {
"battery": battery "battery": battery
} }
}; };
headers["Content-Type"] = "application/json";
await http.post( await http.post(
url, url,
headers: headers, headers: headers,