8struct RacPt1411hwruFanSpeed {
13static const char *
const TAG =
"toshiba.climate";
94 0x04, 0x0C, 0x0D, 0x09, 0x08, 0x0A, 0x0B};
97 0x22, 0x06, 0x26, 0x07, 0x05, 0x25, 0x04, 0x24, 0x0C,
98 0x2C, 0x0D, 0x2D, 0x09, 0x08, 0x28, 0x0A, 0x2A, 0x0B};
114 if (restore.has_value()) {
115 restore->apply(
this);
143 uint8_t message[16] = {0};
144 uint8_t message_length = 9;
151 message[2] = message_length - 6;
154 message[3] = message[0] ^ message[1] ^ message[2];
166 switch (this->mode) {
215 message[6] = fan |
mode;
225 for (uint8_t i = 4; i < 8; i++) {
226 message[8] ^= message[i];
233 encode_(data, message, message_length, 1);
249 message[1] = ~message[0];
282 message[3] = ~message[2];
289 index =
static_cast<uint8_t
>(roundf(temp_adjd));
309 switch (this->
mode) {
337 message[5] = ~message[4];
347 for (index = 6; index <= 10; index++) {
348 message[11] += message[index];
351 ESP_LOGV(TAG,
"*** Generated codes: 0x%.2X%.2X%.2X%.2X%.2X%.2X 0x%.2X%.2X%.2X%.2X%.2X%.2X", message[0], message[1],
352 message[2], message[3], message[4], message[5], message[6], message[7], message[8], message[9], message[10],
358 if (message[6] != 0) {
404 message[1] = ~message[0];
406 message[2] =
static_cast<uint8_t
>(roundf(
temperature));
407 if (cs_send_update) {
409 }
else if (cs_state) {
413 message[3] = ~message[2];
415 switch (this->
mode) {
431 message[5] = ~message[4];
433 ESP_LOGV(TAG,
"*** Generated code: 0x%.2X%.2X%.2X%.2X%.2X%.2X", message[0], message[1], message[2], message[3],
434 message[4], message[5]);
446 for (
auto i : header) {
447 if ((message[0] == i) && (message[1] ==
static_cast<uint8_t
>(~i)))
458 if (message1[i] != message2[i])
472 (message[4] ==
static_cast<uint8_t
>(~message[5]))) {
494 uint8_t message[18] = {0};
502 if (!
decode_(&data, message, message_length)) {
509 }
else if ((message[0] ^ message[1] ^ message[2]) != message[3]) {
514 message_length = message[2] + 2;
517 if (!
decode_(&data, &message[4], message_length)) {
560 switch (message[4] & 0x0F) {
592 switch (message[2]) {
664 if (
checksum != message[message_length - 1]) {
674 switch (message[6] & 0x0F) {
701 switch (message[6] & 0xF0) {
733 const uint8_t repeat) {
736 for (uint8_t copy = 0; copy <= repeat; copy++) {
739 for (uint8_t
byte = 0;
byte < nbytes;
byte++) {
740 for (uint8_t bit = 0; bit < 8; bit++) {
742 if (message[
byte] & (1 << (7 - bit))) {
754 for (uint8_t
byte = 0;
byte < nbytes;
byte++) {
755 for (uint8_t bit = 0; bit < 8; bit++) {
757 message[byte] |= 1 << (7 - bit);
759 message[byte] &=
static_cast<uint8_t
>(~(1 << (7 - bit)));
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.
float current_temperature
The current temperature of the climate device, as reported from the integration.
void publish_state()
Publish the state of the climate device, to be called from integrations.
optional< ClimateDeviceRestoreState > restore_state_()
Restore the state of the climate device, call this from your setup() method.
float maximum_temperature_
std::set< climate::ClimateSwingMode > swing_modes_
float minimum_temperature_
value_type const & value() const
bool expect_item(uint32_t mark, uint32_t space)
void space(uint32_t length)
void set_carrier_frequency(uint32_t carrier_frequency)
void mark(uint32_t length)
void item(uint32_t mark, uint32_t space)
RemoteTransmitterBase * transmitter_
RemoteTransmitData * get_data()
void add_on_state_callback(std::function< void(float)> &&callback)
Add a callback that will be called every time a filtered value arrives.
float state
This member variable stores the last state that has passed through all filters.
void encode_(remote_base::RemoteTransmitData *data, const uint8_t *message, uint8_t nbytes, uint8_t repeat)
bool compare_rac_pt1411hwru_packets_(const uint8_t *message1, const uint8_t *message2)
bool is_valid_rac_pt1411hwru_message_(const uint8_t *message)
uint8_t is_valid_rac_pt1411hwru_header_(const uint8_t *message)
void transmit_rac_pt1411hwru_()
bool decode_(remote_base::RemoteReceiveData *data, uint8_t *message, uint8_t nbytes)
std::set< climate::ClimateSwingMode > toshiba_swing_modes_()
void transmit_rac_pt1411hwru_temp_(bool cs_state=true, bool cs_send_update=true)
void transmit_state() override
bool on_receive(remote_base::RemoteReceiveData data) override
@ CLIMATE_SWING_OFF
The swing mode is set to Off.
@ CLIMATE_SWING_VERTICAL
The fan mode is set to Vertical.
@ 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 TOSHIBA_HEADER_LENGTH
const uint8_t RAC_PT1411HWRU_MODE_HEAT
const uint16_t TOSHIBA_HEADER_MARK
const uint8_t TOSHIBA_MODE_HEAT
const uint8_t RAC_PT1411HWRU_MODE_FAN
const uint8_t RAC_PT1411HWRU_CS_ENABLED
const uint16_t TOSHIBA_CARRIER_FREQUENCY
const uint8_t TOSHIBA_FAN_SPEED_2
const uint8_t RAC_PT1411HWRU_MODE_AUTO
const RacPt1411hwruFanSpeed RAC_PT1411HWRU_NO_FAN
const uint8_t RAC_PT1411HWRU_MODE_COOL
const uint8_t RAC_PT1411HWRU_TEMPERATURE_FAN_ONLY
const uint8_t TOSHIBA_COMMAND_MOTION
const uint8_t RAC_PT1411HWRU_FLAG_FAH
const uint8_t RAC_PT1411HWRU_CS_FOOTER_COOL
const uint8_t RAC_PT1411HWRU_CS_DATA
const uint8_t TOSHIBA_MODE_DRY
const uint8_t RAC_PT1411HWRU_FAN_OFF
const uint8_t TOSHIBA_FAN_SPEED_QUIET
const uint16_t TOSHIBA_BIT_MARK
const uint8_t RAC_PT1411HWRU_FLAG_NEG
const float TOSHIBA_RAC_PT1411HWRU_TEMP_F_MIN
const uint8_t TOSHIBA_POWER_HIGH
const uint8_t TOSHIBA_MODE_FAN_ONLY
const uint8_t TOSHIBA_POWER_ECO
const float TOSHIBA_GENERIC_TEMP_C_MAX
const uint8_t TOSHIBA_MODE_COOL
const float TOSHIBA_GENERIC_TEMP_C_MIN
const uint16_t TOSHIBA_ZERO_SPACE
const uint8_t TOSHIBA_FAN_SPEED_3
constexpr RacPt1411hwruFanSpeed RAC_PT1411HWRU_FAN_LOW
const uint16_t TOSHIBA_GAP_SPACE
const uint8_t RAC_PT1411HWRU_MESSAGE_HEADER1
const float TOSHIBA_RAC_PT1411HWRU_TEMP_C_MAX
const uint8_t RAC_PT1411HWRU_CS_HEADER
const uint8_t TOSHIBA_COMMAND_POWER
constexpr RacPt1411hwruFanSpeed RAC_PT1411HWRU_FAN_AUTO
const std::vector< uint8_t > RAC_PT1411HWRU_TEMPERATURE_F
const uint8_t TOSHIBA_COMMAND_TIMER
const uint8_t TOSHIBA_FAN_SPEED_4
const uint8_t TOSHIBA_COMMAND_DEFAULT
const uint8_t TOSHIBA_FAN_SPEED_1
const std::vector< uint8_t > RAC_PT1411HWRU_SWING_VERTICAL
const uint8_t RAC_PT1411HWRU_CS_FOOTER_AUTO
const uint8_t TOSHIBA_MOTION_SWING
const uint8_t TOSHIBA_MODE_AUTO
const uint8_t RAC_PT1411HWRU_MODE_DRY
const uint16_t TOSHIBA_ONE_SPACE
constexpr RacPt1411hwruFanSpeed RAC_PT1411HWRU_FAN_HIGH
const uint8_t TOSHIBA_FAN_SPEED_5
const uint8_t RAC_PT1411HWRU_MESSAGE_HEADER0
constexpr RacPt1411hwruFanSpeed RAC_PT1411HWRU_FAN_MED
const uint8_t RAC_PT1411HWRU_FLAG_FRAC
const uint16_t TOSHIBA_HEADER_SPACE
const uint8_t TOSHIBA_MODE_OFF
const uint8_t RAC_PT1411HWRU_CS_FOOTER_HEAT
const uint16_t TOSHIBA_PACKET_SPACE
const uint8_t RAC_PT1411HWRU_MODE_OFF
const float TOSHIBA_RAC_PT1411HWRU_TEMP_C_MIN
const uint8_t RAC_PT1411HWRU_MESSAGE_LENGTH
const uint8_t RAC_PT1411HWRU_FLAG_MASK
const uint8_t TOSHIBA_MOTION_FIX
const std::vector< uint8_t > RAC_PT1411HWRU_TEMPERATURE_C
const uint8_t RAC_PT1411HWRU_SWING_HEADER
const uint8_t TOSHIBA_FAN_SPEED_AUTO
const std::vector< uint8_t > RAC_PT1411HWRU_SWING_OFF
Providing packet encoding functions for exchanging data with a remote host.
constexpr const T & clamp(const T &v, const T &lo, const T &hi, Compare comp)