Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/test_panasonic_heatpump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
strategy:
fail-fast: false
matrix:
board: [esp8266, esp32s2, esp32c3, full]
board: [esp32s2, esp32c3, full]
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion components/maidesite_desk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

### What you need

* ESPHome compatible microcontroller (e.g. ESP8266, ESP32, ESP32-S2, ESP32-C3, ...)
* ESPHome compatible microcontroller (e.g. ESP32, ESP32-S2, ESP32-C3, ...)
* RJ12 cable (phone cable, RJ11 may also work)

### Wiring
Expand Down
27 changes: 21 additions & 6 deletions components/panasonic_heatpump/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,28 @@

### What you need

* ESPHome compatible microcontroller (e.g. ESP8266, ESP32, ESP32-S2, ESP32-C3, ...)
* ESPHome compatible microcontroller (e.g. ESP32, ESP32-S2, ESP32-C3, ...)
* ADUM1201 Dual Channel Digital Magnetic Isolator
(to convert 5V UART signal from the heatpump to 3.3V UART signal of the ESP controller)
* CN-CNT cable/connectors to Heatpump/CZ-TAW1 (see [Heishamon](https://github.com/Egyras/HeishaMon) github site for more information)
* CN-CNT cable/connectors to Heatpump/CZ-TAW1 (see [Heishamon](https://github.com/heishamon/HeishaMon) github site for more information)
* For example: [S05B-XASK-1 JST Connector](https://a.aliexpress.com/_EvkmGVo)
* For example: [XAP-05V-1 5Pin Cable with Female to Female Connector](https://a.aliexpress.com/_ExPT82E)

> [!IMPORTANT]
> The support for ESP8266 and the arduino framework is deprecated for this component.
> Since v0.0.8 this component uses threads to process the UART communication.
> But if you still want to use an ESP8266 controller or the arduino framework,
> please use the branch "heatpump/arduino".
>
> ```yaml
> external_components:
> - source:
> type: git
> url: https://github.com/ElVit/esphome_components
> ref: 'heatpump/arduino'
> components: [ panasonic_heatpump ]
> ```

### Wiring

![wiring_adum1201.png](../../prototypes/panasonic_heatpump/wiring_adum1201.png)
Expand Down Expand Up @@ -644,7 +659,7 @@ water_heater:

## Custom Entities (For Advanced Users)

If you review the [ProtocolByteDecrypt.md](https://github.com/Egyras/HeishaMon/blob/master/ProtocolByteDecrypt.md) file you will find also some TOPs and SETs which are not implemented yet in heishamon.
If you review the [ProtocolByteDecrypt.md](https://github.com/heishamon/HeishaMon/blob/main/ProtocolByteDecrypt.md) file you will find also some TOPs and SETs which are not implemented yet in heishamon.
They are usually marked as TOP (without a number).
The nice part of ESPHome is that it is so highly customizeable.
So if you want some additional TOP or SET entities you can easily create your own.
Expand All @@ -664,7 +679,7 @@ sensor:
unit_of_measurement: °C
lambda: |-
// get the requried byte
int byte = my_heatpump->getResponseByte(46);
int byte = my_heatpump->get_response_byte(46);
// a valid byte range is 0x00-0xFF
// do not update if the byte is invalid
if (byte < 0) return {};
Expand All @@ -678,7 +693,7 @@ text_sensor:
update_interval: 3s
lambda: |-
// get the requried byte
int byte = my_heatpump->getResponseByte(9);
int byte = my_heatpump->get_response_byte(9);
// a valid byte range is 0x00-0xFF
// do not update if the byte is invalid
if (byte < 0) return {};
Expand All @@ -703,5 +718,5 @@ After a power on the heatpump should respond to the requests.

## Sources

:heart: A big THANKS to [Egyras](https://github.com/Egyras) and the work done on the repository [HeishaMon](https://github.com/Egyras/HeishaMon) for decoding the panasonic uart protocol and providing information to build hardware based on an ESP Chip.
:heart: A big THANKS to [Egyras](https://github.com/Egyras), [IgorYbema](https://github.com/IgorYbema) and the work done on the repository [HeishaMon](https://github.com/heishamon/HeishaMon) for decoding the panasonic uart protocol and providing information to build hardware based on an ESP Chip.
:heart: Thanks to the whole home assistant community for sharing their knowlege and helping me to create this ESPHome component!
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ climate::ClimateTraits PanasonicHeatpumpClimate::traits() {

void PanasonicHeatpumpClimate::control(const climate::ClimateCall& call) {
if (call.get_mode().has_value()) {
int byte6 = this->parent_->getResponseByte(6);
int byte6 = this->parent_->get_response_byte(6);
if (byte6 >= 0) {
climate::ClimateMode new_mode = *call.get_mode();
uint8_t newByte6 = this->setClimateMode(new_mode, (uint8_t)byte6);
Expand Down
13 changes: 8 additions & 5 deletions components/panasonic_heatpump/helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ namespace esphome {
namespace panasonic_heatpump {
static const char* const TAG = "panasonic_heatpump";

void PanasonicHelpers::log_uart_hex(UartLogDirection direction, const std::vector<uint8_t>& data,
const char separator) {
PanasonicHelpers::log_uart_hex(direction, &data[0], data.size(), separator);
void PanasonicHelpers::write_uart_log(UartLogDirection direction, const std::vector<uint8_t>& data,
const char separator, bool logBytes) {
PanasonicHelpers::write_uart_log(direction, &data[0], data.size(), separator, logBytes);
}

void PanasonicHelpers::log_uart_hex(UartLogDirection direction, const uint8_t* data, const size_t length,
const char separator) {
void PanasonicHelpers::write_uart_log(UartLogDirection direction, const uint8_t* data, const size_t length,
const char separator, bool logBytes) {
std::string logStr = "";
std::string msgDir = direction == UART_LOG_TX ? ">>>" : "<<<";
std::string msgType = direction == UART_LOG_TX ? "request" : "response";
Expand All @@ -31,6 +31,9 @@ void PanasonicHelpers::log_uart_hex(UartLogDirection direction, const uint8_t* d
ESP_LOGI(TAG, "%s %s[%i]", msgDir.c_str(), msgType.c_str(), length);
delay(10);

if (!logBytes)
return;

logStr += byte_array_to_hex_string(data, length, separator);

// Log in chunks to avoid ESP_LOG buffer overflow (https://developers.esphome.io/architecture/logging/).
Expand Down
6 changes: 4 additions & 2 deletions components/panasonic_heatpump/helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ enum UartLogDirection : uint8_t {

class PanasonicHelpers {
public:
static void log_uart_hex(UartLogDirection direction, const std::vector<uint8_t>& data, const char separator);
static void log_uart_hex(UartLogDirection direction, const uint8_t* data, const size_t length, const char separator);
static void write_uart_log(UartLogDirection direction, const std::vector<uint8_t>& data, const char separator,
bool logBytes);
static void write_uart_log(UartLogDirection direction, const uint8_t* data, const size_t length, const char separator,
bool logBytes);
static std::string byte_array_to_hex_string(const std::vector<uint8_t>& data, const char separator);
static std::string byte_array_to_hex_string(const uint8_t* data, const size_t length, const char separator);
};
Expand Down
Loading
Loading