Remove test data send
This commit is contained in:
		| @@ -12,32 +12,6 @@ class LocationManager { | |||||||
|       String httpWebHost = |       String httpWebHost = | ||||||
|           "${prefs.getString('hassio-res-protocol')}://$domain:$port"; |           "${prefs.getString('hassio-res-protocol')}://$domain:$port"; | ||||||
|       if (webhookId != null && webhookId.isNotEmpty) { |       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..."); |         Logger.d("[Location isolate #${Isolate.current.hashCode}] Getting device location..."); | ||||||
|         Geolocator().getCurrentPosition(desiredAccuracy: LocationAccuracy.medium).then((location) { |         Geolocator().getCurrentPosition(desiredAccuracy: LocationAccuracy.medium).then((location) { | ||||||
|           Logger.d("[Location isolate #${Isolate.current.hashCode}] Got location: ${location.latitude} ${location.longitude}. Sending home..."); |           Logger.d("[Location isolate #${Isolate.current.hashCode}] Got location: ${location.latitude} ${location.longitude}. Sending home..."); | ||||||
| @@ -92,8 +66,6 @@ class LocationManager { | |||||||
|       Duration locationUpdateInterval = Duration( |       Duration locationUpdateInterval = Duration( | ||||||
|           minutes: prefs.getInt("location-interval") ?? |           minutes: prefs.getInt("location-interval") ?? | ||||||
|               defaultUpdateIntervalMinutes); |               defaultUpdateIntervalMinutes); | ||||||
|       Logger.d("Canceling previous schedule if any..."); |  | ||||||
|       await AndroidAlarmManager.cancel(alarmId); |  | ||||||
|       Logger.d("Scheduling location update for every ${locationUpdateInterval |       Logger.d("Scheduling location update for every ${locationUpdateInterval | ||||||
|           .inMinutes} minutes..."); |           .inMinutes} minutes..."); | ||||||
|       await AndroidAlarmManager.periodic( |       await AndroidAlarmManager.periodic( | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user