Skip to content

fix(climate): support stateful split AC over MQTT IR blasters#1573

Open
nesvet wants to merge 1 commit into
smartHomeHub:masterfrom
nesvet:feat/mqtt-stateful-ac
Open

fix(climate): support stateful split AC over MQTT IR blasters#1573
nesvet wants to merge 1 commit into
smartHomeHub:masterfrom
nesvet:feat/mqtt-stateful-ac

Conversation

@nesvet

@nesvet nesvet commented Jun 20, 2026

Copy link
Copy Markdown

Summary

Fixes control of stateful split AC units through MQTT IR blasters (Zigbee2MQTT: Moes UFO-R11, ZS06, etc.).

Today SmartIR always sends a separate on IR packet before every mode/fan/temperature command. For stateful AC protocols the state packet already encodes power + mode + fan + setpoint. Sending on first causes many MQTT blasters to ignore the follow-up command or apply the wrong state.

This PR:

  1. Skips the separate on command by default for MQTT controllers, while keeping the previous behaviour for Broadlink, Xiaomi, LOOK.in, and ESPHome.
  2. Adds an explicit send_on_command YAML option (and optional per-device JSON field sendOnCommand) so users with hardware that still needs a dedicated power-on packet can opt back in.
  3. Auto-formats MQTT payloads for Zigbee2MQTT:
    • topic ending in ir_code_to_send → raw code string
    • device set topic → {"ir_code_to_send":"<code>"}
    • command already JSON → passed through unchanged
  4. Documents MQTT/Z2M setup in docs/CLIMATE.md.

Motivation / related issues

Behaviour change

Controller Before After
MQTT always sends on + state sends state only (default)
Broadlink / others sends on + state unchanged

Backward compatibility: set send_on_command: true in YAML or "sendOnCommand": true in the device JSON.

Test plan

  • MQTT + Z2M topic zigbee2mqtt/<device>/set/ir_code_to_send: climate.set_hvac_modeclimate.set_fan_modeclimate.set_temperature controls AC without a prior on packet
  • MQTT + Z2M topic zigbee2mqtt/<device>/set: payload is valid JSON with ir_code_to_send
  • send_on_command: true restores legacy on + state sequence on MQTT
  • Broadlink climate entity still sends on before state commands (default unchanged)
  • climate.turn_off still sends only the off command
  • Entity attribute send_on_command reflects resolved setting

Example configuration

climate:
  - platform: smartir
    name: Kitchen AC
    device_code: 1962
    controller_data: zigbee2mqtt/Kitchen Smart IR Remote Control/set/ir_code_to_send
    # send_on_command defaults to false for MQTT; omit unless needed

Device JSON fields used with MQTT blasters:

{
  "supportedController": "MQTT",
  "commandsEncoding": "Raw"
}

Skip the separate power-on IR packet by default for MQTT controllers,
with optional YAML/JSON overrides via send_on_command. Auto-format MQTT
payloads for Zigbee2MQTT (raw ir_code_to_send topic vs JSON on set).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant