mirror of
https://github.com/esphome/esphome.git
synced 2024-11-30 02:34:12 +01:00
Fix an Issue with IR Remote Climate and Whirlpool protocol toggle (#5447)
Co-authored-by: Clyde Stubbs <2366188+clydebarrow@users.noreply.github.com> Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
parent
ec4777b8d0
commit
e9bda2810f
2 changed files with 9 additions and 0 deletions
|
@ -33,6 +33,7 @@ const uint8_t WHIRLPOOL_SWING_MASK = 128;
|
||||||
const uint8_t WHIRLPOOL_POWER = 0x04;
|
const uint8_t WHIRLPOOL_POWER = 0x04;
|
||||||
|
|
||||||
void WhirlpoolClimate::transmit_state() {
|
void WhirlpoolClimate::transmit_state() {
|
||||||
|
this->last_transmit_time_ = millis(); // setting the time of the last transmission.
|
||||||
uint8_t remote_state[WHIRLPOOL_STATE_LENGTH] = {0};
|
uint8_t remote_state[WHIRLPOOL_STATE_LENGTH] = {0};
|
||||||
remote_state[0] = 0x83;
|
remote_state[0] = 0x83;
|
||||||
remote_state[1] = 0x06;
|
remote_state[1] = 0x06;
|
||||||
|
@ -149,6 +150,12 @@ void WhirlpoolClimate::transmit_state() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WhirlpoolClimate::on_receive(remote_base::RemoteReceiveData data) {
|
bool WhirlpoolClimate::on_receive(remote_base::RemoteReceiveData data) {
|
||||||
|
// Check if the esp isn't currently transmitting.
|
||||||
|
if (millis() - this->last_transmit_time_ < 500) {
|
||||||
|
ESP_LOGV(TAG, "Blocked receive because of current trasmittion");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Validate header
|
// Validate header
|
||||||
if (!data.expect_item(WHIRLPOOL_HEADER_MARK, WHIRLPOOL_HEADER_SPACE)) {
|
if (!data.expect_item(WHIRLPOOL_HEADER_MARK, WHIRLPOOL_HEADER_SPACE)) {
|
||||||
ESP_LOGV(TAG, "Header fail");
|
ESP_LOGV(TAG, "Header fail");
|
||||||
|
|
|
@ -47,6 +47,8 @@ class WhirlpoolClimate : public climate_ir::ClimateIR {
|
||||||
void transmit_state() override;
|
void transmit_state() override;
|
||||||
/// Handle received IR Buffer
|
/// Handle received IR Buffer
|
||||||
bool on_receive(remote_base::RemoteReceiveData data) override;
|
bool on_receive(remote_base::RemoteReceiveData data) override;
|
||||||
|
/// Set the time of the last transmission.
|
||||||
|
int32_t last_transmit_time_{};
|
||||||
|
|
||||||
bool send_swing_cmd_{false};
|
bool send_swing_cmd_{false};
|
||||||
Model model_;
|
Model model_;
|
||||||
|
|
Loading…
Reference in a new issue