4namespace fujitsu_general {
8#define SET_NIBBLE(message, nibble, value) \
9 ((message)[(nibble) / 2] |= ((value) &0b00001111) << (((nibble) % 2) ? 0 : 4))
10#define GET_NIBBLE(message, nibble) (((message)[(nibble) / 2] >> (((nibble) % 2) ? 0 : 4)) & 0b00001111)
12static const char *
const TAG =
"fujitsu_general.climate";
94 ESP_LOGV(TAG,
"Transmit state");
112 uint8_t temperature_clamped =
123 switch (this->
mode) {
191 ESP_LOGV(TAG,
"Transmit off");
209 ESP_LOGV(TAG,
"Transmit message length %d",
length);
221 for (uint8_t i = 0; i <
length; ++i) {
222 const uint8_t
byte = message[i];
223 for (uint8_t mask = 0b00000001; mask > 0; mask <<= 1) {
225 bool bit =
byte & mask;
248 ESP_LOGV(TAG,
"Received IR message");
252 ESP_LOGV(TAG,
"Header fail");
261 for (uint8_t bit = 0; bit < 8; ++bit) {
263 recv_message[byte] |= 1 << bit;
265 ESP_LOGV(TAG,
"Byte %d bit %d fail",
byte, bit);
272 uint8_t recv_message_length;
274 switch (recv_message_type) {
276 ESP_LOGV(TAG,
"Received state message");
282 ESP_LOGV(TAG,
"Received util message");
286 ESP_LOGV(TAG,
"Unknown message type %X", recv_message_type);
292 for (uint8_t bit = 0; bit < 8; ++bit) {
294 recv_message[byte] |= 1 << bit;
296 ESP_LOGV(TAG,
"Byte %d bit %d fail",
byte, bit);
302 for (uint8_t
byte = 0;
byte < recv_message_length; ++byte) {
303 ESP_LOGVV(TAG,
"%02X", recv_message[
byte]);
306 const uint8_t recv_checksum = recv_message[recv_message_length - 1];
307 uint8_t calculated_checksum;
314 if (recv_checksum != calculated_checksum) {
315 ESP_LOGV(TAG,
"Checksum fail - expected %X - got %X", calculated_checksum, recv_checksum);
323 ESP_LOGV(TAG,
"Received temperature %d", offset_temperature);
326 ESP_LOGV(TAG,
"Received mode %X", recv_mode);
348 ESP_LOGV(TAG,
"Received fan mode %X", recv_fan_mode);
349 switch (recv_fan_mode) {
369 ESP_LOGV(TAG,
"Received swing mode %X", recv_swing_mode);
370 switch (recv_swing_mode) {
389 ESP_LOGV(TAG,
"Received off message");
395 ESP_LOGV(TAG,
"Received unsupprted message type %X", recv_message_type);
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.
void publish_state()
Publish the state of the climate device, to be called from integrations.
uint8_t checksum_state_(uint8_t const *message)
Calculate checksum for a state message.
void transmit_state() override
Transmit via IR the state of this climate controller.
uint8_t checksum_util_(uint8_t const *message)
Calculate cecksum for a util message.
bool on_receive(remote_base::RemoteReceiveData data) override
Parse incoming message.
void transmit_off_()
Transmit via IR power off command.
void transmit_(uint8_t const *message, uint8_t length)
Transmit message as IR pulses.
value_type const & value() const
bool expect_item(uint32_t mark, uint32_t space)
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_AUTO
The fan mode is set to Auto.
@ CLIMATE_FAN_LOW
The fan mode is set to Low.
@ CLIMATE_FAN_QUIET
The fan mode is set to Quiet.
@ CLIMATE_FAN_HIGH
The fan mode is set to High.
const uint8_t FUJITSU_GENERAL_FAN_NIBBLE
const uint8_t FUJITSU_GENERAL_MESSAGE_TYPE_STATE
const uint16_t FUJITSU_GENERAL_ZERO_SPACE
const uint8_t FUJITSU_GENERAL_POWER_ON
const uint8_t FUJITSU_GENERAL_FAN_AUTO
const uint8_t FUJITSU_GENERAL_SWING_NONE
const uint8_t FUJITSU_GENERAL_FAN_SILENT
const uint16_t FUJITSU_GENERAL_HEADER_MARK
const uint16_t FUJITSU_GENERAL_TRL_SPACE
const uint16_t FUJITSU_GENERAL_BIT_MARK
const uint8_t FUJITSU_GENERAL_POWER_ON_NIBBLE
const uint8_t FUJITSU_GENERAL_FAN_HIGH
const uint8_t FUJITSU_GENERAL_COMMON_BYTE4
const uint8_t FUJITSU_GENERAL_SWING_BOTH
const uint16_t FUJITSU_GENERAL_HEADER_SPACE
const uint8_t FUJITSU_GENERAL_POWER_OFF
const uint16_t FUJITSU_GENERAL_ONE_SPACE
const uint8_t FUJITSU_GENERAL_MESSAGE_TYPE_ECONOMY
const uint8_t FUJITSU_GENERAL_TEMPERATURE_NIBBLE
const uint8_t FUJITSU_GENERAL_COMMON_LENGTH
const uint8_t FUJITSU_GENERAL_MODE_DRY
const uint8_t FUJITSU_GENERAL_COMMON_BYTE1
const uint8_t FUJITSU_GENERAL_FAN_MEDIUM
const uint8_t FUJITSU_GENERAL_STATE_HEADER_BYTE1
const uint8_t FUJITSU_GENERAL_MODE_FAN
const uint8_t FUJITSU_GENERAL_MODE_AUTO
const uint8_t FUJITSU_GENERAL_MESSAGE_TYPE_BYTE
const uint32_t FUJITSU_GENERAL_CARRIER_FREQUENCY
const uint8_t FUJITSU_GENERAL_SWING_VERTICAL
const uint8_t FUJITSU_GENERAL_STATE_MESSAGE_LENGTH
const uint16_t FUJITSU_GENERAL_TRL_MARK
const uint8_t FUJITSU_GENERAL_SWING_HORIZONTAL
const uint8_t FUJITSU_GENERAL_MODE_HEAT
const uint8_t FUJITSU_GENERAL_MODE_NIBBLE
const uint8_t FUJITSU_GENERAL_STATE_HEADER_BYTE0
const uint8_t FUJITSU_GENERAL_TEMP_MAX
const uint8_t FUJITSU_GENERAL_COMMON_BYTE2
const uint8_t FUJITSU_GENERAL_STATE_FOOTER_BYTE0
const uint8_t FUJITSU_GENERAL_TEMP_MIN
const uint8_t FUJITSU_GENERAL_MODE_COOL
const uint8_t FUJITSU_GENERAL_UTIL_MESSAGE_LENGTH
const uint8_t FUJITSU_GENERAL_FAN_LOW
const uint8_t FUJITSU_GENERAL_COMMON_BYTE0
const uint8_t FUJITSU_GENERAL_MESSAGE_TYPE_OFF
const uint8_t FUJITSU_GENERAL_MESSAGE_TYPE_NUDGE
const uint8_t FUJITSU_GENERAL_SWING_NIBBLE
const uint8_t FUJITSU_GENERAL_COMMON_BYTE3
Providing packet encoding functions for exchanging data with a remote host.