mirror of
https://github.com/home-assistant/core.git
synced 2026-05-08 17:49:37 +01:00
Remove name field from Forecast.solar config flow (#169165)
This commit is contained in:
@@ -15,7 +15,7 @@ from homeassistant.config_entries import (
|
||||
OptionsFlow,
|
||||
SubentryFlowResult,
|
||||
)
|
||||
from homeassistant.const import CONF_API_KEY, CONF_LATITUDE, CONF_LONGITUDE, CONF_NAME
|
||||
from homeassistant.const import CONF_API_KEY, CONF_LATITUDE, CONF_LONGITUDE
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers import config_validation as cv, selector
|
||||
|
||||
@@ -94,7 +94,7 @@ class ForecastSolarFlowHandler(ConfigFlow, domain=DOMAIN):
|
||||
"""Handle a flow initiated by the user."""
|
||||
if user_input is not None:
|
||||
return self.async_create_entry(
|
||||
title=user_input[CONF_NAME],
|
||||
title="",
|
||||
data={
|
||||
CONF_LATITUDE: user_input[CONF_LATITUDE],
|
||||
CONF_LONGITUDE: user_input[CONF_LONGITUDE],
|
||||
@@ -118,13 +118,11 @@ class ForecastSolarFlowHandler(ConfigFlow, domain=DOMAIN):
|
||||
data_schema=self.add_suggested_values_to_schema(
|
||||
vol.Schema(
|
||||
{
|
||||
vol.Required(CONF_NAME): str,
|
||||
vol.Required(CONF_LATITUDE): cv.latitude,
|
||||
vol.Required(CONF_LONGITUDE): cv.longitude,
|
||||
}
|
||||
).extend(PLANE_SCHEMA.schema),
|
||||
{
|
||||
CONF_NAME: self.hass.config.location_name,
|
||||
CONF_LATITUDE: self.hass.config.latitude,
|
||||
CONF_LONGITUDE: self.hass.config.longitude,
|
||||
CONF_DECLINATION: DEFAULT_DECLINATION,
|
||||
|
||||
@@ -7,8 +7,7 @@
|
||||
"declination": "Declination (0 = Horizontal, 90 = Vertical)",
|
||||
"latitude": "[%key:common::config_flow::data::latitude%]",
|
||||
"longitude": "[%key:common::config_flow::data::longitude%]",
|
||||
"modules_power": "Total Watt peak power of your solar modules",
|
||||
"name": "[%key:common::config_flow::data::name%]"
|
||||
"modules_power": "Total Watt peak power of your solar modules"
|
||||
},
|
||||
"description": "Fill in the data of your solar panels. Please refer to the documentation if a field is unclear."
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ from homeassistant.config_entries import (
|
||||
SOURCE_USER,
|
||||
ConfigSubentryData,
|
||||
)
|
||||
from homeassistant.const import CONF_API_KEY, CONF_LATITUDE, CONF_LONGITUDE, CONF_NAME
|
||||
from homeassistant.const import CONF_API_KEY, CONF_LATITUDE, CONF_LONGITUDE
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
@@ -38,7 +38,6 @@ async def test_user_flow(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> No
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
user_input={
|
||||
CONF_NAME: "Name",
|
||||
CONF_LATITUDE: 52.42,
|
||||
CONF_LONGITUDE: 4.42,
|
||||
CONF_AZIMUTH: 142,
|
||||
@@ -50,7 +49,7 @@ async def test_user_flow(hass: HomeAssistant, mock_setup_entry: AsyncMock) -> No
|
||||
assert result["type"] is FlowResultType.CREATE_ENTRY
|
||||
|
||||
config_entry = result["result"]
|
||||
assert config_entry.title == "Name"
|
||||
assert config_entry.title == ""
|
||||
assert config_entry.unique_id is None
|
||||
assert config_entry.data == {
|
||||
CONF_LATITUDE: 52.42,
|
||||
|
||||
Reference in New Issue
Block a user