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

Optimize NDBC Buoy Configuration and Data Fetching #33

Merged
merged 11 commits into from
Mar 3, 2025
Merged

Optimize NDBC Buoy Configuration and Data Fetching #33

merged 11 commits into from
Mar 3, 2025

Conversation

Flight-Lab
Copy link
Owner

@Flight-Lab Flight-Lab commented Mar 2, 2025

  1. Simplified Setup Flow: Removed the manual data section selection step for NDBC buoys, making configuration more straightforward for users while automatically checking all available data sections.

  2. Comprehensive Wave Sensor Prioritization: Added logic to prefer higher quality spectral wave sensors over meteorological sensors when both are available. This prioritization now covers all key wave measurements:

    • Wave height (WVHT)
    • Average wave period (APD)
    • Wave direction (MWD)

    This ensures users get the best available data quality across all wave-related measurements by default.

  3. Optimized API Usage: Implemented smart data section detection to only fetch from data sections that have active sensors, reducing unnecessary API calls and improving performance.

…selection step

Remove the manual data section selection step to streamline configuration for NDBC buoys.
Automatically check all data sections during setup, then fetch data only from sections with active sensors.
…ized fetching

Add constants to map sensors to their data sections for more efficient API usage.
Create mappings for overlapping wave height sensors to prioritize spectral wave data over meteorological data when both are available.
Add METEO_SENSORS, SPEC_WAVE_SENSORS, and OCEAN_CURRENT_SENSORS constants for better organization.
…or prioritization

Add functions to deduplicate overlapping wave height sensors, prioritizing spectral wave data over meteorological data.
Implement utility to determine which data sections are required based on selected sensors.
Update validation to check all NDBC data sections by default for more reliable buoy detection.
…d API requests

Modify coordinator to intelligently determine required data sections based on selected sensors.
This ensures backward compatibility for existing configurations while optimizing API usage by only fetching from sections that contain active sensors, reducing unnecessary network requests.
…om required data sections

Update the NDBC API client to fetch data only from sections that have active sensors.
Accept all data sections during initialization but create API request tasks only for required sections, improving performance and reducing unnecessary data fetching.
Clean up translation files to reflect the removal of the data section selection step in the configuration flow.
Retain the data section options for sensor labels, while removing the now-unnecessary step translation entries.
…ove UI experience

Add explicit device registration during integration setup to ensure devices appear immediately without requiring a restart. Use the current device registry API with proper DeviceEntryType to create a service device that sensor entities will attach to, significantly improving the user experience.
Remove redundant device creation code from sensor entities.
…easurements

Rename and enhance the _deduplicate_wave_height_sensors function to _deduplicate_overlapping_sensors to handle more types of overlapping measurements.
Update the function to prioritize spectral wave data over meteorological data for wave height, wave period, and wave direction.
… and direction measurements

Enhance sensor prioritization to include all wave-related measurements by creating a more comprehensive OVERLAPPING_SENSORS mapping. This prioritizes spectral wave data over meteorological data for wave height, wave period, and wave direction measurements.
@Flight-Lab Flight-Lab merged commit a7455ce into main Mar 3, 2025
2 checks passed
@Flight-Lab Flight-Lab deleted the dev branch March 3, 2025 00:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant