mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 09:17:53 +00:00
Add inverter size to Forecast.Solar (#68263)
This commit is contained in:
parent
11cdc3706c
commit
0c45241d43
@ -16,6 +16,7 @@ from .const import (
|
||||
CONF_AZIMUTH,
|
||||
CONF_DAMPING,
|
||||
CONF_DECLINATION,
|
||||
CONF_INVERTER_SIZE,
|
||||
CONF_MODULES_POWER,
|
||||
DOMAIN,
|
||||
)
|
||||
@ -29,6 +30,11 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
# this if statement is here to catch that.
|
||||
api_key = entry.options.get(CONF_API_KEY) or None
|
||||
|
||||
if (
|
||||
inverter_size := entry.options.get(CONF_INVERTER_SIZE)
|
||||
) is not None and inverter_size > 0:
|
||||
inverter_size = inverter_size / 1000
|
||||
|
||||
session = async_get_clientsession(hass)
|
||||
forecast = ForecastSolar(
|
||||
api_key=api_key,
|
||||
@ -39,6 +45,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
azimuth=(entry.options[CONF_AZIMUTH] - 180),
|
||||
kwp=(entry.options[CONF_MODULES_POWER] / 1000),
|
||||
damping=entry.options.get(CONF_DAMPING, 0),
|
||||
inverter=inverter_size,
|
||||
)
|
||||
|
||||
# Free account have a resolution of 1 hour, using that as the default
|
||||
|
@ -15,6 +15,7 @@ from .const import (
|
||||
CONF_AZIMUTH,
|
||||
CONF_DAMPING,
|
||||
CONF_DECLINATION,
|
||||
CONF_INVERTER_SIZE,
|
||||
CONF_MODULES_POWER,
|
||||
DOMAIN,
|
||||
)
|
||||
@ -118,6 +119,14 @@ class ForecastSolarOptionFlowHandler(OptionsFlow):
|
||||
CONF_DAMPING,
|
||||
default=self.config_entry.options.get(CONF_DAMPING, 0.0),
|
||||
): vol.Coerce(float),
|
||||
vol.Optional(
|
||||
CONF_INVERTER_SIZE,
|
||||
description={
|
||||
"suggested_value": self.config_entry.options.get(
|
||||
CONF_INVERTER_SIZE
|
||||
)
|
||||
},
|
||||
): vol.Coerce(int),
|
||||
}
|
||||
),
|
||||
)
|
||||
|
@ -14,6 +14,7 @@ CONF_DECLINATION = "declination"
|
||||
CONF_AZIMUTH = "azimuth"
|
||||
CONF_MODULES_POWER = "modules power"
|
||||
CONF_DAMPING = "damping"
|
||||
CONF_INVERTER_SIZE = "inverter_size"
|
||||
|
||||
SENSORS: tuple[ForecastSolarSensorEntityDescription, ...] = (
|
||||
ForecastSolarSensorEntityDescription(
|
||||
|
@ -3,7 +3,7 @@
|
||||
"name": "Forecast.Solar",
|
||||
"config_flow": true,
|
||||
"documentation": "https://www.home-assistant.io/integrations/forecast_solar",
|
||||
"requirements": ["forecast_solar==2.1.0"],
|
||||
"requirements": ["forecast_solar==2.2.0"],
|
||||
"codeowners": ["@klaasnicolaas", "@frenck"],
|
||||
"quality_scale": "platinum",
|
||||
"iot_class": "cloud_polling"
|
||||
|
@ -22,6 +22,7 @@
|
||||
"api_key": "Forecast.Solar API Key (optional)",
|
||||
"azimuth": "Azimuth (360 degrees, 0 = North, 90 = East, 180 = South, 270 = West)",
|
||||
"damping": "Damping factor: adjusts the results in the morning and evening",
|
||||
"inverter_size": "Inverter size (Watt)",
|
||||
"declination": "Declination (0 = Horizontal, 90 = Vertical)",
|
||||
"modules power": "Total Watt peak power of your solar modules"
|
||||
}
|
||||
|
@ -21,6 +21,7 @@
|
||||
"api_key": "Forecast.Solar API Key (optional)",
|
||||
"azimuth": "Azimuth (360 degrees, 0 = North, 90 = East, 180 = South, 270 = West)",
|
||||
"damping": "Damping factor: adjusts the results in the morning and evening",
|
||||
"inverter_size": "Inverter size (Watt)",
|
||||
"declination": "Declination (0 = Horizontal, 90 = Vertical)",
|
||||
"modules power": "Total Watt peak power of your solar modules"
|
||||
},
|
||||
|
@ -658,7 +658,7 @@ fnvhash==0.1.0
|
||||
foobot_async==1.0.0
|
||||
|
||||
# homeassistant.components.forecast_solar
|
||||
forecast_solar==2.1.0
|
||||
forecast_solar==2.2.0
|
||||
|
||||
# homeassistant.components.fortios
|
||||
fortiosapi==1.0.5
|
||||
|
@ -453,7 +453,7 @@ fnvhash==0.1.0
|
||||
foobot_async==1.0.0
|
||||
|
||||
# homeassistant.components.forecast_solar
|
||||
forecast_solar==2.1.0
|
||||
forecast_solar==2.2.0
|
||||
|
||||
# homeassistant.components.freebox
|
||||
freebox-api==0.0.10
|
||||
|
@ -11,6 +11,7 @@ from homeassistant.components.forecast_solar.const import (
|
||||
CONF_AZIMUTH,
|
||||
CONF_DAMPING,
|
||||
CONF_DECLINATION,
|
||||
CONF_INVERTER_SIZE,
|
||||
CONF_MODULES_POWER,
|
||||
DOMAIN,
|
||||
)
|
||||
@ -38,6 +39,7 @@ def mock_config_entry() -> MockConfigEntry:
|
||||
CONF_AZIMUTH: 190,
|
||||
CONF_MODULES_POWER: 5100,
|
||||
CONF_DAMPING: 0.5,
|
||||
CONF_INVERTER_SIZE: 2000,
|
||||
},
|
||||
)
|
||||
|
||||
|
@ -5,6 +5,7 @@ from homeassistant.components.forecast_solar.const import (
|
||||
CONF_AZIMUTH,
|
||||
CONF_DAMPING,
|
||||
CONF_DECLINATION,
|
||||
CONF_INVERTER_SIZE,
|
||||
CONF_MODULES_POWER,
|
||||
DOMAIN,
|
||||
)
|
||||
@ -81,6 +82,7 @@ async def test_options_flow(
|
||||
CONF_AZIMUTH: 22,
|
||||
CONF_MODULES_POWER: 2122,
|
||||
CONF_DAMPING: 0.25,
|
||||
CONF_INVERTER_SIZE: 2000,
|
||||
},
|
||||
)
|
||||
|
||||
@ -91,4 +93,5 @@ async def test_options_flow(
|
||||
CONF_AZIMUTH: 22,
|
||||
CONF_MODULES_POWER: 2122,
|
||||
CONF_DAMPING: 0.25,
|
||||
CONF_INVERTER_SIZE: 2000,
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user