HVAC Mode case sensitive

I have automations which attempt to set the preset mode for both my Ecobee and Generic Thermostats.

service: climate.set_preset_mode
target:
  entity_id:
    - climate.dining_room_ac_thermostat
    - climate.master_bedroom_ac_thermostat
    - climate.master_bedroom
    - climate.hallway
data:
  preset_mode: away

Unfortunately, it can only do one or the other because the modes are case sensitive.


or

Which integration is correct? Or are both wrong as they should ignore case when setting the mode?

Oddly, when you set a trigger, you get a GUI drop down, which shows both in title case, but when you view the yaml, you can see the Generic Thermostat is in lower case.


Why doesn’t the script editor also have a drop down with the presets?

Presets are defined by the integration. As implemented there is no requirement for them to be case insensitive. I do believe that they could be case insensitive and that would be better for the product, such that if you specify Away, away, AWAY, AWay you get the same result. That said, unless you want to create the pull request that changes this for 100+ integrations, it probably won’t get changed. You could create a GitHub issue maybe some one will pick it up.

The workaround is to do two service calls in a row, one for the thermostats that use “away” and the second for ones that use “Away”

Regarding the automation editor. I don’t use it. But a reasonable implementation would be for the drop-down to only show preset modes that are common between all the targeted entities. Since yours all have different cases there is no common set.

The Linux system Home Assistant is built on is case sensitive. So are Python variables. This is unlikely to change.

The solution is to use two service calls:

I don’t know which entity uses capitalised values but here’s an example:

- service: climate.set_preset_mode
  target:
    entity_id:
      - climate.dining_room_ac_thermostat
      - climate.master_bedroom_ac_thermostat
  data:
    preset_mode: away
- service: climate.set_preset_mode
  target:
    entity_id:
      - climate.master_bedroom
      - climate.hallway
  data:
    preset_mode: Away

The HA frontend translates state values into “pretty” versions, this includes capitalisation and has confused a lot of people but the developers are not going to change it back to the real value. The only way to see the real value is to look in Developer Tools → States.