mirror of
https://github.com/home-assistant/core.git
synced 2025-07-30 16:57:19 +00:00
Make exceptions translatable in Tankerkoenig integration (#149611)
This commit is contained in:
parent
bf568b22d7
commit
3c1aa9d9de
@ -131,19 +131,31 @@ class TankerkoenigDataUpdateCoordinator(DataUpdateCoordinator[dict[str, PriceInf
|
|||||||
stations,
|
stations,
|
||||||
err,
|
err,
|
||||||
)
|
)
|
||||||
raise ConfigEntryAuthFailed(err) from err
|
raise ConfigEntryAuthFailed(
|
||||||
|
translation_domain=DOMAIN,
|
||||||
|
translation_key="invalid_api_key",
|
||||||
|
) from err
|
||||||
except TankerkoenigRateLimitError as err:
|
except TankerkoenigRateLimitError as err:
|
||||||
_LOGGER.warning(
|
_LOGGER.warning(
|
||||||
"API rate limit reached, consider to increase polling interval"
|
"API rate limit reached, consider to increase polling interval"
|
||||||
)
|
)
|
||||||
raise UpdateFailed(err) from err
|
raise UpdateFailed(
|
||||||
|
translation_domain=DOMAIN,
|
||||||
|
translation_key="rate_limit_reached",
|
||||||
|
) from err
|
||||||
except (TankerkoenigError, TankerkoenigConnectionError) as err:
|
except (TankerkoenigError, TankerkoenigConnectionError) as err:
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
"error occur during update of stations %s %s",
|
"error occur during update of stations %s %s",
|
||||||
stations,
|
stations,
|
||||||
err,
|
err,
|
||||||
)
|
)
|
||||||
raise UpdateFailed(err) from err
|
raise UpdateFailed(
|
||||||
|
translation_domain=DOMAIN,
|
||||||
|
translation_key="station_update_failed",
|
||||||
|
translation_placeholders={
|
||||||
|
"station_ids": ", ".join(stations),
|
||||||
|
},
|
||||||
|
) from err
|
||||||
|
|
||||||
prices.update(data)
|
prices.update(data)
|
||||||
|
|
||||||
|
@ -6,6 +6,6 @@
|
|||||||
"documentation": "https://www.home-assistant.io/integrations/tankerkoenig",
|
"documentation": "https://www.home-assistant.io/integrations/tankerkoenig",
|
||||||
"iot_class": "cloud_polling",
|
"iot_class": "cloud_polling",
|
||||||
"loggers": ["aiotankerkoenig"],
|
"loggers": ["aiotankerkoenig"],
|
||||||
"quality_scale": "silver",
|
"quality_scale": "platinum",
|
||||||
"requirements": ["aiotankerkoenig==0.4.2"]
|
"requirements": ["aiotankerkoenig==0.4.2"]
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ rules:
|
|||||||
entity-device-class: done
|
entity-device-class: done
|
||||||
entity-disabled-by-default: done
|
entity-disabled-by-default: done
|
||||||
entity-translations: done
|
entity-translations: done
|
||||||
exception-translations: todo
|
exception-translations: done
|
||||||
icon-translations: done
|
icon-translations: done
|
||||||
reconfiguration-flow:
|
reconfiguration-flow:
|
||||||
status: exempt
|
status: exempt
|
||||||
|
@ -180,5 +180,16 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"exceptions": {
|
||||||
|
"rate_limit_reached": {
|
||||||
|
"message": "You have reached the rate limit for the Tankerkoenig API. Please try to increase the poll interval and reduce the requests."
|
||||||
|
},
|
||||||
|
"invalid_api_key": {
|
||||||
|
"message": "The provided API key is invalid. Please check your API key."
|
||||||
|
},
|
||||||
|
"station_update_failed": {
|
||||||
|
"message": "Failed to update station data for station(s) {station_ids}. Please check your network connection."
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user