The Haier Climate component provides several triggers to react to AC state changes or incoming status packets. These triggers can be used within ESPHome automation blocks (e.g., on_...: then:) and allow access to specific variables via lambdas.
on_alarm_start
Triggered when a new alarm is activated by the AC.
- Variables available:
code (uint8_t): The error code of the alarm.message (const char *): The error message.
on_alarm_end
Triggered when a previously active alarm is deactivated.
- Variables available:
code (uint8_t): The error code of the alarm.message (const char *): The error message.
on_status_message
Triggered when the component receives a new status packet from the AC. This is useful for implementing model-specific features not covered by standard components.
- Variables available:
data (const char *): Raw message binary (excluding header and checksum).data_size (uint8_t): Length of the message.
climate:
- protocol: hon
on_alarm_start:
then:
- logger.log:
level: WARN
format: "Alarm activated. Code: %d. Message: \"%s\""
args: [ 'code', 'message' ]
on_status_message:
then:
- logger.log:
level: INFO
format: "New status message received, size=%d, subcmd=%02X%02X"
args: [ 'data_size', 'data[0]', 'data[1]' ]