Skip to content

Commit

Permalink
Merge pull request #168 from basbruss/163-add-strategy-for-see-throug…
Browse files Browse the repository at this point in the history
…h-blinds-to-always-close-fully-in-summer-mode

add transparent blind option to climate mode
  • Loading branch information
basbruss authored May 23, 2024
2 parents 4652571 + d39bb4a commit cebef26
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 6 deletions.
10 changes: 8 additions & 2 deletions custom_components/adaptive_cover/calculation.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ class ClimateCoverData:
outside_entity: str
temp_switch: bool
blind_type: str
transparent_blind: bool

@property
def outside_temperature(self):
Expand Down Expand Up @@ -277,13 +278,18 @@ class ClimateCoverState(NormalCoverState):
def normal_type_cover(self) -> int:
"""Determine state for horizontal and vertical covers."""
# glare does not matter
if (self.climate_data.is_presence is False or self.climate_data.transparent_blind) and self.cover.sol_elev > 0:
if self.climate_data.transparent_blind and self.climate_data.is_summer:
if not self.cover.valid:
return self.cover.default
return 0
if self.climate_data.is_summer:
return 0
if self.climate_data.is_presence is False and self.cover.sol_elev > 0:
# allow maximum solar radiation
if self.climate_data.is_winter:
return 100
# don't allow solar radiation
if self.climate_data.is_summer:
return 0
return self.cover.default

# prefer glare reduction over climate control
Expand Down
3 changes: 3 additions & 0 deletions custom_components/adaptive_cover/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
CONF_TILT_DEPTH,
CONF_TILT_DISTANCE,
CONF_TILT_MODE,
CONF_TRANSPARENT_BLIND,
CONF_WEATHER_ENTITY,
CONF_WEATHER_STATE,
DOMAIN,
Expand Down Expand Up @@ -231,6 +232,7 @@
domain=["device_tracker", "zone", "binary_sensor", "input_boolean"]
)
),
vol.Optional(CONF_TRANSPARENT_BLIND, default=False): selector.BooleanSelector(),
vol.Optional(
CONF_WEATHER_ENTITY, default=vol.UNDEFINED
): selector.EntitySelector(
Expand Down Expand Up @@ -491,6 +493,7 @@ async def async_step_update(self, user_input: dict[str, Any] | None = None):
CONF_ENABLE_BLIND_SPOT: self.config.get(CONF_ENABLE_BLIND_SPOT),
CONF_MIN_ELEVATION: self.config.get(CONF_MIN_ELEVATION, None),
CONF_MAX_ELEVATION: self.config.get(CONF_MAX_ELEVATION, None),
CONF_TRANSPARENT_BLIND: self.config.get(CONF_TRANSPARENT_BLIND, False),
},
)

Expand Down
1 change: 1 addition & 0 deletions custom_components/adaptive_cover/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
CONF_BLIND_SPOT_ELEVATION = "blind_spot_elevation"
CONF_MIN_ELEVATION = "min_elevation"
CONF_MAX_ELEVATION = "max_elevation"
CONF_TRANSPARENT_BLIND = "transparent_blind"


CONF_DELTA_POSITION = "delta_position"
Expand Down
2 changes: 2 additions & 0 deletions custom_components/adaptive_cover/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
CONF_TILT_DEPTH,
CONF_TILT_DISTANCE,
CONF_TILT_MODE,
CONF_TRANSPARENT_BLIND,
CONF_WEATHER_ENTITY,
CONF_WEATHER_STATE,
DOMAIN,
Expand Down Expand Up @@ -219,6 +220,7 @@ async def _async_update_data(self) -> AdaptiveCoverData:
self.config_entry.options.get(CONF_OUTSIDETEMP_ENTITY),
self._temp_toggle,
self._cover_type,
self.config_entry.options.get(CONF_TRANSPARENT_BLIND),
]
climate = ClimateCoverData(*climate_data_var)
self.climate_state = round(
Expand Down
12 changes: 8 additions & 4 deletions custom_components/adaptive_cover/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,16 @@
"weather_entity": "Weather entity (optional)",
"outside_temp": "Outside temperature sensor (optional)",
"temp_low": "Low temperature threshold",
"temp_high": "High temperature threshold"
"temp_high": "High temperature threshold",
"transparent_blind": "Transparent blind"
},
"data_description": {
"presence_entity": "Entity representing room or home presence status",
"weather_entity": "Monitors weather conditions, and outside temperature",
"outside_temp": "Overrides outside temperature from weather entity if both are set",
"temp_low": "Minimum comfortable temperature",
"temp_high": "Maximum comfortable temperature"
"temp_high": "Maximum comfortable temperature",
"transparent_blind": "The blind is transparent and should always close fully when summer mode is active"
},
"description": "Add additional climate configuration variables.",
"title": "Climate settings"
Expand Down Expand Up @@ -267,14 +269,16 @@
"weather_entity": "Weather entity (optional)",
"outside_temp": "Outside temperature sensor (optional)",
"temp_low": "Low temperature threshold",
"temp_high": "High temperature threshold"
"temp_high": "High temperature threshold",
"transparent_blind": "Transparent blind"
},
"data_description": {
"presence_entity": "Entity representing room or home presence status",
"weather_entity": "Monitors weather conditions, and outside temperature",
"outside_temp": "Overrides outside temperature from weather entity if both are set",
"temp_low": "Minimum comfortable temperature",
"temp_high": "Maximum comfortable temperature"
"temp_high": "Maximum comfortable temperature",
"transparent_blind": "The blind is transparent and should always close fully when summer mode is active"
},
"description": "Add additional climate configuration variables.",
"title": "Climate settings"
Expand Down

0 comments on commit cebef26

Please sign in to comment.