4namespace hitachi_ac344 {
6static const char *
const TAG =
"climate.hitachi_ac344";
8void 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);
153 switch (this->
mode) {
173 ESP_LOGW(TAG,
"Unsupported mode: %s", LOG_STR_ARG(climate_mode_to_string(this->
mode)));
223 for (uint8_t r = 0; r <= repeat; r++) {
228 for (uint8_t j = 0; j < 8; j++) {
230 bool bit = i & (1 << j);
303 uint8_t swing_modeh =
307 if ((swing_modeh & 0x3) == 0x3) {
319 ESP_LOGVV(TAG,
"Header fail");
327 for (int8_t bit = 0; bit < 8; bit++) {
329 recv_state[pos] |= 1 << bit;
331 ESP_LOGVV(TAG,
"Byte %d bit %d fail", pos, bit);
339 ESP_LOGVV(TAG,
"Footer fail");
362 ESP_LOGV(TAG,
"%s: %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X",
action,
state[i + 0],
state[i + 1],
BedjetMode mode
BedJet operating mode.
ClimateMode mode
The active mode of the climate device.
optional< ClimateFanMode > fan_mode
The active fan mode of the climate device.
float target_temperature
The target temperature of the climate device.
ClimateSwingMode swing_mode
The active swing mode of the climate device.
ClimateAction action
The active state of the climate device.
void publish_state()
Publish the state of the climate device, to be called from integrations.
void transmit_state() override
bool on_receive(remote_base::RemoteReceiveData data) override
void set_swing_v_(bool on)
void dump_state_(const char action[], uint8_t remote_state[])
bool parse_temperature_(const uint8_t remote_state[])
void set_swing_h_(uint8_t position)
bool parse_mode_(const uint8_t remote_state[])
void set_fan_(uint8_t speed)
bool parse_fan_(const uint8_t remote_state[])
void set_swing_v_toggle_(bool on)
void set_mode_(uint8_t mode)
void set_temp_(uint8_t celsius, bool set_previous=false)
uint8_t remote_state_[HITACHI_AC344_STATE_LENGTH]
bool parse_swing_(const uint8_t remote_state[])
bool get_swing_v_toggle_()
void set_button_(uint8_t button)
value_type const & value() const
bool expect_item(uint32_t mark, uint32_t space)
bool expect_mark(uint32_t length)
void set_carrier_frequency(uint32_t carrier_frequency)
RemoteTransmitterBase * transmitter_
RemoteTransmitData * get_data()
@ CLIMATE_SWING_OFF
The swing mode is set to Off.
@ CLIMATE_SWING_HORIZONTAL
The fan mode is set to Horizontal.
@ CLIMATE_SWING_VERTICAL
The fan mode is set to Vertical.
@ CLIMATE_SWING_BOTH
The fan mode is set to Both.
@ CLIMATE_MODE_DRY
The climate device is set to dry/humidity mode.
@ CLIMATE_MODE_FAN_ONLY
The climate device only has the fan enabled, no heating or cooling is taking place.
@ CLIMATE_MODE_HEAT
The climate device is set to heat to reach the target temperature.
@ CLIMATE_MODE_COOL
The climate device is set to cool to reach the target temperature.
@ CLIMATE_MODE_HEAT_COOL
The climate device is set to heat/cool to reach the target temperature.
@ CLIMATE_MODE_OFF
The climate device is off.
@ CLIMATE_FAN_MEDIUM
The fan mode is set to Medium.
@ CLIMATE_FAN_ON
The fan mode is set to On.
@ CLIMATE_FAN_AUTO
The fan mode is set to Auto.
@ CLIMATE_FAN_LOW
The fan mode is set to Low.
@ CLIMATE_FAN_HIGH
The fan mode is set to High.
const uint8_t HITACHI_AC344_SWINGV_OFFSET
const uint8_t HITACHI_AC344_TEMP_MIN
const uint8_t HITACHI_AC344_BUTTON_FAN
const uint16_t HITACHI_AC344_BIT_MARK
void set_bit(uint8_t *const data, const uint8_t position, const bool on)
const uint8_t HITACHI_AC344_BUTTON_BYTE
const uint8_t HITACHI_AC344_TEMP_BYTE
const uint8_t HITACHI_AC344_MODE_BYTE
const uint8_t HITACHI_AC344_SWINGV_BYTE
const uint16_t HITACHI_AC344_ZERO_SPACE
const uint8_t HITACHI_AC344_SWINGH_SIZE
const uint8_t HITACHI_AC344_FAN_MIN
const uint8_t HITACHI_AC344_BUTTON_POWER
uint8_t * invert_byte_pairs(uint8_t *ptr, const uint16_t length)
const uint8_t HITACHI_AC344_BUTTON_SWINGH
const uint8_t HITACHI_AC344_FAN_MAX
const uint8_t HITACHI_AC344_MODE_DRY
const uint16_t HITACHI_AC344_HDR_SPACE
const uint8_t HITACHI_AC344_FAN_MAX_DRY
const uint8_t HITACHI_AC344_MODE_FAN
void set_bits(uint8_t *const dst, const uint8_t offset, const uint8_t nbits, const uint8_t data)
const uint16_t HITACHI_AC344_FREQ
const uint8_t HITACHI_AC344_SWINGH_AUTO
const uint8_t HITACHI_AC344_BUTTON_TEMP_DOWN
const uint8_t HITACHI_AC344_MODE_AUTO
const uint8_t HITACHI_AC344_BUTTON_TEMP_UP
const uint8_t HITACHI_AC344_MODE_COOL
const uint16_t HITACHI_AC344_STATE_LENGTH
const uint8_t HITACHI_AC344_SWINGH_OFFSET
const uint8_t HITACHI_AC344_POWER_ON
const uint8_t HITACHI_AC344_TEMP_SIZE
const uint8_t HITACHI_AC344_FAN_HIGH
const uint8_t HITACHI_AC344_MODE_HEAT
const uint8_t HITACHI_AC344_FAN_BYTE
const uint16_t HITACHI_AC344_HDR_MARK
const uint8_t HITACHI_AC344_SWINGH_LEFT_MAX
const uint8_t HITACHI_AC344_TEMP_MAX
const uint8_t HITACHI_AC344_TEMP_OFFSET
const uint8_t HITACHI_AC344_FAN_LOW
const uint32_t HITACHI_AC344_MIN_GAP
const uint8_t HITACHI_AC344_FAN_MEDIUM
const uint8_t HITACHI_AC344_POWER_OFF
const uint8_t HITACHI_AC344_SWINGH_MIDDLE
const uint8_t HITACHI_AC344_POWER_BYTE
const uint8_t HITACHI_AC344_FAN_AUTO
const uint16_t HITACHI_AC344_ONE_SPACE
const uint8_t HITACHI_AC344_SWINGH_BYTE
const uint8_t HITACHI_AC344_BUTTON_SWINGV
const uint8_t HITACHI_AC344_TEMP_FAN
Providing packet encoding functions for exchanging data with a remote host.