Repository navigation
Feat/impove cover - #22
Merged
Merged
Conversation
… reopen, persistence - Add CoverManager._async_check_proactive_close(): once per day at Heat Window Start, close covers ahead of time if today's forecast high (via weather.get_forecasts on a configurable cover_weather_entity) exceeds cover_forecast_threshold — the reactive threshold alone only fires after the room has already absorbed hours of heat - Reactive threshold stays active as a fallback for forecast misses - Add CoverManager._async_check_evening_reopen(): reopen covers this automation closed today, once after Heat Window End the outdoor sensor drops to/below cover_evening_reopen_temp; never touches a cover closed manually or by another scheduler - Add cover_weather_entity, cover_forecast_threshold, cover_evening_reopen_temp config options (config_flow selectors + EN/FR translations) - Refactor cover action application (My button / close_cover / stop_cover) into a shared _async_apply_cover_action() helper - Persist the once-per-day tracking dates via Store (async_restore_state / _async_save_state), restored at startup — survives a HA restart mid-day - Update README: document the two close paths, evening reopen, state persistence, and add a feature-support table
…Adjustment
- Add CoverManager.async_compute_daily_schedule()/async_check_daily_schedule(): opens/closes CONF_DAILY_COVER_ENTITIES (typically a cover group) natively, without any Scheduler-integration entity — separate from CONF_COVER_ENTITIES used by heat protection, so a single unitary cover stays under heat protection's control while a whole-house group follows this schedule
- Open time is resolved per day mode via daily_cover_open_time_map ("ModeKey:Value, ..."): 'sunrise' (floored at sunrise_earliest), 'skip' (no automatic opening), or a fixed 'HH:MM' — one config field per day mode in a new "Daily Cover Schedule" options-flow step, so behavior can be batched per mode (e.g. Work + Remote both on sunrise) instead of two separate sunrise-modes/skip-modes lists; a mode absent from the map falls back to 08:30, so Away opens like Home by default
- Close time is always today's sunset + daily_cover_close_offset_minutes, unconditionally for every day mode (closing was never mode-dependent)
- Both actions fire at most once per calendar day; state persists via the same Store as heat protection, surviving a HA restart mid-day
- Remove CoverManager.async_adjust_sunrise_schedulers() and the whole "Sunrise Scheduler Adjustment" config_flow step/menu entry/translations — superseded now that Daily Cover Schedule covers sunrise-based opening natively; CONF_SUNRISE_EARLIEST is kept (now solely used as the daily schedule's sunrise floor)
- sensor.cover_open_time now only registers on daily_cover_entities; new sensor.cover_close_time mirrors it for the computed close time
- Update README (Daily Cover Schedule section, config table, feature-support table) and translations (EN/FR)
…ily Cover Schedule - Heat protection no longer owns an independent active window (cover_time_start/end, cover_reopen_temp all removed): its window is now derived entirely from Daily Cover Schedule's computed cover_open_time/daily_close_time, so it stays inert until that feature is configured and has computed today's times - Once the cover closes for heat (proactively via forecast, or reactively via the reactive threshold), it stays closed for the rest of the day — no automatic reopening; only the next day's normal open, or the daily schedule's own unconditional sunset close, touches it again - _async_check_reactive_close/_async_check_proactive_close key off the shared window/open-time instead of their own config, and heat_closed (bool) replaces the old closed_date/reopened_date pair in both memory and the persisted Store state - async_compute_daily_schedule() resets heat_closed at the top of each new day - Update config_flow, README, and EN/FR translations to drop the now-removed fields and describe the close-only behavior - Rewrite tests/test_coordinator_features.py's cover suites for the new close-only, schedule-derived behavior (drop TestCoverReactiveReopen and the reopen-tracking assertions) - Add tests/test_config_flow.py (58 tests): schema field sets, day-mode/daily-open-time map (de)serialization, and every config/options flow step — closes the coverage gap left by config_flow.py having zero tests despite being the most heavily reshaped file across this branch's work (0% -> 99% line coverage) Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…s, allow closing before sunset, fix heat-protection/schedule ordering - Run Daily Cover Schedule's check before heat protection's in every poll cycle: heat protection's proactive close and the daily schedule's morning open both key off cover_open_time, so with the old order a hot-forecast proactive close was immediately undone by the group's own open action firing right after in the same cycle - Add CoverManager.open_datetime()/close_datetime() and coordinator._schedule_cover_timers(): one-shot timers (async_track_point_in_time, same mechanism already used for next-mode changes) scheduled whenever today's times are computed, so open/close fire at the scheduled minute instead of waiting up to SCAN_INTERVAL_MINUTES for the next poll. The periodic poll stays as an idempotent fallback/catch-up; timers are cancelled on unload - Switch every cover/button service call (daily open, daily close, heat-protection close, My button) from blocking=False to blocking=True — a fire-and-forget call swallows failures in HA's core log instead of surfacing them, and left _daily_closed_date/_daily_opened_date marked done even when the underlying call failed, silently skipping the retry for the rest of the day - Allow the Close Offset to be negative: covers can now close before sunset (e.g. -10) as well as after (e.g. +10) — the underlying timedelta math already supported it, only the config_flow NumberSelector's min=0 floor was blocking it - Add tests: open_datetime/close_datetime, cover timer scheduling/cancellation, check-order coverage for both the timer callback and the periodic poll path, and a negative close-offset case Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.