Skip to content

Commit ee2ff2b

Browse files
committed
Update to open-meteo-solar-forecast 0.1.18
- Improves cell temperature calculation (should reduce over/under-estimations) - Add damping support for morning and/or evening Signed-off-by: rany <[email protected]>
1 parent 2766611 commit ee2ff2b

File tree

6 files changed

+38
-10
lines changed

6 files changed

+38
-10
lines changed

Diff for: custom_components/open_meteo_solar_forecast/config_flow.py

+20-6
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,20 @@
55
from typing import Any
66

77
import voluptuous as vol
8-
from homeassistant.config_entries import (
9-
ConfigEntry,
10-
ConfigFlow,
11-
OptionsFlow,
12-
)
8+
from homeassistant.config_entries import ConfigEntry, ConfigFlow, OptionsFlow
139
from homeassistant.const import CONF_API_KEY, CONF_LATITUDE, CONF_LONGITUDE, CONF_NAME
1410
from homeassistant.core import callback
1511
from homeassistant.helpers import config_validation as cv
1612

1713
from .const import (
1814
CONF_AZIMUTH,
1915
CONF_BASE_URL,
16+
CONF_DAMPING_EVENING,
17+
CONF_DAMPING_MORNING,
2018
CONF_DECLINATION,
2119
CONF_EFFICIENCY_FACTOR,
22-
CONF_MODULES_POWER,
2320
CONF_INVERTER_POWER,
21+
CONF_MODULES_POWER,
2422
DOMAIN,
2523
)
2624

