Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for newer Ethera devices #95

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ An open source alternative for the Panasonic wi-fi adapter that works locally wi

# Features

* NEW: Support Ethera generation ACs
* Control your AC locally via Home Assistant, MQTT or directly
* Instantly control the AC without any delay like in the Comfort Cloud app
* Receive live reports and state from the AC
Expand Down
4 changes: 2 additions & 2 deletions components/panasonic_ac/esppac.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ namespace panasonic_ac {

static const char *const VERSION = "2.4.0";

static const uint8_t BUFFER_SIZE = 128; // The maximum size of a single packet (both receive and transmit)
static const uint8_t READ_TIMEOUT = 20; // The maximum time to wait before considering a packet complete
static const uint8_t BUFFER_SIZE = 240; // The maximum size of a single packet (both receive and transmit)
static const uint8_t READ_TIMEOUT = 240; // The maximum time to wait before considering a packet complete

static const uint8_t MIN_TEMPERATURE = 16; // Minimum temperature as reported by Panasonic app
static const uint8_t MAX_TEMPERATURE = 30; // Maximum temperature as supported by Panasonic app
Expand Down
8 changes: 8 additions & 0 deletions components/panasonic_ac/esppac_wlan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,10 @@ void PanasonicACWLAN::handle_handshake_packet() {
{
ESP_LOGD(TAG, "Answering handshake [12/16]");
send_command(CMD_HANDSHAKE_13, sizeof(CMD_HANDSHAKE_13));
} else if (this->rx_buffer_[14] == 0x83 && this->rx_buffer_[15] == 0x5A) // Ethera generation devices handshake failure
{
ESP_LOGD(TAG, "Received 83 5A packet, Initialization failed, restarting init");
this->state_ = ACState::Initializing; // Restart Initialization, otherwise hangs here on ethera. Likely to succeed on 2nd attempt.
} else if (this->rx_buffer_[2] == 0x10 && this->rx_buffer_[3] == 0x88) // Answer for handshake 13
{
// Ignore
Expand Down Expand Up @@ -646,6 +650,10 @@ void PanasonicACWLAN::send_set_command() {
packet[12 + (i * 4) + 3] =
0x00; // Unknown, either 0x00 or 0x01 or 0x02; overwritten by checksum on last key value pair
}

if (packet[12] == 0x31) {
packet[11] = 0x02;
}

send_packet(packet, CommandType::Normal);
this->set_queue_index_ = 0;
Expand Down
4 changes: 2 additions & 2 deletions components/panasonic_ac/esppac_wlan.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ namespace WLAN {
static const uint8_t HEADER = 0x5A; // The header of the protocol, every packet starts with this

static const int INIT_TIMEOUT = 10000; // Time to wait before initializing after boot
static const int INIT_END_TIMEOUT = 10000; // Time to wait for last handshake packet
static const int INIT_END_TIMEOUT = 20000; // Time to wait for last handshake packet
static const int FIRST_POLL_TIMEOUT = 650; // Time to wait before requesting the first poll
static const int POLL_INTERVAL = 30000; // The interval at which to poll the AC
static const int RESPONSE_TIMEOUT = 600; // The timeout after which we expect a response to our last command
static const int INIT_FAIL_TIMEOUT = 30000; // The timeout after which the initialization is considered failed
static const int INIT_FAIL_TIMEOUT = 60000; // The timeout after which the initialization is considered failed

enum class ACState {
Initializing, // Before first handshake packet is sent
Expand Down