diff --git a/README.md b/README.md index b7c7cd81..2344146f 100644 --- a/README.md +++ b/README.md @@ -188,18 +188,19 @@ This mode is split up in two types of strategies; [Presence](https://github.com/ ### Vertical -| Variables | Default | Range | Description | -| ----------------- | ------- | ----- | ------------------------------------------------------------------------------------------- | -| Window Height | 2.1 | 0.1-6 | Length of fully extended cover/window | -| Glare Zone | 0.5 | 0.1-2 | Objects within this distance of the cover recieve direct sunlight. Measured horizontally from the bottom of the cover when fully extended | +| Variables | Default | Range | Description | +| ----------------------- | ------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Window Height | 2.1 | 0.1-6 | Length of fully extended cover/window | +| Glare Zone | 0.5 | 0.1-10 | Objects within this distance of the cover recieve direct sunlight. Measured horizontally from the bottom of the cover when fully extended | +| Glare Height Adjustment | 0.0 | -6 - 6 | The vertical distance from the bottom of the closed blind to the shaded area. Will be negative value for 2nd story windows in tall rooms and postive value when shaded area is higher than base of window | ### Horizontal -| Variables | Default | Range | Description | -| -------------------------- | ------- | ----- | ---------------------------------------------- | -| Awning Height | 2 | 0.1-6 | Height from work area to awning mounting point | -| Awning Length (horizontal) | 2.1 | 0.3-6 | Length of the awning when fully extended | -| Awning Angle | 0 | 0-45 | Angle of the awning from the wall | +| Variables | Default | Range | Description | +| -------------------------- | ------- | ----- | ----------------------------------------------------------------- | +| Awning Height | 2 | 0.1-6 | Height from work area to awning mounting point | +| Awning Length (horizontal) | 2.1 | 0.3-6 | Length of the awning when fully extended | +| Awning Angle | 0 | 0-45 | Angle of the awning from the wall | | Glare Zone | 0.5 | 0.1-2 | Objects within this distance of the cover recieve direct sunlight | ### Tilt diff --git a/custom_components/adaptive_cover/calculation.py b/custom_components/adaptive_cover/calculation.py index c76cad70..d58388e0 100644 --- a/custom_components/adaptive_cover/calculation.py +++ b/custom_components/adaptive_cover/calculation.py @@ -501,12 +501,14 @@ class AdaptiveVerticalCover(AdaptiveGeneralCover): distance: float h_win: float + shaded_height_delta: float def calculate_position(self) -> float: """Calculate blind height.""" # calculate blind height blind_height = np.clip( - (self.distance / cos(rad(self.gamma))) * tan(rad(self.sol_elev)), + (self.distance / cos(rad(self.gamma))) * tan(rad(self.sol_elev)) + + self.shaded_height_delta, 0, self.h_win, ) diff --git a/custom_components/adaptive_cover/config_flow.py b/custom_components/adaptive_cover/config_flow.py index 077de481..6ac618a1 100644 --- a/custom_components/adaptive_cover/config_flow.py +++ b/custom_components/adaptive_cover/config_flow.py @@ -55,6 +55,7 @@ CONF_PRESENCE_ENTITY, CONF_RETURN_SUNSET, CONF_SENSOR_TYPE, + CONF_SHADED_HEIGHT_DELTA, CONF_START_ENTITY, CONF_START_TIME, CONF_SUNRISE_OFFSET, @@ -170,7 +171,12 @@ ), vol.Required(CONF_DISTANCE, default=0.5): selector.NumberSelector( selector.NumberSelectorConfig( - min=0.1, max=2, step=0.1, mode="slider", unit_of_measurement="m" + min=0.1, max=10, step=0.1, mode="slider", unit_of_measurement="m" + ) + ), + vol.Required(CONF_SHADED_HEIGHT_DELTA, default=0.0): selector.NumberSelector( + selector.NumberSelectorConfig( + min=-6, max=6, step=0.1, mode="slider", unit_of_measurement="m" ) ), } @@ -580,6 +586,7 @@ async def async_step_update(self, user_input: dict[str, Any] | None = None): CONF_FOV_RIGHT: self.config.get(CONF_FOV_RIGHT), CONF_ENTITIES: self.config.get(CONF_ENTITIES), CONF_INVERSE_STATE: self.config.get(CONF_INVERSE_STATE), + CONF_SHADED_HEIGHT_DELTA: self.config.get(CONF_SHADED_HEIGHT_DELTA), CONF_SUNSET_POS: self.config.get(CONF_SUNSET_POS), CONF_SUNSET_OFFSET: self.config.get(CONF_SUNSET_OFFSET), CONF_SUNRISE_OFFSET: self.config.get(CONF_SUNRISE_OFFSET), diff --git a/custom_components/adaptive_cover/const.py b/custom_components/adaptive_cover/const.py index b80d3802..fc094c61 100644 --- a/custom_components/adaptive_cover/const.py +++ b/custom_components/adaptive_cover/const.py @@ -27,6 +27,7 @@ CONF_TILT_DEPTH = "slat_depth" CONF_TILT_DISTANCE = "slat_distance" CONF_TILT_MODE = "tilt_mode" +CONF_SHADED_HEIGHT_DELTA = "height_adjustment_shaded_area" CONF_SUNSET_POS = "sunset_position" CONF_SUNSET_OFFSET = "sunset_offset" CONF_SUNRISE_OFFSET = "sunrise_offset" diff --git a/custom_components/adaptive_cover/coordinator.py b/custom_components/adaptive_cover/coordinator.py index 3a6180cc..aa4a6baf 100644 --- a/custom_components/adaptive_cover/coordinator.py +++ b/custom_components/adaptive_cover/coordinator.py @@ -82,6 +82,7 @@ CONF_OUTSIDETEMP_ENTITY, CONF_PRESENCE_ENTITY, CONF_RETURN_SUNSET, + CONF_SHADED_HEIGHT_DELTA, CONF_START_ENTITY, CONF_START_TIME, CONF_SUNRISE_OFFSET, @@ -692,6 +693,7 @@ def vertical_data(self, options): return [ options.get(CONF_DISTANCE), options.get(CONF_HEIGHT_WIN), + options.get(CONF_SHADED_HEIGHT_DELTA), ] def horizontal_data(self, options): diff --git a/custom_components/adaptive_cover/strings.json b/custom_components/adaptive_cover/strings.json index 7a20c176..63c061fa 100644 --- a/custom_components/adaptive_cover/strings.json +++ b/custom_components/adaptive_cover/strings.json @@ -38,7 +38,8 @@ "data": { "set_azimuth": "Window Azimuth", "window_height": "Window Height", - "distance_shaded_area": "Shaded area", + "distance_shaded_area": "Shaded Area", + "height_adjustment_shaded_area": "Shaded Area Height Adjustment", "default_percentage": "Default Position", "max_position": "Maximum Position", "fov_left": "Field of view left", @@ -58,6 +59,7 @@ "set_azimuth": "Adjust Azimuth", "window_height": "Specify window height in meters", "distance_shaded_area": "Distance from cover to shaded area in meters", + "height_adjustment_shaded_area": "Distance from the bottom of the closed blind to the shaded area", "default_percentage": "Default cover position as a percentage", "max_position": "Maximum adjustable cover position as a percentage", "fov_left": "Field of view angle to the left of the window center", @@ -258,7 +260,8 @@ "data": { "set_azimuth": "Window Azimuth", "window_height": "Window Height", - "distance_shaded_area": "Shaded area", + "distance_shaded_area": "Shaded Area", + "height_adjustment_shaded_area": "Shaded Area Height Adjustment", "default_percentage": "Default Position", "max_position": "Maximum Position", "fov_left": "Field of view left", @@ -278,6 +281,7 @@ "set_azimuth": "Adjust Azimuth", "window_height": "Specify window height in meters", "distance_shaded_area": "Distance from cover to shaded area in meters", + "height_adjustment_shaded_area": "Distance from the bottom of the closed blind to the shaded area", "default_percentage": "Default cover position as a percentage", "max_position": "Maximum adjustable cover position as a percentage", "fov_left": "Field of view angle to the left of the window center", diff --git a/custom_components/adaptive_cover/translations/en.json b/custom_components/adaptive_cover/translations/en.json index ea763d92..d381b0e1 100644 --- a/custom_components/adaptive_cover/translations/en.json +++ b/custom_components/adaptive_cover/translations/en.json @@ -39,6 +39,7 @@ "set_azimuth": "Window Azimuth", "window_height": "Window Height", "distance_shaded_area": "Glare Zone", + "height_adjustment_shaded_area": "Shaded Area Height Adjustment", "default_percentage": "Default Position", "min_position": "Minimum Position", "max_position": "Maximum Position", @@ -61,6 +62,7 @@ "set_azimuth": "Adjust Azimuth", "window_height": "Specify window height in meters", "distance_shaded_area": "Objects within this distance from the cover recieve direct sunlight. Distance measured horizontally from the bottom of the cover when the cover is fully extended.", + "height_adjustment_shaded_area": "Distance from the bottom of the closed blind to the shaded area", "default_percentage": "Default cover position as a percentage", "min_position": "Minimum adjustable cover position as a percentage", "max_position": "Maximum adjustable cover position as a percentage", @@ -272,6 +274,7 @@ "set_azimuth": "Window Azimuth", "window_height": "Window Height", "distance_shaded_area": "Glare Zone", + "height_adjustment_shaded_area": "Shaded Area Height Adjustment", "default_percentage": "Default Position", "min_position": "Minimum Position", "max_position": "Maximum Position", @@ -294,6 +297,7 @@ "set_azimuth": "Adjust Azimuth", "window_height": "Specify window height in meters", "distance_shaded_area": "Objects within this distance from the cover recieve direct sunlight. Distance measured horizontally from the bottom of the cover when the cover is fully extended.", + "height_adjustment_shaded_area": "Distance from the bottom of the closed blind to the shaded area", "default_percentage": "Default cover position as a percentage", "min_position": "Minimum adjustable cover position as a percentage", "max_position": "Maximum adjustable cover position as a percentage",