@@ -58,6 +56,8 @@ async def async_step_user(
5856
CONF_API_KEY: user_input[CONF_API_KEY],
5957
CONF_AZIMUTH: user_input[CONF_AZIMUTH],
6058
CONF_BASE_URL: user_input[CONF_BASE_URL],
59+
CONF_DAMPING_MORNING: user_input[CONF_DAMPING_MORNING],
60+
CONF_DAMPING_EVENING: user_input[CONF_DAMPING_EVENING],
6161
CONF_DECLINATION: user_input[CONF_DECLINATION],
6262
CONF_MODULES_POWER: user_input[CONF_MODULES_POWER],
6363
CONF_INVERTER_POWER: user_input[CONF_INVERTER_POWER],
@@ -94,6 +94,8 @@ async def async_step_user(
9494
vol.Required(CONF_INVERTER_POWER, default=0): vol.All(
9595
vol.Coerce(int), vol.Range(min=0)
9696
),
97+
vol.Optional(CONF_DAMPING_MORNING, default=0.0): vol.Coerce(float),
98+
vol.Optional(CONF_DAMPING_EVENING, default=0.0): vol.Coerce(float),
9799
vol.Optional(CONF_EFFICIENCY_FACTOR, default=1.0): vol.All(
98100
vol.Coerce(float), vol.Range(min=0)
99101
),
@@ -147,6 +149,18 @@ async def async_step_init(
147149
CONF_MODULES_POWER,
148150
default=self.config_entry.options[CONF_MODULES_POWER],
149151
): vol.All(vol.Coerce(int), vol.Range(min=1)),
152+
vol.Optional(
153+
CONF_DAMPING_MORNING,
154+
default=self.config_entry.options.get(
155+
CONF_DAMPING_MORNING, 0.0
156+
),
157+
): vol.Coerce(float),
158+
vol.Optional(
159+
CONF_DAMPING_EVENING,
160+
default=self.config_entry.options.get(
161+
CONF_DAMPING_EVENING, 0.0
162+
),
163+
): vol.Coerce(float),
150164
vol.Required(
151165
CONF_INVERTER_POWER,
152166
default=self.config_entry.options.get(CONF_INVERTER_POWER, 0),

Diff for: custom_components/open_meteo_solar_forecast/const.py

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
CONF_DECLINATION = "declination"
1212
CONF_AZIMUTH = "azimuth"
1313
CONF_MODULES_POWER = "modules_power"
14+
CONF_DAMPING_MORNING = "damping_morning"
15+
CONF_DAMPING_EVENING = "damping_evening"
1416
CONF_INVERTER_POWER = "inverter_power"
1517
CONF_EFFICIENCY_FACTOR = "efficiency_factor"
1618

Diff for: custom_components/open_meteo_solar_forecast/coordinator.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,19 @@
44

55
from datetime import timedelta
66

7-
from open_meteo_solar_forecast import Estimate, OpenMeteoSolarForecast
8-
97
from homeassistant.config_entries import ConfigEntry
108
from homeassistant.const import CONF_API_KEY, CONF_LATITUDE, CONF_LONGITUDE
119
from homeassistant.core import HomeAssistant
1210
from homeassistant.helpers.aiohttp_client import async_get_clientsession
1311
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
1412

13+
from open_meteo_solar_forecast import Estimate, OpenMeteoSolarForecast
14+
1515
from .const import (
1616
CONF_AZIMUTH,
1717
CONF_BASE_URL,
18+
CONF_DAMPING_EVENING,
19+
CONF_DAMPING_MORNING,
1820
CONF_DECLINATION,
1921
CONF_EFFICIENCY_FACTOR,
2022
CONF_INVERTER_POWER,
@@ -52,6 +54,8 @@ def __init__(self, hass: HomeAssistant, entry: ConfigEntry) -> None:
5254
dc_kwp=(entry.options[CONF_MODULES_POWER] / 1000),
5355
declination=entry.options[CONF_DECLINATION],
5456
efficiency_factor=entry.options[CONF_EFFICIENCY_FACTOR],
57+
damping_morning=entry.options.get(CONF_DAMPING_MORNING, 0.0),
58+
damping_evening=entry.options.get(CONF_DAMPING_EVENING, 0.0),
5559
)
5660

5761
update_interval = timedelta(minutes=30)

Diff for: custom_components/open_meteo_solar_forecast/manifest.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
"integration_type": "service",
88
"iot_class": "cloud_polling",
99
"issue_tracker": "https://github.com/rany2/ha-open-meteo-solar-forecast/issues",
10-
"requirements": ["open_meteo_solar_forecast==0.1.17"],
11-
"version": "0.1.15"
10+
"requirements": ["open_meteo_solar_forecast==0.1.18"],
11+
"version": "0.1.16"
1212
}

Diff for: custom_components/open_meteo_solar_forecast/strings.json

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
"data": {
77
"api_key": "[%key:common::config_flow::data::api_key%]",
88
"azimuth": "Azimuth (360 degrees, 0 = North, 90 = East, 180 = South, 270 = West)",
9+
"damping_morning": "Damping factor: adjusts the results in the morning",
10+
"damping_evening": "Damping factor: adjusts the results in the evening",
911
"declination": "Declination (0 = Horizontal, 90 = Vertical)",
1012
"latitude": "[%key:common::config_flow::data::latitude%]",
1113
"longitude": "[%key:common::config_flow::data::longitude%]",
@@ -27,6 +29,8 @@
2729
"data": {
2830
"api_key": "[%key:common::config_flow::data::api_key%]",
2931
"azimuth": "[%key:component::solar_forecast::config::step::user::data::azimuth%]",
32+
"damping_morning": "[%key:component::solar_forecast::config::step::user::data::damping_morning%]",
33+
"damping_evening": "[%key:component::solar_forecast::config::step::user::data::damping_evening%]",
3034
"declination": "[%key:component::solar_forecast::config::step::user::data::declination%]",
3135
"efficiency_factor": "[%key:component::solar_forecast::config::step::user::data::efficiency_factor%]",
3236
"modules_power": "[%key:component::solar_forecast::config::step::user::data::modules_power%]",

Diff for: custom_components/open_meteo_solar_forecast/translations/en.json

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
"data": {
66
"api_key": "API key",
77
"azimuth": "Azimuth (360 degrees, 0 = North, 90 = East, 180 = South, 270 = West)",
8+
"damping_morning": "Damping factor: adjusts the results in the morning",
9+
"damping_evening": "Damping factor: adjusts the results in the evening",
810
"declination": "Declination (0 = Horizontal, 90 = Vertical)",
911
"latitude": "Latitude",
1012
"longitude": "Longitude",
@@ -87,6 +89,8 @@
8789
"data": {
8890
"api_key": "API key",
8991
"azimuth": "Azimuth (360 degrees, 0 = North, 90 = East, 180 = South, 270 = West)",
92+
"damping_morning": "Damping factor: adjusts the results in the morning",
93+
"damping_evening": "Damping factor: adjusts the results in the evening",
9094
"declination": "Declination (0 = Horizontal, 90 = Vertical)",
9195
"inverter_size": "Inverter size (Watt)",
9296
"efficiency_factor": "DC efficiency factor (0.0-1.0, 0.0 = 100% loss, 1.0 = no loss)",

0 commit comments

Comments
 (0)