Merge pull request #30 from ElVit/heatpump/feature/error-reset
Add Error Reset (Restart Heatpump)
This commit is contained in:
commit
11585db55d
|
|
@ -565,6 +565,8 @@ switch:
|
||||||
name: "Set External Heat Cool Control"
|
name: "Set External Heat Cool Control"
|
||||||
set34:
|
set34:
|
||||||
name: "Set Bivalent Control"
|
name: "Set Bivalent Control"
|
||||||
|
error_reset:
|
||||||
|
name: "Error Reset (Restart Heatpump)"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Selects
|
### Selects
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ void PanasonicHeatpumpClimate::control(const climate::ClimateCall& call) {
|
||||||
}
|
}
|
||||||
|
|
||||||
this->publish_state();
|
this->publish_state();
|
||||||
this->keep_state_ = 2;
|
this->keep_state_ = KEEP_STATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PanasonicHeatpumpClimate::publish_new_state(const std::vector<uint8_t>& data) {
|
void PanasonicHeatpumpClimate::publish_new_state(const std::vector<uint8_t>& data) {
|
||||||
|
|
|
||||||
|
|
@ -32,11 +32,7 @@ void PanasonicHelpers::log_uart_hex(UartLogDirection direction, const uint8_t* d
|
||||||
delay(10);
|
delay(10);
|
||||||
|
|
||||||
logStr += byte_array_to_hex_string(data, length, separator);
|
logStr += byte_array_to_hex_string(data, length, separator);
|
||||||
|
ESP_LOGI(TAG, "%s %s", msgDir.c_str(), logStr.c_str());
|
||||||
for (size_t i = 0; i < logStr.length(); i += UART_LOG_CHUNK_SIZE) {
|
|
||||||
ESP_LOGI(TAG, "%s %s", msgDir.c_str(), logStr.substr(i, UART_LOG_CHUNK_SIZE).c_str());
|
|
||||||
delay(10);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string PanasonicHelpers::byte_array_to_hex_string(const std::vector<uint8_t>& data, const char separator) {
|
std::string PanasonicHelpers::byte_array_to_hex_string(const std::vector<uint8_t>& data, const char separator) {
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,6 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#ifndef UART_LOG_CHUNK_SIZE
|
|
||||||
#define UART_LOG_CHUNK_SIZE 120
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome {
|
||||||
namespace panasonic_heatpump {
|
namespace panasonic_heatpump {
|
||||||
enum UartLogDirection : uint8_t {
|
enum UartLogDirection : uint8_t {
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ void PanasonicHeatpumpNumber::control(float value) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this->publish_state(state);
|
this->publish_state(state);
|
||||||
this->keep_state_ = 2;
|
this->keep_state_ = KEEP_STATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PanasonicHeatpumpNumber::publish_new_state(const std::vector<uint8_t>& data) {
|
void PanasonicHeatpumpNumber::publish_new_state(const std::vector<uint8_t>& data) {
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,11 @@
|
||||||
#include "commands.h"
|
#include "commands.h"
|
||||||
|
|
||||||
#ifndef PANASONIC_HEATPUMP_VERSION
|
#ifndef PANASONIC_HEATPUMP_VERSION
|
||||||
#define PANASONIC_HEATPUMP_VERSION "0.0.8"
|
#define PANASONIC_HEATPUMP_VERSION "0.0.8-beta.2"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef KEEP_STATE
|
||||||
|
#define KEEP_STATE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome {
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ void PanasonicHeatpumpSelect::control(const std::string& value) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this->publish_state(value);
|
this->publish_state(value);
|
||||||
this->keep_state_ = 2;
|
this->keep_state_ = KEEP_STATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PanasonicHeatpumpSelect::publish_new_state(const std::vector<uint8_t>& data) {
|
void PanasonicHeatpumpSelect::publish_new_state(const std::vector<uint8_t>& data) {
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ CONF_SET31 = "set31" # Set External Error
|
||||||
CONF_SET32 = "set32" # Set External Compressor Control
|
CONF_SET32 = "set32" # Set External Compressor Control
|
||||||
CONF_SET33 = "set33" # Set External Heat Cool Control
|
CONF_SET33 = "set33" # Set External Heat Cool Control
|
||||||
CONF_SET34 = "set34" # Set Bivalent Control
|
CONF_SET34 = "set34" # Set Bivalent Control
|
||||||
|
CONF_ERROR = "error_reset" # Error Reset (Restart Heatpump)
|
||||||
|
|
||||||
TYPES = [
|
TYPES = [
|
||||||
CONF_SET1,
|
CONF_SET1,
|
||||||
|
|
@ -35,6 +36,7 @@ TYPES = [
|
||||||
CONF_SET32,
|
CONF_SET32,
|
||||||
CONF_SET33,
|
CONF_SET33,
|
||||||
CONF_SET34,
|
CONF_SET34,
|
||||||
|
CONF_ERROR,
|
||||||
]
|
]
|
||||||
|
|
||||||
PanasonicHeatpumpSwitch = panasonic_heatpump_ns.class_(
|
PanasonicHeatpumpSwitch = panasonic_heatpump_ns.class_(
|
||||||
|
|
@ -85,6 +87,9 @@ CONFIG_SCHEMA = cv.Schema(
|
||||||
cv.Optional(CONF_SET34): switch.switch_schema(
|
cv.Optional(CONF_SET34): switch.switch_schema(
|
||||||
PanasonicHeatpumpSwitch,
|
PanasonicHeatpumpSwitch,
|
||||||
),
|
),
|
||||||
|
cv.Optional(CONF_ERROR): switch.switch_schema(
|
||||||
|
PanasonicHeatpumpSwitch,
|
||||||
|
),
|
||||||
}
|
}
|
||||||
).extend(cv.COMPONENT_SCHEMA)
|
).extend(cv.COMPONENT_SCHEMA)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,12 +52,15 @@ void PanasonicHeatpumpSwitch::write_state(bool state) {
|
||||||
case SwitchIds::CONF_SET34:
|
case SwitchIds::CONF_SET34:
|
||||||
this->parent_->set_command_byte(PanasonicCommand::setPlus1(value), 26);
|
this->parent_->set_command_byte(PanasonicCommand::setPlus1(value), 26);
|
||||||
break;
|
break;
|
||||||
|
case SwitchIds::CONF_ERROR:
|
||||||
|
this->parent_->set_command_byte(value, 8);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
this->publish_state(state);
|
this->publish_state(state);
|
||||||
this->keep_state_ = 2;
|
this->keep_state_ = KEEP_STATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PanasonicHeatpumpSwitch::publish_new_state(const std::vector<uint8_t>& data) {
|
void PanasonicHeatpumpSwitch::publish_new_state(const std::vector<uint8_t>& data) {
|
||||||
|
|
@ -130,6 +133,11 @@ void PanasonicHeatpumpSwitch::publish_new_state(const std::vector<uint8_t>& data
|
||||||
if (this->state == new_state)
|
if (this->state == new_state)
|
||||||
return;
|
return;
|
||||||
break;
|
break;
|
||||||
|
case SwitchIds::CONF_ERROR:
|
||||||
|
new_state = PanasonicDecode::getBinaryState(data[8]);
|
||||||
|
if (this->state == new_state)
|
||||||
|
return;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ enum SwitchIds : uint8_t {
|
||||||
CONF_SET32,
|
CONF_SET32,
|
||||||
CONF_SET33,
|
CONF_SET33,
|
||||||
CONF_SET34,
|
CONF_SET34,
|
||||||
|
CONF_ERROR,
|
||||||
};
|
};
|
||||||
|
|
||||||
class PanasonicHeatpumpSwitch : public switch_::Switch,
|
class PanasonicHeatpumpSwitch : public switch_::Switch,
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ void PanasonicHeatpumpWaterHeater::control(const water_heater::WaterHeaterCall&
|
||||||
};
|
};
|
||||||
|
|
||||||
this->publish_state();
|
this->publish_state();
|
||||||
this->keep_state_ = 2;
|
this->keep_state_ = KEEP_STATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PanasonicHeatpumpWaterHeater::publish_new_state(const std::vector<uint8_t>& data) {
|
void PanasonicHeatpumpWaterHeater::publish_new_state(const std::vector<uint8_t>& data) {
|
||||||
|
|
|
||||||
|
|
@ -469,6 +469,8 @@ switch:
|
||||||
name: "Set External Heat Cool Control"
|
name: "Set External Heat Cool Control"
|
||||||
set34:
|
set34:
|
||||||
name: "Set Bivalent Control"
|
name: "Set Bivalent Control"
|
||||||
|
error_reset:
|
||||||
|
name: "Error Reset (Restart Heatpump)"
|
||||||
|
|
||||||
# Test climate platform
|
# Test climate platform
|
||||||
climate:
|
climate:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue