4 namespace hitachi_ac424 {
6 static const char *
const TAG =
"climate.hitachi_ac424";
8 void set_bits(uint8_t *
const dst,
const uint8_t offset,
const uint8_t nbits,
const uint8_t data) {
9 if (offset >= 8 || !nbits)
12 uint8_t mask = UINT8_MAX >> (8 - ((nbits > 8) ? 8 : nbits));
15 *dst &= ~(uint8_t) (mask << offset);
17 *dst |= ((data & mask) << offset);
30 for (uint16_t i = 1; i <
length; i += 2) {
32 uint8_t inv = ~*(ptr + i - 1);
48 uint8_t new_mode =
mode;
98 new_speed = std::min(new_speed, fan_max);
154 switch (this->
mode) {
224 for (uint8_t r = 0; r <= repeat; r++) {
229 for (uint8_t j = 0; j < 8; j++) {
231 bool bit = i & (1 << j);
276 ESP_LOGV(TAG,
"Temperature: %02X %02u %04f", remote_state[HITACHI_AC424_TEMP_BYTE], temperature,
306 ESP_LOGV(TAG,
"SwingH: %02X %02X", remote_state[HITACHI_AC424_SWINGH_BYTE], swing_modeh);
308 if ((swing_modeh & 0x3) == 0x3) {
320 ESP_LOGVV(TAG,
"Header fail");
328 for (int8_t bit = 0; bit < 8; bit++) {
330 recv_state[pos] |= 1 << bit;
332 ESP_LOGVV(TAG,
"Byte %d bit %d fail", pos, bit);
340 ESP_LOGVV(TAG,
"Footer fail");
363 ESP_LOGV(TAG,
"%s: %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X", action, state[i + 0], state[i + 1],
364 state[i + 2], state[i + 3], state[i + 4], state[i + 5], state[i + 6], state[i + 7], state[i + 8],
367 ESP_LOGV(TAG,
"%s: %02X %02X %02X", action, state[40], state[41], state[42]);
The fan mode is set to Low.
const uint8_t HITACHI_AC424_BUTTON_FAN
value_type const & value() const
const uint8_t HITACHI_AC424_BUTTON_BYTE
ClimateSwingMode swing_mode
The active swing mode of the climate device.
void set_swing_v_toggle_(bool on)
uint8_t * invert_byte_pairs(uint8_t *ptr, const uint16_t length)
The fan mode is set to Both.
const uint8_t HITACHI_AC424_POWER_BYTE
void set_bit(uint8_t *const data, const uint8_t position, const bool on)
const uint8_t HITACHI_AC424_BUTTON_TEMP_DOWN
const uint8_t HITACHI_AC424_FAN_HIGH
const uint16_t HITACHI_AC424_HDR_MARK
float target_temperature
The target temperature of the climate device.
const uint8_t HITACHI_AC424_FAN_MEDIUM
void set_carrier_frequency(uint32_t carrier_frequency)
void transmit_state() override
const uint16_t HITACHI_AC424_ZERO_SPACE
const LogString * climate_mode_to_string(ClimateMode mode)
Convert the given ClimateMode to a human-readable string.
const uint16_t HITACHI_AC424_HDR_SPACE
The climate device is set to heat to reach the target temperature.
const uint8_t HITACHI_AC424_TEMP_FAN
const uint8_t HITACHI_AC424_SWINGH_BYTE
ClimateMode mode
The active mode of the climate device.
const uint8_t HITACHI_AC424_BUTTON_SWINGH
const uint8_t HITACHI_AC424_TEMP_SIZE
bool parse_swing_(const uint8_t remote_state[])
const uint8_t HITACHI_AC424_MODE_AUTO
const uint8_t HITACHI_AC424_MODE_FAN
The climate device is set to dry/humidity mode.
const uint8_t HITACHI_AC424_POWER_OFF
const uint8_t HITACHI_AC424_SWINGV_OFFSET
const uint8_t HITACHI_AC424_POWER_ON
bool parse_mode_(const uint8_t remote_state[])
bool expect_mark(uint32_t length)
const uint16_t HITACHI_AC424_ONE_SPACE
void set_fan_(uint8_t speed)
const uint8_t HITACHI_AC424_FAN_MAX
const uint16_t HITACHI_AC424_STATE_LENGTH
const uint16_t HITACHI_AC424_BIT_MARK
const uint8_t HITACHI_AC424_FAN_AUTO
const uint8_t HITACHI_AC424_FAN_MIN
The fan mode is set to Horizontal.
The climate device is set to cool to reach the target temperature.
The fan mode is set to Auto.
const uint8_t HITACHI_AC424_TEMP_OFFSET
bool get_swing_v_toggle_()
const uint8_t HITACHI_AC424_TEMP_MIN
const uint8_t HITACHI_AC424_MODE_DRY
const uint8_t HITACHI_AC424_MODE_BYTE
void set_mode_(uint8_t mode)
RemoteTransmitterBase * transmitter_
const uint8_t HITACHI_AC424_BUTTON_SWINGV
const uint8_t HITACHI_AC424_SWINGH_AUTO
The climate device is set to heat/cool to reach the target temperature.
const uint8_t HITACHI_AC424_FAN_LOW
The fan mode is set to Vertical.
void set_bits(uint8_t *const dst, const uint8_t offset, const uint8_t nbits, const uint8_t data)
const uint8_t HITACHI_AC424_MODE_HEAT
bool parse_fan_(const uint8_t remote_state[])
const uint8_t HITACHI_AC424_SWINGV_BYTE
const uint8_t HITACHI_AC424_MODE_COOL
const uint8_t HITACHI_AC424_SWINGH_SIZE
void publish_state()
Publish the state of the climate device, to be called from integrations.
void set_temp_(uint8_t celsius, bool set_previous=false)
The fan mode is set to High.
RemoteTransmitData * get_data()
The swing mode is set to Off.
The climate device is off.
bool parse_temperature_(const uint8_t remote_state[])
const uint8_t HITACHI_AC424_TEMP_MAX
optional< ClimateFanMode > fan_mode
The active fan mode of the climate device.
const uint8_t HITACHI_AC424_SWINGH_MIDDLE
The fan mode is set to On.
bool on_receive(remote_base::RemoteReceiveData data) override
const uint8_t HITACHI_AC424_BUTTON_TEMP_UP
Implementation of SPI Controller mode.
const uint8_t HITACHI_AC424_FAN_BYTE
const uint8_t HITACHI_AC424_FAN_MAX_DRY
const uint32_t HITACHI_AC424_MIN_GAP
void set_button_(uint8_t button)
const uint8_t HITACHI_AC424_SWINGH_OFFSET
const uint8_t HITACHI_AC424_TEMP_BYTE
The fan mode is set to Medium.
uint8_t remote_state_[HITACHI_AC424_STATE_LENGTH]
const uint8_t HITACHI_AC424_BUTTON_POWER
const uint8_t HITACHI_AC424_SWINGH_LEFT_MAX
const uint16_t HITACHI_AC424_FREQ
bool expect_item(uint32_t mark, uint32_t space)
The climate device only has the fan enabled, no heating or cooling is taking place.
ClimateAction action
The active state of the climate device.
void set_swing_h_(uint8_t position)
void set_swing_v_(bool on)
void dump_state_(const char action[], uint8_t remote_state[])