feat: support for displaying current weather attributes#34
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds support for displaying current weather attributes in the weather forecast card, mimicking the Home Assistant built-in weather entity more-info dialog. The feature allows users to configure which weather attributes (like humidity, pressure, wind speed, etc.) are displayed below the current weather conditions.
Key Changes
- Added configuration interface for selecting weather attributes to display (boolean, single attribute, or array of attributes)
- Implemented new component
wfc-current-weather-attributesto render configured attributes with icons and formatted values - Extended editor with multi-select dropdown for choosing weather attributes
Reviewed changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| src/types.ts | Added CURRENT_WEATHER_ATTRIBUTES constant and CurrentWeatherAttributes type, plus WeatherForecastCardCurrentConfig interface |
| src/data/weather.ts | Exported WeatherEntityAttributes interface and added getWind() function with cardinal direction formatting |
| src/components/wfc-current-weather.ts | Updated to conditionally render weather attributes based on configuration |
| src/components/wfc-current-weather-attributes.ts | New component to render individual weather attributes with icons, labels, and formatted values |
| src/editor/weather-forecast-card-editor.ts | Added editor support for selecting weather attributes via multi-select dropdown |
| src/weather-forecast-card.css | Added styling for weather attributes display with flexbox layout |
| test/mocks/ha-attribute-icon.ts | New mock component for rendering attribute icons in tests |
| test/mocks/hass.ts | Added localization strings for weather attributes and cardinal directions, plus formatEntityAttributeValue mock |
| test/mocks/index.ts | New index file exporting all mocks |
| test/current-weather-attributes.test.ts | Added test coverage for weather attributes rendering |
| test/app/index.html | Added test card demonstrating weather attributes feature |
| README.md | Documented new current.show_attributes configuration option |
| package.json & pnpm-lock.yaml | Added @mdi/js dependency for test icons |
| demo/index.html | Updated import path for MockHass |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Tero Roininen <troinine@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Tero Roininen <troinine@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 15 changed files in this pull request and generated 2 comments.
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Tero Roininen <troinine@users.noreply.github.com>
This PR adds support to both, the card and its editor, for weather entity attributes. The feature mimics the built-in weather entity more-info dialog by its design.
Configured attributes are rendered if available in the weather entity. List of attributes extracted from https://www.home-assistant.io/integrations/weather/