Fix for Google Home and Zigbee2mqtt thermostats

Hello! I was having trouble getting Google Assistant to change the setpoint on my new Centralite Pearl thermostat, connected via zigbee2mqtt. I watched the events, setting a single setpoint, but the device has two setpoints, and it would not update either. I’m not sure if this is an oversight in Home Assistant to not apply a request from Google Assistant based on the current mode setting, or something else. Either way, I needed a fix! I tried a generic thermostat coupled with the climate_group HACS integration, but no luck. Finally I realized I could ‘intercept’ the google_assistant_command event and call climate.set_temperature based on this. Sadly it won’t fix the assistant not telling you the setpoint, but it’s something.

Find it below or at ha-config/zigbee2mqtt_thermostat_fix.yaml at main · Ceralor/ha-config (github.com)

blueprint:
  name: Zigbee2mqtt Thermostat Fix for Google Home
  description: Handles the setpoint for any dual-setpoint thermostats in Zigbee2MQTT, such as the Centralite Pearl
  domain: automation
  source_url: https://github.com/Ceralor/ha-config/blob/0c135d689ecb7a7b04e5e1fa792523df1a2ad86e/blueprints/automation/zigbee2mqtt_thermostat_fix.yaml
  input:
    thermostat_entity:
      name: Thermostat
      selector:
        entity:
          domain: climate
          integration: mqtt
    fahrenheit:
      name: Convert to Fahrenheit
      description: Needed if your thermostat is set to Fahrenheit
      selector:
        boolean:
mode: single
trigger:
  - platform: event
    event_type: google_assistant_command
    event_data:
      entity_id:
        - !input thermostat_entity
      execution:
        - command: action.devices.commands.ThermostatTemperatureSetpoint
action:
  - alias: Set Thermostat
    variables:
      thermostat_entity: !input thermostat_entity
      fahrenheit: !input fahrenheit
  - alias: Set Variables
    variables:
      target_temp_in_f: >-
        {%- set target_in_c = 
          trigger.event.data.execution[0].params.thermostatTemperatureSetpoint -%}
        {%- if fahrenheit -%}
        {{ (target_in_c * (9.0/5.0)) + 32 | round(0) }}
        {%- else -%}
        {{ target_in_c }}
        {%- endif -%}
      mode: >-
        {{- states(thermostat_entity) -}}
  - if:
      - condition: template
        value_template: "{{ mode != 'off' }}"
    then:
      - service: climate.set_temperature
        data:
          target_temp_high: >-
            {{ target_temp_in_f if 'cool' in mode else
            state_attr(thermostat_entity,'target_temp_high') }}
          target_temp_low: >-
            {{ target_temp_in_f if 'heat' in mode else
            state_attr(thermostat_entity,'target_temp_low') }}
        target:
          entity_id: !input thermostat_entity
1 Like

Oye, thanks for sharing this. I have not pulled the trigger yet on the Centralite but was seriously considering it and I also use Z2M and have Android & Google Home speakers. I want aware of these issues so I think I’m going to wait for some solutions before I make that move.

It otherwise seems to work fine. I do wish it worked for reporting temperature as well as setpoint. I’m not sure how much of that is on Z2M, HA, or Google.

Did you ever find a solution for this? I had this same thermostat working with ZHA (No trickery needed), but after the move the Z2M I’m running into the same issue as you