Skip to content

Commit

Permalink
Disable fronyx predictions
Browse files Browse the repository at this point in the history
API has been broken for >4 months now
  • Loading branch information
johan12345 committed Aug 11, 2024
1 parent fa04092 commit 17a8259
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 17 deletions.
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,4 @@ free, i.e. the background map displayed in the app if OpenStreetMap is selected

<a href="https://chargeprice.app"><img src="https://raw.githubusercontent.com/ev-map/EVMap/master/_img/powered_by_chargeprice.svg" alt="Powered by Chargeprice" height="58"/></a><br>
Since April 2021, **Chargeprice.app** provide their price comparison API at a greatly reduced
price for EVMap. This data is used in EVMap's price comparison feature.

<a href="https://fronyx.io/"><img src="https://github.com/ev-map/EVMap/blob/master/_img/powered_by_fronyx.svg" alt="Powered by Fronyx" height="68"/></a><br>
Since September 2022, for certain charging stations, **Fronyx** provide us free access to their API
for availability predictions.
price for EVMap. This data is used in EVMap's price comparison feature.
11 changes: 5 additions & 6 deletions app/src/main/java/net/vonforst/evmap/auto/ChargerDetailScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ import net.vonforst.evmap.api.availability.ChargeLocationStatus
import net.vonforst.evmap.api.availability.tesla.Pricing
import net.vonforst.evmap.api.chargeprice.ChargepriceApi
import net.vonforst.evmap.api.createApi
import net.vonforst.evmap.api.fronyx.FronyxApi
import net.vonforst.evmap.api.fronyx.PredictionData
import net.vonforst.evmap.api.fronyx.PredictionRepository
import net.vonforst.evmap.model.ChargeLocation
import net.vonforst.evmap.model.Cost
import net.vonforst.evmap.model.FaultReport
Expand Down Expand Up @@ -82,7 +80,8 @@ class ChargerDetailScreen(ctx: CarContext, val chargerSparse: ChargeLocation) :
private val repo =
ChargeLocationsRepository(createApi(prefs.dataSource, ctx), lifecycleScope, db, prefs)
private val availabilityRepo = AvailabilityRepository(ctx)
private val predictionRepo = PredictionRepository(ctx)

//private val predictionRepo = PredictionRepository(ctx)
private val timeFormat = DateTimeFormatter.ofLocalizedTime(FormatStyle.SHORT)

private val imageSize = 128 // images should be 128dp according to docs
Expand Down Expand Up @@ -546,12 +545,12 @@ class ChargerDetailScreen(ctx: CarContext, val chargerSparse: ChargeLocation) :
)
this@ChargerDetailScreen.photo = outImg
}
fronyxSupported = charger.chargepoints.any {
fronyxSupported = false /*charger.chargepoints.any {
FronyxApi.isChargepointSupported(
charger,
it
)
} && !availabilityRepo.isSupercharger(charger)
} && !availabilityRepo.isSupercharger(charger)*/
teslaSupported = availabilityRepo.isTeslaSupported(charger)

invalidate()
Expand All @@ -560,7 +559,7 @@ class ChargerDetailScreen(ctx: CarContext, val chargerSparse: ChargeLocation) :

invalidate()

prediction = predictionRepo.getPredictionData(charger, availability)
//prediction = predictionRepo.getPredictionData(charger, availability)

invalidate()
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import net.vonforst.evmap.api.availability.ChargeLocationStatus
import net.vonforst.evmap.api.availability.tesla.Pricing
import net.vonforst.evmap.api.createApi
import net.vonforst.evmap.api.fronyx.PredictionData
import net.vonforst.evmap.api.fronyx.PredictionRepository
import net.vonforst.evmap.api.goingelectric.GEChargepoint
import net.vonforst.evmap.api.openchargemap.OCMConnection
import net.vonforst.evmap.api.openchargemap.OCMReferenceData
Expand Down Expand Up @@ -266,13 +265,14 @@ class MapViewModel(application: Application, private val state: SavedStateHandle
it.data?.extraData as? Pricing
}

private val predictionRepository = PredictionRepository(application)
//private val predictionRepository = PredictionRepository(application)

val predictionData: LiveData<PredictionData> = availability.switchMap { av ->
liveData {
/*liveData {
val charger = charger.value?.data ?: return@liveData
emit(predictionRepository.getPredictionData(charger, av.data, filteredConnectors.value))
}
}*/
MutableLiveData()
}

val myLocationEnabled: MutableLiveData<Boolean> by lazy {
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/xml/settings_data.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
android:defaultValue="goingelectric"
app:useSimpleSummaryProvider="true" />

<CheckBoxPreference
<!--<CheckBoxPreference
android:key="prediction_enabled"
android:title="@string/pref_prediction_enabled"
android:defaultValue="true"
android:summary="@string/pref_prediction_enabled_summary" />
android:summary="@string/pref_prediction_enabled_summary" />-->

<Preference
android:key="tesla_account"
Expand Down

0 comments on commit 17a8259

Please sign in to comment.