Exposing climate modes to Android Auto app

As you’ll probably know, there’s a very simple Android Auto interface for Home Assistant now:

It provides a menu of specific types of entities that can be clicked to toggle (e.g. switch, input_boolean) or run (e.g. script). There’s currently no exposure of the climate domain, though — which is the thing I’d like most, to be able to pre-heat the house when driving home.

I use three preset_modes with my Generic Thermostat: comfort (19°C), sleep (17°C) and away (16°C). Here’s my solution to make these switchable from the car interface.

I have set up three input_boolean helpers (called “toggles” in the UI), one for each mode, with short names such that they don’t get truncated on the car display (“CH” is “central heating”):

Then I have two automations — one to match the climate mode to a change of the input_booleans (from the car); and one to update the input_booleans in line with a change to the climate mode (from my schedule, presence detection, the front end, or any other source):

- alias: Climate - manage mode via input booleans (for car)
  description: Match CH mode to changed input boolean
  trigger:
    - platform: state
      entity_id:
        - input_boolean.ch_away
        - input_boolean.ch_comfort
        - input_boolean.ch_sleep
      from: 'off'
      to: 'on'
  action:
    - service: climate.set_preset_mode
      entity_id: climate.central_heating
      data: "{{ {'preset_mode': trigger.entity_id.split('_')[2]} }}"

- alias: Climate - update input booleans to changed mode
  description: Match input booleans to changed CH mode
  trigger:
    - platform: state
      entity_id: climate.central_heating
      attribute: preset_mode
      to:
        - 'away'
        - 'comfort'
        - 'sleep'
  action:
    - service: input_boolean.turn_{{ 'on' if state_attr('climate.central_heating', 'preset_mode') == 'away' else 'off' }}
      entity_id: input_boolean.ch_away
    - service: input_boolean.turn_{{ 'on' if state_attr('climate.central_heating', 'preset_mode') == 'comfort' else 'off' }}
      entity_id: input_boolean.ch_comfort
    - service: input_boolean.turn_{{ 'on' if state_attr('climate.central_heating', 'preset_mode') == 'sleep' else 'off' }}
      entity_id: input_boolean.ch_sleep

This works perfectly, allowing selection of climate mode from the car screen. I’ve also given the input_booleans an alias:

This allows me to use Assist to say, for example, “switch the central heating comfort mode on”.

3 Likes