hass-core/homeassistant/components/pvpc_hourly_pricing/strings.json
Eugenio Panadero 32aa1aaec2
Add pvpc hourly pricing optional API Token support (#85767)
* 🍱 Add new fixture for PVPC data from authenticated API call

and update mocked server responses when data is not available
(now returns a 200 OK with empty data)

*  Implement optional API token in config-flow + options

to make the data download from an authenticated path in ESIOS server

As this is an *alternative* access, and current public path works for the PVPC,
no user (current or new) is compelled to obtain a token,
and it can be enabled anytime in options, or doing the setup again

When enabling the token, it is verified (or "invalid_auth" error),
and a 'reauth' flow is implemented, which can change or disable the token if
it starts failing.

The 1st step of config/options flow adds a bool to enable this private access,
- if unchecked (default), entry is set for public access (like before)
- if checked, a 2nd step opens to input the token, with instructions
  of how to get one (with a direct link to create a 'request email').
  If the token is valid, the entry is set for authenticated access

The 'reauth' flow shows the boolean flag so the user could disable a bad token
by unchecking the boolean flag 'use_api_token'

* 🌐 Update strings for config/options flows

*  Adapt tests to check API token option and add test_reauth

* 🎨 Link new strings to those in config-flow

* 🐛 tests: Fix mocked date-change with async_fire_time_changed

* ♻️ Remove storage of flag 'use_api_token' in config entry

leaving it only to enable/disable the optional token in the config-flow

* ♻️ Adjust async_update_options
2023-11-23 08:35:30 +01:00

54 lines
1.9 KiB
JSON

{
"config": {
"step": {
"user": {
"data": {
"name": "Sensor Name",
"tariff": "Applicable tariff by geographic zone",
"power": "Contracted power (kW)",
"power_p3": "Contracted power for valley period P3 (kW)",
"use_api_token": "Enable ESIOS Personal API token for private access"
}
},
"api_token": {
"title": "ESIOS API token",
"description": "To use the extended API you must request a personal token by mailing to {mail_to_link}.",
"data": {
"api_token": "[%key:common::config_flow::data::api_token%]"
}
},
"reauth_confirm": {
"data": {
"description": "Re-authenticate with a valid token or disable it",
"use_api_token": "[%key:component::pvpc_hourly_pricing::config::step::user::data::use_api_token%]",
"api_token": "[%key:common::config_flow::data::api_token%]"
}
}
},
"error": {
"invalid_auth": "[%key:common::config_flow::error::invalid_auth%]"
},
"abort": {
"already_configured": "[%key:common::config_flow::abort::already_configured_service%]",
"reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]"
}
},
"options": {
"step": {
"init": {
"data": {
"power": "[%key:component::pvpc_hourly_pricing::config::step::user::data::power%]",
"power_p3": "[%key:component::pvpc_hourly_pricing::config::step::user::data::power_p3%]",
"use_api_token": "[%key:component::pvpc_hourly_pricing::config::step::user::data::use_api_token%]"
}
},
"api_token": {
"title": "[%key:component::pvpc_hourly_pricing::config::step::api_token::title%]",
"description": "[%key:component::pvpc_hourly_pricing::config::step::api_token::description%]",
"data": {
"api_token": "[%key:common::config_flow::data::api_token%]"
}
}
}
}
}