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

Improve weather forecast card layout #23704

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

watercrossing
Copy link

Proposed change

The weather forecast card is rather space in-efficient and includes a lot of empty space. Here is a screenshot of the weather card, showing 1. Current Weather (2 rows), 2. Hourly forecast (3 rows), 3. Daily forefast (3 rows), 4. Current Weather and Daily Forecast (4 rows), and 5. Current weather and Hourly forecast (4 rows). In particular around 2. and 5. there is a lot of empty vertical space.

Screenshot 2025-01-11 213039

I think it looks now a little more similar to the tile cards, although the size could probably be compressed further still.

This pull request adjusts the styling of the cards to enable them to fit them into slighty fewer rows.

Screenshot 2025-01-11 234200

I have also added a configuration option to adjust the number of forecast slots to show. The default is still 5 to not change existing installations (but in my opinion 7 looks better).

Screenshot 2025-01-12 171206

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example configuration

views:
  - title: Home
    sections:
      - type: grid
        cards:
          - type: heading
            heading: Weather
            heading_style: title
          - type: tile
            entity: sensor.sun_next_dawn
          - type: entities
            entities:
              - entity: sensor.sun_next_dusk
          - type: weather-forecast
            entity: weather.forecast_home
            show_forecast: false
            forecast_type: daily
            grid_options:
              columns: 12
              rows: 2
          - show_current: false
            show_forecast: true
            type: weather-forecast
            entity: weather.forecast_home
            forecast_type: hourly
            grid_options:
              columns: 12
              rows: 2
            forecast_slots: 5
          - show_current: false
            show_forecast: true
            type: weather-forecast
            entity: weather.forecast_home
            forecast_type: daily
            forecast_slots: 7
          - show_current: true
            show_forecast: true
            type: weather-forecast
            entity: weather.forecast_home
            forecast_type: hourly
            forecast_slots: 5
          - type: weather-forecast
            entity: weather.forecast_home
            forecast_type: daily
            grid_options:
              columns: 12
              rows: 4
          - show_current: false
            show_forecast: true
            type: weather-forecast
            entity: weather.forecast_home
            forecast_type: hourly
            forecast_slots: 10

Additional information

I have added a new localization string "ui.panel.lovelace.editor.card.weather-forecast.forecast_slots".

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant