1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-01 19:02:18 +01:00
This commit is contained in:
Keith Burzinski
2025-08-21 18:38:42 -05:00
parent b01510c34b
commit 637e8ebd5d
8 changed files with 43 additions and 43 deletions

View File

@@ -70,8 +70,8 @@ service APIConnection {
rpc alarm_control_panel_command (AlarmControlPanelCommandRequest) returns (void) {}
rpc zwave_proxy_read(ZWaveProxyReadRequest) returns (void) {}
rpc zwave_proxy_write(ZWaveProxyWriteRequest) returns (void) {}
rpc zwave_proxy_from_device(ZWaveProxyFromDeviceRequest) returns (void) {}
rpc zwave_proxy_to_device(ZWaveProxyToDeviceRequest) returns (void) {}
}
@@ -2284,14 +2284,14 @@ message UpdateCommandRequest {
// ==================== Z-WAVE ====================
message ZWaveProxyReadRequest {
message ZWaveProxyFromDeviceRequest {
option (id) = 128;
option (source) = SOURCE_CLIENT;
option (ifdef) = "USE_ZWAVE_PROXY";
option (no_delay) = true;
}
message ZWaveProxyReadResponse {
message ZWaveProxyFromDeviceResponse {
option (id) = 129;
option (source) = SOURCE_SERVER;
option (ifdef) = "USE_ZWAVE_PROXY";
@@ -2300,7 +2300,7 @@ message ZWaveProxyReadResponse {
string data = 1;
}
message ZWaveProxyWriteRequest {
message ZWaveProxyToDeviceRequest {
option (id) = 130;
option (source) = SOURCE_CLIENT;
option (ifdef) = "USE_ZWAVE_PROXY";
@@ -2309,7 +2309,7 @@ message ZWaveProxyWriteRequest {
string data = 1;
}
message ZWaveProxyWriteResponse {
message ZWaveProxyToDeviceResponse {
option (id) = 131;
option (source) = SOURCE_SERVER;
option (ifdef) = "USE_ZWAVE_PROXY";

View File

@@ -1207,8 +1207,8 @@ void APIConnection::voice_assistant_set_configuration(const VoiceAssistantSetCon
#endif
#ifdef USE_ZWAVE_PROXY
void APIConnection::zwave_proxy_read(const ZWaveProxyReadRequest &msg) {}
void APIConnection::zwave_proxy_write(const ZWaveProxyWriteRequest &msg) {
void APIConnection::zwave_proxy_from_device(const ZWaveProxyFromDeviceRequest &msg) {}
void APIConnection::zwave_proxy_to_device(const ZWaveProxyToDeviceRequest &msg) {
zwave_proxy::global_zwave_proxy->send_frame(msg.data);
}
#endif

View File

@@ -172,8 +172,8 @@ class APIConnection final : public APIServerConnection {
#endif
#ifdef USE_ZWAVE_PROXY
void zwave_proxy_read(const ZWaveProxyReadRequest &msg) override;
void zwave_proxy_write(const ZWaveProxyWriteRequest &msg) override;
void zwave_proxy_from_device(const ZWaveProxyFromDeviceRequest &msg) override;
void zwave_proxy_to_device(const ZWaveProxyToDeviceRequest &msg) override;
#endif
#ifdef USE_ALARM_CONTROL_PANEL

View File

@@ -3008,9 +3008,9 @@ bool UpdateCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
}
#endif
#ifdef USE_ZWAVE_PROXY
void ZWaveProxyReadResponse::encode(ProtoWriteBuffer buffer) const { buffer.encode_string(1, this->data_ref_); }
void ZWaveProxyReadResponse::calculate_size(ProtoSize &size) const { size.add_length(1, this->data_ref_.size()); }
bool ZWaveProxyWriteRequest::decode_length(uint32_t field_id, ProtoLengthDelimited value) {
void ZWaveProxyFromDeviceResponse::encode(ProtoWriteBuffer buffer) const { buffer.encode_string(1, this->data_ref_); }
void ZWaveProxyFromDeviceResponse::calculate_size(ProtoSize &size) const { size.add_length(1, this->data_ref_.size()); }
bool ZWaveProxyToDeviceRequest::decode_length(uint32_t field_id, ProtoLengthDelimited value) {
switch (field_id) {
case 1:
this->data = value.as_string();

View File

@@ -2914,12 +2914,12 @@ class UpdateCommandRequest final : public CommandProtoMessage {
};
#endif
#ifdef USE_ZWAVE_PROXY
class ZWaveProxyReadRequest final : public ProtoMessage {
class ZWaveProxyFromDeviceRequest final : public ProtoMessage {
public:
static constexpr uint8_t MESSAGE_TYPE = 128;
static constexpr uint8_t ESTIMATED_SIZE = 0;
#ifdef HAS_PROTO_MESSAGE_DUMP
const char *message_name() const override { return "z_wave_proxy_read_request"; }
const char *message_name() const override { return "z_wave_proxy_from_device_request"; }
#endif
#ifdef HAS_PROTO_MESSAGE_DUMP
void dump_to(std::string &out) const override;
@@ -2927,12 +2927,12 @@ class ZWaveProxyReadRequest final : public ProtoMessage {
protected:
};
class ZWaveProxyReadResponse final : public ProtoMessage {
class ZWaveProxyFromDeviceResponse final : public ProtoMessage {
public:
static constexpr uint8_t MESSAGE_TYPE = 129;
static constexpr uint8_t ESTIMATED_SIZE = 9;
#ifdef HAS_PROTO_MESSAGE_DUMP
const char *message_name() const override { return "z_wave_proxy_read_response"; }
const char *message_name() const override { return "z_wave_proxy_from_device_response"; }
#endif
StringRef data_ref_{};
void set_data(const StringRef &ref) { this->data_ref_ = ref; }
@@ -2944,12 +2944,12 @@ class ZWaveProxyReadResponse final : public ProtoMessage {
protected:
};
class ZWaveProxyWriteRequest final : public ProtoDecodableMessage {
class ZWaveProxyToDeviceRequest final : public ProtoDecodableMessage {
public:
static constexpr uint8_t MESSAGE_TYPE = 130;
static constexpr uint8_t ESTIMATED_SIZE = 9;
#ifdef HAS_PROTO_MESSAGE_DUMP
const char *message_name() const override { return "z_wave_proxy_write_request"; }
const char *message_name() const override { return "z_wave_proxy_to_device_request"; }
#endif
std::string data{};
#ifdef HAS_PROTO_MESSAGE_DUMP
@@ -2959,12 +2959,12 @@ class ZWaveProxyWriteRequest final : public ProtoDecodableMessage {
protected:
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override;
};
class ZWaveProxyWriteResponse final : public ProtoMessage {
class ZWaveProxyToDeviceResponse final : public ProtoMessage {
public:
static constexpr uint8_t MESSAGE_TYPE = 131;
static constexpr uint8_t ESTIMATED_SIZE = 0;
#ifdef HAS_PROTO_MESSAGE_DUMP
const char *message_name() const override { return "z_wave_proxy_write_response"; }
const char *message_name() const override { return "z_wave_proxy_to_device_response"; }
#endif
#ifdef HAS_PROTO_MESSAGE_DUMP
void dump_to(std::string &out) const override;

View File

@@ -2101,10 +2101,10 @@ void UpdateCommandRequest::dump_to(std::string &out) const {
}
#endif
#ifdef USE_ZWAVE_PROXY
void ZWaveProxyReadRequest::dump_to(std::string &out) const { out.append("ZWaveProxyReadRequest {}"); }
void ZWaveProxyReadResponse::dump_to(std::string &out) const { dump_field(out, "data", this->data_ref_); }
void ZWaveProxyWriteRequest::dump_to(std::string &out) const { dump_field(out, "data", this->data); }
void ZWaveProxyWriteResponse::dump_to(std::string &out) const { out.append("ZWaveProxyWriteResponse {}"); }
void ZWaveProxyFromDeviceRequest::dump_to(std::string &out) const { out.append("ZWaveProxyFromDeviceRequest {}"); }
void ZWaveProxyFromDeviceResponse::dump_to(std::string &out) const { dump_field(out, "data", this->data_ref_); }
void ZWaveProxyToDeviceRequest::dump_to(std::string &out) const { dump_field(out, "data", this->data); }
void ZWaveProxyToDeviceResponse::dump_to(std::string &out) const { out.append("ZWaveProxyToDeviceResponse {}"); }
#endif
} // namespace esphome::api

View File

@@ -597,24 +597,24 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
}
#endif
#ifdef USE_ZWAVE_PROXY
case ZWaveProxyReadRequest::MESSAGE_TYPE: {
ZWaveProxyReadRequest msg;
case ZWaveProxyFromDeviceRequest::MESSAGE_TYPE: {
ZWaveProxyFromDeviceRequest msg;
// Empty message: no decode needed
#ifdef HAS_PROTO_MESSAGE_DUMP
ESP_LOGVV(TAG, "on_z_wave_proxy_read_request: %s", msg.dump().c_str());
ESP_LOGVV(TAG, "on_z_wave_proxy_from_device_request: %s", msg.dump().c_str());
#endif
this->on_z_wave_proxy_read_request(msg);
this->on_z_wave_proxy_from_device_request(msg);
break;
}
#endif
#ifdef USE_ZWAVE_PROXY
case ZWaveProxyWriteRequest::MESSAGE_TYPE: {
ZWaveProxyWriteRequest msg;
case ZWaveProxyToDeviceRequest::MESSAGE_TYPE: {
ZWaveProxyToDeviceRequest msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
ESP_LOGVV(TAG, "on_z_wave_proxy_write_request: %s", msg.dump().c_str());
ESP_LOGVV(TAG, "on_z_wave_proxy_to_device_request: %s", msg.dump().c_str());
#endif
this->on_z_wave_proxy_write_request(msg);
this->on_z_wave_proxy_to_device_request(msg);
break;
}
#endif
@@ -932,16 +932,16 @@ void APIServerConnection::on_alarm_control_panel_command_request(const AlarmCont
}
#endif
#ifdef USE_ZWAVE_PROXY
void APIServerConnection::on_z_wave_proxy_read_request(const ZWaveProxyReadRequest &msg) {
void APIServerConnection::on_z_wave_proxy_from_device_request(const ZWaveProxyFromDeviceRequest &msg) {
if (this->check_authenticated_()) {
this->zwave_proxy_read(msg);
this->zwave_proxy_from_device(msg);
}
}
#endif
#ifdef USE_ZWAVE_PROXY
void APIServerConnection::on_z_wave_proxy_write_request(const ZWaveProxyWriteRequest &msg) {
void APIServerConnection::on_z_wave_proxy_to_device_request(const ZWaveProxyToDeviceRequest &msg) {
if (this->check_authenticated_()) {
this->zwave_proxy_write(msg);
this->zwave_proxy_to_device(msg);
}
}
#endif

View File

@@ -207,11 +207,11 @@ class APIServerConnectionBase : public ProtoService {
virtual void on_update_command_request(const UpdateCommandRequest &value){};
#endif
#ifdef USE_ZWAVE_PROXY
virtual void on_z_wave_proxy_read_request(const ZWaveProxyReadRequest &value){};
virtual void on_z_wave_proxy_from_device_request(const ZWaveProxyFromDeviceRequest &value){};
#endif
#ifdef USE_ZWAVE_PROXY
virtual void on_z_wave_proxy_write_request(const ZWaveProxyWriteRequest &value){};
virtual void on_z_wave_proxy_to_device_request(const ZWaveProxyToDeviceRequest &value){};
#endif
protected:
@@ -342,10 +342,10 @@ class APIServerConnection : public APIServerConnectionBase {
virtual void alarm_control_panel_command(const AlarmControlPanelCommandRequest &msg) = 0;
#endif
#ifdef USE_ZWAVE_PROXY
virtual void zwave_proxy_read(const ZWaveProxyReadRequest &msg) = 0;
virtual void zwave_proxy_from_device(const ZWaveProxyFromDeviceRequest &msg) = 0;
#endif
#ifdef USE_ZWAVE_PROXY
virtual void zwave_proxy_write(const ZWaveProxyWriteRequest &msg) = 0;
virtual void zwave_proxy_to_device(const ZWaveProxyToDeviceRequest &msg) = 0;
#endif
protected:
void on_hello_request(const HelloRequest &msg) override;
@@ -470,10 +470,10 @@ class APIServerConnection : public APIServerConnectionBase {
void on_alarm_control_panel_command_request(const AlarmControlPanelCommandRequest &msg) override;
#endif
#ifdef USE_ZWAVE_PROXY
void on_z_wave_proxy_read_request(const ZWaveProxyReadRequest &msg) override;
void on_z_wave_proxy_from_device_request(const ZWaveProxyFromDeviceRequest &msg) override;
#endif
#ifdef USE_ZWAVE_PROXY
void on_z_wave_proxy_write_request(const ZWaveProxyWriteRequest &msg) override;
void on_z_wave_proxy_to_device_request(const ZWaveProxyToDeviceRequest &msg) override;
#endif
};