mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Remove orphan fuel type settings from Tankerkoening (#141207)
remove orphan fule type settings
This commit is contained in:
parent
2465d0db7b
commit
6b724603c8
@ -39,7 +39,7 @@ from homeassistant.helpers.selector import (
|
||||
NumberSelectorConfig,
|
||||
)
|
||||
|
||||
from .const import CONF_FUEL_TYPES, CONF_STATIONS, DEFAULT_RADIUS, DOMAIN, FUEL_TYPES
|
||||
from .const import CONF_STATIONS, DEFAULT_RADIUS, DOMAIN
|
||||
|
||||
|
||||
async def async_get_nearby_stations(
|
||||
@ -175,10 +175,6 @@ class FlowHandler(ConfigFlow, domain=DOMAIN):
|
||||
vol.Required(
|
||||
CONF_API_KEY, default=user_input.get(CONF_API_KEY, "")
|
||||
): cv.string,
|
||||
vol.Required(
|
||||
CONF_FUEL_TYPES,
|
||||
default=user_input.get(CONF_FUEL_TYPES, list(FUEL_TYPES)),
|
||||
): cv.multi_select(FUEL_TYPES),
|
||||
vol.Required(
|
||||
CONF_LOCATION,
|
||||
default=user_input.get(
|
||||
|
@ -3,14 +3,11 @@
|
||||
DOMAIN = "tankerkoenig"
|
||||
NAME = "tankerkoenig"
|
||||
|
||||
CONF_FUEL_TYPES = "fuel_types"
|
||||
CONF_STATIONS = "stations"
|
||||
|
||||
DEFAULT_RADIUS = 2
|
||||
DEFAULT_SCAN_INTERVAL = 30
|
||||
|
||||
FUEL_TYPES = {"e5": "Super", "e10": "Super E10", "diesel": "Diesel"}
|
||||
|
||||
ATTR_BRAND = "brand"
|
||||
ATTR_CITY = "city"
|
||||
ATTR_FUEL_TYPE = "fuel_type"
|
||||
|
@ -24,7 +24,7 @@ from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
||||
|
||||
from .const import CONF_FUEL_TYPES, CONF_STATIONS, DOMAIN
|
||||
from .const import CONF_STATIONS, DOMAIN
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -54,7 +54,6 @@ class TankerkoenigDataUpdateCoordinator(DataUpdateCoordinator[dict[str, PriceInf
|
||||
|
||||
self._selected_stations: list[str] = self.config_entry.data[CONF_STATIONS]
|
||||
self.stations: dict[str, Station] = {}
|
||||
self.fuel_types: list[str] = self.config_entry.data[CONF_FUEL_TYPES]
|
||||
self.show_on_map: bool = self.config_entry.options[CONF_SHOW_ON_MAP]
|
||||
|
||||
self._tankerkoenig = Tankerkoenig(
|
||||
|
@ -5,7 +5,6 @@
|
||||
"data": {
|
||||
"name": "Region name",
|
||||
"api_key": "[%key:common::config_flow::data::api_key%]",
|
||||
"fuel_types": "Fuel types",
|
||||
"location": "[%key:common::config_flow::data::location%]",
|
||||
"stations": "Additional fuel stations",
|
||||
"radius": "Search radius"
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
from aiotankerkoenig import PriceInfo, Station, Status
|
||||
|
||||
from homeassistant.components.tankerkoenig.const import CONF_FUEL_TYPES, CONF_STATIONS
|
||||
from homeassistant.components.tankerkoenig.const import CONF_STATIONS
|
||||
from homeassistant.const import (
|
||||
CONF_API_KEY,
|
||||
CONF_LATITUDE,
|
||||
@ -98,7 +98,6 @@ PRICES_MISSING_FUELTYPE = {
|
||||
CONFIG_DATA = {
|
||||
CONF_NAME: "Home",
|
||||
CONF_API_KEY: "269534f6-xxxx-xxxx-xxxx-yyyyzzzzxxxx",
|
||||
CONF_FUEL_TYPES: ["e5"],
|
||||
CONF_LOCATION: {CONF_LATITUDE: 51.0, CONF_LONGITUDE: 13.0},
|
||||
CONF_RADIUS: 2.0,
|
||||
CONF_STATIONS: [
|
||||
|
@ -12,9 +12,6 @@
|
||||
'entry': dict({
|
||||
'data': dict({
|
||||
'api_key': '**REDACTED**',
|
||||
'fuel_types': list([
|
||||
'e5',
|
||||
]),
|
||||
'location': dict({
|
||||
'latitude': '**REDACTED**',
|
||||
'longitude': '**REDACTED**',
|
||||
|
@ -4,11 +4,7 @@ from unittest.mock import AsyncMock, patch
|
||||
|
||||
from aiotankerkoenig.exceptions import TankerkoenigInvalidKeyError
|
||||
|
||||
from homeassistant.components.tankerkoenig.const import (
|
||||
CONF_FUEL_TYPES,
|
||||
CONF_STATIONS,
|
||||
DOMAIN,
|
||||
)
|
||||
from homeassistant.components.tankerkoenig.const import CONF_STATIONS, DOMAIN
|
||||
from homeassistant.config_entries import SOURCE_USER
|
||||
from homeassistant.const import (
|
||||
CONF_API_KEY,
|
||||
@ -30,7 +26,6 @@ from tests.common import MockConfigEntry
|
||||
MOCK_USER_DATA = {
|
||||
CONF_NAME: "Home",
|
||||
CONF_API_KEY: "269534f6-xxxx-xxxx-xxxx-yyyyzzzzxxxx",
|
||||
CONF_FUEL_TYPES: ["e5"],
|
||||
CONF_LOCATION: {CONF_LATITUDE: 51.0, CONF_LONGITUDE: 13.0},
|
||||
CONF_RADIUS: 2.0,
|
||||
}
|
||||
@ -81,7 +76,6 @@ async def test_user(hass: HomeAssistant) -> None:
|
||||
assert result["type"] is FlowResultType.CREATE_ENTRY
|
||||
assert result["data"][CONF_NAME] == "Home"
|
||||
assert result["data"][CONF_API_KEY] == "269534f6-xxxx-xxxx-xxxx-yyyyzzzzxxxx"
|
||||
assert result["data"][CONF_FUEL_TYPES] == ["e5"]
|
||||
assert result["data"][CONF_LOCATION] == {"latitude": 51.0, "longitude": 13.0}
|
||||
assert result["data"][CONF_RADIUS] == 2.0
|
||||
assert result["data"][CONF_STATIONS] == [
|
||||
|
Loading…
x
Reference in New Issue
Block a user