Skip to content

Commit

Permalink
reparar traduccions
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarsanchezdm committed Aug 20, 2024
1 parent f13a5ec commit 5f20040
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 48 deletions.
12 changes: 0 additions & 12 deletions custom_components/bicing/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,18 +128,6 @@ class OptionFlowHandler(config_entries.OptionsFlow):
def __init__(self, config_entry):
self.config_entry = config_entry

# async def async_step_reauth(self, user_input=None):
# if user_input is not None:
# return self.async_create_entry(title=self.config_entry.title, data={
# TOKEN: user_input[TOKEN],
# CONF_STATION_IDS: self.config_entry.data[CONF_STATION_IDS],
# })

# schema = vol.Schema({
# vol.Required(TOKEN): TextSelector()
# })
# return self.async_show_form(step_id="reauth", data_schema=schema, last_step=True)

async def async_step_init(self, user_input=None):
estacions_actuals = self.config_entry.options.get(CONF_STATION_IDS, self.config_entry.data[CONF_STATION_IDS])
token_actual = self.config_entry.options.get(TOKEN, self.config_entry.data[TOKEN])
Expand Down
31 changes: 0 additions & 31 deletions custom_components/bicing/lib/bike_stations_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,38 +67,7 @@ async def get_station_name(token, station_id):
return f"Estació {station_id}"

return bike_station['name']


@staticmethod
async def get_station_status(token, station_id):
headers = {
'Authorization': token,
}
session = aiohttp.ClientSession(headers=headers)
response = await session.get(const.STATION_STATUS_ENDPOINT)

if response.status != 200:
raise aiohttp.ServerConnectionError("El servidor no ha contestat un codi 200/OK")

json = await response.json()
await session.close()

bike_station = None
for station in json['data']['stations']:
if str(station['station_id']) == str(station_id):
bike_station = station

if bike_station is None:
return None

station_status = StationStatus(
id=bike_station['station_id'],
bikes_available=bike_station['num_bikes_available_types']['mechanical'],
ebikes_available=bike_station['num_bikes_available_types']['ebike'],
docks_available=bike_station['num_docks_available']
)
return station_status

@staticmethod
async def get_stations_status(token, station_ids):
headers = {
Expand Down
10 changes: 5 additions & 5 deletions custom_components/bicing/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"step": {
"user": {
"data": {
"host": "[%key:common::config_flow::data::host%]",
"username": "[%key:common::config_flow::data::username%]",
"password": "[%key:common::config_flow::data::password%]"
"host": "[%key:common::config_flow::step::data::host%]",
"username": "[%key:common::config_flow::step::data::username%]",
"password": "[%key:common::config_flow::step::data::password%]"
}
},
"reauth_confirm": {
"title": "[%key:common::config_flow::title::reauth%]",
"description": "[%key:common::config_flow::description::reauth%]"
"title": "[%key:common::config_flow::step::reauth_confirm::title%]",
"description": "[%key:common::config_flow::step::reauth_confirm::description%]"
}
},
"error": {
Expand Down

0 comments on commit 5f20040

Please sign in to comment.