Skip to content

Thermostat card preset mode feature not showing icons #19250

Description

@cryptk

Checklist

  • I have updated to the latest available Home Assistant version.
  • I have cleared the cache of my browser.
  • I have tried a different browser to see if it is related to my browser.
  • I have tried reproducing the issue in safe mode to rule out problems with unsupported custom resources.

Describe the issue you are experiencing

The thermostat card, with the "Climate preset modes" feature enabled, does not show proper icons for the various preset modes, only dots. This makes the "icons" style almost useless as the buttons cannot be differentiated from each other.

This appears to be caused because the preset modes for an Ecobee thermostat are capitalized "Home", "Sleep", etc and the pattern matching to determine what icon to use only works for the lowercase version of those words. If I edit the state for the climate entity to have the preset modes in all lowercase, then re-configure the card, the icons appear. This only lasts until the next time the integration updates of course, so it's great for validating the problem, but it is not a long term solution.

Describe the behavior you expected

Proper icons should be shown for the preset modes regardless of casing. Adjusting the Ecobee integration to return the preset modes in lowercase is not a great long-term solution as users can add custom preset modes to many thermostats, and the casing that the end-user provides should be preserved (which is the current behavior of the Ecobee integration).

Steps to reproduce the issue

  1. Configure a climate entity that supports preset modes
  2. Ensure the entity state has the preset modes capitalized (Home, Sleep, etc)
  3. Configure the thermostat card to show preset modes
  4. Observe the lack of icons, they are all replaced with just dots

What version of Home Assistant Core has the issue?

2023.12.4

What was the last working version of Home Assistant Core?

No response

In which browser are you experiencing the issue with?

Firefox 121.0, Android Companion 2023.12.4-full

Which operating system are you using to run this browser?

Andriod, Ubuntu 23.10, Windows 11

State of relevant entities

hvac_modes:
  - heat_cool
  - heat
  - cool
  - "off"
min_temp: 44.6
max_temp: 95
target_temp_step: 0.5
fan_modes:
  - auto
  - "on"
preset_modes:
  - Home
  - Away
  - Sleep
supported_features: 27
current_temperature: 74.6
target_temp_high: 80
target_temp_low: 75
current_humidity: 41
fan_mode: auto
hvac_action: idle
preset_mode: temp
fan: "off"
climate_mode: Home
equipment_running: ""
fan_min_on_time: 0
friendly_name: Downstairs

Problem-relevant frontend configuration

type: thermostat
entity: climate.downstairs_2
features:
  - type: climate-hvac-modes
    hvac_modes:
      - heat_cool
      - heat
      - cool
      - 'off'
  - style: icons
    preset_modes:
      - Home
      - Away
      - Sleep
    type: climate-preset-modes

Javascript errors shown in your browser console/inspector

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleThis has been marked as stale by the automated bot

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions