Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor climate pending state logic in coordinator #40

Merged
merged 1 commit into from
Aug 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions custom_components/nissan_carwings/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,11 @@ def is_climate_pending_state_active(self) -> bool:
climate_pending_state = self.config_entry.runtime_data.climate_pending_state
climate_status: CarwingsLatestClimateControlStatusResponse = self.data[DATA_CLIMATE_STATUS_KEY]

# we will also consider the pending state as active if there is no status data available
return (
climate_status is not None
and climate_status.ac_start_stop_date_and_time is not None
and climate_pending_state.pending_timestamp > climate_status.ac_start_stop_date_and_time
climate_status is None
or climate_status.ac_start_stop_date_and_time is None
or climate_pending_state.pending_timestamp > climate_status.ac_start_stop_date_and_time
)


Expand Down