4 namespace hitachi_ac344 {
6 static const char *
const TAG =
"climate.hitachi_ac344";
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);
151 switch (this->
mode) {
221 for (uint8_t r = 0; r <= repeat; r++) {
226 for (uint8_t j = 0; j < 8; j++) {
228 bool bit = i & (1 << j);
273 ESP_LOGV(TAG,
"Temperature: %02X %02u %04f", remote_state[HITACHI_AC344_TEMP_BYTE], temperature,
301 uint8_t swing_modeh =
303 ESP_LOGV(TAG,
"SwingH: %02X %02X", remote_state[HITACHI_AC344_SWINGH_BYTE], swing_modeh);
305 if ((swing_modeh & 0x3) == 0x3) {
317 ESP_LOGVV(TAG,
"Header fail");
325 for (int8_t bit = 0; bit < 8; bit++) {
327 recv_state[pos] |= 1 << bit;
329 ESP_LOGVV(TAG,
"Byte %d bit %d fail", pos, bit);
337 ESP_LOGVV(TAG,
"Footer fail");
360 ESP_LOGV(TAG,
"%s: %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X", action, state[i + 0], state[i + 1],
361 state[i + 2], state[i + 3], state[i + 4], state[i + 5], state[i + 6], state[i + 7], state[i + 8],
364 ESP_LOGV(TAG,
"%s: %02X %02X %02X", action, state[40], state[41], state[42]);
The fan mode is set to Low.
const uint16_t HITACHI_AC344_HDR_MARK
value_type const & value() const
void transmit_state() override
ClimateSwingMode swing_mode
The active swing mode of the climate device.
const uint8_t HITACHI_AC344_FAN_AUTO
The fan mode is set to Both.
const uint8_t HITACHI_AC344_SWINGH_BYTE
void set_temp_(uint8_t celsius, bool set_previous=false)
float target_temperature
The target temperature of the climate device.
const uint8_t HITACHI_AC344_SWINGH_OFFSET
const uint8_t HITACHI_AC344_TEMP_SIZE
void set_carrier_frequency(uint32_t carrier_frequency)
const uint8_t HITACHI_AC344_MODE_AUTO
void set_bit(uint8_t *const data, const uint8_t position, const bool on)
const uint8_t HITACHI_AC344_FAN_BYTE
void set_mode_(uint8_t mode)
void set_swing_v_toggle_(bool on)
const uint8_t HITACHI_AC344_BUTTON_SWINGV
const LogString * climate_mode_to_string(ClimateMode mode)
Convert the given ClimateMode to a human-readable string.
The climate device is set to heat to reach the target temperature.
const uint8_t HITACHI_AC344_MODE_FAN
bool on_receive(remote_base::RemoteReceiveData data) override
void set_swing_h_(uint8_t position)
void set_bits(uint8_t *const dst, const uint8_t offset, const uint8_t nbits, const uint8_t data)
ClimateMode mode
The active mode of the climate device.
const uint8_t HITACHI_AC344_BUTTON_POWER
const uint8_t HITACHI_AC344_TEMP_MAX
The climate device is set to dry/humidity mode.
bool expect_mark(uint32_t length)
const uint8_t HITACHI_AC344_TEMP_FAN
uint8_t remote_state_[HITACHI_AC344_STATE_LENGTH]
bool parse_mode_(const uint8_t remote_state[])
void set_button_(uint8_t button)
const uint8_t HITACHI_AC344_TEMP_OFFSET
const uint8_t HITACHI_AC344_FAN_MEDIUM
bool get_swing_v_toggle_()
const uint8_t HITACHI_AC344_SWINGV_BYTE
The fan mode is set to Horizontal.
The climate device is set to cool to reach the target temperature.
const uint8_t HITACHI_AC344_FAN_HIGH
The fan mode is set to Auto.
const uint32_t HITACHI_AC344_MIN_GAP
bool parse_swing_(const uint8_t remote_state[])
const uint8_t HITACHI_AC344_BUTTON_BYTE
const uint8_t HITACHI_AC344_SWINGH_AUTO
const uint8_t HITACHI_AC344_BUTTON_TEMP_DOWN
RemoteTransmitterBase * transmitter_
const uint8_t HITACHI_AC344_SWINGH_SIZE
const uint8_t HITACHI_AC344_POWER_BYTE
const uint8_t HITACHI_AC344_POWER_OFF
The climate device is set to heat/cool to reach the target temperature.
The fan mode is set to Vertical.
const uint8_t HITACHI_AC344_BUTTON_SWINGH
const uint8_t HITACHI_AC344_FAN_MAX_DRY
bool parse_temperature_(const uint8_t remote_state[])
const uint8_t HITACHI_AC344_BUTTON_TEMP_UP
const uint16_t HITACHI_AC344_HDR_SPACE
const uint8_t HITACHI_AC344_BUTTON_FAN
void publish_state()
Publish the state of the climate device, to be called from integrations.
The fan mode is set to High.
const uint8_t HITACHI_AC344_SWINGV_OFFSET
RemoteTransmitData * get_data()
The swing mode is set to Off.
The climate device is off.
void set_swing_v_(bool on)
bool parse_fan_(const uint8_t remote_state[])
const uint8_t HITACHI_AC344_TEMP_MIN
const uint16_t HITACHI_AC344_FREQ
const uint8_t HITACHI_AC344_FAN_LOW
const uint8_t HITACHI_AC344_MODE_DRY
optional< ClimateFanMode > fan_mode
The active fan mode of the climate device.
const uint16_t HITACHI_AC344_ZERO_SPACE
const uint16_t HITACHI_AC344_BIT_MARK
const uint8_t HITACHI_AC344_MODE_BYTE
void dump_state_(const char action[], uint8_t remote_state[])
const uint8_t HITACHI_AC344_SWINGH_LEFT_MAX
const uint8_t HITACHI_AC344_SWINGH_MIDDLE
The fan mode is set to On.
const uint8_t HITACHI_AC344_MODE_COOL
void set_fan_(uint8_t speed)
uint8_t * invert_byte_pairs(uint8_t *ptr, const uint16_t length)
const uint8_t HITACHI_AC344_TEMP_BYTE
Implementation of SPI Controller mode.
const uint16_t HITACHI_AC344_ONE_SPACE
const uint8_t HITACHI_AC344_MODE_HEAT
const uint8_t HITACHI_AC344_FAN_MIN
The fan mode is set to Medium.
const uint16_t HITACHI_AC344_STATE_LENGTH
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.
const uint8_t HITACHI_AC344_POWER_ON
const uint8_t HITACHI_AC344_FAN_MAX