Remove test data send

This commit is contained in:
estevez-dev 2019-09-01 22:01:27 +03:00
parent 21f3e8985a
commit e8efefe25d

View File

@ -12,32 +12,6 @@ class LocationManager {
String httpWebHost =
"${prefs.getString('hassio-res-protocol')}://$domain:$port";
if (webhookId != null && webhookId.isNotEmpty) {
DateTime currentTime = DateTime.now();
String timeData = "${currentTime.year}-${currentTime.month}-${currentTime.day} ${currentTime.hour}:${currentTime.minute}";
try {
print("[Location isolate #${Isolate.current.hashCode}] Sending test time data home...");
String url = "$httpWebHost/api/webhook/$webhookId";
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
}
}
};
http.post(
url,
headers: headers,
body: json.encode(data)
);
} catch (e) {
print("[Location isolate #${Isolate.current.hashCode}] Error: ${e.toString()}");
}
Logger.d("[Location isolate #${Isolate.current.hashCode}] Getting device location...");
Geolocator().getCurrentPosition(desiredAccuracy: LocationAccuracy.medium).then((location) {
Logger.d("[Location isolate #${Isolate.current.hashCode}] Got location: ${location.latitude} ${location.longitude}. Sending home...");
@ -92,8 +66,6 @@ class LocationManager {
Duration locationUpdateInterval = Duration(
minutes: prefs.getInt("location-interval") ??
defaultUpdateIntervalMinutes);
Logger.d("Canceling previous schedule if any...");
await AndroidAlarmManager.cancel(alarmId);
Logger.d("Scheduling location update for every ${locationUpdateInterval
.inMinutes} minutes...");
await AndroidAlarmManager.periodic(